Drake C++ Documentation
NameValue< T > Class Template Reference

Detailed Description

template<typename T>
class drake::NameValue< T >

(Advanced) A basic implementation of the Name-Value Pair concept as used in the Serialize / Archive pattern.

NameValue stores a pointer to a const name and a pointer to a mutable value. Both pointers must remain valid throughout the lifetime of an object. NameValue objects are typically short-lived, existing only for a transient moment while an Archive is visiting some Serializable field.

For more information, refer to Drake's YAML Serialization and especially the Implementing Serialize section, or also the Boost Name-Value Pairs documentation for background.

#include <drake/common/name_value.h>

Public Types

typedef T value_type
 Type of the referenced value. More...

Public Member Functions

 NameValue (const char *name_in, T *value_in)
 (Advanced) Constructs a NameValue. More...
Does not allow copy, move, or assignment
 NameValue (const NameValue &)=delete
NameValueoperator= (const NameValue &)=delete
 NameValue (NameValue &&)=delete
NameValueoperator= (NameValue &&)=delete
Accessors to the raw pointers
const char * name () const
T * value () const

Member Typedef Documentation

◆ value_type

typedef T value_type

Type of the referenced value.

Constructor & Destructor Documentation

◆ NameValue() [1/3]

NameValue ( const NameValue< T > &  )

◆ NameValue() [2/3]

NameValue ( NameValue< T > &&  )

◆ NameValue() [3/3]

NameValue ( const char *  name_in,
T *  value_in 

(Advanced) Constructs a NameValue.

Prefer DRAKE_NVP instead of this constructor. Both pointers are aliased and must remain valid for the lifetime of this object. Neither pointer can be nullptr.

Member Function Documentation

◆ name()

const char* name ( ) const

◆ operator=() [1/2]

NameValue& operator= ( NameValue< T > &&  )

◆ operator=() [2/2]

NameValue& operator= ( const NameValue< T > &  )

◆ value()

T* value ( ) const

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