HOPS
HOPS class reference
|
Class MHO_ContainerStore. More...
#include <MHO_ContainerStore.hh>
Public Member Functions | |
MHO_ContainerStore () | |
virtual | ~MHO_ContainerStore () |
template<typename XClassType > | |
bool | AddObject (XClassType *obj) |
Adds an object (with specific type) to the container store if it's non-null and can be cast to MHO_Serializable. More... | |
void | Clear () |
Deletes all objects in the store. More... | |
bool | DeleteObject (const MHO_UUID &obj_id) |
Deletes an object from the container and removes related mappings by its UUID. More... | |
template<typename XClassType > | |
bool | DeleteObject (XClassType *obj_ptr) |
Deletes an object and removes associated entries from containers, returns true if successful. More... | |
void | DumpShortNamesToIds () |
std::vector< std::tuple< std::string, std::string, std::string > > | GetAllObjectInfo () |
void | GetAllObjectUUIDsOfType (MHO_UUID type_id, std::vector< MHO_UUID > &obj_ids) |
get every object uuid in store associated with the specified type UUID More... | |
void | GetAllShortNames (std::vector< std::string > &shortnames) |
get all short names currently in use More... | |
void | GetAllTypeUUIDs (std::vector< MHO_UUID > &type_ids) |
get every type uuid that is present in store More... | |
template<typename XClassType > | |
std::size_t | GetNObjects () const |
get the number of objects of a specific type More... | |
std::size_t | GetNObjects () const |
get total number of objects in store More... | |
template<typename XClassType > | |
XClassType * | GetObject (const MHO_UUID &obj_id) |
get an object of a specific type via object uuid (returns nullptr if not present) More... | |
MHO_Serializable * | GetObject (const MHO_UUID &obj_id) |
get an object via uuid (returns nullptr if not present) More... | |
template<typename XClassType > | |
XClassType * | GetObject (const std::string &shortname) |
provides retrieval of an object via shortname/nickname, returns nullptr on failure More... | |
template<typename XClassType > | |
XClassType * | GetObject (std::size_t index) |
get an object of a specific type via integer index (returns nullptr if not present) More... | |
MHO_UUID | GetObjectTypeUUID (const MHO_UUID &obj_id) |
returns the type uuid of the object with obj_id (if it exists) More... | |
MHO_UUID | GetObjectUUID (const std::string &shortname) |
provide retrieval of an object uuid via shortname/nickname, returns zero'd uuid if none exist More... | |
std::string | GetShortName (const MHO_UUID &obj_id) |
provide retrival of object short name from uuid More... | |
template<typename XClassType > | |
MHO_UUID | GetTypeUUID () |
get the type uuid for a specific type (if it is supported) - if unsupported uuid will be zero More... | |
bool | IsObjectPresent (const MHO_UUID &obj_id) const |
Checks if an object with a given UUID is present in the container store. More... | |
void | RenameObject (const std::string ¤t_shortname, const std::string &new_shortname) |
provides a way in which we can replace the shortname/nickname of an object More... | |
bool | SetShortName (const MHO_UUID &obj_id, const std::string &shortname) |
provide the ability to attach a nicknames to object uuids, all nicknames must be unique returns false if unsuccessful (object not present, or shortname already in use) More... | |
Protected Types | |
using | key_pair = std::pair< MHO_UUID, MHO_UUID > |
Protected Attributes | |
MHO_ContainerDictionary | fDictionary |
std::map< key_pair, MHO_Serializable * > | fIdsToObjects |
std::map< MHO_Serializable *, key_pair > | fObjectsToIds |
std::set< std::string > | fShortNameSet |
std::map< std::string, MHO_UUID > | fShortNameToIds |
Class MHO_ContainerStore.
holds a collection of objects all pointed to by base class MHO_Serializable* retrieval is through type/object ids
|
protected |
|
inline |
|
inlinevirtual |
bool hops::MHO_ContainerStore::AddObject | ( | XClassType * | obj | ) |
Adds an object (with specific type) to the container store if it's non-null and can be cast to MHO_Serializable.
Function MHO_ContainerStore::AddObject, addes and object via pointer.
XClassType | Template parameter, the object type |
obj | Pointer to the object to add, must not be nullptr |
obj | (XClassType*) |
void hops::MHO_ContainerStore::Clear | ( | ) |
Deletes all objects in the store.
bool hops::MHO_ContainerStore::DeleteObject | ( | const MHO_UUID & | obj_id | ) |
Deletes an object from the container and removes related mappings by its UUID.
obj_id | UUID of the object to delete. |
bool hops::MHO_ContainerStore::DeleteObject | ( | XClassType * | obj_ptr | ) |
Deletes an object and removes associated entries from containers, returns true if successful.
Function MHO_ContainerStore::DeleteObject - removes an object via pointer.
XClassType | Template parameter XClassType |
obj_ptr | Pointer to the object of type XClassType to delete. |
obj_ptr | (XClassType*) |
|
inline |
std::vector< std::tuple< std::string, std::string, std::string > > hops::MHO_ContainerStore::GetAllObjectInfo | ( | ) |
void hops::MHO_ContainerStore::GetAllShortNames | ( | std::vector< std::string > & | shortnames | ) |
get all short names currently in use
reference | to (std::vector< std::string>&) to be filled |
void hops::MHO_ContainerStore::GetAllTypeUUIDs | ( | std::vector< MHO_UUID > & | type_ids | ) |
get every type uuid that is present in store
type_ids | Output parameter: vector to hold retrieved UUIDs. |
std::size_t hops::MHO_ContainerStore::GetNObjects |
get the number of objects of a specific type
Counts and returns the number of objects of type XClassType stored in MHO_ContainerStore.
XClassType | Template parameter XClassType |
|
inline |
get total number of objects in store
XClassType * hops::MHO_ContainerStore::GetObject | ( | const MHO_UUID & | obj_id | ) |
get an object of a specific type via object uuid (returns nullptr if not present)
Retrieves an object of type XClassType from the container store using its UUID.
obj_id | UUID of the object to retrieve |
obj_id | The unique identifier (UUID) of the desired object |
MHO_Serializable * hops::MHO_ContainerStore::GetObject | ( | const MHO_UUID & | obj_id | ) |
get an object via uuid (returns nullptr if not present)
obj_id | UUID of the object to retrieve |
XClassType * hops::MHO_ContainerStore::GetObject | ( | const std::string & | shortname | ) |
provides retrieval of an object via shortname/nickname, returns nullptr on failure
Retrieves an object of type XClassType from the container store using its shortname.
XClassType | Template parameter XClassType |
shortname | (const std::string&) |
shortname | (const std::string&) |
XClassType * hops::MHO_ContainerStore::GetObject | ( | std::size_t | index | ) |
get an object of a specific type via integer index (returns nullptr if not present)
Retrieves an object of type XClassType at a specific index (for this class type) in the container.
XClassType | Template parameter XClassType |
index | (std::size_t) |
index | Index of the desired object |
returns the type uuid of the object with obj_id (if it exists)
obj_id | The ID of the object whose type's UUID is to be retrieved. |
MHO_UUID hops::MHO_ContainerStore::GetObjectUUID | ( | const std::string & | shortname | ) |
provide retrieval of an object uuid via shortname/nickname, returns zero'd uuid if none exist
shortname | Short name of the object |
std::string hops::MHO_ContainerStore::GetShortName | ( | const MHO_UUID & | obj_id | ) |
provide retrival of object short name from uuid
obj_id | The UUID for which to retrieve the short name. |
MHO_UUID hops::MHO_ContainerStore::GetTypeUUID |
get the type uuid for a specific type (if it is supported) - if unsupported uuid will be zero
Retrieves the UUID for a given class type from the internal dictionary, given the class XClassType template parameter.
XClassType | Template parameter XClassType |
bool hops::MHO_ContainerStore::IsObjectPresent | ( | const MHO_UUID & | obj_id | ) | const |
Checks if an object with a given UUID is present in the container store.
XClassType | Template parameter XClassType |
obj_id | The UUID of the object to search for. |
|
inline |
provides a way in which we can replace the shortname/nickname of an object
Renames an object in MHO_ContainerStore by updating its short name and associated UUID.
current_shortname | (std::string) the current shortname |
new_shortname | (std::string) the new object shortname |
current_shortname | Current short name of the object to be renamed |
new_shortname | New short name for the object |
bool hops::MHO_ContainerStore::SetShortName | ( | const MHO_UUID & | obj_id, |
const std::string & | shortname | ||
) |
provide the ability to attach a nicknames to object uuids, all nicknames must be unique returns false if unsuccessful (object not present, or shortname already in use)
obj_id | Object UUID to associate with the short name |
shortname | Unique short name to assign to the object |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |