OpFlex Framework  1.3.0
opflex::modb::mointernal::ObjectInstance Class Reference

An internal instance of an object in the managed object store. More...

#include <opflex/modb/mo-internal/ObjectInstance.h>

Public Member Functions

 ObjectInstance (class_id_t class_id_)
 Construct an empty object represented the specified class. More...
 
class_id_t getClassId () const
 Get the class ID for this object instance. More...
 
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. More...
 
bool unset (prop_id_t prop_id, PropertyInfo::property_type_t type, PropertyInfo::cardinality_t cardinality)
 Unset the given property. More...
 
uint64_t getUInt64 (prop_id_t prop_id) const
 Get the unsigned 64-bit valued property for prop_name. More...
 
uint64_t getUInt64 (prop_id_t prop_id, size_t index) const
 For a vector-valued 64-bit unsigned property, get the specified property value at the specified index. More...
 
size_t getUInt64Size (prop_id_t prop_id) const
 Get the number of unsigned 64-bit values for the specified property. More...
 
int64_t getInt64 (prop_id_t prop_id) const
 Get the signed 64-bit valued property for prop_name. More...
 
int64_t getInt64 (prop_id_t prop_id, size_t index) const
 For a vector-valued 64-bit signed property, get the specified property value at the specified index. More...
 
size_t getInt64Size (prop_id_t prop_id) const
 Get the number of signed 64-bit values for the specified property. More...
 
const std::string & getString (prop_id_t prop_id) const
 Get the string-valued property for prop_name. More...
 
const std::string & getString (prop_id_t prop_id, size_t index) const
 For a vector-valued string property, get the specified property value at the specified index. More...
 
size_t getStringSize (prop_id_t prop_id) const
 Get the number of string values for the specified property. More...
 
reference_t getReference (prop_id_t prop_id) const
 Get the reference-valued property for prop_name. More...
 
reference_t getReference (prop_id_t prop_id, size_t index) const
 For a vector-valued reference property, get the specified property value at the specified index. More...
 
size_t getReferenceSize (prop_id_t prop_id) const
 Get the number of reference values for the specified property. More...
 
const MACgetMAC (prop_id_t prop_id) const
 Get the MAC-address-valued property for prop_name. More...
 
const MACgetMAC (prop_id_t prop_id, size_t index) const
 For a vector-valued MAC address property, get the specified property value at the specified index. More...
 
size_t getMACSize (prop_id_t prop_id) const
 Get the number of MAC address values for the specified property. More...
 
void setUInt64 (prop_id_t prop_id, uint64_t value)
 Set the uint64-valued parameter to the specified value. More...
 
void setUInt64 (prop_id_t prop_id, const std::vector< uint64_t > &value)
 Set the uint64-vector-valued parameter to the specified value. More...
 
void setString (prop_id_t prop_id, const std::string &value)
 Set the string-valued parameter to the specified value. More...
 
void setString (prop_id_t prop_id, const std::vector< std::string > &value)
 Set the string-vector-valued parameter to the specified vector. More...
 
void setInt64 (prop_id_t prop_id, int64_t value)
 Set the int64-valued parameter to the specified value. More...
 
void setInt64 (prop_id_t prop_id, const std::vector< int64_t > &value)
 Set the int64-vector-valued parameter to the specified value. More...
 
void setReference (prop_id_t prop_id, class_id_t class_id, const URI &uri)
 Set the reference-valued parameter to the specified value. More...
 
void setReference (prop_id_t prop_id, const std::vector< reference_t > &value)
 Set the reference-vector-valued parameter to the specified vector. More...
 
void setMAC (prop_id_t prop_id, const MAC &value)
 Set the MAC address-valued parameter to the specified value. More...
 
void setMAC (prop_id_t prop_id, const std::vector< MAC > &value)
 Set the MAC address-vector-valued parameter to the specified value. More...
 
void addUInt64 (prop_id_t prop_id, uint64_t value)
 Add a value to a the specified unsigned 64-bit vector. More...
 
void addInt64 (prop_id_t prop_id, int64_t value)
 Add a value to a the specified signed 64-bit vector. More...
 
void addString (prop_id_t prop_id, const std::string &value)
 Add a value to a the specified string vector. More...
 
void addReference (prop_id_t prop_id, class_id_t class_id, const URI &uri)
 Add a value to a the specified reference vector. More...
 
void addMAC (prop_id_t prop_id, const MAC &value)
 Add a value to a the specified MAC address vector. More...
 

Friends

bool operator== (const ObjectInstance &lhs, const ObjectInstance &rhs)
 Check for ObjectInstance equality.
 
bool operator!= (const ObjectInstance &lhs, const ObjectInstance &rhs)
 Check for ObjectInstance inequality.
 
bool operator== (const Value &lhs, const Value &rhs)
 
bool operator!= (const Value &lhs, const Value &rhs)
 
template<typename T >
bool equal (const Value &lhs, const Value &rhs)
 

Detailed Description

An internal instance of an object in the managed object store.

While inside the object store, an object instance should never be modified; only const references should be generated. To modify, we atomically update the pointer to point to a modified copy.

Constructor & Destructor Documentation

opflex::modb::mointernal::ObjectInstance::ObjectInstance ( class_id_t  class_id_)
inline

Construct an empty object represented the specified class.

Parameters
class_id_the class ID for the object

Member Function Documentation

void opflex::modb::mointernal::ObjectInstance::addInt64 ( prop_id_t  prop_id,
int64_t  value 
)

Add a value to a the specified signed 64-bit vector.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::addMAC ( prop_id_t  prop_id,
const MAC value 
)

Add a value to a the specified MAC address vector.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::addReference ( prop_id_t  prop_id,
class_id_t  class_id,
const URI uri 
)

Add a value to a the specified reference vector.

Parameters
prop_idthe property ID to set
class_idthe class_id of the reference
urithe URI of the reference
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::addString ( prop_id_t  prop_id,
const std::string &  value 
)

Add a value to a the specified string vector.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::addUInt64 ( prop_id_t  prop_id,
uint64_t  value 
)

Add a value to a the specified unsigned 64-bit vector.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
class_id_t opflex::modb::mointernal::ObjectInstance::getClassId ( ) const
inline

Get the class ID for this object instance.

Returns
the class ID
int64_t opflex::modb::mointernal::ObjectInstance::getInt64 ( prop_id_t  prop_id) const

Get the signed 64-bit valued property for prop_name.

Parameters
prop_idthe property ID to look up
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
int64_t opflex::modb::mointernal::ObjectInstance::getInt64 ( prop_id_t  prop_id,
size_t  index 
) const

For a vector-valued 64-bit signed property, get the specified property value at the specified index.

Parameters
prop_idthe property ID to look up
indexthe vector index to retrieve
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
size_t opflex::modb::mointernal::ObjectInstance::getInt64Size ( prop_id_t  prop_id) const

Get the number of signed 64-bit values for the specified property.

Parameters
prop_idthe property ID to look up
Returns
the number of elements
const MAC& opflex::modb::mointernal::ObjectInstance::getMAC ( prop_id_t  prop_id) const

Get the MAC-address-valued property for prop_name.

Parameters
prop_idthe property ID to look up
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
const MAC& opflex::modb::mointernal::ObjectInstance::getMAC ( prop_id_t  prop_id,
size_t  index 
) const

For a vector-valued MAC address property, get the specified property value at the specified index.

Parameters
prop_idthe property ID to look up
indexthe vector index to retrieve
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
size_t opflex::modb::mointernal::ObjectInstance::getMACSize ( prop_id_t  prop_id) const

Get the number of MAC address values for the specified property.

Parameters
prop_idthe property ID to look up
Returns
the number of elements
reference_t opflex::modb::mointernal::ObjectInstance::getReference ( prop_id_t  prop_id) const

Get the reference-valued property for prop_name.

Parameters
prop_idthe property ID to look up
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
reference_t opflex::modb::mointernal::ObjectInstance::getReference ( prop_id_t  prop_id,
size_t  index 
) const

For a vector-valued reference property, get the specified property value at the specified index.

Parameters
prop_idthe property ID to look up
indexthe vector index to retrieve
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
size_t opflex::modb::mointernal::ObjectInstance::getReferenceSize ( prop_id_t  prop_id) const

Get the number of reference values for the specified property.

Parameters
prop_idthe property ID to look up
Returns
the number of elements
const std::string& opflex::modb::mointernal::ObjectInstance::getString ( prop_id_t  prop_id) const

Get the string-valued property for prop_name.

Parameters
prop_idthe property ID to look up
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
const std::string& opflex::modb::mointernal::ObjectInstance::getString ( prop_id_t  prop_id,
size_t  index 
) const

For a vector-valued string property, get the specified property value at the specified index.

Parameters
prop_idthe property ID to look up
indexthe vector index to retrieve
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
size_t opflex::modb::mointernal::ObjectInstance::getStringSize ( prop_id_t  prop_id) const

Get the number of string values for the specified property.

Parameters
prop_idthe property ID to look up
Returns
the number of elements
uint64_t opflex::modb::mointernal::ObjectInstance::getUInt64 ( prop_id_t  prop_id) const

Get the unsigned 64-bit valued property for prop_name.

Parameters
prop_idthe property ID to look up
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
uint64_t opflex::modb::mointernal::ObjectInstance::getUInt64 ( prop_id_t  prop_id,
size_t  index 
) const

For a vector-valued 64-bit unsigned property, get the specified property value at the specified index.

Parameters
prop_idthe property ID to look up
indexthe vector index to retrieve
Returns
the property value
Exceptions
std::out_of_rangeif no such element is present.
size_t opflex::modb::mointernal::ObjectInstance::getUInt64Size ( prop_id_t  prop_id) const

Get the number of unsigned 64-bit values for the specified property.

Parameters
prop_idthe property ID to look up
Returns
the number of elements
bool opflex::modb::mointernal::ObjectInstance::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.

If the property is vector-valued, this will return false if the vector is zero length.

Parameters
prop_idthe property ID to check
cardinalitythe cardinality of the property to check
typethe type of the property
void opflex::modb::mointernal::ObjectInstance::setInt64 ( prop_id_t  prop_id,
int64_t  value 
)

Set the int64-valued parameter to the specified value.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setInt64 ( prop_id_t  prop_id,
const std::vector< int64_t > &  value 
)

Set the int64-vector-valued parameter to the specified value.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setMAC ( prop_id_t  prop_id,
const MAC value 
)

Set the MAC address-valued parameter to the specified value.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setMAC ( prop_id_t  prop_id,
const std::vector< MAC > &  value 
)

Set the MAC address-vector-valued parameter to the specified value.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setReference ( prop_id_t  prop_id,
class_id_t  class_id,
const URI uri 
)

Set the reference-valued parameter to the specified value.

Parameters
prop_idthe property ID to set
class_idthe class_id of the reference
urithe URI of the reference
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setReference ( prop_id_t  prop_id,
const std::vector< reference_t > &  value 
)

Set the reference-vector-valued parameter to the specified vector.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setString ( prop_id_t  prop_id,
const std::string &  value 
)

Set the string-valued parameter to the specified value.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setString ( prop_id_t  prop_id,
const std::vector< std::string > &  value 
)

Set the string-vector-valued parameter to the specified vector.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setUInt64 ( prop_id_t  prop_id,
uint64_t  value 
)

Set the uint64-valued parameter to the specified value.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
void opflex::modb::mointernal::ObjectInstance::setUInt64 ( prop_id_t  prop_id,
const std::vector< uint64_t > &  value 
)

Set the uint64-vector-valued parameter to the specified value.

Parameters
prop_idthe property ID to set
valuethe value to set
Returns
a reference to this object that can be used to chain the calls
bool opflex::modb::mointernal::ObjectInstance::unset ( prop_id_t  prop_id,
PropertyInfo::property_type_t  type,
PropertyInfo::cardinality_t  cardinality 
)

Unset the given property.

If its a vector, the vector is emptied. If its a scalar, the scalar is unset.

Parameters
prop_idthe property ID to reset
typethe type of the property
cardinalitythe cardinality of the property to unset
Returns
true if the property was alread set before

The documentation for this class was generated from the following file: