Apama
9.10.0.4.289795
|
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_t & | operator= (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... | |
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>&.
com::softwareag::connectivity::custom_t< T >::custom_t | ( | ) |
Create an empty custom_t.
com::softwareag::connectivity::custom_t< T >::custom_t | ( | T * | payload | ) |
Create a custom_t which owns the given payload.
com::softwareag::connectivity::custom_t< T >::~custom_t | ( | ) |
deletes the underlying pointer.
com::softwareag::connectivity::custom_t< T >::custom_t | ( | custom_t< T > && | other | ) |
Move constructor.
custom_t com::softwareag::connectivity::custom_t< T >::copy | ( | ) | const |
Return a copy of the underlying pointer.
|
inline |
Return the wrapped pointer as the correct type.
|
inline |
Return the wrapped pointer as the correct type.
|
inline |
Return the wrapped pointer as the correct type.
|
inline |
Return the wrapped pointer as the correct type.
|
inline |
Return the wrapped pointer as the correct type.
|
inline |
Return the wrapped pointer as the correct type.
custom_t& com::softwareag::connectivity::custom_t< T >::operator= | ( | custom_t< T > && | other | ) |
Move assignment, destroying the current contents.
void com::softwareag::connectivity::custom_t< T >::swap | ( | custom_t< T > && | other | ) |
Swap with another custom_t of the same type.