Public Member Functions |
| | external () OMG_NOEXCEPT |
| | Creates an empty shared object.
|
| |
| | external (T *p, bool locked=false) |
| | Creates a new shared object with the managed object p.
|
| |
| | external (shared_ptr p) |
| | Creates an external instance that shares the managed object and reference counting with an existing shared_ptr.
|
| |
| | external (const external &other) |
| | Creates a shared object from an existing shared object.
|
| |
| | ~external () |
| | Destroys the managed object if this is the last shared object pointing to it.
|
| |
| external & | operator= (const external &other) |
| | Assigns another external, depending on the locked state.
|
| |
| T & | operator* () OMG_NOEXCEPT |
| | Obtains a reference to the managed object.
|
| |
| const T & | operator* () const OMG_NOEXCEPT |
| | Obtains a const reference to the managed object.
|
| |
| T * | get () OMG_NOEXCEPT |
| | Obtains a pointer to the managed object.
|
| |
| const T * | get () const OMG_NOEXCEPT |
| | Obtains a const pointer to the managed object.
|
| |
| shared_ptr | get_shared_ptr () |
| | Obtains a shared_ptr to the managed object.
|
| |
| T * | operator-> () OMG_NOEXCEPT |
| | Allows accessing members of the managed object.
|
| |
| const T * | operator-> () const OMG_NOEXCEPT |
| | Allows accessing members of the managed object.
|
| |
| bool | operator== (const external< T > &other) const OMG_NOEXCEPT |
| | Returns whether two shared objects manage the same object or are both empty.
|
| |
| bool | operator!= (const external< T > &other) const |
| | Returns whether two shared objects do not manage the same object.
|
| |
| | operator bool () const OMG_NOEXCEPT |
| | Checks if there is a managed object (is not null) or not (is null)
|
| |
| bool | is_locked () const |
| | Indicates whether the managed object is locked or not.
|
| |
template<typename T>
class dds::core::external< T >
A managed reference to an object.
- Template Parameters
-
| T | The type of the object this external<T> manages |
Members of an IDL type marked with the @Shared or @external tag map to this C++ type. External members can share the same object when publishing different data samples. This can make more efficient the publication of large objects by saving extra copies.
This class behaves like a std::shared_ptr, except when the object is in "locked" state.
Objects of this class created with any of the constructors documented here behave like a std::shared_ptr<T>. Objects that the middleware returns in a LoanedSample (for example, from dds::sub::DataReader::take) are in a "locked" state and its contents can't be shared or modified. When assigning a sample with locked external members into another one where those members are not locked, the contents are copied, not shared. Modifying a locked object is not allowed. This special behavior prevents applications from corrupting loaned memory.
- See Also
- Working with IDL types