μHAL (v2.7.9)
Part of the IPbus software repository
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 <stdint.h>
44 #include <string>
45 #include <vector>
46 
47 #include <boost/shared_ptr.hpp>
48 
49 #include "uhal/ClientInterface.hpp" // IWYU pragma: keep
50 #include "uhal/Node.hpp" // IWYU pragma: keep
51 
52 
53 namespace boost {
54  template <class Y> class shared_ptr;
55 }
56 
57 namespace uhal
58 {
61  {
62  public:
68  HwInterface ( const boost::shared_ptr<ClientInterface>& aClientInterface , const boost::shared_ptr< Node >& aNode );
69 
76  HwInterface ( const HwInterface& );
77 
79  virtual ~HwInterface();
80 
86 
91  const std::string& uri() const;
92 
97  const std::string& id() const;
98 
99 
101  void dispatch ();
102 
107  void setTimeoutPeriod ( const uint32_t& aTimeoutPeriod );
108 
113  uint32_t getTimeoutPeriod();
114 
115  // /**
116  // Ping the target for this client
117  // */
118  // void ping();
119 
124  const Node& getNode () const;
125 
131  const Node& getNode ( const std::string& aId ) const;
132 
138  template< typename T>
139  const T& getNode ( const std::string& aId ) const;
140 
145  std::vector<std::string> getNodes() const;
146 
152  std::vector<std::string> getNodes ( const std::string& aRegex ) const;
153 
154  private:
159  void claimNode ( Node& aNode );
160 
163 
166  };
167 
168 }
169 
171 
172 #endif
uhal::HwInterface
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
Definition: HwInterface.hpp:61
HwInterface.hxx
boost::shared_ptr
Definition: DerivedNodeFactory.hpp:52
uhal::HwInterface::setTimeoutPeriod
void setTimeoutPeriod(const uint32_t &aTimeoutPeriod)
A method to modify the timeout period for any pending or future transactions.
Definition: HwInterface.cpp:124
Node.hpp
uhal::HwInterface::mClientInterface
boost::shared_ptr< ClientInterface > mClientInterface
A shared pointer to the IPbus client through which the transactions will be sent.
Definition: HwInterface.hpp:162
uhal::ClientInterface
An abstract base class for defining the interface to the various IPbus clients as well as providing t...
Definition: ClientInterface.hpp:100
boost
Definition: log.hpp:13
uhal::HwInterface::id
const std::string & id() const
Return the identifier of the target for this client.
Definition: HwInterface.cpp:112
uhal::HwInterface::HwInterface
HwInterface(const boost::shared_ptr< ClientInterface > &aClientInterface, const boost::shared_ptr< Node > &aNode)
Constructor.
Definition: HwInterface.cpp:49
uhal::HwInterface::dispatch
void dispatch()
Make the IPbus client issue a dispatch.
Definition: HwInterface.cpp:106
uhal::HwInterface::claimNode
void claimNode(Node &aNode)
A function which sets the HwInterface pointer in the Node to point to this HwInterface.
Definition: HwInterface.cpp:72
uhal
Definition: HttpResponseGrammar.hpp:49
uhal::HwInterface::mNode
boost::shared_ptr< Node > mNode
A node tree.
Definition: HwInterface.hpp:165
uhal::Node
A heirarchical node for navigating heirarchical firmwares.
Definition: Node.hpp:86
uhal::HwInterface::getTimeoutPeriod
uint32_t getTimeoutPeriod()
A method to retrieve the timeout period currently being used.
Definition: HwInterface.cpp:130
uhal::HwInterface::~HwInterface
virtual ~HwInterface()
Destructor.
Definition: HwInterface.cpp:67
uhal::HwInterface::getClient
ClientInterface & getClient()
Get the underlying IPbus client.
Definition: HwInterface.cpp:83
uhal::HwInterface::uri
const std::string & uri() const
Return the url of the target for this client.
Definition: HwInterface.cpp:118
uhal::HwInterface::getNodes
std::vector< std::string > getNodes() const
Return all node IDs known to this HwInterface.
Definition: HwInterface.cpp:147
uhal::HwInterface::getNode
const Node & getNode() const
Retrieve the top-level node.
Definition: HwInterface.cpp:135
ClientInterface.hpp