OpFlex Framework 1.7.0
|
This is the base class for all managed objects, which are the primary point of interface with data stored in the managedb object store. More...
#include <opflex/modb/mo-internal/MO.h>
Public Member Functions | |
virtual | ~MO () |
Destroy an MO. | |
class_id_t | getClassId () const |
Get the class ID associated with this managed object. | |
const URI & | getURI () const |
Get the URI associated with this managed object. | |
Protected Member Functions | |
MO (class_id_t class_id, const URI &uri, const OF_SHARED_PTR< const ObjectInstance > &oi) | |
Construct an MO. | |
MO (ofcore::OFFramework &framework, class_id_t class_id, const URI &uri, const OF_SHARED_PTR< const ObjectInstance > &oi) | |
Construct an MO associated with a non-default framework instance. | |
ofcore::OFFramework & | getFramework () const |
Get the framework instance associated with this managed object. | |
const ObjectInstance & | getObjectInstance () const |
Get the raw object instance associated with this managed object. | |
Mutator & | getTLMutator () |
Get the currently-active mutator. | |
template<class T> | |
OF_SHARED_PTR< T > | addChild (class_id_t parent_class, const URI &parent_uri, prop_id_t parent_prop, class_id_t child_class, const URI &child_uri) |
Add a child of the specified type to the mutator and instantiate the correct wrapper class. | |
Static Protected Member Functions | |
static OF_SHARED_PTR< const ObjectInstance > | resolveOI (ofcore::OFFramework &framework, class_id_t class_id, const URI &uri) |
Resolve the specified URI to the underlying object instance, if it exists. | |
static StoreClient & | getStoreClient (ofcore::OFFramework &framework) |
Get a read-only store client for the framework instance. | |
static void | registerListener (ofcore::OFFramework &framework, ObjectListener *listener, class_id_t class_id) |
Register the listener for the specified class ID. | |
static void | unregisterListener (ofcore::OFFramework &framework, ObjectListener *listener, class_id_t class_id) |
Unregister the listener for the specified class ID. | |
template<class T> | |
static boost::optional< OF_SHARED_PTR< T > > | resolve (ofcore::OFFramework &framework, class_id_t class_id, const URI &uri) |
Resolve the specified URI to its managed object wrapper class, if it exists. | |
template<class T> | |
static void | resolveChildren (ofcore::OFFramework &framework, class_id_t parent_class, const URI &parent_uri, prop_id_t parent_prop, class_id_t child_class, std::vector< OF_SHARED_PTR< T > > &out) |
Resolve any children of the specified parent object to their managed object wrapper classes. | |
template<class T> | |
static OF_SHARED_PTR< T > | createRootElement (ofcore::OFFramework &framework, class_id_t class_id) |
Add a root element of the given type to the framework. | |
static void | remove (ofcore::OFFramework &framework, class_id_t class_id, const modb::URI &uri) |
Remove the specified node. | |
Friends | |
class | MOImpl |
bool | operator== (const MO &lhs, const MO &rhs) |
Check for MO equality. | |
bool | operator!= (const MO &lhs, const MO &rhs) |
Check for MO inequality. | |
This is the base class for all managed objects, which are the primary point of interface with data stored in the managedb object store.
A managed object is an object that can be stored in the managed object store, and supports operations for serialization and deserialization for use with the OpFlex protocol. Managed objects are the primary interface point for the opflex framework.
Children of MO are temporary typed objects that reference the "real" objects stored in the MO. The properties of the MO will not change once resolved, so if the object changes in the store, you must respond to the update notification by resolving the affected MOs again.
|
protected |
Construct an MO.
class_id | the class ID for the object |
uri | the URI for the object |
oi | the object instance for this object |
Referenced by operator!=, and operator==.
|
protected |
class_id_t opflex::modb::mointernal::MO::getClassId | ( | ) | const |
Get the class ID associated with this managed object.
The class ID is a unique ID for the type. This ID must be unique for a given managed object database, but need not be globally unique.
|
protected |
Get the framework instance associated with this managed object.
Referenced by addChild().
|
protected |
Get the raw object instance associated with this managed object.
|
protected |
Get the currently-active mutator.
std::logic_error | if there is no active mutator |
Referenced by addChild().
const URI & opflex::modb::mointernal::MO::getURI | ( | ) | const |
|
inlinestaticprotected |
Resolve the specified URI to its managed object wrapper class, if it exists.
framework | the framework instance |
class_id | the class ID for the corresponding object |
uri | the URI to resolve |
References resolveOI().
Referenced by resolveChildren().
|
staticprotected |
Resolve the specified URI to the underlying object instance, if it exists.
framework | the framework instance |
class_id | the class ID for the corresponding object |
uri | the URI to resolve |
std::out_of_range | if the provided URI does not exist locally |
Referenced by resolve().