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... | |
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 | |
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::deque< 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 86 of file Node.cpp.
References mChildren, and mChildrenMap.
|
virtual |
Node::const_iterator uhal::Node::begin | ( | ) | const |
Definition at line 199 of file Node.cpp.
Referenced by uhal::tests::iteration().
|
protectedvirtual |
Node::const_iterator uhal::Node::end | ( | ) | const |
Definition at line 206 of file Node.cpp.
Referenced by uhal::tests::iteration().
const uint32_t & uhal::Node::getAddress | ( | ) | const |
Return the register address with which this node is associated.
Definition at line 261 of file Node.cpp.
References mAddr.
Referenced by uhal::tests::for(), and operator==().
|
private |
Get the full path to the current node.
Definition at line 250 of file Node.cpp.
References getAncestors(), and mParent.
Referenced by getAncestors(), and getPath().
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 293 of file Node.cpp.
References mDescription.
const boost::unordered_map< std::string, std::string > & uhal::Node::getFirmwareInfo | ( | ) | const |
Return parameters for inferring the VHDL address decoding.
Definition at line 309 of file Node.cpp.
References mFirmwareInfo.
const std::string & uhal::Node::getId | ( | ) | const |
Return the unique ID of the current node.
Definition at line 221 of file Node.cpp.
References mUid.
Referenced by getNode(), and operator==().
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 operator==().
const defs::BlockReadWriteMode & uhal::Node::getMode | ( | ) | const |
const std::string & uhal::Node::getModule | ( | ) | const |
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 408 of file Node.cpp.
References uhal::Error, getPath(), mChildrenMap, and uhal::Quote().
Referenced by 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::Quote(), and uhal::Type().
std::vector< std::string > uhal::Node::getNodes | ( | ) | const |
Return all node IDs known to this HwInterface.
Definition at line 459 of file Node.cpp.
References mChildrenMap.
Referenced by uhal::tests::iteration().
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 472 of file Node.cpp.
References uhal::Info, and mChildrenMap.
const boost::unordered_map< std::string, std::string > & uhal::Node::getParameters | ( | ) | const |
Return parameters of the current node.
Definition at line 304 of file Node.cpp.
References mParameters.
Referenced by uhal::tests::DummyParentNode::printParameters().
std::string uhal::Node::getPath | ( | ) | const |
Return the full path to the current node.
Definition at line 226 of file Node.cpp.
References getAncestors().
Referenced by getNode(), read(), readBlock(), readBlockOffset(), write(), writeBlock(), and writeBlockOffset().
const defs::NodePermission & uhal::Node::getPermission | ( | ) | const |
Return the read/write access permissions of this node.
Definition at line 281 of file Node.cpp.
References mPermission.
Referenced by operator==().
const uint32_t & uhal::Node::getSize | ( | ) | const |
const std::string & uhal::Node::getTags | ( | ) | const |
Assignment operator.
aNode | a Node to copy |
Definition at line 125 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 212 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 589 of file Node.cpp.
References uhal::HwInterface::getClient(), getPath(), mAddr, mHw, mMask, mPermission, uhal::defs::NOMASK, uhal::Quote(), uhal::defs::READ, and uhal::ClientInterface::read().
Referenced by uhal::tests::job_multiple(), uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(), and uhal::PCIe::write().
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 610 of file Node.cpp.
References uhal::HwInterface::getClient(), getPath(), mAddr, mHw, mMode, mPermission, mSize, uhal::Quote(), uhal::defs::READ, uhal::ClientInterface::readBlock(), and uhal::defs::SINGLE.
Referenced by uhal::tests::for(), uhal::tests::getBlockUnitTestDepths(), 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 641 of file Node.cpp.
References uhal::HwInterface::getClient(), getPath(), mAddr, mHw, mMode, mPermission, mSize, uhal::defs::NON_INCREMENTAL, uhal::Quote(), uhal::defs::READ, uhal::ClientInterface::readBlock(), and uhal::defs::SINGLE.
Referenced by uhal::tests::for().
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 314 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 494 of file Node.cpp.
References uhal::HwInterface::getClient(), getPath(), mAddr, mHw, mMask, mPermission, uhal::defs::NOMASK, uhal::Quote(), uhal::defs::READ, uhal::defs::WRITE, and uhal::ClientInterface::write().
Referenced by uhal::PCIe::implementDispatch(), 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 520 of file Node.cpp.
References uhal::HwInterface::getClient(), getPath(), mAddr, mHw, mMode, mPermission, mSize, uhal::Quote(), uhal::defs::SINGLE, uhal::defs::WRITE, and uhal::ClientInterface::writeBlock().
Referenced by uhal::tests::for(), uhal::tests::getBlockUnitTestDepths(), 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 551 of file Node.cpp.
References uhal::HwInterface::getClient(), getPath(), mAddr, mHw, mMode, mPermission, mSize, uhal::defs::NON_INCREMENTAL, uhal::Quote(), uhal::defs::SINGLE, uhal::defs::WRITE, and uhal::ClientInterface::writeBlock().
Referenced by uhal::tests::for().
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
The register address with which this node is associated.
Definition at line 345 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), uhal::NodeTreeBuilder::checkForAddressCollisions(), getAddress(), uhal::NodeTreeBuilder::NodePtrCompare(), operator=(), read(), readBlock(), readBlockOffset(), stream(), write(), writeBlock(), and writeBlockOffset().
|
private |
The direct children of the node.
Definition at line 378 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::addChildren(), uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), uhal::NodeTreeBuilder::checkForAddressCollisions(), uhal::HwInterface::claimNode(), uhal::Node::const_iterator::next(), Node(), operator=(), stream(), and ~Node().
|
private |
Helper to assist look-up of a particular child node, given a name.
Definition at line 381 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::addChildren(), uhal::NodeTreeBuilder::checkForAddressCollisions(), getNode(), getNodes(), Node(), operator=(), and ~Node().
|
private |
Class name used to construct the derived node type.
Definition at line 366 of file Node.hpp.
Referenced by uhal::DerivedNodeFactory::convertToClassType(), operator=(), uhal::NodeTreeBuilder::plainNodeCreator(), uhal::NodeTreeBuilder::setClassName(), and stream().
|
private |
Optional string which the user can specify.
Definition at line 360 of file Node.hpp.
Referenced by getDescription(), operator=(), uhal::NodeTreeBuilder::setDescription(), and stream().
|
private |
parameters to infer the VHDL address decoding
Definition at line 372 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 337 of file Node.hpp.
Referenced by uhal::HwInterface::claimNode(), getClient(), operator=(), read(), readBlock(), readBlockOffset(), write(), writeBlock(), and writeBlockOffset().
|
private |
The mask to be applied if this node is a sub-field, rather than an entire register.
Definition at line 348 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::checkForAddressCollisions(), 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 352 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::addChildren(), uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), uhal::NodeTreeBuilder::checkForAddressCollisions(), getMode(), operator=(), readBlock(), readBlockOffset(), uhal::NodeTreeBuilder::setModeAndSize(), stream(), writeBlock(), and writeBlockOffset().
|
private |
The name of the module in which the current node resides.
Definition at line 363 of file Node.hpp.
Referenced by getModule(), operator=(), uhal::NodeTreeBuilder::setModule(), and stream().
|
private |
Additional parameters of the node.
Definition at line 369 of file Node.hpp.
Referenced by getParameters(), operator=(), uhal::NodeTreeBuilder::setPars(), and stream().
|
private |
The parent of the current node.
Definition at line 375 of file Node.hpp.
Referenced by getAncestors().
|
private |
The register address with which this node is associated.
Definition at line 343 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 350 of file Node.hpp.
Referenced by getPermission(), operator=(), read(), readBlock(), readBlockOffset(), uhal::NodeTreeBuilder::setPermissions(), stream(), write(), writeBlock(), and writeBlockOffset().
|
private |
The maximum size available to a block read/write.
Definition at line 354 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::calculateHierarchicalAddresses(), uhal::NodeTreeBuilder::checkForAddressCollisions(), getSize(), operator=(), readBlock(), readBlockOffset(), uhal::NodeTreeBuilder::setModeAndSize(), stream(), writeBlock(), and writeBlockOffset().
|
private |
Optional string which the user can specify.
Definition at line 357 of file Node.hpp.
Referenced by getTags(), operator=(), uhal::NodeTreeBuilder::setTags(), and stream().
|
private |
The Unique ID of this node.
Definition at line 340 of file Node.hpp.
Referenced by uhal::NodeTreeBuilder::addChildren(), uhal::NodeTreeBuilder::bitmaskNodeCreator(), getId(), operator=(), uhal::NodeTreeBuilder::plainNodeCreator(), uhal::NodeTreeBuilder::setModeAndSize(), uhal::NodeTreeBuilder::setUid(), and stream().