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

#include <Archive.h>

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

Public Member Functions

 Archive ()
 
 Archive (int line, int column)
 
virtual ~Archive ()
 
void initSharedInfo (const std::string &projectFile, bool isSubProject)
 
void inheritSharedInfoFrom (Archive &archive)
 
void addProcessOnSubTreeRestored (const std::function< void()> &func) const
 
void addPostProcess (const std::function< void()> &func, int priority=0) const
 
void addFinalProcess (const std::function< void()> &func) const
 
ArchivefindSubArchive (const std::string &name)
 
const ArchivefindSubArchive (const std::string &name) const
 
bool forSubArchive (const std::string &name, std::function< bool(const Archive &archive)> func) const
 
ArchiveopenSubArchive (const std::string &name)
 
ArchivesubArchive (Mapping *node)
 
ValueNodePtr getItemId (const Item *item) const
 
ItemfindItem (const ValueNode *id) const
 
int getViewId (const View *view) const
 
ViewfindView (int id) const
 
void clearIds ()
 
template<class ItemType >
ItemType * findItem (ValueNode *id) const
 
void writeItemId (const std::string &key, Item *item)
 
template<class ItemType >
ItemType * findItem (const std::string &key) const
 
std::string resolveRelocatablePath (const std::string &relocatable, bool doAbsolutize=true) const
 
bool readRelocatablePath (const std::string &key, std::string &out_value) const
 
std::string readItemFilePath () const
 
std::string expandPathVariables (const std::string &path) const
 
bool loadFileTo (Item *item) const
 
bool loadFileTo (Item *item, const std::string &filepath) const
 
std::string getRelocatablePath (const std::string &path) const
 
bool writeRelocatablePath (const std::string &key, const std::string &path)
 
bool writeFileInformation (Item *item)
 
bool loadFileTo (const std::string &filepath, Item *item) const
 
bool loadItemFile (Item *item, const std::string &fileNameKey, const std::string &fileFormatKey=std::string()) const
 
ItemcurrentParentItem () const
 
std::string projectDirectory () const
 
FilePathVariableProcessorfilePathVariableProcessor () const
 
- Public Member Functions inherited from cnoid::Mapping
 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 ItemTreeArchiver
 
class ViewManager
 
class ProjectManager
 

Additional Inherited Members

- Public Types inherited from cnoid::Mapping
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
}
 
- 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
 

Constructor & Destructor Documentation

◆ Archive() [1/2]

Archive::Archive ( )

◆ Archive() [2/2]

Archive::Archive ( int  line,
int  column 
)

◆ ~Archive()

Archive::~Archive ( )
virtual

Member Function Documentation

◆ addFinalProcess()

void Archive::addFinalProcess ( const std::function< void()> &  func) const

◆ addPostProcess()

void Archive::addPostProcess ( const std::function< void()> &  func,
int  priority = 0 
) const

◆ addProcessOnSubTreeRestored()

void Archive::addProcessOnSubTreeRestored ( const std::function< void()> &  func) const

◆ clearIds()

void Archive::clearIds ( )

◆ currentParentItem()

Item * Archive::currentParentItem ( ) const

◆ expandPathVariables()

std::string cnoid::Archive::expandPathVariables ( const std::string &  path) const
inline

◆ filePathVariableProcessor()

FilePathVariableProcessor * Archive::filePathVariableProcessor ( ) const

◆ findItem() [1/3]

template<class ItemType >
ItemType* cnoid::Archive::findItem ( const std::string &  key) const
inline

◆ findItem() [2/3]

Item * Archive::findItem ( const ValueNode id) const

◆ findItem() [3/3]

template<class ItemType >
ItemType* cnoid::Archive::findItem ( ValueNode id) const
inline

◆ findSubArchive() [1/2]

Archive * Archive::findSubArchive ( const std::string &  name)

◆ findSubArchive() [2/2]

const Archive * Archive::findSubArchive ( const std::string &  name) const

◆ findView()

View * Archive::findView ( int  id) const

◆ forSubArchive()

bool Archive::forSubArchive ( const std::string &  name,
std::function< bool(const Archive &archive)>  func 
) const

◆ getItemId()

ValueNodePtr Archive::getItemId ( const Item item) const

◆ getRelocatablePath()

std::string Archive::getRelocatablePath ( const std::string &  path) const

◆ getViewId()

int Archive::getViewId ( const View view) const
Returns
-1 if item does not belong to the archive

◆ inheritSharedInfoFrom()

void Archive::inheritSharedInfoFrom ( Archive archive)

◆ initSharedInfo()

void Archive::initSharedInfo ( const std::string &  projectFile,
bool  isSubProject 
)

◆ loadFileTo() [1/3]

bool cnoid::Archive::loadFileTo ( const std::string &  filepath,
Item item 
) const
inline

◆ loadFileTo() [2/3]

bool Archive::loadFileTo ( Item item) const

◆ loadFileTo() [3/3]

bool Archive::loadFileTo ( Item item,
const std::string &  filepath 
) const

◆ loadItemFile()

bool Archive::loadItemFile ( Item item,
const std::string &  fileNameKey,
const std::string &  fileFormatKey = std::string() 
) const

◆ openSubArchive()

Archive * Archive::openSubArchive ( const std::string &  name)

◆ projectDirectory()

std::string Archive::projectDirectory ( ) const

◆ readItemFilePath()

std::string Archive::readItemFilePath ( ) const

◆ readRelocatablePath()

bool Archive::readRelocatablePath ( const std::string &  key,
std::string &  out_value 
) const

◆ resolveRelocatablePath()

std::string Archive::resolveRelocatablePath ( const std::string &  relocatable,
bool  doAbsolutize = true 
) const

◆ subArchive()

Archive * Archive::subArchive ( Mapping node)

◆ writeFileInformation()

bool Archive::writeFileInformation ( Item item)

◆ writeItemId()

void Archive::writeItemId ( const std::string &  key,
Item item 
)

◆ writeRelocatablePath()

bool Archive::writeRelocatablePath ( const std::string &  key,
const std::string &  path 
)

Friends And Related Function Documentation

◆ ItemTreeArchiver

friend class ItemTreeArchiver
friend

◆ ProjectManager

friend class ProjectManager
friend

◆ ViewManager

friend class ViewManager
friend

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