EventAnalysis  1.3.0
Public Member Functions | Protected Attributes | List of all members
EA::ObjectWrapperTImpl< DataType > Class Template Reference

Wrapper for data objects. More...

#include <ObjectWrapperT.h>

Inheritance diagram for EA::ObjectWrapperTImpl< DataType >:
EA::ObjectWrapperBase EA::ObjectWrapperT< DataType, typename > EA::ObjectWrapperT< DataType, typename std::enable_if< smart_is_copy_constructible< DataType >::value >::type >

Public Member Functions

 ObjectWrapperTImpl (observer_ptr< DataType > dataObjPtr)
 Constructor. More...
 
 ObjectWrapperTImpl (std::shared_ptr< DataType > dataObjPtr)
 Constructor. More...
 
 ObjectWrapperTImpl (std::unique_ptr< DataType > dataObjPtr)
 Constructor. More...
 
 ObjectWrapperTImpl (const ObjectWrapperTImpl< DataType > &)
 Copy constructor. More...
 
observer_ptr< DataType > GetObj ()
 Data object getter method. More...
 
bool IsPolymorphic ()
 Test for polymorphic wrapped object. More...
 
bool IsConst ()
 Test for const wrapped object. More...
 
const std::type_info & GetObjType ()
 Returns the type of the wrapped object. More...
 
void WrapNothing ()
 Remove the wrapped object. More...
 
bool WrapsSomething ()
 Checks if the wrapper wraps something. More...
 
void * GetObjAddress ()
 Getter for raw pointer to the wrapped object. More...
 
bool WrapObject (void *address, const std::type_info &type, bool own, bool isPolymorphic, bool isConst)
 Wrap the object at the given address. More...
 
- Public Member Functions inherited from EA::ObjectWrapperBase
virtual ~ObjectWrapperBase ()
 Destructor. More...
 
virtual std::unique_ptr< ObjectWrapperBaseCloneObject ()=0
 Clones the wrapped object and wraps it. More...
 
virtual std::unique_ptr< ObjectWrapperBaseCloneWrapper ()=0
 Clones the wrapper. More...
 

Protected Attributes

observer_ptr< DataType > _dataObjPtr
 
std::shared_ptr< DataType > _dataObjSharedPtr
 

Additional Inherited Members

- Protected Member Functions inherited from EA::ObjectWrapperBase
 ObjectWrapperBase ()
 Constructor. More...
 

Detailed Description

template<typename DataType>
class EA::ObjectWrapperTImpl< DataType >

Wrapper for data objects.

This class is a template child of ObjectWrapperBase. It implements the wrapping for the template type. The class wraps objects by wrapping their addresses, so no object copy is done. It may or may not own the wrapped objects. This class contains the common implementation of the two template versions of #ObjectWrapperT; it must never be instantiated or used explicitly.

Constructor & Destructor Documentation

◆ ObjectWrapperTImpl() [1/4]

template<typename DataType >
EA::ObjectWrapperTImpl< DataType >::ObjectWrapperTImpl ( observer_ptr< DataType >  dataObjPtr)

Constructor.

Constructs a wrapper holding a pointer to data object passed as first argument. The wrapper will not own the object.

Parameters
dataObjPtrpointer to the data object to be wrapped.

◆ ObjectWrapperTImpl() [2/4]

template<typename DataType >
EA::ObjectWrapperTImpl< DataType >::ObjectWrapperTImpl ( std::shared_ptr< DataType >  dataObjPtr)

Constructor.

Constructs a wrapper holding a pointer to data object passed as first argument. The wrapper will share the ownership of the object through the shared_ptr.

Parameters
dataObjPtrpointer to the data object to be wrapped.

◆ ObjectWrapperTImpl() [3/4]

template<typename DataType >
EA::ObjectWrapperTImpl< DataType >::ObjectWrapperTImpl ( std::unique_ptr< DataType >  dataObjPtr)

Constructor.

Constructs a wrapper holding a pointer to data object passed as first argument. The wrapper will own the pointed object

Parameters
dataObjPtrpointer to the data object to be wrapped.

◆ ObjectWrapperTImpl() [4/4]

template<typename DataType >
EA::ObjectWrapperTImpl< DataType >::ObjectWrapperTImpl ( const ObjectWrapperTImpl< DataType > &  original)

Copy constructor.

Member Function Documentation

◆ GetObj()

template<typename DataType >
observer_ptr< DataType > EA::ObjectWrapperTImpl< DataType >::GetObj ( )

Data object getter method.

Returns
A pointer to the wrapped data object.

◆ GetObjAddress()

template<typename DataType>
void* EA::ObjectWrapperTImpl< DataType >::GetObjAddress ( )
inlinevirtual

Getter for raw pointer to the wrapped object.

Returns
the address of the wrapped object.

Implements EA::ObjectWrapperBase.

◆ GetObjType()

template<typename DataType>
const std::type_info& EA::ObjectWrapperTImpl< DataType >::GetObjType ( )
inlinevirtual

Returns the type of the wrapped object.

Returns
The type of the wrapped object.

Implements EA::ObjectWrapperBase.

◆ IsConst()

template<typename DataType >
bool EA::ObjectWrapperTImpl< DataType >::IsConst ( )
virtual

Test for const wrapped object.

Returns
true if the wrapped object is constant.

Implements EA::ObjectWrapperBase.

◆ IsPolymorphic()

template<typename DataType >
bool EA::ObjectWrapperTImpl< DataType >::IsPolymorphic ( )
virtual

Test for polymorphic wrapped object.

Returns
true if the wrapped object is of a polymorphic class.

Implements EA::ObjectWrapperBase.

◆ WrapNothing()

template<typename DataType>
void EA::ObjectWrapperTImpl< DataType >::WrapNothing ( )
inlinevirtual

Remove the wrapped object.

Makes the wrapper wrap no object. An eventual previously wrapped object will be deleted if the object is owned by the wrapper.

Implements EA::ObjectWrapperBase.

◆ WrapObject()

template<typename DataType >
bool EA::ObjectWrapperTImpl< DataType >::WrapObject ( void *  address,
const std::type_info &  type,
bool  own,
bool  isPolymorphic,
bool  isConst 
)
virtual

Wrap the object at the given address.

Set the wrapped object. This method should be used only in those rare cases where the object is available only through a void*. Type check is enforced through the #type argument.

Parameters
addressThe address of the object to be wrapped.
typeThe type of the object at the given address.
ownIf true then the wrapper will own the wrapped object.
isPolymorhicSet to true for objects of polymorphic classes.
isCopnstSet to true for constant objects.
Returns
true if the object at the given address has been correctly wrapped.

Implements EA::ObjectWrapperBase.

◆ WrapsSomething()

template<typename DataType>
bool EA::ObjectWrapperTImpl< DataType >::WrapsSomething ( )
inlinevirtual

Checks if the wrapper wraps something.

Returns
true if the wrapped pointer is not nullptr.

Implements EA::ObjectWrapperBase.

Member Data Documentation

◆ _dataObjPtr

template<typename DataType>
observer_ptr<DataType> EA::ObjectWrapperTImpl< DataType >::_dataObjPtr
protected

◆ _dataObjSharedPtr

template<typename DataType>
std::shared_ptr<DataType> EA::ObjectWrapperTImpl< DataType >::_dataObjSharedPtr
protected

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