![]() |
Provides a pair container where the key is a string and the content element is a pointer to a template definition. More...
#include <Dictionary.h>
Public Types | |
typedef function< void(string &pKeyRef, T *&pValuePtrRef)> | ForEachWorker |
Public Member Functions | |
Dictionary () | |
virtual | ~Dictionary () |
void | operator() (Dictionary &pReference) |
Copy operator() assimilates the content of the Dictionary given by reference. | |
T & | ref (string &pKeyRef) |
Return a reference for the value pointed by the provided parameter. | |
T & | ref (const char *pKeyPtr) |
Return a reference for the value pointed by the provided parameter. | |
T * | ptr (string &pKeyRef) |
Returns a pointer to the internally stored element pointed by the provided parameter. | |
T * | ptr (const char *pKeyPtr) |
Returns a pointer to the internally stored element pointed by the provided parameter. | |
bool | has (string &pKeyRef) |
Indicates if the specified key corresponds to an stored element. | |
bool | has (const char *pKeyPtr) |
Indicates if the specified key corresponds to an stored element. | |
void | put (string &pKeyRef, T &pValueRef) |
Introduces a copy of the specified element inside the Catalog. | |
void | put (const char *pKeyPtr, T &pValueRef) |
Insert a copy of the specified element inside the Catalog. | |
void | put (string &pKeyRef, T *pValuePtr) |
Insert the specified pointer (not a copy or a copy of the pointed element) inside the Catalog. | |
void | put (const char *pKeyPtr, T *pValuePtr) |
Insert the specified pointer (not a copy or a copy of the pointed element) inside the Catalog. | |
void | erase (const char *pKeyPtr) |
Erases the specified dictionary entry according with the provided key constant value. | |
void | erase (string &pKeyRef) |
Erases the specified dictionary entry according with the provided key constant value. | |
void | clear () |
Erases all the stored dictionary pairs running the delete method for each contained pointer and cleaning the internal data container. | |
bool | forEach (ForEachWorker pWorker) |
Executes the given pWorker function on every contained element. | |
size_t | size () |
Returns the container size. | |
![]() | |
string & | lastErrorRef () |
Returns a reference to the last stored error message. | |
ErrorCode | lastCode () |
Returns the last stored code. | |
bool | valid () |
Permits to know if the object has a valid internal state. | |
string & | typeRef () |
Permits to know the type of this particular object. | |
Additional Inherited Members | |
![]() | |
HSEPObject (const char *pType) | |
Constructor, providing the base for the state controlling instance. | |
virtual | ~HSEPObject () |
void | setLastError (string &pErrorMsgRef) |
Assigns an error message text to the last executed operation. | |
void | setLastError (const string &pErrorMsgRef) |
Assigns an error message text to the last executed operation. | |
void | setLastError (const char *pErrorMsg) |
Assigns an error message text to the last executed operation. | |
void | setValid () |
Defines that the object has a valid state. | |
void | setInvalid () |
Defines that the object has an invalid state. | |
void | setLastCode (const ErrorCode pErrorCode) |
Defines the internal result code for the object. | |
Provides a pair container where the key is a string and the content element is a pointer to a template definition.
The idea with the Dictionary is to offer a more precise control on the contained elements, reducing memory footprint but without letting possible memory leaks because of the lack of control of a plain regular map container.
Definition at line 44 of file Dictionary.h.
typedef function<void (string& pKeyRef, T*& pValuePtrRef)> HSEP::Dictionary< T >::ForEachWorker |
Definition at line 48 of file Dictionary.h.
|
inline |
Definition at line 50 of file Dictionary.h.
|
inlinevirtual |
Definition at line 53 of file Dictionary.h.
|
inline |
Erases all the stored dictionary pairs running the delete method for each contained pointer and cleaning the internal data container.
Definition at line 254 of file Dictionary.h.
Referenced by HSEPData::DB::loadDrivers(), HSEP::FileTool::retrieve(), and HSEP::DriverSet< Type >::unload().
|
inline |
Erases the specified dictionary entry according with the provided key constant value.
pKeyPtr | key to find the pair will be erased |
Definition at line 237 of file Dictionary.h.
|
inline |
Erases the specified dictionary entry according with the provided key constant value.
pKeyRef | key to find the pair will be erased |
Definition at line 246 of file Dictionary.h.
|
inline |
Executes the given pWorker function on every contained element.
pWorker | The given function |
It is possible to assign a regular C style function pointer or a lambda style function.
Definition at line 274 of file Dictionary.h.
Referenced by HSEP::DriverSet< Type >::forEach(), HSEP::DriverSet< Type >::info(), HSEP::RegexpChecker::key(), HSEP::Dictionary< DriverLibType >::operator()(), HSEP::RegexpChecker::RegexpChecker(), and HSEP::FileTool::store().
|
inline |
Indicates if the specified key corresponds to an stored element.
pKeyRef | key to find the specified element |
Definition at line 148 of file Dictionary.h.
Referenced by HSEP::DriverSet< Type >::has(), HSEPData::DB::loadInstances(), and HSEP::RegexpChecker::match().
|
inline |
Indicates if the specified key corresponds to an stored element.
pKeyPtr | key to find the specified element |
Definition at line 158 of file Dictionary.h.
|
inline |
Copy operator() assimilates the content of the Dictionary given by reference.
pReference |
Definition at line 62 of file Dictionary.h.
|
inline |
Returns a pointer to the internally stored element pointed by the provided parameter.
pKeyRef | key to find the specified value. |
Definition at line 120 of file Dictionary.h.
Referenced by HSEP::DriverSet< Type >::has(), and HSEP::DriverSet< Type >::ptr().
|
inline |
Returns a pointer to the internally stored element pointed by the provided parameter.
pKeyPtr | key to find the specified value. |
Definition at line 137 of file Dictionary.h.
|
inline |
Introduces a copy of the specified element inside the Catalog.
If the specified element is already stored inside the dictionary, the original will be erased and the new element will be stored instead.
pKeyRef | key to further find the specified element |
pValueRef | reference value that will be copied inside the dictionary |
Definition at line 172 of file Dictionary.h.
Referenced by HSEP::DriverSet< Type >::_addLibrary(), HSEPData::QueryUniqueCycle::execute(), HSEPDataSqLite::feedMetadata(), HSEPData::DB::loadDrivers(), HSEP::RegexpChecker::RegexpChecker(), HSEP::FileTool::retrieve(), and HSEP::StringTool::split().
|
inline |
Insert a copy of the specified element inside the Catalog.
If the specified element is already stored inside the dictionary, the original will be erased and the new element will be stored instead.
pKeyPtr | key to further find the specified element |
pValueRef | reference value that will be copied inside the dictionary |
Definition at line 194 of file Dictionary.h.
|
inline |
Insert the specified pointer (not a copy or a copy of the pointed element) inside the Catalog.
If the specified element is already stored inside the dictionary, the original will be erased and the new element will be stored instead.
pKeyRef | key to further find the specified element |
pValuePtr | pointer to the value that will be stored inside the dictionary |
Definition at line 208 of file Dictionary.h.
|
inline |
Insert the specified pointer (not a copy or a copy of the pointed element) inside the Catalog.
If the specified element is already stored inside the dictionary, the original will be erased and the new element will be stored instead.
pKeyPtr | key to further find the specified element |
pValuePtr | pointer to the value that will be stored inside the dictionary |
Definition at line 226 of file Dictionary.h.
|
inline |
Return a reference for the value pointed by the provided parameter.
As the behavior, when the an element doesn't exist can't be defined, the method throw an exception when it is called with a non existent key. When having doubts, first check about the existence of the element with the "has" method, or use the "ptr" method instead.
pKeyRef | key to find the specified value. |
Definition at line 81 of file Dictionary.h.
Referenced by HSEPData::QueryUniqueCycle::getValueRef(), HSEPData::DB::loadInstances(), and HSEP::RegexpChecker::match().
|
inline |
Return a reference for the value pointed by the provided parameter.
As the behavior, when the an element doesn't exist can't be defined, the method throw an exception when it is called with a non existent key. When having doubts, first check about the existence of the element with the "has" method, or use the "ptr" method instead.
pKeyPtr | key to find the specified value. |
Definition at line 109 of file Dictionary.h.
|
inline |