14 #ifndef MODB_OBJECTINSTANCE_H_ 15 #define MODB_OBJECTINSTANCE_H_ 19 #include <boost/tuple/tuple_comparison.hpp> 20 #include <boost/cstdint.hpp> 21 #include <boost/variant.hpp> 26 #include "opflex/ofcore/OFTypes.h" 58 #if __cplusplus > 199711L 65 template<>
struct hash<
opflex::modb::prop_key_t> {
70 return opflex::modb::hash_value(u);
78 template<>
struct hash<
opflex::modb::reference_t> {
94 namespace mointernal {
111 : class_id(class_id_), local(true) { }
121 : class_id(class_id_), local(local_) { }
387 const std::vector<reference_t>& value);
467 boost::variant<boost::blank,
473 std::vector<uint64_t>*,
474 std::vector<int64_t>*,
475 std::vector<std::string>*,
476 std::vector<reference_t>*,
477 std::vector<MAC>*> value;
480 Value(
const Value& val);
482 Value& operator=(
const Value& val);
487 typedef OF_UNORDERED_MAP<prop_key_t, Value> prop_map_t;
499 template <
typename T>
500 friend bool equal(
const Value& lhs,
const Value& rhs);
506 bool operator==(
const ObjectInstance& lhs,
const ObjectInstance& rhs);
510 bool operator!=(
const ObjectInstance& lhs,
const ObjectInstance& rhs);
size_t getMACSize(prop_id_t prop_id) const
Get the number of MAC address values for the specified property.
bool unset(prop_id_t prop_id, PropertyInfo::property_type_t type, PropertyInfo::cardinality_t cardinality)
Unset the given property.
ObjectInstance(class_id_t class_id_, bool local_)
Construct an empty object represented the specified class and using the provided local flag...
Definition: ObjectInstance.h:120
boost::tuple< PropertyInfo::property_type_t, PropertyInfo::cardinality_t, prop_id_t > prop_key_t
A tuple containing the key for a property value.
Definition: ObjectInstance.h:36
void setInt64(prop_id_t prop_id, int64_t value)
Set the int64-valued parameter to the specified value.
Interface definition file for MACs.
A scalar-valued property.
Definition: PropertyInfo.h:84
void setUInt64(prop_id_t prop_id, uint64_t value)
Set the uint64-valued parameter to the specified value.
void addUInt64(prop_id_t prop_id, uint64_t value)
Add a value to a the specified unsigned 64-bit vector.
reference_t getReference(prop_id_t prop_id) const
Get the reference-valued property for prop_name.
const MAC & getMAC(prop_id_t prop_id) const
Get the MAC-address-valued property for prop_name.
cardinality_t
Enum representing the cardinality of the property.
Definition: PropertyInfo.h:82
void setReference(prop_id_t prop_id, class_id_t class_id, const URI &uri)
Set the reference-valued parameter to the specified value.
size_t hash_value(URI const &uri)
Compute a hash value for the URI, making URI suitable as a key in a boost::unordered_map.
Interface definition file for PropertyInfo.
bool isLocal() const
Return whether the object was from the remote policy repository or was written locally.
Definition: ObjectInstance.h:136
size_t getReferenceSize(prop_id_t prop_id) const
Get the number of reference values for the specified property.
void setMAC(prop_id_t prop_id, const MAC &value)
Set the MAC address-valued parameter to the specified value.
void setString(prop_id_t prop_id, const std::string &value)
Set the string-valued parameter to the specified value.
void addInt64(prop_id_t prop_id, int64_t value)
Add a value to a the specified signed 64-bit vector.
An internal instance of an object in the managed object store.
Definition: ObjectInstance.h:103
class_id_t getClassId() const
Get the class ID for this object instance.
Definition: ObjectInstance.h:128
const std::string & getString(prop_id_t prop_id) const
Get the string-valued property for prop_name.
int64_t getInt64(prop_id_t prop_id) const
Get the signed 64-bit valued property for prop_name.
Definition: OFLogHandler.h:20
ObjectInstance(class_id_t class_id_)
Construct an empty object represented the specified class.
Definition: ObjectInstance.h:110
bool isSet(prop_id_t prop_id, PropertyInfo::property_type_t type, PropertyInfo::cardinality_t cardinality=PropertyInfo::SCALAR) const
Check whether the given property is set.
void addString(prop_id_t prop_id, const std::string &value)
Add a value to a the specified string vector.
std::pair< class_id_t, URI > reference_t
A URI reference containing a class ID and a URI pair.
Definition: ObjectInstance.h:41
void addReference(prop_id_t prop_id, class_id_t class_id, const URI &uri)
Add a value to a the specified reference vector.
size_t getUInt64Size(prop_id_t prop_id) const
Get the number of unsigned 64-bit values for the specified property.
A URI is used to identify managed objects in the MODB.
Definition: URI.h:43
size_t getStringSize(prop_id_t prop_id) const
Get the number of string values for the specified property.
uint64_t getUInt64(prop_id_t prop_id) const
Get the unsigned 64-bit valued property for prop_name.
Interface definition file for URIs.
void addMAC(prop_id_t prop_id, const MAC &value)
Add a value to a the specified MAC address vector.
property_type_t
Possible property types.
Definition: PropertyInfo.h:54
A MAC address is used to identify devices on an ethernet network.
Definition: MAC.h:37
friend bool operator==(const ObjectInstance &lhs, const ObjectInstance &rhs)
Check for ObjectInstance equality.
friend bool operator!=(const ObjectInstance &lhs, const ObjectInstance &rhs)
Check for ObjectInstance inequality.
size_t getInt64Size(prop_id_t prop_id) const
Get the number of signed 64-bit values for the specified property.
size_t hash_value(MAC const &mac)
Compute a hash value for the MAC, making MAC suitable as a key in a boost::unordered_map.