17#include <boost/multi_index_container.hpp>
18#include <boost/multi_index/hashed_index.hpp>
19#include <boost/multi_index/mem_fun.hpp>
20#include <boost/multi_index/composite_key.hpp>
21#include <boost/shared_ptr.hpp>
73 const std::string&
test);
90 bool del(
const uint8_t type,
const uint32_t vendor = 0);
103 size_t count(
const uint8_t type,
const uint32_t vendor = 0)
const {
104 return (
container_.count(boost::make_tuple(vendor, type)));
127 const uint32_t vendor = 0)
const;
134 std::string
getTest(
const uint8_t type,
const uint32_t vendor = 0)
const;
169 const std::string&
test)
174 if (expr || !
test.empty()) {
176 isc_throw(BadValue,
"once of attribute or test");
178 if (!expr ||
test.empty()) {
179 isc_throw(BadValue,
"missing expression or test");
203 return (
def_->type_);
211 return (
def_->vendor_);
216 boost::multi_index_container<
220 boost::multi_index::indexed_by<
222 boost::multi_index::hashed_non_unique<
223 boost::multi_index::composite_key<
225 boost::multi_index::const_mem_fun<
226 AttributeValue, uint32_t, &AttributeValue::getVendor
228 boost::multi_index::const_mem_fun<
229 AttributeValue, uint8_t, &AttributeValue::getType
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
Base class for classes representing DHCP messages.
Collection of attributes.
AttrDefPtr def_
Pointer to the attribute definition (required).
ConstAttributePtr attr_
Pointer to the attribute.
uint8_t getType() const
Return the type.
std::string test_
Original expression.
dhcp::ExpressionPtr expr_
Expression to compute the value.
uint32_t getVendor() const
Return the vendor.
AttributeValue(const AttrDefPtr &def, const ConstAttributePtr &attr, const dhcp::ExpressionPtr &expr, const std::string &test)
Constructor.
ConstAttributePtr get(const uint8_t type, const uint32_t vendor=0) const
Get instance of the attribute in the configuration.
dhcp::ExpressionPtr getExpr(const uint8_t type, const uint32_t vendor=0) const
Returns the expression of an attribute.
Attributes getAll() const
Get all attributes in the configuration.
CfgAttributes()
Constructor.
void add(const AttrDefPtr &def, const ConstAttributePtr &attr, const dhcp::ExpressionPtr &expr, const std::string &test)
Adds instance of the attribute to the configuration.
size_t size() const
Returns the number of elements.
size_t count(const uint8_t type, const uint32_t vendor=0) const
Counts instance of the attribute in the configuration.
AttrDefPtr getDef(const uint8_t type, const uint32_t vendor=0) const
Returns the definition of an attribute.
bool empty() const
Checks if the object is empty.
bool del(const uint8_t type, const uint32_t vendor=0)
Deletes an attribute from the configuration.
void add(const AttrDefPtr &def, const ConstAttributePtr &attr)
Adds instance of the attribute to the configuration.
std::string getTest(const uint8_t type, const uint32_t vendor=0) const
Returns the text expression of an attribute.
boost::multi_index_container< AttributeValue, boost::multi_index::indexed_by< boost::multi_index::hashed_non_unique< boost::multi_index::composite_key< AttributeValue, boost::multi_index::const_mem_fun< AttributeValue, uint32_t, &AttributeValue::getVendor >, boost::multi_index::const_mem_fun< AttributeValue, uint8_t, &AttributeValue::getType > > > > > container_
The container.
void clear()
Clear the container.
Attributes getEvalAll(dhcp::Pkt &pkt)
Get all evaluated attributes in the configuration.
data::ElementPtr toElement() const override
Unparse configuration.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< Expression > ExpressionPtr
boost::shared_ptr< const Attribute > ConstAttributePtr
boost::shared_ptr< AttrDef > AttrDefPtr
Shared pointers to Attribute definition.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.