NEST
2.6.0,not_revisioned_source_dir@0
|
This template is the standard safe-pointer implementation of SYNOD. More...
#include <lockptr.h>
Classes | |
class | PointerObject |
Public Member Functions | |
lockPTR (D *p=NULL) | |
lockPTR (D &p_o) | |
lockPTR (const lockPTR< D > &spd) | |
virtual | ~lockPTR () |
lockPTR< D > | operator= (const lockPTR< D > &spd) |
lockPTR< D > | operator= (D &s) |
lockPTR< D > | operator= (D const &s) |
D * | get (void) |
D * | get (void) const |
D * | operator-> () const |
D * | operator-> () |
D & | operator* () |
const D & | operator* () const |
bool | operator! () const |
< returns true if and only if obj->pointee == NULL More... | |
bool | operator== (const lockPTR< D > &p) const |
bool | operator!= (const lockPTR< D > &p) const |
bool | valid (void) const |
< returns true if and only if obj->pointee != NULL More... | |
bool | islocked (void) const |
bool | deletable (void) const |
void | lock (void) const |
void | unlock (void) const |
void | unlock (void) |
size_t | references (void) const |
Private Attributes | |
PointerObject * | obj |
This template is the standard safe-pointer implementation of SYNOD.
In order for this scheme to work smoothly, the user has to take some precautions:
Class lockPTR is designed to behave just like the pointer would. You can use the dereference operators (* and ->) to access the protected object. However, the pointer itself is (with exceptions) never exposed to the user.
Since all access to the referenced object is done via a lockPTR, it is possible to maintain a count of all active references. If this count dropts to zero, the referenced object can savely be destroyed. For dynamically allocated objects, delete is envoked on the stored pointer.
class lockPTR distinguishes between dynamically and automatically allocated objects by the way it is initialised:
If a lockPTR is initialised with a pointer, it assumes that the referenced object was dynamically allocated and will call the destructor once the reference count drops to zero.
If the lockPTR is initialised with a reference, it assumes that the object is automatically allocated. Thus, the lockPTR wil NOT call the destructor.
In some cases it is necessary for a routine to actually get hold of the pointer, contained in the lockPTR object. This can be done by using the member function get(). After the pointer has been exposed this way, the lockPTR will regard the referenced object as unsafe, since the user might call delete on the pointer. Thus, lockPTR will "lock" the referenced object and deny all further access. The object can be unlocked by calling the unlock() member.
Equality for lockPTRs is defined as identity of the data object.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
< returns true if and only if obj->pointee == NULL
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by lockPTRDatum< D, slt >::equals().
|
inline |
|
inline |
|
inline |
|
inline |
< returns true if and only if obj->pointee != NULL
Referenced by nest::ConnectionCreator::convergent_connect_(), PrintFunction::execute(), PrettyprintFunction::execute(), CloseistreamFunction::execute(), FlushFunction::execute(), EndlFunction::execute(), EndsFunction::execute(), IparseFunction::execute(), EatwhiteFunction::execute(), SetwFunction::execute(), SetprecisionFunction::execute(), IOSFixedFunction::execute(), IOSScientificFunction::execute(), IOSDefaultFunction::execute(), IOSShowpointFunction::execute(), IOSNoshowpointFunction::execute(), IOSShowbaseFunction::execute(), IOSNoshowbaseFunction::execute(), IOSDecFunction::execute(), IOSHexFunction::execute(), IOSOctFunction::execute(), IOSLeftFunction::execute(), IOSRightFunction::execute(), IOSInternalFunction::execute(), GetcFunction::execute(), GetsFunction::execute(), GetlineFunction::execute(), IGoodFunction::execute(), IClearFunction::execute(), OClearFunction::execute(), IFailFunction::execute(), OGoodFunction::execute(), IEofFunction::execute(), OEofFunction::execute(), In_AvailFunction::execute(), ReadDoubleFunction::execute(), ReadIntFunction::execute(), ReadWordFunction::execute(), nest::Node::get_status_base(), PgetrusageFunction::getinfo_(), SLIStartup::init(), librandom::BinomialRandomDev::ldev(), librandom::PoissonRandomDev::ldev(), librandom::RandomDev::ldev(), librandom::RandomDev::operator()(), nest::Node::set_status_base(), nest::ConnectionCreator::source_driven_connect_(), and nest::ConnectionCreator::target_driven_connect_().
|
private |
Referenced by lockPTR< nest::Ntree< D, index > >::deletable(), lockPTR< nest::Ntree< D, index > >::get(), lockPTR< nest::Ntree< D, index > >::islocked(), lockPTR< nest::Ntree< D, index > >::lock(), lockPTR< nest::Ntree< D, index > >::lockPTR(), lockPTR< nest::Ntree< D, index > >::operator!(), lockPTR< nest::Ntree< D, index > >::operator!=(), lockPTR< nest::Ntree< D, index > >::operator*(), lockPTR< nest::Ntree< D, index > >::operator->(), lockPTR< nest::Ntree< D, index > >::operator=(), lockPTR< nest::Ntree< D, index > >::operator==(), lockPTR< nest::Ntree< D, index > >::references(), lockPTR< nest::Ntree< D, index > >::unlock(), lockPTR< nest::Ntree< D, index > >::valid(), and lockPTR< nest::Ntree< D, index > >::~lockPTR().