μHAL (v2.7.9)
Part of the IPbus software repository
fixtures.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  Andrew Rose, Imperial College, London
24  email: awr01 <AT> imperial.ac.uk
25 
26  Tom Williams, Rutherford Appleton Laboratory, Oxfordshire
27  email: tom.williams <AT> cern.ch
28 
29 ---------------------------------------------------------------------------
30 */
31 
32 #ifndef _uhal_tests_fixtures_hpp_
33 #define _uhal_tests_fixtures_hpp_
34 
35 
36 #include <stdint.h>
37 #include <string>
38 
40 #include "uhal/HwInterface.hpp"
42 #include "uhal/tests/tools.hpp"
43 
44 
45 namespace uhal {
46 namespace tests {
47 
49 protected:
51  virtual ~AbstractFixture() {}
52 
53  static std::string getAddressFileURI();
54 
55 public:
56  static std::string connectionFileURI;
57  // HW client timeout in milliseconds
58  static size_t timeout;
59  static bool quickTest;
60 };
61 
62 
63 
64 template <DeviceType type> struct MinimalFixture;
65 
66 
67 template <DeviceType type>
68 struct MinimalFixture : public AbstractFixture {
70  virtual ~MinimalFixture();
71 
73 
74  static const DeviceType deviceType;
75 
76 protected:
77  uint16_t devicePort;
78  std::string deviceId;
79 };
80 
81 
82 template <>
84  MinimalFixture();
86 
88 
89  static const DeviceType deviceType;
90  std::string hardwareToClientFile;
91  std::string clientToHardwareFile;
92  std::string deviceId;
93 };
94 
95 template <DeviceType type>
97 
98 template <>
100 
101 template <>
103 
104 template <>
106 
107 template <>
109 
110 template <>
112 
113 template <>
115 
116 
117 template <DeviceType type>
119 {
120 }
121 
122 template <DeviceType type>
124 {
125  ConnectionManager manager(connectionFileURI);
126  HwInterface hw(manager.getDevice(deviceId));
127  hw.setTimeoutPeriod(timeout);
128  return hw;
129 }
130 
131 
132 
133 
134 template <DeviceType type>
135 struct DummyHardwareFixture : public MinimalFixture<type> {
138 
140 };
141 
142 
143 template <>
145 
146 template <>
148 
149 template <>
151 
152 template <>
154 
155 template <>
157 
158 template <>
160 
161 template <>
163 
164 
165 } // end ns tests
166 } // end ns uhal
167 
168 
169 #endif
tools.hpp
uhal::HwInterface
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
Definition: HwInterface.hpp:61
uhal::tests::MinimalFixture< IPBUS_2_0_PCIE >::deviceId
std::string deviceId
Definition: fixtures.hpp:92
uhal::ConnectionManager::getDevice
HwInterface getDevice(const std::string &aId)
Retrieves protocol, host, and port from the connection file to create an IPbus Client Retrieves the a...
Definition: ConnectionManager.cpp:140
uhal::tests::DummyHardwareFixture::hwRunner
DummyHardwareRunner hwRunner
Definition: fixtures.hpp:139
uhal::tests::DummyHardwareFixture::~DummyHardwareFixture
~DummyHardwareFixture()
Definition: fixtures.hpp:137
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
uhal::tests::DeviceType
DeviceType
Definition: definitions.hpp:39
uhal::tests::AbstractFixture::connectionFileURI
static std::string connectionFileURI
Definition: fixtures.hpp:56
uhal::tests::IPBUS_2_0_PCIE
@ IPBUS_2_0_PCIE
Definition: definitions.hpp:46
uhal::tests::DummyHardwareFixture::DummyHardwareFixture
DummyHardwareFixture()
uhal::tests::AbstractFixture::timeout
static size_t timeout
Definition: fixtures.hpp:58
uhal::tests::MinimalFixture::getHwInterface
uhal::HwInterface getHwInterface() const
Definition: fixtures.hpp:123
definitions.hpp
uhal
Definition: HttpResponseGrammar.hpp:49
uhal::tests::MinimalFixture::~MinimalFixture
virtual ~MinimalFixture()
Definition: fixtures.hpp:118
uhal::tests::hw
HwInterface hw
Definition: test_rawclient.cpp:93
uhal::tests::DummyHardwareRunner
Definition: tools.hpp:59
uhal::tests::MinimalFixture::devicePort
uint16_t devicePort
Definition: fixtures.hpp:77
uhal::tests::AbstractFixture
Definition: fixtures.hpp:48
uhal::tests::MinimalFixture::MinimalFixture
MinimalFixture()
uhal::tests::MinimalFixture< IPBUS_2_0_PCIE >::deviceType
static const DeviceType deviceType
Definition: fixtures.hpp:89
uhal::tests::DummyHardwareFixture
Definition: fixtures.hpp:135
uhal::tests::MinimalFixture< IPBUS_2_0_PCIE >::hardwareToClientFile
std::string hardwareToClientFile
Definition: fixtures.hpp:90
HwInterface.hpp
uhal::ConnectionManager
A class to open and manage XML connection files and wrap up the interfaces to the NodeTreeBuilder and...
Definition: ConnectionManager.hpp:79
uhal::tests::AbstractFixture::AbstractFixture
AbstractFixture()
Definition: fixtures.hpp:50
uhal::tests::AbstractFixture::~AbstractFixture
virtual ~AbstractFixture()
Definition: fixtures.hpp:51
uhal::tests::MinimalFixture< IPBUS_2_0_PCIE >::clientToHardwareFile
std::string clientToHardwareFile
Definition: fixtures.hpp:91
uhal::tests::MinimalFixture::deviceId
std::string deviceId
Definition: fixtures.hpp:78
ConnectionManager.hpp
uhal::tests::MinimalFixture::deviceType
static const DeviceType deviceType
Definition: fixtures.hpp:74
uhal::tests::AbstractFixture::quickTest
static bool quickTest
Definition: fixtures.hpp:59
uhal::tests::MinimalFixture
Definition: fixtures.hpp:64
uhal::tests::AbstractFixture::getAddressFileURI
static std::string getAddressFileURI()
Definition: fixtures.cpp:18