Choreonoid  1.8
Public Types | Public Member Functions | Friends | List of all members
cnoid::Mapping Class Reference

#include <ValueTree.h>

Inheritance diagram for cnoid::Mapping:
cnoid::ValueNode cnoid::Referenced cnoid::Archive

Public Types

enum  AssignMode { READ_MODE, WRITE_MODE }
 
typedef Container::iterator iterator
 
typedef Container::const_iterator const_iterator
 
- Public Types inherited from cnoid::ValueNode
enum  TypeBit {
  INVALID_NODE = 0, SCALAR = 1, MAPPING = 2, LISTING = 4,
  INSERT_LF = 8, APPEND_LF = 16, FORCED_RADIAN_MODE = 32
}
 

Public Member Functions

 Mapping ()
 
 Mapping (int line, int column)
 
virtual ~Mapping ()
 
virtual ValueNodeclone () const
 
virtual MappingcloneMapping () const
 
bool empty () const
 
int size () const
 
void clear ()
 
void setFlowStyle (bool isFlowStyle=true)
 
bool isFlowStyle () const
 
void setFloatingNumberFormat (const char *format)
 
const char * floatingNumberFormat ()
 
void setDoubleFormat (const char *format)
 
const char * doubleFormat ()
 
void setKeyQuoteStyle (StringStyle style)
 
ValueNodefind (const std::string &key) const
 
ValueNodefind (std::initializer_list< const char * > keys) const
 
MappingfindMapping (const std::string &key) const
 
MappingfindMapping (std::initializer_list< const char * > keys) const
 
ListingfindListing (const std::string &key) const
 
ListingfindListing (std::initializer_list< const char * > keys) const
 
ValueNodePtr extract (const std::string &key)
 
ValueNodePtr extract (std::initializer_list< const char * > keys)
 
bool extract (const std::string &key, double &out_value)
 
bool extract (const std::string &key, std::string &out_value)
 
ValueNodeget (const std::string &key) const
 
ValueNodeoperator[] (const std::string &key) const
 
void insert (const std::string &key, ValueNode *node)
 
void insert (const Mapping *other)
 
MappingopenMapping (const std::string &key)
 
MappingopenFlowStyleMapping (const std::string &key)
 
MappingcreateMapping (const std::string &key)
 
MappingcreateFlowStyleMapping (const std::string &key)
 
ListingopenListing (const std::string &key)
 
ListingopenFlowStyleListing (const std::string &key)
 
ListingcreateListing (const std::string &key)
 
ListingcreateFlowStyleListing (const std::string &key)
 
bool remove (const std::string &key)
 
bool read (const std::string &key, std::string &out_value) const
 
bool read (const std::string &key, bool &out_value) const
 
bool read (const std::string &key, int &out_value) const
 
bool read (const std::string &key, double &out_value) const
 
bool read (const std::string &key, float &out_value) const
 
template<class T >
bool read (std::initializer_list< const char * > keys, T &out_value) const
 
bool readAngle (const std::string &key, double &out_angle, const ValueNode *unitAttrNode=nullptr) const
 
bool readAngle (const std::string &key, float &out_angle, const ValueNode *unitAttrNode=nullptr) const
 
bool readAngle (std::initializer_list< const char * > keys, double &out_angle, const ValueNode *unitAttrNode=nullptr) const
 
bool readAngle (std::initializer_list< const char * > keys, float &out_angle, const ValueNode *unitAttrNode=nullptr) const
 
template<class T >
get (const std::string &key) const
 
template<class T >
get (const std::string &key, const T &defaultValue) const
 
std::string get (const std::string &key, const char *defaultValue) const
 
template<class T >
get (std::initializer_list< const char * > keys, const T &defaultValue) const
 
void write (const std::string &key, const std::string &value, StringStyle stringStyle=PLAIN_STRING)
 
void write (const std::string &key, const char *value, StringStyle stringStyle=PLAIN_STRING)
 
void write (const std::string &key, bool value)
 
void write (const std::string &key, int value)
 
void write (const std::string &key, double value)
 
void writePath (const std::string &key, const std::string &value)
 
template<class ArrayType >
void writeAsListing (const std::string &key, const ArrayType &container)
 
void setAssignMode (AssignMode mode)
 
template<class T >
void assign (const std::string &key, T &io_value, const T &defaultValue)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void throwKeyNotFoundException (const std::string &key) const
 
StringStyle keyStringStyle () const
 
template<class T >
read (const std::string &key) const
 
- Public Member Functions inherited from cnoid::ValueNode
bool isValid () const
 
 operator bool () const
 
TypeBit LFType () const
 
TypeBit nodeType () const
 
int toInt () const
 
double toDouble () const
 
float toFloat () const
 
bool toBool () const
 
double toAngle () const
 
bool isScalar () const
 
bool isString () const
 
bool isCollection () const
 
const std::string & toString () const
 
bool isForcedRadianMode () const
 
void setForcedRadianMode (bool on=true)
 
bool isDegreeMode () const
 
void setDegreeMode ()
 
template<typename T >
to () const
 
bool isMapping () const
 
const MappingtoMapping () const
 
MappingtoMapping ()
 
bool isListing () const
 
const ListingtoListing () const
 
ListingtoListing ()
 
bool read (int &out_value) const
 
bool read (double &out_value) const
 
bool read (float &out_value) const
 
bool read (bool &out_value) const
 
bool read (std::string &out_value) const
 
bool hasLineInfo () const
 
int line () const
 
int column () const
 
void throwException (const std::string &message) const
 
int indexInMapping () const
 
void setAsHeaderInMapping (int priority=1)
 
template<>
double to () const
 
template<>
float to () const
 
template<>
int to () const
 
- Public Member Functions inherited from cnoid::Referenced
virtual ~Referenced ()
 

Friends

class Listing
 
class YAMLReaderImpl
 

Additional Inherited Members

- Protected Member Functions inherited from cnoid::ValueNode
 ValueNode ()
 
 ValueNode (TypeBit type)
 
virtual ~ValueNode ()
 
void throwNotScalrException () const
 
void throwNotMappingException () const
 
void throwNotListingException () const
 
- Protected Member Functions inherited from cnoid::Referenced
 Referenced ()
 
 Referenced (const Referenced &)
 
int refCount () const
 
- Protected Attributes inherited from cnoid::ValueNode
int typeBits
 

Member Typedef Documentation

◆ const_iterator

typedef Container::const_iterator cnoid::Mapping::const_iterator

◆ iterator

typedef Container::iterator cnoid::Mapping::iterator

Member Enumeration Documentation

◆ AssignMode

Enumerator
READ_MODE 
WRITE_MODE 

Constructor & Destructor Documentation

◆ Mapping() [1/2]

Mapping::Mapping ( )

◆ Mapping() [2/2]

Mapping::Mapping ( int  line,
int  column 
)

◆ ~Mapping()

Mapping::~Mapping ( )
virtual

Member Function Documentation

◆ assign()

template<class T >
void cnoid::Mapping::assign ( const std::string &  key,
T &  io_value,
const T &  defaultValue 
)
inline

◆ begin() [1/2]

iterator cnoid::Mapping::begin ( )
inline

◆ begin() [2/2]

const_iterator cnoid::Mapping::begin ( ) const
inline

◆ clear()

void Mapping::clear ( )

◆ clone()

ValueNode * Mapping::clone ( ) const
virtual

Reimplemented from cnoid::ValueNode.

◆ cloneMapping()

Mapping * Mapping::cloneMapping ( ) const
virtual

◆ createFlowStyleListing()

Listing* cnoid::Mapping::createFlowStyleListing ( const std::string &  key)
inline

◆ createFlowStyleMapping()

Mapping* cnoid::Mapping::createFlowStyleMapping ( const std::string &  key)
inline

◆ createListing()

Listing* cnoid::Mapping::createListing ( const std::string &  key)
inline

◆ createMapping()

Mapping* cnoid::Mapping::createMapping ( const std::string &  key)
inline

◆ doubleFormat()

const char* cnoid::Mapping::doubleFormat ( )
inline

◆ empty()

bool cnoid::Mapping::empty ( ) const
inline

◆ end() [1/2]

iterator cnoid::Mapping::end ( )
inline

◆ end() [2/2]

const_iterator cnoid::Mapping::end ( ) const
inline

◆ extract() [1/4]

ValueNodePtr Mapping::extract ( const std::string &  key)

◆ extract() [2/4]

bool Mapping::extract ( const std::string &  key,
double &  out_value 
)

◆ extract() [3/4]

bool Mapping::extract ( const std::string &  key,
std::string &  out_value 
)

◆ extract() [4/4]

ValueNodePtr Mapping::extract ( std::initializer_list< const char * >  keys)

◆ find() [1/2]

ValueNode * Mapping::find ( const std::string &  key) const

◆ find() [2/2]

ValueNode * Mapping::find ( std::initializer_list< const char * >  keys) const

◆ findListing() [1/2]

Listing * Mapping::findListing ( const std::string &  key) const

◆ findListing() [2/2]

Listing * Mapping::findListing ( std::initializer_list< const char * >  keys) const

◆ findMapping() [1/2]

Mapping * Mapping::findMapping ( const std::string &  key) const

◆ findMapping() [2/2]

Mapping * Mapping::findMapping ( std::initializer_list< const char * >  keys) const

◆ floatingNumberFormat()

const char* cnoid::Mapping::floatingNumberFormat ( )
inline

◆ get() [1/5]

ValueNode & Mapping::get ( const std::string &  key) const

◆ get() [2/5]

template<class T >
T cnoid::Mapping::get ( const std::string &  key) const
inline

◆ get() [3/5]

std::string cnoid::Mapping::get ( const std::string &  key,
const char *  defaultValue 
) const
inline

◆ get() [4/5]

template<class T >
T cnoid::Mapping::get ( const std::string &  key,
const T &  defaultValue 
) const
inline

◆ get() [5/5]

template<class T >
T cnoid::Mapping::get ( std::initializer_list< const char * >  keys,
const T &  defaultValue 
) const
inline

◆ insert() [1/2]

void Mapping::insert ( const Mapping other)

◆ insert() [2/2]

void Mapping::insert ( const std::string &  key,
ValueNode node 
)

◆ isFlowStyle()

bool cnoid::Mapping::isFlowStyle ( ) const
inline

◆ keyStringStyle()

StringStyle cnoid::Mapping::keyStringStyle ( ) const
inline

◆ openFlowStyleListing()

Listing* cnoid::Mapping::openFlowStyleListing ( const std::string &  key)
inline

◆ openFlowStyleMapping()

Mapping* cnoid::Mapping::openFlowStyleMapping ( const std::string &  key)
inline

◆ openListing()

Listing* cnoid::Mapping::openListing ( const std::string &  key)
inline

◆ openMapping()

Mapping* cnoid::Mapping::openMapping ( const std::string &  key)
inline

◆ operator[]()

ValueNode& cnoid::Mapping::operator[] ( const std::string &  key) const
inline

◆ read() [1/7]

template<class T >
T cnoid::Mapping::read ( const std::string &  key) const
inline

◆ read() [2/7]

bool Mapping::read ( const std::string &  key,
bool &  out_value 
) const

◆ read() [3/7]

bool Mapping::read ( const std::string &  key,
double &  out_value 
) const

◆ read() [4/7]

bool Mapping::read ( const std::string &  key,
float &  out_value 
) const

◆ read() [5/7]

bool Mapping::read ( const std::string &  key,
int &  out_value 
) const

◆ read() [6/7]

bool Mapping::read ( const std::string &  key,
std::string &  out_value 
) const

◆ read() [7/7]

template<class T >
bool cnoid::Mapping::read ( std::initializer_list< const char * >  keys,
T &  out_value 
) const
inline

◆ readAngle() [1/4]

bool Mapping::readAngle ( const std::string &  key,
double &  out_angle,
const ValueNode unitAttrNode = nullptr 
) const

◆ readAngle() [2/4]

bool Mapping::readAngle ( const std::string &  key,
float &  out_angle,
const ValueNode unitAttrNode = nullptr 
) const

◆ readAngle() [3/4]

bool Mapping::readAngle ( std::initializer_list< const char * >  keys,
double &  out_angle,
const ValueNode unitAttrNode = nullptr 
) const

◆ readAngle() [4/4]

bool Mapping::readAngle ( std::initializer_list< const char * >  keys,
float &  out_angle,
const ValueNode unitAttrNode = nullptr 
) const

◆ remove()

bool Mapping::remove ( const std::string &  key)

◆ setAssignMode()

void cnoid::Mapping::setAssignMode ( AssignMode  mode)
inline

◆ setDoubleFormat()

void cnoid::Mapping::setDoubleFormat ( const char *  format)
inline

◆ setFloatingNumberFormat()

void Mapping::setFloatingNumberFormat ( const char *  format)

◆ setFlowStyle()

void cnoid::Mapping::setFlowStyle ( bool  isFlowStyle = true)
inline

◆ setKeyQuoteStyle()

void Mapping::setKeyQuoteStyle ( StringStyle  style)

◆ size()

int cnoid::Mapping::size ( ) const
inline

◆ throwKeyNotFoundException()

void Mapping::throwKeyNotFoundException ( const std::string &  key) const

◆ write() [1/5]

void Mapping::write ( const std::string &  key,
bool  value 
)

◆ write() [2/5]

void cnoid::Mapping::write ( const std::string &  key,
const char *  value,
StringStyle  stringStyle = PLAIN_STRING 
)
inline

◆ write() [3/5]

void Mapping::write ( const std::string &  key,
const std::string &  value,
StringStyle  stringStyle = PLAIN_STRING 
)

◆ write() [4/5]

void Mapping::write ( const std::string &  key,
double  value 
)

◆ write() [5/5]

void Mapping::write ( const std::string &  key,
int  value 
)

◆ writeAsListing()

template<class ArrayType >
void cnoid::Mapping::writeAsListing ( const std::string &  key,
const ArrayType &  container 
)

◆ writePath()

void Mapping::writePath ( const std::string &  key,
const std::string &  value 
)

Friends And Related Function Documentation

◆ Listing

friend class Listing
friend

◆ YAMLReaderImpl

friend class YAMLReaderImpl
friend

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