OpenDDS  Snapshot(2023/04/28-20:55)
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element Struct Reference

#include <SafetyProfileSequence.h>

Public Member Functions

 Element (CharT *&element, seq_flag_type release)
 
 Element (const Element &elt)
 
Elementoperator= (const CharT *rhs)
 
Elementoperator= (CharT *rhs)
 
Elementoperator= (const ::TAO::String_var< CharT > &rhs)
 
Elementoperator= (const ::TAO::String_Manager_T< CharT > &rhs)
 
 operator const CharT * () const
 
const CharT * in () const
 
CharT *& inout ()
 
::TAO::String_out< CharT > out () const
 
CharT * _retn ()
 

Private Member Functions

Elementmove_from (::TAO::String_var< CharT > &rhs)
 

Private Attributes

CharT *& element_
 
seq_flag_type release_
 

Friends

bool operator>> (DCPS::Serializer &ser, Element elt)
 

Detailed Description

template<typename CharT>
struct OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element

Indexing a non-const string sequence yields an object of this class. This allows string memory management duing assignment.

Definition at line 130 of file SafetyProfileSequence.h.

Constructor & Destructor Documentation

◆ Element() [1/2]

template<typename CharT >
OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::Element ( CharT *&  element,
seq_flag_type  release 
)
inline

◆ Element() [2/2]

template<typename CharT >
OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::Element ( const Element elt)
inline

Member Function Documentation

◆ _retn()

template<typename CharT >
CharT* OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::_retn ( void  )
inline

Definition at line 171 of file SafetyProfileSequence.h.

172  {
173  CharT* const tmp = element_;
174  element_ = StringTraits<CharT>::empty();
175  return tmp;
176  }

◆ in()

template<typename CharT >
const CharT* OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::in ( void  ) const
inline

◆ inout()

template<typename CharT >
CharT*& OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::inout ( void  )
inline

◆ move_from()

template<typename CharT >
Element& OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::move_from ( ::TAO::String_var< CharT > &  rhs)
inlineprivate

Definition at line 179 of file SafetyProfileSequence.h.

References TAO::String_var< charT >::_retn().

180  {
181  if (release_) StringTraits<CharT>::free(element_);
182  element_ = rhs._retn();
183  return *this;
184  }
character_type * _retn(void)

◆ operator const CharT *()

template<typename CharT >
OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::operator const CharT * ( ) const
inline

◆ operator=() [1/4]

template<typename CharT >
Element& OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::operator= ( const CharT *  rhs)
inline

Definition at line 137 of file SafetyProfileSequence.h.

138  {
139  ::TAO::String_var<CharT> tmp(rhs);
140  return move_from(tmp);
141  }
Element & move_from(::TAO::String_var< CharT > &rhs)

◆ operator=() [2/4]

template<typename CharT >
Element& OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::operator= ( CharT *  rhs)
inline

Definition at line 143 of file SafetyProfileSequence.h.

144  {
145  ::TAO::String_var<CharT> tmp(rhs);
146  return move_from(tmp);
147  }
Element & move_from(::TAO::String_var< CharT > &rhs)

◆ operator=() [3/4]

template<typename CharT >
Element& OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::operator= ( const ::TAO::String_var< CharT > &  rhs)
inline

Definition at line 149 of file SafetyProfileSequence.h.

150  {
151  ::TAO::String_var<CharT> tmp(rhs);
152  return move_from(tmp);
153  }
Element & move_from(::TAO::String_var< CharT > &rhs)

◆ operator=() [4/4]

template<typename CharT >
Element& OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::operator= ( const ::TAO::String_Manager_T< CharT > &  rhs)
inline

Definition at line 155 of file SafetyProfileSequence.h.

156  {
157  ::TAO::String_var<CharT> tmp(rhs);
158  return move_from(tmp);
159  }
Element & move_from(::TAO::String_var< CharT > &rhs)

◆ out()

template<typename CharT >
::TAO::String_out<CharT> OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::out ( void  ) const
inline

Definition at line 165 of file SafetyProfileSequence.h.

166  {
167  if (release_) StringTraits<CharT>::free(element_);
168  return element_;
169  }

Friends And Related Function Documentation

◆ operator>>

template<typename CharT >
bool operator>> ( DCPS::Serializer ser,
Element  elt 
)
friend

Definition at line 189 of file SafetyProfileSequence.h.

190  {
191  ser.read_string(elt.out(), StringTraits<CharT>::alloc,
192  StringTraits<CharT>::free);
193  return ser.good_bit();
194  }

Member Data Documentation

◆ element_

template<typename CharT >
CharT*& OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::element_
private

Definition at line 186 of file SafetyProfileSequence.h.

◆ release_

template<typename CharT >
seq_flag_type OpenDDS::SafetyProfile::StringEltPolicy< CharT >::Element::release_
private

Definition at line 187 of file SafetyProfileSequence.h.


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