Ligo config file. More...
#include <ligo_config.h>
Public Member Functions | |
| CLigoConfig () | |
| virtual | ~CLigoConfig () |
| bool | readConfigFile (const char *fileName, bool parsePrimitiveComboContent) |
| Load the config file. | |
| bool | readPrimitiveClass (const char *fileName, bool parsePrimitiveComboContent) |
| This file will read the file ligo class description file (XML) using the LigoClass as file name. | |
| bool | reloadIndexFile (const std::string &indexFileName=std::string()) |
| void | resetPrimitiveConfiguration () |
| Reset the primitive configurations. | |
Public Attributes | |
Public value | |
| float | CellSize |
| Size of a cell of the ligoscape in meter. | |
| float | Snap |
| Snap precision for vertex position checking in meter. | |
| uint | ZoneSnapShotRes |
| Zone snap shot resolution. | |
| std::string | PrimitiveClassFilename |
| The ligo class file. | |
Primitive class accessors | |
|
| |
| std::map< std::string, CPrimitiveClass > | _PrimitiveClasses |
| std::vector< std::string > | _Contexts |
| std::map< std::string, std::string > | _ContextFilesLookup |
| std::vector < CPrimitiveConfigurations > | _PrimitiveConfigurations |
| uint32 | _DynamicAliasBitCount |
| std::string | _IndexFileName |
| Name of the index file. | |
| std::map< std::string, uint32 > | _StaticAliasFileMapping |
| uint32 | getDynamicAliasSize () const |
| Get the dynamic bit size for alias. | |
| uint32 | getDynamicAliasMask () const |
| Get the dynamic bit mask for alias. | |
| uint32 | getStaticAliasSize () const |
| Get the static bit size for alias. | |
| uint32 | getStaticAliasMask () const |
| Get the static bit mask for alias. | |
| uint32 | buildAlias (uint32 staticPart, uint32 dynamicPart, bool warnIfOverload=true) const |
| Build an alias given a static and dynamic part. | |
| void | registerFileToStaticAliasTranslation (const std::string &fileName, uint32 staticPart) |
| register filename to static alias translation | |
| virtual uint32 | getFileStaticAliasMapping (const std::string &fileName) const |
| get the static alias mapping (or 0 if no mapping defined) | |
| const std::string & | getFileNameForStaticAlias (uint32 staticAlias) const |
| get the filename for a static alias (or empty string for 0) | |
| bool | isFileStaticAliasMapped (const std::string &fileName) const |
| Check if a file is already mapped. | |
| std::string | aliasToString (uint32 fullAlias) |
| Build a standard human readable alias string. | |
| uint32 | aliasFromString (std::string fullAlias) |
| Read a standard human readable alias string. | |
| const CPrimitiveClass * | getPrimitiveClass (const NLLIGO::IPrimitive &primitive) const |
| const CPrimitiveClass * | getPrimitiveClass (const char *className) const |
| NLMISC::CRGBA | getPrimitiveColor (const NLLIGO::IPrimitive &primitive) |
| bool | isStaticChild (const NLLIGO::IPrimitive &primitive) |
| bool | isPrimitiveLinked (const NLLIGO::IPrimitive &primitive) |
| const NLLIGO::IPrimitive * | getLinkedPrimitive (const NLLIGO::IPrimitive &primitive) const |
| const NLLIGO::IPrimitive * | getPreviousLinkedPrimitive (const NLLIGO::IPrimitive &primitive) const |
| bool | isPrimitiveDeletable (const NLLIGO::IPrimitive &primitive) |
| bool | canBeChild (const NLLIGO::IPrimitive &child, const NLLIGO::IPrimitive &parent) |
| bool | canBeRoot (const NLLIGO::IPrimitive &primitive) |
| bool | getPropertyString (std::string &result, const char *filename, xmlNodePtr xmlNode, const char *propName) |
| void | syntaxError (const char *filename, xmlNodePtr xmlNode, const char *format,...) |
| virtual void | errorMessage (const char *format,...) |
| const std::vector< std::string > & | getContextString () const |
| const std::vector < CPrimitiveConfigurations > & | getPrimitiveConfiguration () const |
| void | updateDynamicAliasBitCount (uint32 newDynamicAliasBitCount) |
| bool | initPrimitiveClass (const char *filename) |
Ligo config file.
Definition at line 46 of file ligo_config.h.
| NLLIGO::CLigoConfig::CLigoConfig | ( | ) |
Definition at line 41 of file ligo_config.cpp.
| virtual NLLIGO::CLigoConfig::~CLigoConfig | ( | ) | [inline, virtual] |
Definition at line 52 of file ligo_config.h.
| uint32 NLLIGO::CLigoConfig::aliasFromString | ( | std::string | fullAlias | ) |
Read a standard human readable alias string.
Definition at line 794 of file ligo_config.cpp.
References getDynamicAliasMask(), getDynamicAliasSize(), and getStaticAliasMask().
| std::string NLLIGO::CLigoConfig::aliasToString | ( | uint32 | fullAlias | ) |
Build a standard human readable alias string.
Definition at line 782 of file ligo_config.cpp.
References getDynamicAliasMask(), getDynamicAliasSize(), getStaticAliasMask(), and NLMISC::toString().
| uint32 NLLIGO::CLigoConfig::buildAlias | ( | uint32 | staticPart, | |
| uint32 | dynamicPart, | |||
| bool | warnIfOverload = true | |||
| ) | const |
Build an alias given a static and dynamic part.
Definition at line 683 of file ligo_config.cpp.
References _DynamicAliasBitCount, getDynamicAliasMask(), getDynamicAliasSize(), getStaticAliasMask(), and nlwarning.
Referenced by NLLIGO::CPrimitives::buildFullAlias(), and NLLIGO::CPrimitives::buildPrimitiveWithAliasList().
| bool NLLIGO::CLigoConfig::canBeChild | ( | const NLLIGO::IPrimitive & | child, | |
| const NLLIGO::IPrimitive & | parent | |||
| ) |
Definition at line 440 of file ligo_config.cpp.
References NLLIGO::CPrimitiveClass::DynamicChildren, NLLIGO::CPrimitiveClass::GeneratedChildren, NLLIGO::IPrimitive::getParent(), getPrimitiveClass(), and NLLIGO::IPrimitive::getPropertyByName().
| bool NLLIGO::CLigoConfig::canBeRoot | ( | const NLLIGO::IPrimitive & | primitive | ) |
Definition at line 484 of file ligo_config.cpp.
References NLLIGO::CPrimitiveClass::DynamicChildren, getPrimitiveClass(), and NLLIGO::IPrimitive::getPropertyByName().
| void NLLIGO::CLigoConfig::errorMessage | ( | const char * | format, | |
| ... | ||||
| ) | [virtual] |
Definition at line 544 of file ligo_config.cpp.
References nlwarning.
Referenced by readPrimitiveClass(), and syntaxError().
| const std::vector< std::string > & NLLIGO::CLigoConfig::getContextString | ( | ) | const |
Definition at line 558 of file ligo_config.cpp.
References _Contexts.
| uint32 NLLIGO::CLigoConfig::getDynamicAliasMask | ( | ) | const |
Get the dynamic bit mask for alias.
Definition at line 655 of file ligo_config.cpp.
References _DynamicAliasBitCount.
Referenced by aliasFromString(), aliasToString(), buildAlias(), NLLIGO::CPrimitives::forceAlias(), NLLIGO::CPrimitives::genAlias(), NLLIGO::CPrimitives::getPrimitiveByAlias(), getStaticAliasMask(), and NLLIGO::CPrimitives::releaseAlias().
| uint32 NLLIGO::CLigoConfig::getDynamicAliasSize | ( | ) | const |
Get the dynamic bit size for alias.
Definition at line 648 of file ligo_config.cpp.
References _DynamicAliasBitCount.
Referenced by aliasFromString(), aliasToString(), buildAlias(), NLLIGO::CPrimitives::getPrimitiveByAlias(), and registerFileToStaticAliasTranslation().
| const std::string & NLLIGO::CLigoConfig::getFileNameForStaticAlias | ( | uint32 | staticAlias | ) | const |
get the filename for a static alias (or empty string for 0)
Definition at line 736 of file ligo_config.cpp.
References _StaticAliasFileMapping.
| uint32 NLLIGO::CLigoConfig::getFileStaticAliasMapping | ( | const std::string & | fileName | ) | const [virtual] |
get the static alias mapping (or 0 if no mapping defined)
Definition at line 753 of file ligo_config.cpp.
References _StaticAliasFileMapping.
Referenced by NLLIGO::CPrimitives::read(), reloadIndexFile(), and NLLIGO::CPrimitives::serial().
| const NLLIGO::IPrimitive * NLLIGO::CLigoConfig::getLinkedPrimitive | ( | const NLLIGO::IPrimitive & | primitive | ) | const |
Definition at line 344 of file ligo_config.cpp.
References _PrimitiveClasses, NLLIGO::IPrimitive::getChild(), NLLIGO::IPrimitive::getChildId(), NLLIGO::IPrimitive::getParent(), and NLLIGO::IPrimitive::getPropertyByName().
| const NLLIGO::IPrimitive * NLLIGO::CLigoConfig::getPreviousLinkedPrimitive | ( | const NLLIGO::IPrimitive & | primitive | ) | const |
Definition at line 379 of file ligo_config.cpp.
References _PrimitiveClasses, NLLIGO::IPrimitive::getChild(), NLLIGO::IPrimitive::getChildId(), NLLIGO::IPrimitive::getParent(), and NLLIGO::IPrimitive::getPropertyByName().
| const CPrimitiveClass * NLLIGO::CLigoConfig::getPrimitiveClass | ( | const char * | className | ) | const |
Definition at line 598 of file ligo_config.cpp.
References _PrimitiveClasses.
| const CPrimitiveClass * NLLIGO::CLigoConfig::getPrimitiveClass | ( | const NLLIGO::IPrimitive & | primitive | ) | const |
Definition at line 565 of file ligo_config.cpp.
References _PrimitiveClasses, NLLIGO::IPrimitive::getParent(), and NLLIGO::IPrimitive::getPropertyByName().
Referenced by canBeChild(), canBeRoot(), NLLIGO::IPrimitive::initDefaultValues(), isStaticChild(), and NLLIGO::CPrimitiveClass::read().
| NLMISC::CRGBA NLLIGO::CLigoConfig::getPrimitiveColor | ( | const NLLIGO::IPrimitive & | primitive | ) |
Definition at line 308 of file ligo_config.cpp.
References _PrimitiveClasses, DEFAULT_PRIMITIVE_COLOR, and NLLIGO::IPrimitive::getPropertyByName().
| const std::vector<CPrimitiveConfigurations>& NLLIGO::CLigoConfig::getPrimitiveConfiguration | ( | ) | const [inline] |
Definition at line 154 of file ligo_config.h.
References _PrimitiveConfigurations.
| bool NLLIGO::CLigoConfig::getPropertyString | ( | std::string & | result, | |
| const char * | filename, | |||
| xmlNodePtr | xmlNode, | |||
| const char * | propName | |||
| ) |
Definition at line 517 of file ligo_config.cpp.
References syntaxError().
Referenced by NLLIGO::CPrimitiveConfigurations::read(), NLLIGO::CPrimitiveClass::read(), ReadChild(), and readPrimitiveClass().
| uint32 NLLIGO::CLigoConfig::getStaticAliasMask | ( | ) | const |
Get the static bit mask for alias.
Definition at line 675 of file ligo_config.cpp.
References getDynamicAliasMask().
Referenced by aliasFromString(), aliasToString(), buildAlias(), NLLIGO::CPrimitives::getPrimitiveByAlias(), and registerFileToStaticAliasTranslation().
| uint32 NLLIGO::CLigoConfig::getStaticAliasSize | ( | ) | const |
Get the static bit size for alias.
Definition at line 668 of file ligo_config.cpp.
References _DynamicAliasBitCount.
| bool NLLIGO::CLigoConfig::initPrimitiveClass | ( | const char * | filename | ) | [private] |
| bool NLLIGO::CLigoConfig::isFileStaticAliasMapped | ( | const std::string & | fileName | ) | const |
Check if a file is already mapped.
Definition at line 768 of file ligo_config.cpp.
References _StaticAliasFileMapping.
Referenced by reloadIndexFile().
| bool NLLIGO::CLigoConfig::isPrimitiveDeletable | ( | const NLLIGO::IPrimitive & | primitive | ) |
Definition at line 418 of file ligo_config.cpp.
References _PrimitiveClasses, NLLIGO::IPrimitive::getPropertyByName(), and isStaticChild().
| bool NLLIGO::CLigoConfig::isPrimitiveLinked | ( | const NLLIGO::IPrimitive & | primitive | ) |
Definition at line 326 of file ligo_config.cpp.
References _PrimitiveClasses, and NLLIGO::IPrimitive::getPropertyByName().
| bool NLLIGO::CLigoConfig::isStaticChild | ( | const NLLIGO::IPrimitive & | primitive | ) |
Definition at line 617 of file ligo_config.cpp.
References NLLIGO::IPrimitive::getParent(), getPrimitiveClass(), NLLIGO::IPrimitive::getPropertyByName(), and NLLIGO::CPrimitiveClass::StaticChildren.
Referenced by isPrimitiveDeletable().
Load the config file.
Can throw some exceptions if file doesn't exist or is malformed.
This file will try to open the file ligo class description file (XML) using the LigoClass as file name. It will try first to load directly the file and then to lookup the file in NLMISC::CPath.
Definition at line 48 of file ligo_config.cpp.
References _Contexts, _PrimitiveClasses, _PrimitiveConfigurations, NLMISC::CConfigFile::CVar::asFloat(), NLMISC::CConfigFile::CVar::asInt(), NLMISC::CConfigFile::CVar::asString(), CellSize, NLMISC::CConfigFile::getVar(), NLMISC::CConfigFile::load(), PrimitiveClassFilename, readPrimitiveClass(), Snap, and ZoneSnapShotRes.
| bool NLLIGO::CLigoConfig::readPrimitiveClass | ( | const char * | fileName, | |
| bool | parsePrimitiveComboContent | |||
| ) |
This file will read the file ligo class description file (XML) using the LigoClass as file name.
It will try first to load directly the file and then to lookup the file in NLMISC::CPath.
Definition at line 82 of file ligo_config.cpp.
References _ContextFilesLookup, _Contexts, _DynamicAliasBitCount, _PrimitiveClasses, _PrimitiveConfigurations, errorMessage(), file, NLMISC::fromString(), getPropertyString(), NLMISC::CIXml::getRootNode(), NLMISC::CIXml::init(), min, nlassert, nlwarning, NLMISC::CIFile::open(), reloadIndexFile(), syntaxError(), and NLMISC::Exception::what().
Referenced by readConfigFile().
| void NLLIGO::CLigoConfig::registerFileToStaticAliasTranslation | ( | const std::string & | fileName, | |
| uint32 | staticPart | |||
| ) |
register filename to static alias translation
Definition at line 706 of file ligo_config.cpp.
References _StaticAliasFileMapping, getDynamicAliasSize(), getStaticAliasMask(), nlassertex, and nlwarning.
Referenced by reloadIndexFile().
| bool NLLIGO::CLigoConfig::reloadIndexFile | ( | const std::string & | indexFileName = std::string() |
) |
Definition at line 243 of file ligo_config.cpp.
References _IndexFileName, NLMISC::CConfigFile::CVar::asInt(), NLMISC::CConfigFile::CVar::asString(), getFileStaticAliasMapping(), NLMISC::CConfigFile::getVarPtr(), isFileStaticAliasMapped(), NLMISC::CConfigFile::load(), nlwarning, registerFileToStaticAliasTranslation(), and NLMISC::CConfigFile::CVar::size().
Referenced by readPrimitiveClass().
| void NLLIGO::CLigoConfig::resetPrimitiveConfiguration | ( | ) |
Reset the primitive configurations.
Definition at line 610 of file ligo_config.cpp.
References _PrimitiveConfigurations.
| void NLLIGO::CLigoConfig::syntaxError | ( | const char * | filename, | |
| xmlNodePtr | xmlNode, | |||
| const char * | format, | |||
| ... | ||||
| ) |
Definition at line 531 of file ligo_config.cpp.
References errorMessage().
Referenced by getPropertyString(), NLLIGO::CPrimitiveConfigurations::read(), NLLIGO::CPrimitiveClass::read(), ReadBool(), and readPrimitiveClass().
| void NLLIGO::CLigoConfig::updateDynamicAliasBitCount | ( | uint32 | newDynamicAliasBitCount | ) |
Definition at line 805 of file ligo_config.cpp.
References _DynamicAliasBitCount, _StaticAliasFileMapping, nlassert, and nlwarning.
std::map<std::string, std::string> NLLIGO::CLigoConfig::_ContextFilesLookup [private] |
Definition at line 176 of file ligo_config.h.
Referenced by readPrimitiveClass().
std::vector<std::string> NLLIGO::CLigoConfig::_Contexts [private] |
Definition at line 173 of file ligo_config.h.
Referenced by getContextString(), readConfigFile(), and readPrimitiveClass().
Definition at line 182 of file ligo_config.h.
Referenced by buildAlias(), getDynamicAliasMask(), getDynamicAliasSize(), getStaticAliasSize(), readPrimitiveClass(), and updateDynamicAliasBitCount().
std::string NLLIGO::CLigoConfig::_IndexFileName [private] |
Name of the index file.
Definition at line 185 of file ligo_config.h.
Referenced by reloadIndexFile().
std::map<std::string, CPrimitiveClass> NLLIGO::CLigoConfig::_PrimitiveClasses [private] |
Definition at line 170 of file ligo_config.h.
Referenced by getLinkedPrimitive(), getPreviousLinkedPrimitive(), getPrimitiveClass(), getPrimitiveColor(), isPrimitiveDeletable(), isPrimitiveLinked(), readConfigFile(), and readPrimitiveClass().
std::vector<CPrimitiveConfigurations> NLLIGO::CLigoConfig::_PrimitiveConfigurations [private] |
Definition at line 179 of file ligo_config.h.
Referenced by getPrimitiveConfiguration(), readConfigFile(), readPrimitiveClass(), and resetPrimitiveConfiguration().
std::map<std::string, uint32> NLLIGO::CLigoConfig::_StaticAliasFileMapping [private] |
Definition at line 187 of file ligo_config.h.
Referenced by getFileNameForStaticAlias(), getFileStaticAliasMapping(), isFileStaticAliasMapped(), registerFileToStaticAliasTranslation(), and updateDynamicAliasBitCount().
Size of a cell of the ligoscape in meter.
Definition at line 76 of file ligo_config.h.
Referenced by NLLIGO::CZoneTemplate::build(), NLLIGO::CZoneEdge::build(), NLLIGO::CZoneEdge::buildMatrix(), NLLIGO::CZoneEdge::invert(), NLLIGO::CZoneEdge::isSymetrical(), and readConfigFile().
| std::string NLLIGO::CLigoConfig::PrimitiveClassFilename |
Snap precision for vertex position checking in meter.
Definition at line 79 of file ligo_config.h.
Referenced by NLLIGO::CZoneTemplate::build(), NLLIGO::CZoneEdge::build(), NLLIGO::CZoneEdge::isSymetrical(), NLLIGO::CZoneEdge::isTheSame(), and readConfigFile().
Zone snap shot resolution.
Definition at line 82 of file ligo_config.h.
Referenced by readConfigFile().
1.6.1