OpFlex Framework 1.7.0
Model Metadata

Classes

class  opflex::modb::ClassInfo
 Class info provides metadata about managed object classes and properties. More...
 
class  opflex::modb::ConstInfo
 Const info defines a specific enum member. More...
 
class  opflex::modb::EnumInfo
 Enum info defines the set of possible values for an enum as well as the properties current defined by it. More...
 
class  opflex::modb::ModelMetadata
 Model metadata encapsulated all the metadata for a given model. More...
 
class  opflex::modb::PropertyInfo
 Property info provides metadata about a particular managed object property. More...
 

Typedefs

typedef OF_UNORDERED_MAP< prop_id_t, PropertyInfoopflex::modb::ClassInfo::property_map_t
 A map from a prop_id_t to a PropertyInfo object.
 
typedef uint64_t opflex::modb::class_id_t
 A unique class ID.
 
typedef uint64_t opflex::modb::prop_id_t
 A unique property ID.
 

Enumerations

enum  opflex::modb::ClassInfo::class_type_t {
  opflex::modb::ClassInfo::POLICY , opflex::modb::ClassInfo::REMOTE_ENDPOINT , opflex::modb::ClassInfo::LOCAL_ENDPOINT , opflex::modb::ClassInfo::OBSERVABLE ,
  opflex::modb::ClassInfo::LOCAL_ONLY , opflex::modb::ClassInfo::RESOLVER , opflex::modb::ClassInfo::RELATIONSHIP , opflex::modb::ClassInfo::REVERSE_RELATIONSHIP
}
 The type of an MO in the Opflex protocol. More...
 
enum  opflex::modb::PropertyInfo::property_type_t {
  opflex::modb::PropertyInfo::COMPOSITE , opflex::modb::PropertyInfo::REFERENCE , opflex::modb::PropertyInfo::STRING , opflex::modb::PropertyInfo::S64 ,
  opflex::modb::PropertyInfo::U64 , opflex::modb::PropertyInfo::MAC , opflex::modb::PropertyInfo::ENUM8 , opflex::modb::PropertyInfo::ENUM16 ,
  opflex::modb::PropertyInfo::ENUM32 , opflex::modb::PropertyInfo::ENUM64
}
 Possible property types. More...
 
enum  opflex::modb::PropertyInfo::cardinality_t { opflex::modb::PropertyInfo::SCALAR , opflex::modb::PropertyInfo::VECTOR }
 Enum representing the cardinality of the property. More...
 

Functions

 opflex::modb::ClassInfo::ClassInfo ()
 Default constructor.
 
 opflex::modb::ClassInfo::ClassInfo (class_id_t class_id, class_type_t class_type, const std::string &class_name, const std::string &owner, const std::vector< PropertyInfo > &properties, const std::vector< prop_id_t > &naming_props)
 Construct a class info object for the given class ID.
 
 opflex::modb::ClassInfo::~ClassInfo ()
 Destroy the class index.
 
const std::string & opflex::modb::ClassInfo::getName () const
 Get the name for this class.
 
const std::string & opflex::modb::ClassInfo::getOwner () const
 Get the owner for this class.
 
class_id_t opflex::modb::ClassInfo::getId () const
 Get the unique class ID for this class.
 
class_type_t opflex::modb::ClassInfo::getType () const
 Get the type of this class.
 
const property_map_topflex::modb::ClassInfo::getProperties () const
 Get the properties that exist for this class.
 
const std::vector< prop_id_t > & opflex::modb::ClassInfo::getNamingProps () const
 Get the vector of naming properties (in order) that make up the key or naming properties for this class.
 
const PropertyInfoopflex::modb::ClassInfo::getProperty (const std::string &name) const
 Get the PropertyInfo for the given named property.
 
const PropertyInfoopflex::modb::ClassInfo::getProperty (prop_id_t &prop_id) const
 Get the PropertyInfo for the given property ID.
 
 opflex::modb::ConstInfo::ConstInfo (const std::string &name_, uint64_t id_)
 Construct a const info object with the given name and ID.
 
 opflex::modb::ConstInfo::~ConstInfo ()
 Destructor.
 
const std::string & opflex::modb::ConstInfo::getName () const
 Get the name for this const.
 
const uint64_t opflex::modb::ConstInfo::getId () const
 Get the unique ID for this const within the enclosing enum.
 
 opflex::modb::EnumInfo::EnumInfo ()
 Default constructor.
 
 opflex::modb::EnumInfo::EnumInfo (const std::string &name_, const std::vector< ConstInfo > &consts_)
 Construct an enum info with the given name and consts.
 
 opflex::modb::EnumInfo::~EnumInfo ()
 Destructor.
 
const std::string & opflex::modb::EnumInfo::getName () const
 Get the name of the enum.
 
const std::vector< ConstInfo > & opflex::modb::EnumInfo::getConsts () const
 Get the vector of possible const values for the enum.
 
const uint64_t opflex::modb::EnumInfo::getIdByName (const std::string &name) const
 Get the constant value by the enum name.
 
const std::string & opflex::modb::EnumInfo::getNameById (uint64_t id) const
 Get the enum constant name by the enum value.
 
 opflex::modb::ModelMetadata::ModelMetadata (const std::string &model_name, const std::vector< ClassInfo > &classes)
 Construct a model metadata object for the given class ID.
 
 opflex::modb::ModelMetadata::~ModelMetadata ()
 Destroy the class index.
 
const std::string & opflex::modb::ModelMetadata::getName () const
 Get the name for this model.
 
const std::vector< ClassInfo > & opflex::modb::ModelMetadata::getClasses () const
 Get the classes that exist in this model.
 
 opflex::modb::PropertyInfo::PropertyInfo ()
 Default constructor.
 
 opflex::modb::PropertyInfo::PropertyInfo (prop_id_t prop_id, const std::string &property_name, property_type_t type, cardinality_t cardinality)
 Construct a property info object with the provided property name and primitive property type.
 
 opflex::modb::PropertyInfo::PropertyInfo (prop_id_t prop_id, const std::string &property_name, property_type_t type, cardinality_t cardinality, const EnumInfo &enum_info)
 Construct a property info object with enum info of the specified type.
 
 opflex::modb::PropertyInfo::PropertyInfo (prop_id_t prop_id, const std::string &property_name, property_type_t type, class_id_t class_id, cardinality_t cardinality)
 Construct a property info object with either a composite or reference data type of the specified type.
 
 opflex::modb::PropertyInfo::~PropertyInfo ()
 Destroy the property info object.
 
prop_id_t opflex::modb::PropertyInfo::getId () const
 Get the id for this property.
 
const std::string & opflex::modb::PropertyInfo::getName () const
 Get the name for this property.
 
const property_type_t opflex::modb::PropertyInfo::getType () const
 Get the type of this property.
 
const class_id_t opflex::modb::PropertyInfo::getClassId () const
 Get the class ID for this property.
 
const cardinality_t opflex::modb::PropertyInfo::getCardinality () const
 Get the cardinality for this type.
 
const EnumInfoopflex::modb::PropertyInfo::getEnumInfo () const
 Get the associated enum info for this property if it is an enum.
 

Detailed Description

These types are used to define the basic parameters of the model.

An actual instance of the metadata would be defined in the generated model code.

Enumeration Type Documentation

◆ cardinality_t

Enum representing the cardinality of the property.

Enumerator
SCALAR 

A scalar-valued property.

VECTOR 

A vector-valued property.

◆ class_type_t

The type of an MO in the Opflex protocol.

Updates to these MOs will trigger different operations depending on their types.

Enumerator
POLICY 

An MO describing a configured policy that describes some user intent.

These objects are owned by the policy repository.

REMOTE_ENDPOINT 

An MO describing a policy enforcement endpoint that resolved from the endpoint registry.

These objects are owned by the endpoint registry and ultimately the remote policy element.

LOCAL_ENDPOINT 

An MO describing a policy enforcement endpoint that must be registered in the endpoint registry.

These objects are owned and maintained by the local policy element.

OBSERVABLE 

An MO containing information that is reported to the observer.

This could include health information, faults and other status, and statistics related to its parent MO.

LOCAL_ONLY 

An MO that exists only locally and will not be transmitted over the OpFlex protocol.

RESOLVER 

A special managed object that will be created by the framework and will contain state about pending managed object resolutions.

RELATIONSHIP 

A type that represents a relationship between two managed objects.

This type would contain a target reference property that will allow the user to resolve related managed objects.

REVERSE_RELATIONSHIP 

A reverse relationship works just like a relationship except that it represents the reverse direction.

Though a reverse relationship contains a reference to the referring object, this reference will not be automatically resolved.

◆ property_type_t

Possible property types.

Enumerator
COMPOSITE 

A composite property.

REFERENCE 

A string-valued property containing a class ID and URI which is a reference to another location in the management information tree.

STRING 

A string-valued property.

S64 

A signed 64-bit integer value.

U64 

An unsigned 64-bit integer value.

MAC 

A MAC address.

ENUM8 

An 8-bit enum value.

ENUM16 

A 16-bit enum value.

ENUM32 

A 32-bit enum value.

ENUM64 

A 64-bit enum value.

Function Documentation

◆ getClasses()

const std::vector< ClassInfo > & opflex::modb::ModelMetadata::getClasses ( ) const
inline

Get the classes that exist in this model.

Returns
a vector of ClassInfo objects

◆ getClassId()

const class_id_t opflex::modb::PropertyInfo::getClassId ( ) const
inline

Get the class ID for this property.

This is valid only when property_type_t == COMPOSITE

◆ getConsts()

const std::vector< ConstInfo > & opflex::modb::EnumInfo::getConsts ( ) const
inline

Get the vector of possible const values for the enum.

Returns
the vector of possible const values

◆ getId() [1/2]

class_id_t opflex::modb::ClassInfo::getId ( ) const
inline

Get the unique class ID for this class.

Returns
the class ID

◆ getId() [2/2]

const uint64_t opflex::modb::ConstInfo::getId ( ) const
inline

Get the unique ID for this const within the enclosing enum.

Returns
the const ID within the enum

◆ getIdByName()

const uint64_t opflex::modb::EnumInfo::getIdByName ( const std::string & name) const

Get the constant value by the enum name.

Returns
The integer enum value
Exceptions
std::out_of_rangeif the name does not exist

◆ getName() [1/4]

const std::string & opflex::modb::ClassInfo::getName ( ) const
inline

Get the name for this class.

Returns
the name

◆ getName() [2/4]

const std::string & opflex::modb::ConstInfo::getName ( ) const
inline

Get the name for this const.

This value is used to represent this const in JSON documents.

Returns
the const name

◆ getName() [3/4]

const std::string & opflex::modb::EnumInfo::getName ( ) const
inline

Get the name of the enum.

Returns
the enum name

◆ getName() [4/4]

const std::string & opflex::modb::ModelMetadata::getName ( ) const
inline

Get the name for this model.

Returns
the string name

◆ getNameById()

const std::string & opflex::modb::EnumInfo::getNameById ( uint64_t id) const

Get the enum constant name by the enum value.

Returns
the string name
Exceptions
std::out_of_rangeif the ID does not exist

◆ getNamingProps()

const std::vector< prop_id_t > & opflex::modb::ClassInfo::getNamingProps ( ) const
inline

Get the vector of naming properties (in order) that make up the key or naming properties for this class.

Returns
a vector of property ID object.

◆ getOwner()

const std::string & opflex::modb::ClassInfo::getOwner ( ) const
inline

Get the owner for this class.

Returns
the owner string

◆ getProperties()

const property_map_t & opflex::modb::ClassInfo::getProperties ( ) const
inline

Get the properties that exist for this class.

Returns
A map from prop_id_t to PropertyInfo

◆ getProperty() [1/2]

const PropertyInfo & opflex::modb::ClassInfo::getProperty ( const std::string & name) const
inline

Get the PropertyInfo for the given named property.

Parameters
namethe name of the property
Returns
a reference to the property info
Exceptions
std::out_of_rangeif there is no property with that name

◆ getProperty() [2/2]

const PropertyInfo & opflex::modb::ClassInfo::getProperty ( prop_id_t & prop_id) const
inline

Get the PropertyInfo for the given property ID.

Parameters
prop_idthe ID of the property
Returns
a reference to the property info
Exceptions
std::out_of_rangeif there is no property with that ID

◆ getType()

class_type_t opflex::modb::ClassInfo::getType ( ) const
inline

Get the type of this class.

Returns
the class type
See also
class_type_t

◆ ModelMetadata()

opflex::modb::ModelMetadata::ModelMetadata ( const std::string & model_name,
const std::vector< ClassInfo > & classes )

Construct a model metadata object for the given class ID.

Parameters
model_namethe name of the model
classesa vector containing the classes to be used with the model