RTI Connext Modern C++ API Version 7.2.0
rti::core::xtypes::LoanedDynamicData Class Reference

<<move-only-type>> Gives temporary access to a member of another DynamicData object. More...

#include <DynamicDataImpl.hpp>

Public Member Functions

 ~LoanedDynamicData ()
 Returns the loan if it has not been returned with return_loan() More...
 
void return_loan ()
 Explicitly returns the loan. More...
 
DynamicData & get ()
 Obtains the loaned DynamicData object representing a member of DynamicData object. More...
 
const DynamicData & get () const
 Obtains the loaned DynamicData object representing a member of DynamicData object. More...
 
 operator DynamicData & ()
 Conversion to DynamicData for convenience. More...
 
 operator const DynamicData & () const
 Conversion to DynamicData for convenience. More...
 
 LoanedDynamicData (LoanedDynamicData &&other) OMG_NOEXCEPT
 <<C++11>> Move constructor. More...
 
LoanedDynamicDataoperator= (LoanedDynamicData &&other) OMG_NOEXCEPT
 <<C++11>> Move-assignment operator. More...
 

Detailed Description

<<move-only-type>> Gives temporary access to a member of another DynamicData object.

This type can only be instantiated through dds::core::xtypes::DynamicData::loan_value. This type can't be copied. It can be moved <<C++11>>.

An instance of this type contains a direct reference to a member of another DynamicData object, retrieved with get(). That object can be both inspected or modified and has to be eventually returned.

There are three ways to return the loan:

  1. Letting the destructor do it
  2. Calling return_loan()
  3. Reusing this object to obtain another loan (see dds::core::xtypes::DynamicData::loan_value(LoanedDynamicData&,uint32_t))
See also
dds::core::xtypes::DynamicData::loan_value
Using DynamicData

Constructor & Destructor Documentation

◆ ~LoanedDynamicData()

rti::core::xtypes::LoanedDynamicData::~LoanedDynamicData ( )

Returns the loan if it has not been returned with return_loan()

◆ LoanedDynamicData()

rti::core::xtypes::LoanedDynamicData::LoanedDynamicData ( LoanedDynamicData &&  other)
inline

<<C++11>> Move constructor.

A LoanedDynamicData can only be moved, not copied.

Member Function Documentation

◆ return_loan()

void rti::core::xtypes::LoanedDynamicData::return_loan ( )

Explicitly returns the loan.

◆ get() [1/2]

DynamicData & rti::core::xtypes::LoanedDynamicData::get ( )
inline

Obtains the loaned DynamicData object representing a member of DynamicData object.

The object can be modified and the changes will take effect in the DynamicData object that contains this one.

◆ get() [2/2]

const DynamicData & rti::core::xtypes::LoanedDynamicData::get ( ) const
inline

Obtains the loaned DynamicData object representing a member of DynamicData object.

◆ operator DynamicData &()

rti::core::xtypes::LoanedDynamicData::operator DynamicData & ( )
inline

Conversion to DynamicData for convenience.

◆ operator const DynamicData &()

rti::core::xtypes::LoanedDynamicData::operator const DynamicData & ( ) const
inline

Conversion to DynamicData for convenience.

◆ operator=()

LoanedDynamicData & rti::core::xtypes::LoanedDynamicData::operator= ( LoanedDynamicData &&  other)
inline

<<C++11>> Move-assignment operator.

Since copying a LoanedDynamicData is disabled, only the move-assignment operator is allowed.

This operation returns the loan that *this currently holds.

For example:

LoanedDynamicData member = sample.loan_value(1);
member = sample.loan_value(2);
See also
dds::core::xtypes::DynamicData::loan_value(LoanedDynamicData&, const std::string&)