Apama  9.10.0.4.289795
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
com::softwareag::connectivity::custom_t< T > Class Template Reference

A wrapper type for holding arbitrary objects inside a data_t. More...

#include <sag_connectivity_cpp.hpp>

Inherits sag_underlying_custom_t.

Public Member Functions

 custom_t ()
 Create an empty custom_t. More...
 
 custom_t (T *payload)
 Create a custom_t which owns the given payload. More...
 
 ~custom_t ()
 deletes the underlying pointer. More...
 
T * get ()
 Return the wrapped pointer as the correct type. More...
 
const T * get () const
 Return the wrapped pointer as the correct type. More...
 
 custom_t (custom_t &&other)
 Move constructor. More...
 
custom_toperator= (custom_t &&other)
 Move assignment, destroying the current contents. More...
 
void swap (custom_t &&other)
 Swap with another custom_t of the same type. More...
 
custom_t copy () const
 Return a copy of the underlying pointer. More...
 
T & operator* ()
 Return the wrapped pointer as the correct type. More...
 
const T & operator* () const
 Return the wrapped pointer as the correct type. More...
 
T * operator-> ()
 Return the wrapped pointer as the correct type. More...
 
const T * operator-> () const
 Return the wrapped pointer as the correct type. More...
 

Detailed Description

template<typename T>
class com::softwareag::connectivity::custom_t< T >

A wrapper type for holding arbitrary objects inside a data_t.

It behaves like a std::unique_ptr with an explict copy method and will delete the contents when destroyed unless they are moved out first.

The wrapped class must have a nothrow destructor and a nothrow copy constructor.

You must ensure that you extract your object with the same type that was inserted, or the behaviour is undefined. If you have a heirarchy of objects and you need to determine the type at runtime then you must extract as a custom_t<BaseClass> and then dynamic_cast or call virtual methods to determine the type. This means you must have a virtual hierarchy of objects.

This can be used with get<> or get_custom<> to retrieve the contents of a data_t:

get<custom_t<MyClass> >(data); get_custom<MyClass>(data);

however visitors will still visit a sag_underlying_custom_t& which can be cast to a custom_t<MyClass>&.

Constructor & Destructor Documentation

template<typename T >
com::softwareag::connectivity::custom_t< T >::custom_t ( )

Create an empty custom_t.

template<typename T >
com::softwareag::connectivity::custom_t< T >::custom_t ( T *  payload)

Create a custom_t which owns the given payload.

template<typename T >
com::softwareag::connectivity::custom_t< T >::~custom_t ( )

deletes the underlying pointer.

template<typename T >
com::softwareag::connectivity::custom_t< T >::custom_t ( custom_t< T > &&  other)

Move constructor.

Member Function Documentation

template<typename T >
custom_t com::softwareag::connectivity::custom_t< T >::copy ( ) const

Return a copy of the underlying pointer.

template<typename T >
T* com::softwareag::connectivity::custom_t< T >::get ( )
inline

Return the wrapped pointer as the correct type.

template<typename T >
const T* com::softwareag::connectivity::custom_t< T >::get ( ) const
inline

Return the wrapped pointer as the correct type.

template<typename T >
T& com::softwareag::connectivity::custom_t< T >::operator* ( )
inline

Return the wrapped pointer as the correct type.

template<typename T >
const T& com::softwareag::connectivity::custom_t< T >::operator* ( ) const
inline

Return the wrapped pointer as the correct type.

template<typename T >
T* com::softwareag::connectivity::custom_t< T >::operator-> ( )
inline

Return the wrapped pointer as the correct type.

template<typename T >
const T* com::softwareag::connectivity::custom_t< T >::operator-> ( ) const
inline

Return the wrapped pointer as the correct type.

template<typename T >
custom_t& com::softwareag::connectivity::custom_t< T >::operator= ( custom_t< T > &&  other)

Move assignment, destroying the current contents.

template<typename T >
void com::softwareag::connectivity::custom_t< T >::swap ( custom_t< T > &&  other)

Swap with another custom_t of the same type.


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