RefCount.h File Reference

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

`#include <boost/intrusive_ptr.hpp>`
`#include <boost/shared_ptr.hpp>`
`#include <boost/weak_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

struct | null_deleter
| Used to let a shared pointer exist that doesn't delete anything. This is used by RefBase to hold a shared pointer to *this without actually deleting twice when the object goes out of scope. More...
class | RefBase

## Macros

#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.

## Macro Definition Documentation

## FIELD3D_USE_ATOMIC_COUNT

#define FIELD3D_USE_ATOMIC_COUNT

Definition at line 47 of file RefCount.h.

## DEFINE_CHECK_RTTI_CALL

#define DEFINE_CHECK_RTTI_CALL

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

Definition at line 71 of file RefCount.h.

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

## DEFINE_MATCH_RTTI_CALL

#define DEFINE_MATCH_RTTI_CALL

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

Definition at line 75 of file RefCount.h.

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

## DEFINE_FIELD_RTTI_CONCRETE_CLASS

#define DEFINE_FIELD_RTTI_CONCRETE_CLASS

Value:
DEFINE_CHECK_RTTI_CALL \
DEFINE_MATCH_RTTI_CALL \

Definition at line 84 of file RefCount.h.

#define DEFINE_FIELD_RTTI_CONCRETE_CLASS \
DEFINE_CHECK_RTTI_CALL \
DEFINE_MATCH_RTTI_CALL \

## DEFINE_FIELD_RTTI_ABSTRACT_CLASS

#define DEFINE_FIELD_RTTI_ABSTRACT_CLASS DEFINE_MATCH_RTTI_CALL \

Definition at line 88 of file RefCount.h.

#define DEFINE_FIELD_RTTI_ABSTRACT_CLASS \
DEFINE_MATCH_RTTI_CALL \

## FIELD_DYNAMIC_CAST

#define FIELD_DYNAMIC_CAST field_dynamic_cast

Definition at line 271 of file RefCount.h.

Referenced by convertCellCenteredToMAC(), convertMACToCellCentered(), FrustumFieldMapping::isIdentical(), MatrixFieldMapping::isIdentical(), FrustumFieldMappingIO::write(), FrustumFieldMappingIO::write(), MatrixFieldMappingIO::write(), and MatrixFieldMappingIO::write().

## Function Documentation

## intrusive_ptr_add_ref()

void intrusive_ptr_add_ref | ( | RefBase * | r | ) |

inline

Definition at line 229 of file RefCount.h.

{
r->ref();
}
RefBase::ref
void ref() const
Used by boost::intrusive_pointer.
Definition RefCount.h:150

References RefBase::ref().

## intrusive_ptr_release()

void intrusive_ptr_release | ( | RefBase * | r | ) |

inline

Todo
  Communicate with the FieldCache to prevent any cache updates from happening while this releases its count.

Definition at line 239 of file RefCount.h.

{
r->unref();
if (r->refcnt() == 0)
delete r;
}
RefBase::refcnt
size_t refcnt()
Used by boost::intrusive_pointer.
Definition RefCount.h:146
RefBase::unref
void unref() const
Used by boost::intrusive_pointer.
Definition RefCount.h:159

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