Field3D
RefCount.h File Reference

Contains base class for reference counting with Mutex. More...

#include <boost/intrusive_ptr.hpp>
#include <boost/detail/atomic_count.hpp>
#include <string.h>
#include "Traits.h"
#include "ns.h"

Go to the source code of this file.

Classes

class  RefBase

Defines

#define DEFINE_CHECK_RTTI_CALL
#define DEFINE_FIELD_RTTI_ABSTRACT_CLASS   DEFINE_MATCH_RTTI_CALL \
#define DEFINE_FIELD_RTTI_CONCRETE_CLASS
#define DEFINE_MATCH_RTTI_CALL
#define FIELD3D_USE_ATOMIC_COUNT
#define FIELD_DYNAMIC_CAST   field_dynamic_cast

Functions

template<class Field_T >
Field_T::Ptr field_dynamic_cast (RefBase::Ptr field)
 Dynamic cast that uses string-comparison in order to be safe even after an object crosses a shared library boundary.
void intrusive_ptr_add_ref (RefBase *r)
void intrusive_ptr_release (RefBase *r)

Detailed Description

Contains base class for reference counting with Mutex.

Definition in file RefCount.h.


Define Documentation

#define FIELD3D_USE_ATOMIC_COUNT

Definition at line 47 of file RefCount.h.

#define DEFINE_CHECK_RTTI_CALL
Value:
virtual bool checkRTTI(const char *typenameStr) \
  { return matchRTTI(typenameStr); }              \

Definition at line 68 of file RefCount.h.

#define DEFINE_MATCH_RTTI_CALL
Value:
bool matchRTTI(const char *typenameStr)             \
  {                                                   \
    if (strcmp(typenameStr,classType()) == 0) {       \
      return true;                                    \
    }                                                 \
    return base::matchRTTI(typenameStr);              \
  }                                                   \

Definition at line 72 of file RefCount.h.

#define DEFINE_FIELD_RTTI_CONCRETE_CLASS
Value:

Definition at line 81 of file RefCount.h.

#define DEFINE_FIELD_RTTI_ABSTRACT_CLASS   DEFINE_MATCH_RTTI_CALL \

Definition at line 85 of file RefCount.h.

#define FIELD_DYNAMIC_CAST   field_dynamic_cast

Definition at line 239 of file RefCount.h.


Function Documentation

void intrusive_ptr_add_ref ( RefBase r) [inline]

Definition at line 199 of file RefCount.h.

References RefBase::ref().

{
  r->ref();
}
void intrusive_ptr_release ( RefBase r) [inline]

Definition at line 207 of file RefCount.h.

References RefBase::refcnt(), and RefBase::unref().

{
  r->unref();

  if (r->refcnt() == 0)
    delete r;
}