GU_DetailHandle Class Reference

#include <GU_DetailHandle.h>

List of all members.

Public Member Functions

 GU_DetailHandle ()
 GU_DetailHandle (const GU_DetailHandle &handle)
 ~GU_DetailHandle ()
void clear ()
const GU_DetailHandleoperator= (const GU_DetailHandle &handle)
bool operator== (const GU_DetailHandle &handle) const
bool operator!= (const GU_DetailHandle &handle) const
const GU_DetailpeekDetail () const
const GU_DetailreadLock ()
GU_DetailwriteLock ()
void unlock (const GU_Detail *gdp)
GU_DetailsetGdp (GU_Detail *gdp)
void allocateAndSet (GU_Detail *gdp, bool own=true)
bool deleteGdp ()
bool hasActiveLock () const
 Determines if anyone has a lock on this handle.
bool isNull () const
int getRefCount () const
 Returns the number of references made to the base handle.
void addPreserveRequest ()
void removePreserveRequest ()
int getPreserveRequest () const


Detailed Description

A GU_DetailHandle is designed to allow arms length references to GU_Details. The underlying GU_Detail can be deleted or swapped and things which use the GU_DetailHandle will properly be notified. Further, it provides access control to the GU_Detail, ensuring multiple entities do not write to it at once. This is currently used to ensure deletion is not performed on active GU_Details. Eventually it could be used for multi-threaded support.
Examples:

SIM/SIM_ForceOrbit.C, SIM/SIM_ForceOrbit.h, SIM/SIM_SolverHair.C, SIM/SNOW_Solver.C, and SIM/SNOW_Solver.h.

Definition at line 39 of file GU_DetailHandle.h.


Constructor & Destructor Documentation

GU_DetailHandle::GU_DetailHandle (  ) 

GU_DetailHandle::GU_DetailHandle ( const GU_DetailHandle handle  ) 

GU_DetailHandle::~GU_DetailHandle (  ) 


Member Function Documentation

void GU_DetailHandle::addPreserveRequest (  ) 

Preserve Requests: A preserve request is a request that people create a new GU_DetailHandle rather than editting the current one. It is used by SOPs to determine if it is safe to do an in place cook.

void GU_DetailHandle::allocateAndSet ( GU_Detail gdp,
bool  own = true 
)

Create a new underlying reference & set it to point to the given gdp. The own flag determines if the GU_Detail will be deleted by the handle system when the underlying reference is deleted.

Examples:
SIM/SIM_SolverHair.C, and SIM/SNOW_Solver.C.

void GU_DetailHandle::clear (  ) 

Examples:
SIM/SNOW_Solver.C.

bool GU_DetailHandle::deleteGdp (  ) 

Deletes the underlying gdp and sets the gdp pointer to be null. It returns true if the gdp was successfully deleted, false if not. Failure likely results from a lock being present.

int GU_DetailHandle::getPreserveRequest (  )  const

int GU_DetailHandle::getRefCount (  )  const

Returns the number of references made to the base handle.

bool GU_DetailHandle::hasActiveLock (  )  const

Determines if anyone has a lock on this handle.

bool GU_DetailHandle::isNull (  )  const

Determine if this is a null handle. This means it points to a null handle, or the handle's gdp is null.

Examples:
SIM/SIM_ForceOrbit.C, and SIM/SNOW_Solver.C.

bool GU_DetailHandle::operator!= ( const GU_DetailHandle handle  )  const

const GU_DetailHandle& GU_DetailHandle::operator= ( const GU_DetailHandle handle  ) 

bool GU_DetailHandle::operator== ( const GU_DetailHandle handle  )  const

const GU_Detail* GU_DetailHandle::peekDetail (  )  const

peekDetail does no locking. Thus, it should be avoided unless the goal is just to test if the GU_Detail is present. This is largely provided for supporting old code in hackish situations.

const GU_Detail* GU_DetailHandle::readLock (  ) 

This will acquire a read lock on the GU_Detail. The result is 0 if no lock can be acquired, or no underlying detail exists. The returned detail should be passed to unlock(). (Technically, no locking occurs on error, but unlock is a no-op with a 0 gdp)

void GU_DetailHandle::removePreserveRequest (  ) 

GU_Detail* GU_DetailHandle::setGdp ( GU_Detail gdp  ) 

This changes the underlying gdp of the handle. The old gdp is returned. It is asserted that no locks are active. If there is an active lock, the passed in gdp is returned.

void GU_DetailHandle::unlock ( const GU_Detail gdp  ) 

This will unlock one layer of locking. If the passed in gdp is null, no unlocking occurs. Otherwise, the passed in gdp is asserted to match the one which myHandle points to.

GU_Detail* GU_DetailHandle::writeLock (  ) 

This will acquire a write lock on the GU_Detail. The result is 0 if no lock can be acquired, or no underlying detail is present. The returned detail should be passed to unlock() when finished. There can only be one active write lock at a time. Do not destroy or modify the pointer itself and expect the unlock to update the GU_Detail *. Instead, use one of the delete or change functions. No readlocks or write locks can be active for this to work.


The documentation for this class was generated from the following file:

Generated on Mon Jan 28 00:29:36 2013 for HDK by  doxygen 1.5.9