![]() |
Template Array class that complements the base functionality found in an STL vector. More...
#include <Array.h>
Inheritance diagram for HSEP::Array< T >:
Collaboration diagram for HSEP::Array< T >:Public Types | |
| typedef function< void(T *pValuePtr)> | ForEachWorker |
| Function type prototype to be used to create C style or lambda style functions for the forEach method. | |
Public Member Functions | |
| Array () | |
| Array (Array &pReference) | |
| virtual | ~Array () |
| void | operator() (Array &pReference) |
| T * | ptr (size_t pPos) |
| Returns a pointer to the actually stored element locate at pPos position. | |
| void | push (T &pValueRef) |
| Creetes a copy of the value passed by reference and stores it at the end of the array. | |
| void | push (T *pValuePtr) |
| Stores the given pointer (not a copy or a copy of the pointed element) at the end of the array. | |
| T * | pop () |
| Retrieves the last element stored in the Array, deleting it from the Array. | |
| void | clear () |
| Disposes all contained elements running their delete method and clear the internal container. | |
| bool | forEach (ForEachWorker pWorker) |
| Executes the given pWorker function on every contained element. | |
| size_t | size () |
| Returns the container size. | |
Public Member Functions inherited from HSEP::HSEPObject | |
| 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 | |
Protected Member Functions inherited from HSEP::HSEPObject | |
| 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. | |
Template Array class that complements the base functionality found in an STL vector.
It is important to note that this container stores pointers to the contained elements, to avoid the traditional STL behavior of storing references. The STL's vector behavior, although looks harmless, can produce very dangerous programs when the given elements are created as local variables in the given function stack. As an interesting point, this problem can't be detected by the compiler.
| typedef function<void (T* pValuePtr)> HSEP::Array< T >::ForEachWorker |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
Disposes all contained elements running their delete method and clear the internal container.
Definition at line 126 of file Array.h.
Referenced by HSEPData::DBResultSet::destroyMetadata(), HSEP::FileTool::retrieve(), and HSEP::StringTool::split().
Here is the caller graph for this function:
|
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 143 of file Array.h.
Referenced by HSEP::Array< SQLResultRow >::Array(), HSEPData::DBResultSet::destroyMetadata(), HSEPData::QueryUniqueCycle::execute(), HSEPDataSqLite::feedData(), HSEPDataSqLite::SqLiteResultSet::forEach(), HSEP::BaseDriverSet::load(), HSEPData::DB::loadDrivers(), HSEPData::DB::loadInstances(), HSEP::Array< SQLResultRow >::operator()(), and HSEP::FileTool::store().
Here is the caller graph for this function:
|
inline |
|
inline |
|
inline |
Returns a pointer to the actually stored element locate at pPos position.
| pPos |
Definition at line 86 of file Array.h.
Referenced by HSEPDataSqLite::SQLResultData::current(), and HSEPDataSqLite::SQLResultData::getString().
Here is the caller graph for this function:
|
inline |
Creetes a copy of the value passed by reference and stores it at the end of the array.
| pValueRef |
Definition at line 98 of file Array.h.
Referenced by HSEPDataSqLite::feedData(), HSEPDataSqLite::feedMetadata(), HSEP::fillArray(), HSEP::DriverSet< Type >::info(), HSEP::FileTool::retrieve(), HSEP::StringTool::split(), and HSEP::DirTool::traverse().
Here is the caller graph for this function:
|
inline |
|
inline |