RefBase Class

Header: #include "easyar/base.hpp"

Inherited By: AugmentedTarget, AugmentedTargetList, Augmenter, BarCodeScanner, CameraCalibration, CameraDevice, Frame, Image, ImageList, ImageTracker, Target, TargetList, VideoPlayer

Description

RefBase is the base class for most EasyAR classes.

A RefBase behaves like a normal C++ std::shared_ptr, it is a very thin wrapper on top of the real objects. You can use any class C derived from RefBase as if you are using std::shared_ptr< C_internal >. Memory held by C is reference counted and managed like std::shared_ptr, and C is as thread-safe as std::shared_ptr. A derived RefBase in EasyAR is generally lazy initialized, which means the object is not valid (operator bool() returns false) before certain methods are called. If you prefer to use raw pointers, you can of course use C* in your code.

Public Functions

RefBase()
RefBase(const RefBase& b)
virtual ~RefBase()
RefBase& operator=(const RefBase& b)
operator bool() const
bool operator ==(const RefBase& other)
const bool operator !=(const RefBase& other)
const template<class T> T cast_dynamic()
const template<class T> T cast_static()
const void clear()

RefBase()

Constructs a RefBase object.

RefBase(const RefBase& b)

Constructs a RefBase object that points to the same internal object that b points to.

virtual ~RefBase()

Destroys this object. All resources including threads holding by the object will be released only if this is the unique reference.

RefBase& operator=(const RefBase& b)

Assignment operator. This RefBase will now point to the same object that b points to.

operator bool() const

Returns false if the internal object has been destroyed or if there is no internal object; otherwise returns true.

bool operator ==(const RefBase& other) const

Equality operator. Returns true if the object and other are pointing to the same internal object, otherwise returns false.

bool operator !=(const RefBase& other) const

Inequality operator. Returns true if the object and other are not pointing to the same internal object, otherwise returns false.

template<class T> T cast_dynamic() const

Similar to std::dynamic_pointer_cast. Casts an object to type T using dynamic cast.

template<class T> T cast_static() const

Similar to std::static_pointer_cast. Casts an object to type T using static cast.

void clear()

Clears this object. All resources including threads holding by the object will be released.