μHAL (v2.7.9)
Part of the IPbus software repository
Public Member Functions | Private Member Functions | Private Attributes | List of all members
uhal::HwInterface Class Reference

A class which bundles a node tree and an IPbus client interface together providing everything you need to navigate and perform hardware access. More...

#include <uhal/HwInterface.hpp>

Collaboration diagram for uhal::HwInterface:
[legend]

Public Member Functions

 HwInterface (const boost::shared_ptr< ClientInterface > &aClientInterface, const boost::shared_ptr< Node > &aNode)
 Constructor. More...
 
 HwInterface (const HwInterface &)
 Copy Constructor Calls the copy constructor on the ClientInterface Calls the clone method on the Node Tree. More...
 
virtual ~HwInterface ()
 Destructor. More...
 
ClientInterfacegetClient ()
 Get the underlying IPbus client. More...
 
const std::string & uri () const
 Return the url of the target for this client. More...
 
const std::string & id () const
 Return the identifier of the target for this client. More...
 
void dispatch ()
 Make the IPbus client issue a dispatch. More...
 
void setTimeoutPeriod (const uint32_t &aTimeoutPeriod)
 A method to modify the timeout period for any pending or future transactions. More...
 
uint32_t getTimeoutPeriod ()
 A method to retrieve the timeout period currently being used. More...
 
const NodegetNode () const
 Retrieve the top-level node. More...
 
const NodegetNode (const std::string &aId) const
 Retrieve the Node given by a full-stop delimeted name path relative, to the top-level 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...
 

Private Member Functions

void claimNode (Node &aNode)
 A function which sets the HwInterface pointer in the Node to point to this HwInterface. More...
 

Private Attributes

boost::shared_ptr< ClientInterfacemClientInterface
 A shared pointer to the IPbus client through which the transactions will be sent. More...
 
boost::shared_ptr< NodemNode
 A node tree. More...
 

Detailed Description

A class which bundles a node tree and an IPbus client interface together providing everything you need to navigate and perform hardware access.

Definition at line 60 of file HwInterface.hpp.

Constructor & Destructor Documentation

◆ HwInterface() [1/2]

uhal::HwInterface::HwInterface ( const boost::shared_ptr< ClientInterface > &  aClientInterface,
const boost::shared_ptr< Node > &  aNode 
)

Constructor.

Parameters
aClientInterfacea shared pointer to a client interface which performs the transport
aNodea shared pointer to a >>freshly cloned<< node representing the >>full<< endpoint structure

Definition at line 49 of file HwInterface.cpp.

References claimNode(), mClientInterface, and mNode.

◆ HwInterface() [2/2]

uhal::HwInterface::HwInterface ( const HwInterface otherHw)

Copy Constructor Calls the copy constructor on the ClientInterface Calls the clone method on the Node Tree.

Parameters
hwInterfacea Hardware Interface instance to copy

Definition at line 58 of file HwInterface.cpp.

References claimNode(), mClientInterface, and mNode.

◆ ~HwInterface()

uhal::HwInterface::~HwInterface ( )
virtual

Destructor.

Definition at line 67 of file HwInterface.cpp.

Member Function Documentation

◆ claimNode()

void uhal::HwInterface::claimNode ( Node aNode)
private

A function which sets the HwInterface pointer in the Node to point to this HwInterface.

Parameters
aNodea Node that is to be claimed

Definition at line 72 of file HwInterface.cpp.

References uhal::Node::mChildren, and uhal::Node::mHw.

Referenced by HwInterface().

◆ dispatch()

void uhal::HwInterface::dispatch ( )

◆ getClient()

ClientInterface & uhal::HwInterface::getClient ( )

◆ getNode() [1/3]

const Node & uhal::HwInterface::getNode ( ) const

Retrieve the top-level node.

Returns
the top-level node

Definition at line 135 of file HwInterface.cpp.

References mNode.

Referenced by uhal::tests::for(), uhal::tests::job_multiple(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().

◆ getNode() [2/3]

const Node & uhal::HwInterface::getNode ( const std::string &  aId) const

Retrieve the Node given by a full-stop delimeted name path relative, to the top-level node.

Parameters
aIda full-stop delimeted name path to a node, relative to the top-level node
Returns
the Node given by the identifier

Definition at line 141 of file HwInterface.cpp.

References mNode.

◆ getNode() [3/3]

template<typename T >
const T & uhal::HwInterface::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.

Parameters
aIda full-stop delimeted name path to a node, relative to the current node
Returns
the Node given by the identifier

Definition at line 39 of file HwInterface.hxx.

References mNode.

◆ getNodes() [1/2]

std::vector< std::string > uhal::HwInterface::getNodes ( ) const

Return all node IDs known to this HwInterface.

Returns
all node IDs known to this HwInterface

Definition at line 147 of file HwInterface.cpp.

References mNode.

◆ getNodes() [2/2]

std::vector< std::string > uhal::HwInterface::getNodes ( const std::string &  aRegex) const

Return all node IDs known to this connection manager which match a (boost) regular expression.

Parameters
aRegexa string expression which is converted to a (boost) regular expression against which the node IDs are tested
Returns
all node IDs known to this connection manager

Definition at line 153 of file HwInterface.cpp.

References mNode.

◆ getTimeoutPeriod()

uint32_t uhal::HwInterface::getTimeoutPeriod ( )

A method to retrieve the timeout period currently being used.

Returns
the timeout period currently being used in milliseconds

Definition at line 130 of file HwInterface.cpp.

References mClientInterface.

◆ id()

const std::string & uhal::HwInterface::id ( ) const

Return the identifier of the target for this client.

Returns
the identifier of the target for this client

Definition at line 112 of file HwInterface.cpp.

References mClientInterface.

◆ setTimeoutPeriod()

void uhal::HwInterface::setTimeoutPeriod ( const uint32_t &  aTimeoutPeriod)

A method to modify the timeout period for any pending or future transactions.

Parameters
aTimeoutPeriodthe desired timeout period in milliseconds

Definition at line 124 of file HwInterface.cpp.

References mClientInterface.

Referenced by uhal::tests::MinimalFixture< type >::getHwInterface(), uhal::tests::MinimalFixture< IPBUS_2_0_PCIE >::getHwInterface(), and uhal::tests::job_multiple().

◆ uri()

const std::string & uhal::HwInterface::uri ( ) const

Return the url of the target for this client.

Returns
the url of the target for this client

Definition at line 118 of file HwInterface.cpp.

References mClientInterface.

Referenced by uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().

Member Data Documentation

◆ mClientInterface

boost::shared_ptr<ClientInterface> uhal::HwInterface::mClientInterface
private

A shared pointer to the IPbus client through which the transactions will be sent.

Definition at line 162 of file HwInterface.hpp.

Referenced by dispatch(), getClient(), getTimeoutPeriod(), HwInterface(), id(), setTimeoutPeriod(), and uri().

◆ mNode

boost::shared_ptr<Node> uhal::HwInterface::mNode
private

A node tree.

Definition at line 165 of file HwInterface.hpp.

Referenced by getNode(), getNodes(), and HwInterface().


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