μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
HwInterface.hpp
Go to the documentation of this file.
1/*
2---------------------------------------------------------------------------
3
4 This file is part of uHAL.
5
6 uHAL is a hardware access library and programming framework
7 originally developed for upgrades of the Level-1 trigger of the CMS
8 experiment at CERN.
9
10 uHAL is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 uHAL is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with uHAL. If not, see <http://www.gnu.org/licenses/>.
22
23
24 Andrew Rose, Imperial College, London
25 email: awr01 <AT> imperial.ac.uk
26
27 Marc Magrans de Abril, CERN
28 email: marc.magrans.de.abril <AT> cern.ch
29
30---------------------------------------------------------------------------
31*/
32
39#ifndef _uhal_HwInterface_hpp_
40#define _uhal_HwInterface_hpp_
41
42
43#include <memory>
44#include <stdint.h>
45#include <string>
46#include <vector>
47
48#include "uhal/ClientInterface.hpp" // IWYU pragma: keep
49#include "uhal/Node.hpp" // IWYU pragma: keep
50
51
52namespace uhal
53{
56 {
57 public:
63 HwInterface ( const std::shared_ptr<ClientInterface>& aClientInterface , const std::shared_ptr< Node >& aNode );
64
71 HwInterface ( const HwInterface& );
72
74 virtual ~HwInterface();
75
81
86 const std::string& uri() const;
87
92 const std::string& id() const;
93
94
96 void dispatch ();
97
102 void setTimeoutPeriod ( const uint32_t& aTimeoutPeriod );
103
108 uint32_t getTimeoutPeriod();
109
110 // /**
111 // Ping the target for this client
112 // */
113 // void ping();
114
119 const Node& getNode () const;
120
121 bool hasNode ( const std::string& aId ) const;
122
128 const Node& getNode ( const std::string& aId ) const;
129
135 template< typename T>
136 const T& getNode ( const std::string& aId ) const;
137
142 std::vector<std::string> getNodes() const;
143
149 std::vector<std::string> getNodes ( const std::string& aRegex ) const;
150
151 private:
156 void claimNode ( Node& aNode );
157
159 std::shared_ptr<ClientInterface> mClientInterface;
160
162 std::shared_ptr<Node> mNode;
163 };
164
165}
166
168
169#endif
An abstract base class for defining the interface to the various IPbus clients as well as providing t...
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
Definition: HwInterface.hpp:56
std::vector< std::string > getNodes() const
Return all node IDs known to this HwInterface.
std::shared_ptr< ClientInterface > mClientInterface
A shared pointer to the IPbus client through which the transactions will be sent.
std::shared_ptr< Node > mNode
A node tree.
const Node & getNode() const
Retrieve the top-level node.
virtual ~HwInterface()
Destructor.
Definition: HwInterface.cpp:64
const std::string & id() const
Return the identifier of the target for this client.
void claimNode(Node &aNode)
A function which sets the HwInterface pointer in the Node to point to this HwInterface.
Definition: HwInterface.cpp:69
void dispatch()
Make the IPbus client issue a dispatch.
ClientInterface & getClient()
Get the underlying IPbus client.
Definition: HwInterface.cpp:78
bool hasNode(const std::string &aId) const
uint32_t getTimeoutPeriod()
A method to retrieve the timeout period currently being used.
const std::string & uri() const
Return the url of the target for this client.
void setTimeoutPeriod(const uint32_t &aTimeoutPeriod)
A method to modify the timeout period for any pending or future transactions.
A heirarchical node for navigating heirarchical firmwares.
Definition: Node.hpp:85