ParCompMark::Pointer< T, Lock > Class Template Reference
#include <PCMPointer.h>
Inheritance diagram for ParCompMark::Pointer< T, Lock >:
Detailed Description
template<typename T, class Lock>
class ParCompMark::Pointer< T, Lock >
Template smart pointer class.
- Remarks:
Definition at line 55 of file PCMPointer.h.
Methods | |
virtual bool | isNull () const |
Return true if the pointer does not reference anything. | |
virtual bool | isNotNull () const |
Return true if the pointer does reference something. | |
virtual void | assignWithLock (Pointer< T, Lock > &pointer) |
Assign another smart pointer with keeping it locked. | |
virtual void | reference (const T *pointer) |
Take reference from a C style pointer (does not delete referenced object when smart pointer dies). | |
virtual T * | getPtr () |
Return a C style pointer to the referenced object. | |
virtual void | kill (const bool &force=false) |
Force deallocating referenced object. | |
virtual void | setNull (const bool &force=false) |
Set the referenced object to null without trying to deallocate the actual object. | |
virtual void | lock () |
Lock the referenced object. | |
virtual bool | trylock () |
Try locking referenced object. | |
virtual void | unlock () |
Unlock the referenced object. | |
virtual bool | getLocked () const |
Return true, if the object is locked. | |
virtual void | _deletePointer (const bool &force=false, const bool &keepLock=false) |
Delete the pointer. | |
virtual void | _assignCPointer (const T *pointer, const bool &takeOwnership=true) |
Assign a C style pointer. | |
virtual void | _assignPointer (Pointer< T, Lock > &pointer, const bool &keepLock=false) |
Assign another smart pointer. | |
virtual void | _switchPointer (Pointer< T, Lock > &pointer, const bool &keepLock=false) |
Switch to another smart pointer. | |
virtual bool | _equalsCPointer (const T *pointer) const |
Test indentity. | |
virtual bool | _equalsPointer (Pointer< T, Lock > &pointer) const |
Test indentity. | |
Public Member Functions | |
Constructors & destructor | |
Pointer () | |
Create a NULL pointer. | |
Pointer (const T *pointer, const bool &takeOwnership=true) | |
Create smart pointer from a C style pointer. | |
Pointer (Pointer< T, Lock > &pointer) | |
Create smart pointer from an another smart pointer. | |
Pointer (const Pointer< T, Lock > &pointer) | |
Create smart pointer from an another const smart pointer. | |
virtual | ~Pointer () |
The destructor. | |
Operators | |
virtual const Pointer< T, Lock > & | operator= (const T *pointer) |
Assign a C style pointer. | |
virtual const Pointer< T, Lock > & | operator= (Pointer< T, Lock > &pointer) |
Assign another smart pointer. | |
virtual const Pointer< T, Lock > & | operator= (const Pointer< T, Lock > &pointer) |
Assign another smart pointer (const version). | |
virtual T * | operator-> () |
Get referenced object. | |
virtual bool | operator== (const T *pointer) |
template < typename T, class Lock > inline T Pointer < T, Lock >operator*() Implementation of operator * { Assert(isNotNull(), NULL_POINTER_ERROR, "Pointer::operator()"); return *(mMeta->ptr); } | |
virtual bool | operator== (Pointer< T, Lock > &pointer) |
Equality test operator. | |
virtual bool | operator!= (const T *pointer) |
Equality test operator on a C style pointer. | |
virtual bool | operator!= (Pointer< T, Lock > &pointer) |
Equality test operator. | |
Static Public Attributes | |
Class constants | |
static const Pointer< T, Lock > * | NULLPTR |
Null pointer constant. | |
Protected Attributes | |
Variables | |
Meta * | mMeta |
Meta field for the referenced object. | |
Classes | |
struct | Meta |
Meta field type for the referenced object. More... |
Constructor & Destructor Documentation
ParCompMark::Pointer< T, Lock >::Pointer | ( | ) | [inline] |
ParCompMark::Pointer< T, Lock >::Pointer | ( | const T * | pointer, | |
const bool & | takeOwnership = true | |||
) | [inline, explicit] |
Create smart pointer from a C style pointer.
- Parameters:
-
[in] pointer C style pointer [in] takeOwnership Takes ownership of the assigned object. It will be deleted when smart pointer dies.
Definition at line 407 of file PCMPointer.h.
ParCompMark::Pointer< T, Lock >::Pointer | ( | Pointer< T, Lock > & | pointer | ) | [inline] |
Create smart pointer from an another smart pointer.
(Copy constructor)
- Parameters:
-
[out] pointer Another smart pointer to assign.
Definition at line 417 of file PCMPointer.h.
ParCompMark::Pointer< T, Lock >::Pointer | ( | const Pointer< T, Lock > & | pointer | ) | [inline] |
Create smart pointer from an another const smart pointer.
(Constantant copy constructor)
- Parameters:
-
[in] pointer Another smart pointer to assign.
Definition at line 426 of file PCMPointer.h.
ParCompMark::Pointer< T, Lock >::~Pointer | ( | ) | [virtual] |
Member Function Documentation
void ParCompMark::Pointer< T, Lock >::_assignCPointer | ( | const T * | pointer, | |
const bool & | takeOwnership = true | |||
) | [inline, protected, virtual] |
Assign a C style pointer.
- Parameters:
-
[in] pointer C style pointer [in] takeOwnership Takes ownership of the assigned object. It will be deleted when smart pointer dies.
Definition at line 705 of file PCMPointer.h.
void ParCompMark::Pointer< T, Lock >::_assignPointer | ( | Pointer< T, Lock > & | pointer, | |
const bool & | keepLock = false | |||
) | [inline, protected, virtual] |
Assign another smart pointer.
- Parameters:
-
[out] pointer Another smart pointer to assign. [in] keepLock Keep the pointer locked.
Definition at line 718 of file PCMPointer.h.
void ParCompMark::Pointer< T, Lock >::_deletePointer | ( | const bool & | force = false , |
|
const bool & | keepLock = false | |||
) | [inline, protected, virtual] |
Delete the pointer.
Decrease reference counter, relese lock, free memory if needed.
- Parameters:
-
[in] force If false, the object will only be deallocated when one it has one reference. [in] keepLock Keep the pointer locked.
Definition at line 677 of file PCMPointer.h.
bool ParCompMark::Pointer< T, Lock >::_equalsCPointer | ( | const T * | pointer | ) | const [inline, protected, virtual] |
Test indentity.
- Parameters:
-
[in] pointer C style pointer
- Returns:
- True if the data in parameter is identical to the smart pointer.
Definition at line 751 of file PCMPointer.h.
bool ParCompMark::Pointer< T, Lock >::_equalsPointer | ( | Pointer< T, Lock > & | pointer | ) | const [inline, protected, virtual] |
Test indentity.
- Parameters:
-
[out] pointer Another smart pointer to assign.
- Returns:
- True if the data in parameter is identical to the smart pointer.
Definition at line 758 of file PCMPointer.h.
void ParCompMark::Pointer< T, Lock >::_switchPointer | ( | Pointer< T, Lock > & | pointer, | |
const bool & | keepLock = false | |||
) | [inline, protected, virtual] |
Switch to another smart pointer.
Helps changing reference under continous lock.
- Parameters:
-
[out] pointer Another smart pointer to assign. [in] keepLock Keep the pointer locked.
Definition at line 732 of file PCMPointer.h.
void ParCompMark::Pointer< T, Lock >::assignWithLock | ( | Pointer< T, Lock > & | pointer | ) | [inline, virtual] |
Assign another smart pointer with keeping it locked.
- Parameters:
-
[out] pointer Another smart pointer to assign.
Definition at line 590 of file PCMPointer.h.
bool ParCompMark::Pointer< T, Lock >::getLocked | ( | ) | const [inline, virtual] |
Return true, if the object is locked.
- Returns:
- True if the referenced object is locked.
Definition at line 669 of file PCMPointer.h.
Referenced by ParCompMark::Application::_start(), ParCompMark::Application::createLowLevelScript(), ParCompMark::Application::executeUserCommand(), ParCompMark::Application::processScenarioScript(), and ParCompMark::Application::retrieveDynamicScriptParameters().
T * ParCompMark::Pointer< T, Lock >::getPtr | ( | ) | [inline, virtual] |
Return a C style pointer to the referenced object.
- Returns:
- Pointer to the referenced object.
Definition at line 617 of file PCMPointer.h.
Referenced by ParCompMark::Application::_stop(), ParCompMark::OutputNode::addChildNode(), ParCompMark::Process::addContext(), ParCompMark::FileSystemManager::closeFile(), ParCompMark::Node::createBuffer(), ParCompMark::OpenGLRenderingEngine::createCustomRenderer(), ParCompMark::Host::createNode(), ParCompMark::Node::createProcess(), ParCompMark::Client::handleMessage(), ParCompMark::Host::Host(), ParCompMark::NetServer::initialize(), ParCompMark::Host::initialize(), ParCompMark::NetServer::NetServer(), ParCompMark::HostInfo::refreshCPUs(), ParCompMark::HostInfo::refreshGPUs(), ParCompMark::ConfigOptions::saveToIniFile(), ParCompMark::NetServer::sendBroadcastMessage(), ParCompMark::Application::setEnvironmentVariablesToSquirrel(), ParCompMark::HandleClient::task(), ParCompMark::Thread::Thread(), ParCompMark::Process::threadFinalize(), and ParCompMark::Process::threadInitialize().
bool ParCompMark::Pointer< T, Lock >::isNotNull | ( | ) | const [inline, virtual] |
Return true if the pointer does reference something.
- Returns:
- True if the pointer does reference something.
Definition at line 582 of file PCMPointer.h.
Referenced by ParCompMark::Host::finalize(), ParCompMark::Application::finalize(), ParCompMark::GLXGLContext::GLXGLContext(), ParCompMark::Process::initProcess(), ParCompMark::Cluster::parseXML(), ParCompMark::Cluster::refreshData(), and ParCompMark::HostInfo::~HostInfo().
bool ParCompMark::Pointer< T, Lock >::isNull | ( | ) | const [inline, virtual] |
Return true if the pointer does not reference anything.
- Returns:
- True if the pointer does not reference anything.
Definition at line 575 of file PCMPointer.h.
Referenced by ParCompMark::Network::getIP().
void ParCompMark::Pointer< T, Lock >::kill | ( | const bool & | force = false |
) | [inline, virtual] |
Force deallocating referenced object.
- Parameters:
-
[in] force If false, the object will only be deallocated when one it has one reference.
Definition at line 625 of file PCMPointer.h.
Referenced by ParCompMark::Node::finalize(), ParCompMark::Host::finalize(), ParCompMark::GLXRenderWindow::finalize(), ParCompMark::Application::finalize(), ParCompMark::Network::getIP(), ParCompMark::Cluster::refreshData(), ParCompMarkTest::TestXDisplay::test_constructor_cstd__string(), ParCompMarkTest::TestNetServer::test_constructor_cstd__string(), ParCompMarkTest::TestNetClient::test_constructor_cstd__string(), ParCompMark::Process::threadFinalize(), ParCompMark::PluginManager::unloadPlugins(), ParCompMark::Host::~Host(), and ParCompMark::HostInfo::~HostInfo().
void ParCompMark::Pointer< T, Lock >::lock | ( | ) | [inline, virtual] |
Lock the referenced object.
Definition at line 647 of file PCMPointer.h.
Referenced by ParCompMark::PluginManager::_loadPlugin(), ParCompMark::GLXRenderWindow::_setCaption(), ParCompMark::Application::_start(), ParCompMark::Application::_stop(), ParCompMark::Process::actualizeRenderWindow(), ParCompMark::FileSystemManager::closeFile(), ParCompMark::Application::commanderOperation(), ParCompMark::Node::createBuffer(), ParCompMark::Application::createLowLevelScript(), ParCompMark::Host::createNode(), ParCompMark::Node::createProcess(), ParCompMark::RendererPlugin::createRenderer(), ParCompMark::Application::createVirtualMachines(), ParCompMark::GLXRenderWindow::createWindow(), ParCompMark::GLXRenderWindow::destroyWindow(), ParCompMark::Application::executeUserCommand(), ParCompMark::GLXRenderWindow::finalize(), ParCompMark::GLXGLContext::finalize(), ParCompMark::SqVM::findOrAddScript(), ParCompMark::SqVM::findScript(), ParCompMark::PluginManager::getPlugin(), ParCompMark::ConfigOptions::getValue(), ParCompMark::Client::handleMessage(), ParCompMark::ConfigOptions::hasOption(), ParCompMark::NetServer::initialize(), ParCompMark::Host::initialize(), ParCompMark::GLXGLContext::initialize(), ParCompMark::Application::initializeDynamicScriptParameters(), ParCompMark::Process::initProcess(), ParCompMark::Process::openRenderWindow(), ParCompMark::Host::openXDisplay(), ParCompMark::Application::processScenarioScript(), ParCompMark::GLXRenderWindow::releaseCurrent(), ParCompMark::GLXGLContext::releaseCurrent(), ParCompMark::ConfigOptions::removeOption(), ParCompMark::Application::retrieveDynamicScriptParameters(), ParCompMark::Process::runningProcess(), ParCompMark::NetServer::sendBroadcastMessage(), ParCompMark::GLXRenderWindow::setCurrent(), ParCompMark::GLXGLContext::setCurrent(), ParCompMark::Application::setEnvironmentVariablesToSquirrel(), ParCompMark::ConfigOptions::setValue(), ParCompMark::Process::task(), ParCompMark::HandleClient::task(), ParCompMark::Process::threadFinalize(), ParCompMark::Process::threadInitialize(), and ParCompMark::Application::writeOutput().
bool ParCompMark::Pointer< T, Lock >::operator!= | ( | Pointer< T, Lock > & | pointer | ) | [inline, virtual] |
Equality test operator.
- Parameters:
-
[out] pointer Another smart pointer to test.
- Returns:
- True if the referenced objects are not identical.
Definition at line 563 of file PCMPointer.h.
bool ParCompMark::Pointer< T, Lock >::operator!= | ( | const T * | pointer | ) | [inline, virtual] |
Equality test operator on a C style pointer.
- Parameters:
-
[in] pointer C style pointer
- Returns:
- True if the referenced object is not identical to the parameter.
Definition at line 555 of file PCMPointer.h.
T * ParCompMark::Pointer< T, Lock >::operator-> | ( | ) | [inline, virtual] |
const Pointer< T, Lock > & ParCompMark::Pointer< T, Lock >::operator= | ( | const Pointer< T, Lock > & | pointer | ) | [inline, virtual] |
Assign another smart pointer (const version).
- Parameters:
-
[in] pointer Another smart pointer to assign.
- Returns:
- Self reference.
Definition at line 484 of file PCMPointer.h.
const Pointer< T, Lock > & ParCompMark::Pointer< T, Lock >::operator= | ( | Pointer< T, Lock > & | pointer | ) | [inline, virtual] |
Assign another smart pointer.
- Parameters:
-
[out] pointer Another smart pointer to assign.
- Returns:
- Self reference.
Definition at line 469 of file PCMPointer.h.
const Pointer< T, Lock > & ParCompMark::Pointer< T, Lock >::operator= | ( | const T * | pointer | ) | [inline, virtual] |
Assign a C style pointer.
- Parameters:
-
[in] pointer C style pointer
- Returns:
- Self reference.
Definition at line 448 of file PCMPointer.h.
bool ParCompMark::Pointer< T, Lock >::operator== | ( | Pointer< T, Lock > & | pointer | ) | [inline, virtual] |
Equality test operator.
- Parameters:
-
[out] pointer Another smart pointer to test.
- Returns:
- True if the referenced objects are identical.
Definition at line 547 of file PCMPointer.h.
bool ParCompMark::Pointer< T, Lock >::operator== | ( | const T * | pointer | ) | [inline, virtual] |
template < typename T, class Lock > inline T Pointer < T, Lock >operator*() Implementation of operator * { Assert(isNotNull(), NULL_POINTER_ERROR, "Pointer::operator()"); return *(mMeta->ptr); }
- Parameters:
-
[in] pointer C style pointer
- Returns:
- True if the referenced object is identical to the parameter.
Definition at line 539 of file PCMPointer.h.
void ParCompMark::Pointer< T, Lock >::reference | ( | const T * | pointer | ) | [inline, virtual] |
Take reference from a C style pointer (does not delete referenced object when smart pointer dies).
- Parameters:
-
[in] pointer C style pointer
Definition at line 606 of file PCMPointer.h.
Referenced by ParCompMark::HostInfo::refreshCPUs(), and ParCompMark::HostInfo::refreshGPUs().
void ParCompMark::Pointer< T, Lock >::setNull | ( | const bool & | force = false |
) | [inline, virtual] |
Set the referenced object to null without trying to deallocate the actual object.
- Remarks:
- Parameters:
-
[in] force If false, the reference will only be set to null when one it has one reference.
Definition at line 637 of file PCMPointer.h.
Referenced by ParCompMark::FileSystemManager::closeFile().
bool ParCompMark::Pointer< T, Lock >::trylock | ( | ) | [inline, virtual] |
Try locking referenced object.
- Returns:
- True if the locking was successful.
Definition at line 654 of file PCMPointer.h.
void ParCompMark::Pointer< T, Lock >::unlock | ( | ) | [inline, virtual] |
Unlock the referenced object.
Definition at line 662 of file PCMPointer.h.
Referenced by ParCompMark::PluginManager::_loadPlugin(), ParCompMark::GLXRenderWindow::_setCaption(), ParCompMark::Application::_start(), ParCompMark::Application::_stop(), ParCompMark::Process::actualizeRenderWindow(), ParCompMark::FileSystemManager::closeFile(), ParCompMark::Application::commanderOperation(), ParCompMark::Node::createBuffer(), ParCompMark::Application::createLowLevelScript(), ParCompMark::Host::createNode(), ParCompMark::Node::createProcess(), ParCompMark::RendererPlugin::createRenderer(), ParCompMark::Application::createVirtualMachines(), ParCompMark::GLXRenderWindow::createWindow(), ParCompMark::GLXRenderWindow::destroyWindow(), ParCompMark::Application::executeUserCommand(), ParCompMark::GLXRenderWindow::finalize(), ParCompMark::GLXGLContext::finalize(), ParCompMark::SqVM::findOrAddScript(), ParCompMark::SqVM::findScript(), ParCompMark::PluginManager::getPlugin(), ParCompMark::ConfigOptions::getValue(), ParCompMark::Client::handleMessage(), ParCompMark::ConfigOptions::hasOption(), ParCompMark::NetServer::initialize(), ParCompMark::Host::initialize(), ParCompMark::GLXGLContext::initialize(), ParCompMark::Application::initializeDynamicScriptParameters(), ParCompMark::Process::initProcess(), ParCompMark::Process::openRenderWindow(), ParCompMark::Host::openXDisplay(), ParCompMark::Application::processScenarioScript(), ParCompMark::GLXRenderWindow::releaseCurrent(), ParCompMark::GLXGLContext::releaseCurrent(), ParCompMark::ConfigOptions::removeOption(), ParCompMark::Application::retrieveDynamicScriptParameters(), ParCompMark::Process::runningProcess(), ParCompMark::NetServer::sendBroadcastMessage(), ParCompMark::GLXRenderWindow::setCurrent(), ParCompMark::GLXGLContext::setCurrent(), ParCompMark::Application::setEnvironmentVariablesToSquirrel(), ParCompMark::ConfigOptions::setValue(), ParCompMark::Process::task(), ParCompMark::HandleClient::task(), ParCompMark::Process::threadFinalize(), ParCompMark::Process::threadInitialize(), and ParCompMark::Application::writeOutput().
Member Data Documentation
Meta* ParCompMark::Pointer< T, Lock >::mMeta [protected] |
Meta field for the referenced object.
- Remarks:
- This is own attribute of this class.
Definition at line 119 of file PCMPointer.h.
const Pointer< T, Lock > * ParCompMark::Pointer< T, Lock >::NULLPTR [static] |
Initial value:
Pointer < T, DummyLock > ()
- Remarks:
- This is own attribute of this class.
Definition at line 101 of file PCMPointer.h.
The documentation for this class was generated from the following files: