A class to build a node tree from an Address table file NOTE! This is a factory method and must be Mutex protected if it is used in multithreaded environments! More...
#include <uhal/NodeTreeBuilder.hpp>
Classes | |
| struct | mode_lut |
| A look-up table that the boost qi parser uses for associating strings ("single","block","port","incremental","non-incremental","inc","non-inc") with enumerated mode types. More... | |
| struct | permissions_lut |
| A look-up table that the boost qi parser uses for associating strings ("r","w","rw","wr","read","write","readwrite","writeread") with enumerated permissions types. More... | |
Public Member Functions | |
| Node * | getNodeTree (const std::string &aFilenameExpr, const boost::filesystem::path &aPath) |
| Construct a node tree from file whose name is specified. More... | |
| void | clearAddressFileCache () |
| Clears address filename -> Node tree cache. NOT thread safe; for tread-safety, use ConnectionManager method. More... | |
Static Public Member Functions | |
| static NodeTreeBuilder & | getInstance () |
| Static method to retrieve the single instance of the class. More... | |
Private Member Functions | |
| NodeTreeBuilder () | |
| Default constructor This is private since only a single instance is to be created, using the getInstance method. More... | |
| virtual | ~NodeTreeBuilder () |
| Destructor. More... | |
| void | CallBack (const std::string &aProtocol, const boost::filesystem::path &aPath, std::vector< uint8_t > &aFile, std::vector< const Node * > &aAddressTable) |
| Method called once the file specified in the call to getNodeTree( aFilenameExpr ) has been opened. More... | |
| void | calculateHierarchicalAddresses (Node *aNode, const uint32_t &aAddr) |
| Propagate the addresses down through the hierarchical structure. More... | |
| void | checkForAddressCollisions (Node *aNode, const boost::filesystem::path &aPath) |
| Node * | plainNodeCreator (const bool &aRequireId, const pugi::xml_node &aXmlNode) |
| Node * | moduleNodeCreator (const bool &aRequireId, const pugi::xml_node &aXmlNode) |
| Node * | bitmaskNodeCreator (const bool &aRequireId, const pugi::xml_node &aXmlNode) |
| void | setUid (const bool &aRequireId, const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setClassName (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setPars (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setAddr (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setTags (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setDescription (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setModule (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setPermissions (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setMask (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setModeAndSize (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | setFirmwareInfo (const pugi::xml_node &aXmlNode, Node *aNode) |
| void | addChildren (const pugi::xml_node &aXmlNode, Node *aNode) |
Static Private Member Functions | |
| static bool | NodePtrCompare (Node *aNodeL, Node *aNodeR) |
Private Attributes | |
| Parser< Node *> | mTopLevelNodeParser |
| Parser< Node *> | mNodeParser |
| std::deque< boost::filesystem::path > | mFileCallStack |
| boost::unordered_map< std::string, const Node *> | mNodes |
| Hash map associating a Node tree with a file name so that we do not need to repeatedly parse the xml documents if someone asks for a second copy of a particular node tree. More... | |
| grammars::NodeTreeClassAttributeGrammar | mNodeTreeClassAttributeGrammar |
| grammars::NodeTreeParametersGrammar | mNodeTreeParametersGrammar |
| grammars::NodeTreeFirmwareinfoAttributeGrammar | mNodeTreeFirmwareInfoAttributeGrammar |
Static Private Attributes | |
| static const char * | mIdAttribute = "id" |
| static const char * | mAddressAttribute = "address" |
| static const char * | mParametersAttribute = "parameters" |
| static const char * | mTagsAttribute = "tags" |
| static const char * | mDescriptionAttribute = "description" |
| static const char * | mPermissionsAttribute = "permission" |
| static const char * | mMaskAttribute = "mask" |
| static const char * | mModeAttribute = "mode" |
| static const char * | mSizeAttribute = "size" |
| static const char * | mClassAttribute = "class" |
| static const char * | mModuleAttribute = "module" |
| static const char * | mFirmwareInfo = "fwinfo" |
| static NodeTreeBuilder * | mInstance = NULL |
| The single instance of the class. More... | |
| uhal::NodeTreeBuilder::permissions_lut | mPermissionsLut |
| An instance of a look-up table that the boost qi parser uses for associating strings with enumerated permissions types. More... | |
| uhal::NodeTreeBuilder::mode_lut | mModeLut |
| An instance of a look-up table that the boost qi parser uses for associating strings with enumerated permissions types. More... | |
A class to build a node tree from an Address table file NOTE! This is a factory method and must be Mutex protected if it is used in multithreaded environments!
Definition at line 102 of file NodeTreeBuilder.hpp.
|
private |
Default constructor This is private since only a single instance is to be created, using the getInstance method.
Definition at line 79 of file NodeTreeBuilder.cpp.
References bitmaskNodeCreator(), mNodeParser, moduleNodeCreator(), mTopLevelNodeParser, uhal::Rule< R >::optional(), plainNodeCreator(), and uhal::Rule< R >::require().
Referenced by getInstance().
|
privatevirtual |
Destructor.
Definition at line 136 of file NodeTreeBuilder.cpp.
|
private |
Definition at line 522 of file NodeTreeBuilder.cpp.
References uhal::Node::mChildren, uhal::Node::mChildrenMap, uhal::Node::mMode, mNodeParser, uhal::Node::mUid, uhal::defs::NON_INCREMENTAL, and uhal::Quote().
Referenced by plainNodeCreator().
|
private |
Definition at line 304 of file NodeTreeBuilder.cpp.
References uhal::Debug, uhal::Node::mUid, setAddr(), setClassName(), setDescription(), setFirmwareInfo(), setMask(), setModule(), setPars(), setPermissions(), setTags(), and setUid().
Referenced by NodeTreeBuilder().
|
private |
Propagate the addresses down through the hierarchical structure.
| aNode | the node whose address we are calculating |
| aAddr | the parent address which will be applied to the children |
Definition at line 554 of file NodeTreeBuilder.cpp.
References uhal::defs::HIERARCHICAL, uhal::defs::INCREMENTAL, uhal::Integer(), uhal::Node::mAddr, uhal::Node::mChildren, uhal::Node::mMode, uhal::Node::mPartialAddr, uhal::Node::mSize, NodePtrCompare(), uhal::defs::NOMASK, and uhal::defs::SINGLE.
Referenced by CallBack().
|
private |
Method called once the file specified in the call to getNodeTree( aFilenameExpr ) has been opened.
| aProtocol | The protocol by which the file was loaded |
| aPath | The fully qualified path to the file which has been opened |
| aFile | A byte vector containing the content of the opened file. Done like this since the routine handles local and http files identically |
| aAddressTable | The address table constructed from the file |
Definition at line 189 of file NodeTreeBuilder.cpp.
References calculateHierarchicalAddresses(), checkForAddressCollisions(), uhal::Error, uhal::Info, mFileCallStack, mNodes, mTopLevelNodeParser, uhal::utilities::PugiXMLParseResultPrettifier(), uhal::Quote(), and ThisLocation.
Referenced by getNodeTree().
|
private |
Definition at line 636 of file NodeTreeBuilder.cpp.
References uhal::Error, uhal::hex, uhal::defs::HIERARCHICAL, uhal::defs::INCREMENTAL, uhal::Node::mAddr, uhal::Node::mChildren, uhal::Node::mChildrenMap, uhal::Node::mMask, uhal::Node::mMode, uhal::Node::mSize, uhal::Quote(), and uhal::Warning.
Referenced by CallBack().
| void uhal::NodeTreeBuilder::clearAddressFileCache | ( | ) |
Clears address filename -> Node tree cache. NOT thread safe; for tread-safety, use ConnectionManager method.
Definition at line 179 of file NodeTreeBuilder.cpp.
References mNodes.
Referenced by uhal::ConnectionManager::clearAddressFileCache().
|
static |
Static method to retrieve the single instance of the class.
Definition at line 142 of file NodeTreeBuilder.cpp.
References mInstance, and NodeTreeBuilder().
Referenced by uhal::ConnectionManager::clearAddressFileCache(), and uhal::ConnectionManager::getDevice().
| Node * uhal::NodeTreeBuilder::getNodeTree | ( | const std::string & | aFilenameExpr, |
| const boost::filesystem::path & | aPath | ||
| ) |
Construct a node tree from file whose name is specified.
NOT thread safe; for thread-safety, use ConnectionManager getDevice/getDevices methods
| aFilenameExpr | a Filename Expression |
| aPath | a path that will be prepended to relative filenames for local files. Ignored for http files. |
Definition at line 152 of file NodeTreeBuilder.cpp.
References CallBack(), uhal::Integer(), uhal::utilities::OpenFile(), uhal::utilities::ParseSemicolonDelimitedUriList(), and uhal::Quote().
Referenced by moduleNodeCreator().
|
private |
Definition at line 274 of file NodeTreeBuilder.cpp.
References uhal::DerivedNodeFactory::convertToClassType(), uhal::Debug, uhal::DerivedNodeFactory::getInstance(), getNodeTree(), uhal::utilities::GetXMLattribute< false >(), mFileCallStack, mModuleAttribute, setAddr(), setClassName(), setDescription(), setFirmwareInfo(), setModule(), setPars(), setTags(), and setUid().
Referenced by NodeTreeBuilder().
Definition at line 516 of file NodeTreeBuilder.cpp.
References uhal::Node::mAddr.
Referenced by calculateHierarchicalAddresses().
|
private |
Definition at line 247 of file NodeTreeBuilder.cpp.
References addChildren(), uhal::DerivedNodeFactory::convertToClassType(), uhal::Debug, uhal::DerivedNodeFactory::getInstance(), uhal::Node::mClassName, uhal::Node::mUid, setAddr(), setClassName(), setDescription(), setFirmwareInfo(), setModeAndSize(), setModule(), setPars(), setPermissions(), setTags(), and setUid().
Referenced by NodeTreeBuilder().
|
private |
Definition at line 349 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), mAddressAttribute, and uhal::Node::mPartialAddr.
Referenced by bitmaskNodeCreator(), moduleNodeCreator(), and plainNodeCreator().
|
private |
Definition at line 358 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), mClassAttribute, and uhal::Node::mClassName.
Referenced by bitmaskNodeCreator(), moduleNodeCreator(), and plainNodeCreator().
|
private |
Definition at line 407 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), uhal::Node::mDescription, and mDescriptionAttribute.
Referenced by bitmaskNodeCreator(), moduleNodeCreator(), and plainNodeCreator().
|
private |
Definition at line 494 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), mFirmwareInfo, uhal::Node::mFirmwareInfo, and mNodeTreeFirmwareInfoAttributeGrammar.
Referenced by bitmaskNodeCreator(), moduleNodeCreator(), and plainNodeCreator().
|
private |
Definition at line 451 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), uhal::Node::mMask, and mMaskAttribute.
Referenced by bitmaskNodeCreator().
|
private |
Definition at line 458 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), uhal::defs::INCREMENTAL, uhal::Node::mMode, mModeLut, uhal::Node::mSize, uhal::Node::mUid, uhal::defs::NON_INCREMENTAL, uhal::Notice, and uhal::Quote().
Referenced by plainNodeCreator().
|
private |
Definition at line 425 of file NodeTreeBuilder.cpp.
References mFileCallStack, and uhal::Node::mModule.
Referenced by bitmaskNodeCreator(), moduleNodeCreator(), and plainNodeCreator().
|
private |
Definition at line 367 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), mNodeTreeParametersGrammar, uhal::Node::mParameters, and mParametersAttribute.
Referenced by bitmaskNodeCreator(), moduleNodeCreator(), and plainNodeCreator().
|
private |
Definition at line 433 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), uhal::Node::mPermission, and mPermissionsLut.
Referenced by bitmaskNodeCreator(), and plainNodeCreator().
|
private |
Definition at line 388 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), uhal::Node::mTags, and mTagsAttribute.
Referenced by bitmaskNodeCreator(), moduleNodeCreator(), and plainNodeCreator().
|
private |
Definition at line 333 of file NodeTreeBuilder.cpp.
References uhal::utilities::GetXMLattribute< false >(), uhal::utilities::GetXMLattribute< true >(), mIdAttribute, and uhal::Node::mUid.
Referenced by bitmaskNodeCreator(), moduleNodeCreator(), and plainNodeCreator().
|
staticprivate |
Definition at line 181 of file NodeTreeBuilder.hpp.
Referenced by setAddr().
|
staticprivate |
Definition at line 189 of file NodeTreeBuilder.hpp.
Referenced by setClassName().
|
staticprivate |
Definition at line 184 of file NodeTreeBuilder.hpp.
Referenced by setDescription().
|
private |
Definition at line 196 of file NodeTreeBuilder.hpp.
Referenced by CallBack(), moduleNodeCreator(), and setModule().
|
staticprivate |
Definition at line 191 of file NodeTreeBuilder.hpp.
Referenced by setFirmwareInfo().
|
staticprivate |
Definition at line 180 of file NodeTreeBuilder.hpp.
Referenced by setUid().
|
staticprivate |
The single instance of the class.
Definition at line 200 of file NodeTreeBuilder.hpp.
Referenced by getInstance().
|
staticprivate |
Definition at line 186 of file NodeTreeBuilder.hpp.
Referenced by setMask().
|
staticprivate |
Definition at line 187 of file NodeTreeBuilder.hpp.
|
staticprivate |
An instance of a look-up table that the boost qi parser uses for associating strings with enumerated permissions types.
Definition at line 863 of file NodeTreeBuilder.cpp.
Referenced by setModeAndSize().
|
staticprivate |
Definition at line 190 of file NodeTreeBuilder.hpp.
Referenced by moduleNodeCreator().
Definition at line 194 of file NodeTreeBuilder.hpp.
Referenced by addChildren(), and NodeTreeBuilder().
|
private |
Hash map associating a Node tree with a file name so that we do not need to repeatedly parse the xml documents if someone asks for a second copy of a particular node tree.
Definition at line 203 of file NodeTreeBuilder.hpp.
Referenced by CallBack(), and clearAddressFileCache().
|
private |
Definition at line 221 of file NodeTreeBuilder.hpp.
|
private |
Definition at line 223 of file NodeTreeBuilder.hpp.
Referenced by setFirmwareInfo().
|
private |
Definition at line 222 of file NodeTreeBuilder.hpp.
Referenced by setPars().
|
staticprivate |
Definition at line 182 of file NodeTreeBuilder.hpp.
Referenced by setPars().
|
staticprivate |
Definition at line 185 of file NodeTreeBuilder.hpp.
|
staticprivate |
An instance of a look-up table that the boost qi parser uses for associating strings with enumerated permissions types.
Definition at line 847 of file NodeTreeBuilder.cpp.
Referenced by setPermissions().
|
staticprivate |
Definition at line 188 of file NodeTreeBuilder.hpp.
|
staticprivate |
Definition at line 183 of file NodeTreeBuilder.hpp.
Referenced by setTags().
Definition at line 193 of file NodeTreeBuilder.hpp.
Referenced by CallBack(), and NodeTreeBuilder().
1.8.13