Field3D
RefBase Class Referenceabstract

#include <RefCount.h>

Inheritance diagram for RefBase:
CubicGenericFieldInterp< Field_T > CubicMACFieldInterp< Data_T > FieldBase FieldInterp< Data_T > FieldIO FieldMapping FieldMappingIO File::Partition LinearGenericFieldInterp< Field_T > LinearMACFieldInterp< Data_T > ProceduralFieldLookup< Data_T >

Public Types

typedef boost::intrusive_ptr< RefBasePtr
 

Public Member Functions

void ref () const
 Used by boost::intrusive_pointer. More...
 
size_t refcnt ()
 Used by boost::intrusive_pointer. More...
 
void unref () const
 Used by boost::intrusive_pointer. More...
 
Constructors, destructors, copying
 RefBase ()
 
 RefBase (const RefBase &)
 Copy constructor. More...
 
RefBaseoperator= (const RefBase &)
 Assignment operator. More...
 
virtual ~RefBase ()
 Destructor. More...
 

Private Attributes

boost::detail::atomic_count m_counter
 For boost intrusive pointer. More...
 

RTTI replacement

Note
A note on why the RTTI replacement is needed: RTTI calls fail once the object crosses the dso boundary. We revert to using simple string checks which is more expensive but at least works once the dso is used in Houdini, etc. Use field_dynamic_cast<> for any RefBase subclass instead of dynamic_cast<>.
virtual bool checkRTTI (const char *typenameStr)=0
 This function is only implemented by concrete classes and triggers the actual RTTI check through matchRTTI();. More...
 
bool matchRTTI (const char *typenameStr)
 Performs a check to see if the given typename string matches this class' This needs to be implemented in -all- subclasses, even abstract ones. More...
 
static const char * classType ()
 

Detailed Description

Definition at line 90 of file RefCount.h.

Member Typedef Documentation

◆ Ptr

typedef boost::intrusive_ptr<RefBase> RefBase::Ptr

Definition at line 96 of file RefCount.h.

Constructor & Destructor Documentation

◆ RefBase() [1/2]

RefBase::RefBase ( )
inline

Definition at line 103 of file RefCount.h.

104  : m_counter(0)
105  {}
boost::detail::atomic_count m_counter
For boost intrusive pointer.
Definition: RefCount.h:185

◆ RefBase() [2/2]

RefBase::RefBase ( const RefBase )
inline

Copy constructor.

Definition at line 108 of file RefCount.h.

109  : m_counter(0)
110  {}
boost::detail::atomic_count m_counter
For boost intrusive pointer.
Definition: RefCount.h:185

◆ ~RefBase()

virtual RefBase::~RefBase ( )
inlinevirtual

Destructor.

Definition at line 117 of file RefCount.h.

118  {}

Member Function Documentation

◆ operator=()

RefBase& RefBase::operator= ( const RefBase )
inline

Assignment operator.

Definition at line 113 of file RefCount.h.

Referenced by SparseField< Data_T >::operator=().

114  { return *this; }

◆ refcnt()

size_t RefBase::refcnt ( )
inline

Used by boost::intrusive_pointer.

Definition at line 125 of file RefCount.h.

References m_counter.

Referenced by intrusive_ptr_release().

126  { return m_counter; }
boost::detail::atomic_count m_counter
For boost intrusive pointer.
Definition: RefCount.h:185

◆ ref()

void RefBase::ref ( ) const
inline

Used by boost::intrusive_pointer.

Definition at line 129 of file RefCount.h.

References m_counter.

Referenced by intrusive_ptr_add_ref().

130  {
131 #ifndef FIELD3D_USE_ATOMIC_COUNT
132  boost::mutex::scoped_lock lock(m_refMutex);
133 #endif
134  ++m_counter;
135  }
boost::detail::atomic_count m_counter
For boost intrusive pointer.
Definition: RefCount.h:185

◆ unref()

void RefBase::unref ( ) const
inline

Used by boost::intrusive_pointer.

Definition at line 138 of file RefCount.h.

References checkRTTI(), and m_counter.

Referenced by intrusive_ptr_release().

139  {
140 #ifndef FIELD3D_USE_ATOMIC_COUNT
141  boost::mutex::scoped_lock lock(m_refMutex);
142 #endif
143  --m_counter;
144  // since we use intrusive_pointer no need
145  // to delete the object ourselves.
146  }
boost::detail::atomic_count m_counter
For boost intrusive pointer.
Definition: RefCount.h:185

◆ checkRTTI()

virtual bool RefBase::checkRTTI ( const char *  typenameStr)
pure virtual

This function is only implemented by concrete classes and triggers the actual RTTI check through matchRTTI();.

Referenced by unref().

◆ matchRTTI()

bool RefBase::matchRTTI ( const char *  typenameStr)
inline

Performs a check to see if the given typename string matches this class' This needs to be implemented in -all- subclasses, even abstract ones.

Definition at line 167 of file RefCount.h.

References classType().

168  {
169  if (strcmp(classType(), typenameStr) == 0)
170  return true;
171  return false;
172  }
static const char * classType()
Definition: RefCount.h:174

◆ classType()

static const char* RefBase::classType ( )
inlinestatic

Definition at line 174 of file RefCount.h.

Referenced by matchRTTI().

175  {
176  return "RefBase";
177  }

Member Data Documentation

◆ m_counter

boost::detail::atomic_count RefBase::m_counter
mutableprivate

For boost intrusive pointer.

Definition at line 185 of file RefCount.h.

Referenced by ref(), refcnt(), and unref().


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