8#ifndef META_OCEAN_BASE_SMART_OBJECT_REF_H
9#define META_OCEAN_BASE_SMART_OBJECT_REF_H
88template <
typename T,
typename TBase>
143 template <
typename T2>
199template <
typename T,
typename TBase>
201 ObjectRef<TBase>(dynamic_cast<TBase*>(object))
209template <
typename T,
typename TBase>
211 ObjectRef<TBase>(dynamic_cast<TBase*>(object), releaseCallback)
219template <
typename T,
typename TBase>
234template <
typename T,
typename TBase>
238 if (smartObjectRef.objectPointer_ !=
nullptr)
240 objectPointer_ = smartObjectRef.objectPointer_;
241 ObjectRef<TBase>::objectHolder_ = smartObjectRef.objectHolder_;
243 smartObjectRef.objectPointer_ = nullptr;
244 smartObjectRef.objectHolder_ = nullptr;
248template <
typename T,
typename TBase>
263template <
typename T,
typename TBase>
264template <
typename T2>
279template <
typename T,
typename TBase>
282 if (
this != &smartObjectRef)
305template <
typename T,
typename TBase>
308 if (
this != &smartObjectRef)
324 smartObjectRef.objectPointer_ =
nullptr;
325 smartObjectRef.objectHolder_ =
nullptr;
331template <
typename T,
typename TBase>
360template <
typename T,
typename TBase>
367template <
typename T,
typename TBase>
373template <
typename T,
typename TBase>
381template <
typename T,
typename TBase>
ObjectHolder * ref()
Increases the reference counter.
Definition base/ObjectRef.h:275
ObjectHolder * objectHolder_
Pointer to the object holder.
Definition base/ObjectRef.h:262
Callback< void, const T * > ReleaseCallback
Definition of a release callback function.
Definition base/ObjectRef.h:68
void release()
Releases the internal object, if any.
Definition base/ObjectRef.h:407
SmartObjectRef(SmartObjectRef< T, TBase > &&smartObjectRef)
Move constructor.
Definition SmartObjectRef.h:235
SmartObjectRef< T, TBase > & operator=(const SmartObjectRef< T, TBase > &smartObjectRef)
Assign operator.
Definition SmartObjectRef.h:280
Acceleration3DOFSample * objectPointer_
Definition SmartObjectRef.h:196
SmartObjectRef< T, TBase > & operator=(SmartObjectRef< T, TBase > &&smartObjectRef)
Moves a smart object reference object to this smart object reference.
Definition SmartObjectRef.h:306
T & operator*() const
Returns a reference to the internal object if existing.
Definition SmartObjectRef.h:382
SmartObjectRef(T *object)
Creates a new SmartObjectRef by a given object.
Definition SmartObjectRef.h:200
typename ObjectRef< TBase >::ReleaseCallback ReleaseCallback
Redefinition of the release callback function defined in ObjectRef.
Definition SmartObjectRef.h:96
T * operator->() const
Returns a point to the internal object if existing.
Definition SmartObjectRef.h:374
SmartObjectRef< T, TBase > & operator=(const ObjectRef< TBase > &objectRef)
Assigns a ObjectRef to this smart object reference.
Definition SmartObjectRef.h:332
SmartObjectRef(const SmartObjectRef< T, TBase > &smartObjectRef)
Copy constructor.
Definition SmartObjectRef.h:220
SmartObjectRef(T *object, const ReleaseCallback &releaseCallback)
Creates a new SmartObjectRef by a given object.
Definition SmartObjectRef.h:210
T * pointer() const
Returns a pointer to the objects that is encapsulated by this wrapper.
Definition SmartObjectRef.h:368
SmartObjectRef(const ObjectRef< TBase > &objectRef)
Creates a new SmartObjectRef by a given ObjectRef.
Definition SmartObjectRef.h:249
SmartObjectRef()=default
Creates a new SmartObjectRef with no internal object.
void release()
Releases the internal object, if any.
Definition SmartObjectRef.h:361
SmartObjectRef(const SmartObjectRef< T2, TBase > &smartObjectRef)
Copies a SmartObjectRef object.
Definition SmartObjectRef.h:265
The namespace covering the entire Ocean framework.
Definition Accessor.h:15