A heirarchical node for navigating heirarchical firmwares. More...
#include <uhal/Node.hpp>
Classes | |
class | const_iterator |
Public Member Functions | |
virtual | ~Node () |
Destructor. More... | |
const_iterator | begin () const |
const_iterator | end () const |
bool | operator== (const Node &aNode) const |
A function to determine whether two Nodes are identical. More... | |
const Node & | getNode (const std::string &aId) const |
Retrieve the Node given by a full-stop delimeted name path relative, to the current node. More... | |
template<typename T > | |
const T & | getNode (const std::string &aId) const |
Retrieve the Node given by a full-stop delimeted name path relative, to the current node and cast it to a particular node type. More... | |
std::vector< std::string > | getNodes () const |
Return all node IDs known to this HwInterface. More... | |
std::vector< std::string > | getNodes (const std::string &aRegex) const |
Return all node IDs known to this connection manager which match a (boost) regular expression. More... | |
const std::string & | getId () const |
Return the unique ID of the current node. More... | |
std::string | getPath () const |
Return the full path to the current node. More... | |
const uint32_t & | getAddress () const |
Return the register address with which this node is associated. More... | |
const uint32_t & | getMask () const |
Return the mask to be applied if this node is a sub-field, rather than an entire register. More... | |
const defs::BlockReadWriteMode & | getMode () const |
Return whether the node represents a single register, a block of registers or a block-read/write port. More... | |
const uint32_t & | getSize () const |
Return the maximum size available to a block read/write. More... | |
const defs::NodePermission & | getPermission () const |
Return the read/write access permissions of this node. More... | |
const std::string & | getTags () const |
Return the optional tags string which the user can specify for the current node. More... | |
const std::string & | getDescription () const |
Return the optional description string which the user can specify for the current node. More... | |
const std::string & | getModule () const |
Return the name of the module in which the current node resides. More... | |
const boost::unordered_map< std::string, std::string > & | getParameters () const |
Return parameters of the current node. More... | |
const boost::unordered_map< std::string, std::string > & | getFirmwareInfo () const |
Return parameters for inferring the VHDL address decoding. More... | |
void | stream (std::ostream &aStr, std::size_t aIndent=0) const |
A streaming helper function to create pretty, indented tree diagrams. More... | |
ValHeader | write (const uint32_t &aValue) const |
Write a single, unmasked word to a register. More... | |
ValHeader | writeBlock (const std::vector< uint32_t > &aValues) const |
Write a block of data to a block of registers or a block-write port. More... | |
ValHeader | writeBlockOffset (const std::vector< uint32_t > &aValues, const uint32_t &aOffset) const |
Write a block of data to a block of registers or a block-write port. More... | |
ValWord< uint32_t > | read () const |
Read a single, unmasked, unsigned word. More... | |
ValVector< uint32_t > | readBlock (const uint32_t &aSize) const |
Read a block of unsigned data from a block of registers or a block-read port. More... | |
ValVector< uint32_t > | readBlockOffset (const uint32_t &aSize, const uint32_t &aOffset) const |
Read a block of unsigned data from a block of registers or a block-read port. More... | |
ClientInterface & | getClient () const |
Get the underlying IPbus client. More... | |
std::vector< const Node * > | getLineage (const Node &aAncestor) const |
Returns ancestry path of nodes from (but not including) aAncestor to this node. More... | |
bool | isChildOf (const Node &aParent) const |
Returns whether this node is child of the function's argument. More... | |
Protected Member Functions | |
Node () | |
Empty node. More... | |
Node (const Node &aNode) | |
Copy constructor. More... | |
virtual Node & | operator= (const Node &aNode) |
Assignment operator. More... | |
virtual Node * | clone () const |
Function to produce a new copy of the current Node. More... | |
Private Member Functions | |
std::string | getRelativePath (const Node &aAncestor) const |
void | getAncestors (std::deque< const Node * > &aPath) const |
Get the full path to the current node. More... | |
Private Attributes | |
HwInterface * | mHw |
The parent hardware interface of which this node is a child (or rather decendent) More... | |
std::string | mUid |
The Unique ID of this node. More... | |
uint32_t | mPartialAddr |
The register address with which this node is associated. More... | |
uint32_t | mAddr |
The register address with which this node is associated. More... | |
uint32_t | mMask |
The mask to be applied if this node is a sub-field, rather than an entire register. More... | |
defs::NodePermission | mPermission |
The read/write access permissions of this node. More... | |
defs::BlockReadWriteMode | mMode |
Whether the node represents a single register, a block of registers or a block-read/write port. More... | |
uint32_t | mSize |
The maximum size available to a block read/write. More... | |
std::string | mTags |
Optional string which the user can specify. More... | |
std::string | mDescription |
Optional string which the user can specify. More... | |
std::string | mModule |
The name of the module in which the current node resides. More... | |
std::string | mClassName |
Class name used to construct the derived node type. More... | |
boost::unordered_map< std::string, std::string > | mParameters |
Additional parameters of the node. More... | |
boost::unordered_map< std::string, std::string > | mFirmwareInfo |
parameters to infer the VHDL address decoding More... | |
Node * | mParent |
The parent of the current node. More... | |
std::vector< Node * > | mChildren |
The direct children of the node. More... | |
boost::unordered_map< std::string, Node * > | mChildrenMap |
Helper to assist look-up of a particular child node, given a name. More... | |
Friends | |
class | HwInterface |
class | NodeTreeBuilder |
class | DerivedNodeFactory |
class | const_iterator |
|
protected |
|
protected |
Copy constructor.
aNode | a node to copy. |
Definition at line 73 of file Node.cpp.
References mChildren, and mChildrenMap.
|
virtual |
Node::const_iterator uhal::Node::begin | ( | ) | const |
Definition at line 174 of file Node.cpp.
References const_iterator.
Referenced by uhal::tests::checkIteration(), uhal::detail::getAddressDescription(), uhal::detail::getAddressOverlaps(), and getNodes().
|
protectedvirtual |
Node::const_iterator uhal::Node::end | ( | ) | const |
Definition at line 180 of file Node.cpp.
References const_iterator.
Referenced by uhal::tests::checkIteration(), uhal::detail::getAddressDescription(), and getNodes().
const uint32_t & uhal::Node::getAddress | ( | ) | const |
Return the register address with which this node is associated.
Definition at line 260 of file Node.cpp.
References mAddr.
Referenced by uhal::tests::checkProperties(), uhal::detail::compareNodeAddr(), uhal::detail::getAddressOverlaps(), uhal::tests::nodeAddrCompare(), operator==(), uhal::detail::printNodeOverlapDescription(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().
|
private |
Get the full path to the current node.
Definition at line 249 of file Node.cpp.
References getAncestors(), and mParent.
Referenced by getAncestors(), getPath(), and getRelativePath().
ClientInterface & uhal::Node::getClient | ( | ) | const |
const std::string & uhal::Node::getDescription | ( | ) | const |
Return the optional description string which the user can specify for the current node.
Definition at line 296 of file Node.cpp.
References mDescription.
Referenced by uhal::tests::checkProperties().
const boost::unordered_map< std::string, std::string > & uhal::Node::getFirmwareInfo | ( | ) | const |
Return parameters for inferring the VHDL address decoding.
Definition at line 314 of file Node.cpp.
References mFirmwareInfo.
Referenced by uhal::tests::checkProperties().
const std::string & uhal::Node::getId | ( | ) | const |
Return the unique ID of the current node.
Definition at line 195 of file Node.cpp.
References mUid.
Referenced by uhal::tests::checkProperties(), getNode(), and operator==().
Returns ancestry path of nodes from (but not including) aAncestor to this node.
Definition at line 681 of file Node.cpp.
References getPath(), and mParent.
Referenced by uhal::tests::checkLineage(), uhal::tests::checkNodeTree(), and uhal::detail::getAddressDescription().
const uint32_t & uhal::Node::getMask | ( | ) | const |
Return the mask to be applied if this node is a sub-field, rather than an entire register.
Definition at line 266 of file Node.cpp.
References mMask.
Referenced by uhal::tests::checkProperties(), uhal::detail::getAddressOverlaps(), operator==(), and uhal::detail::printNodeOverlapDescription().
const defs::BlockReadWriteMode & uhal::Node::getMode | ( | ) | const |
Return whether the node represents a single register, a block of registers or a block-read/write port.
Definition at line 272 of file Node.cpp.
References mMode.
Referenced by uhal::tests::checkProperties(), uhal::detail::getAddressOverlaps(), and uhal::detail::printNodeOverlapDescription().
const std::string & uhal::Node::getModule | ( | ) | const |
Return the name of the module in which the current node resides.
Definition at line 302 of file Node.cpp.
References mModule.
Referenced by uhal::tests::checkProperties().
const Node & uhal::Node::getNode | ( | const std::string & | aId | ) | const |
Retrieve the Node given by a full-stop delimeted name path relative, to the current node.
aId | a full-stop delimeted name path to a node, relative to the current node |
Definition at line 415 of file Node.cpp.
References getPath(), getRelativePath(), uhal::log(), mChildrenMap, and uhal::Quote().
Referenced by uhal::tests::checkDescendants(), uhal::tests::checkIteration(), uhal::tests::checkLineage(), uhal::tests::checkNodeTree(), and getNode().
const T & uhal::Node::getNode | ( | const std::string & | aId | ) | const |
Retrieve the Node given by a full-stop delimeted name path relative, to the current node and cast it to a particular node type.
aId | a full-stop delimeted name path to a node, relative to the current node |
Definition at line 46 of file Node.hxx.
References getId(), getNode(), uhal::log(), uhal::Quote(), and uhal::Type().
std::vector< std::string > uhal::Node::getNodes | ( | ) | const |
Return all node IDs known to this HwInterface.
Definition at line 452 of file Node.cpp.
References begin(), and end().
Referenced by uhal::tests::checkDescendants().
std::vector< std::string > uhal::Node::getNodes | ( | const std::string & | aRegex | ) | const |
Return all node IDs known to this connection manager which match a (boost) regular expression.
aRegex | a string expression which is converted to a (boost) regular expression against which the node IDs are tested |
Definition at line 466 of file Node.cpp.
References begin(), end(), uhal::Info, uhal::log(), and sort().
const boost::unordered_map< std::string, std::string > & uhal::Node::getParameters | ( | ) | const |
Return parameters of the current node.
Definition at line 308 of file Node.cpp.
References mParameters.
Referenced by uhal::tests::checkProperties(), and uhal::tests::DummyParentNode::printParameters().
std::string uhal::Node::getPath | ( | ) | const |
Return the full path to the current node.
Definition at line 201 of file Node.cpp.
References getAncestors().
Referenced by uhal::tests::checkLineage(), uhal::tests::checkProperties(), uhal::detail::getAddressDescription(), getLineage(), getNode(), uhal::detail::printNodeOverlapDescription(), read(), and write().
const defs::NodePermission & uhal::Node::getPermission | ( | ) | const |
Return the read/write access permissions of this node.
Definition at line 284 of file Node.cpp.
References mPermission.
Referenced by uhal::tests::checkProperties(), and operator==().
|
private |
const uint32_t & uhal::Node::getSize | ( | ) | const |
Return the maximum size available to a block read/write.
Definition at line 278 of file Node.cpp.
References mSize.
Referenced by uhal::tests::checkExceptionsThrownByReadWrite(), uhal::tests::checkProperties(), uhal::detail::getAddressOverlaps(), and uhal::detail::printNodeOverlapDescription().
const std::string & uhal::Node::getTags | ( | ) | const |
Return the optional tags string which the user can specify for the current node.
Definition at line 290 of file Node.cpp.
References mTags.
Referenced by uhal::tests::checkProperties().
bool uhal::Node::isChildOf | ( | const Node & | aParent | ) | const |
Returns whether this node is child of the function's argument.
Definition at line 698 of file Node.cpp.
References mParent.
Referenced by uhal::detail::getAddressOverlaps().
Assignment operator.
aNode | a Node to copy |
Definition at line 106 of file Node.cpp.
References mAddr, mChildren, mChildrenMap, mClassName, mDescription, mHw, mMask, mMode, mModule, mParameters, mPartialAddr, mPermission, mSize, mTags, and mUid.
bool uhal::Node::operator== | ( | const Node & | aNode | ) | const |
A function to determine whether two Nodes are identical.
aNode | a Node to compare |
Definition at line 186 of file Node.cpp.
References getAddress(), getId(), getMask(), and getPermission().
ValWord< uint32_t > uhal::Node::read | ( | ) | const |
Read a single, unmasked, unsigned word.
Definition at line 585 of file Node.cpp.
References uhal::HwInterface::getClient(), getPath(), uhal::log(), mAddr, mHw, mMask, mPermission, uhal::defs::NOMASK, uhal::Quote(), uhal::defs::READ, and uhal::ClientInterface::read().
Referenced by uhal::tests::checkExceptionsThrownByReadWrite(), uhal::tests::job_multiple(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().
ValVector< uint32_t > uhal::Node::readBlock | ( | const uint32_t & | aSize | ) | const |
Read a block of unsigned data from a block of registers or a block-read port.
aSize | the number of words to read |
Definition at line 606 of file Node.cpp.
References uhal::log(), uhal::Quote(), uhal::defs::READ, and uhal::defs::SINGLE.
Referenced by uhal::tests::checkExceptionsThrownByReadWrite(), uhal::tests::for(), uhal::tests::job_multiple(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().
ValVector< uint32_t > uhal::Node::readBlockOffset | ( | const uint32_t & | aSize, |
const uint32_t & | aOffset | ||
) | const |
Read a block of unsigned data from a block of registers or a block-read port.
aSize | the number of words to read |
aOffset | an offset into the block at which to start the block-read |
Definition at line 637 of file Node.cpp.
References uhal::log(), uhal::defs::NON_INCREMENTAL, uhal::Quote(), uhal::defs::READ, and uhal::defs::SINGLE.
Referenced by uhal::tests::checkExceptionsThrownByReadWrite(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().
void uhal::Node::stream | ( | std::ostream & | aStr, |
std::size_t | aIndent = 0 |
||
) | const |
A streaming helper function to create pretty, indented tree diagrams.
aStr | a stream to write to |
aIndent | size of the indentation |
Definition at line 320 of file Node.cpp.
References uhal::dec, uhal::hex, uhal::defs::HIERARCHICAL, uhal::defs::INCREMENTAL, mAddr, mChildren, mClassName, mDescription, mMask, mMode, mModule, mParameters, mPermission, mSize, mTags, mUid, uhal::defs::NON_INCREMENTAL, uhal::defs::READ, uhal::defs::SINGLE, and uhal::defs::WRITE.
Referenced by uhal::operator<<().
ValHeader uhal::Node::write | ( | const uint32_t & | aValue | ) | const |
Write a single, unmasked word to a register.
aValue | the value to write to the register |
Definition at line 490 of file Node.cpp.
References uhal::HwInterface::getClient(), getPath(), uhal::log(), mAddr, mHw, mMask, mPermission, uhal::defs::NOMASK, uhal::Quote(), uhal::defs::READ, uhal::defs::WRITE, and uhal::ClientInterface::write().
Referenced by uhal::tests::checkExceptionsThrownByReadWrite(), uhal::tests::job_multiple(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().
ValHeader uhal::Node::writeBlock | ( | const std::vector< uint32_t > & | aValues | ) | const |
Write a block of data to a block of registers or a block-write port.
aValues | the values to write to the registers or a block-write port |
Definition at line 516 of file Node.cpp.
References uhal::log(), uhal::Quote(), uhal::defs::SINGLE, and uhal::defs::WRITE.
Referenced by uhal::tests::checkExceptionsThrownByReadWrite(), uhal::tests::for(), uhal::tests::job_multiple(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().
ValHeader uhal::Node::writeBlockOffset | ( | const std::vector< uint32_t > & | aValues, |
const uint32_t & | aOffset | ||
) | const |
Write a block of data to a block of registers or a block-write port.
aValues | the values to write to the registers or a block-write port |
aOffset | an offset into the block at which to start the block-write |
Definition at line 547 of file Node.cpp.
References uhal::log(), uhal::defs::NON_INCREMENTAL, uhal::Quote(), uhal::defs::SINGLE, and uhal::defs::WRITE.
Referenced by uhal::tests::checkExceptionsThrownByReadWrite(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
The register address with which this node is associated.
Definition at line 342 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), getAddress(), operator=(), read(), stream(), and write().
|
private |
The direct children of the node.
Definition at line 375 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::addChildren(), uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), uhal::HwInterface::claimNode(), Node(), operator=(), stream(), and ~Node().
|
private |
Helper to assist look-up of a particular child node, given a name.
Definition at line 378 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::addChildren(), getNode(), Node(), operator=(), and ~Node().
|
private |
Class name used to construct the derived node type.
Definition at line 363 of file Node.hpp.
Referenced by uhal::DerivedNodeFactory::convertToClassType(), uhal::NodeTreeBuilder::moduleNodeCreator(), operator=(), uhal::NodeTreeBuilder::plainNodeCreator(), uhal::NodeTreeBuilder::setClassName(), and stream().
|
private |
Optional string which the user can specify.
Definition at line 357 of file Node.hpp.
Referenced by getDescription(), operator=(), uhal::NodeTreeBuilder::setDescription(), and stream().
|
private |
parameters to infer the VHDL address decoding
Definition at line 369 of file Node.hpp.
Referenced by getFirmwareInfo(), and uhal::NodeTreeBuilder::setFirmwareInfo().
|
private |
The parent hardware interface of which this node is a child (or rather decendent)
Definition at line 334 of file Node.hpp.
Referenced by uhal::HwInterface::claimNode(), getClient(), operator=(), read(), and write().
|
private |
The mask to be applied if this node is a sub-field, rather than an entire register.
Definition at line 345 of file Node.hpp.
Referenced by getMask(), operator=(), read(), uhal::NodeTreeBuilder::setMask(), stream(), and write().
|
private |
Whether the node represents a single register, a block of registers or a block-read/write port.
Definition at line 349 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::addChildren(), uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), getMode(), operator=(), uhal::NodeTreeBuilder::setModeAndSize(), and stream().
|
private |
The name of the module in which the current node resides.
Definition at line 360 of file Node.hpp.
Referenced by getModule(), operator=(), uhal::NodeTreeBuilder::setModule(), and stream().
|
private |
Additional parameters of the node.
Definition at line 366 of file Node.hpp.
Referenced by getParameters(), operator=(), uhal::NodeTreeBuilder::setPars(), and stream().
|
private |
The parent of the current node.
Definition at line 372 of file Node.hpp.
Referenced by getAncestors(), getLineage(), and isChildOf().
|
private |
The register address with which this node is associated.
Definition at line 340 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), operator=(), and uhal::NodeTreeBuilder::setAddr().
|
private |
The read/write access permissions of this node.
Definition at line 347 of file Node.hpp.
Referenced by getPermission(), operator=(), read(), uhal::NodeTreeBuilder::setPermissions(), stream(), and write().
|
private |
The maximum size available to a block read/write.
Definition at line 351 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), getSize(), operator=(), uhal::NodeTreeBuilder::setModeAndSize(), and stream().
|
private |
Optional string which the user can specify.
Definition at line 354 of file Node.hpp.
Referenced by getTags(), operator=(), uhal::NodeTreeBuilder::setTags(), and stream().
|
private |
The Unique ID of this node.
Definition at line 337 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::addChildren(), uhal::NodeTreeBuilder::bitmaskNodeCreator(), getId(), uhal::NodeTreeBuilder::moduleNodeCreator(), operator=(), uhal::NodeTreeBuilder::plainNodeCreator(), uhal::NodeTreeBuilder::setModeAndSize(), uhal::NodeTreeBuilder::setPermissions(), uhal::NodeTreeBuilder::setUid(), and stream().