μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DummyHardwareTcp.cxx
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 Marc Magrans de Abril, CERN
24 email: marc.magrans.de.abril <AT> cern.ch
25
26 Andrew Rose, Imperial College, London
27 email: awr01 <AT> imperial.ac.uk
28
29---------------------------------------------------------------------------
30*/
31
32
35
36
37using namespace uhal;
38using namespace uhal::tests;
39
40int main ( int argc, char* argv[] )
41{
43
44 if ( lOptions.version == 1 )
45 {
46 TCPDummyHardware<1,3> lDummyHardware ( lOptions.port , lOptions.delay , false );
47
48 while ( true ) //Is this necessary with the nested "while(true)"'s in the run function?
49 {
50 lDummyHardware.run();
51 }
52 }
53 else if ( lOptions.version == 2 )
54 {
55 TCPDummyHardware<2,0> lDummyHardware ( lOptions.port , lOptions.delay, lOptions.bigendian );
56
57 while ( true ) //Is this necessary with the nested "while(true)"'s in the run function?
58 {
59 lDummyHardware.run();
60 }
61 }
62 else
63 {
64 log ( Error() , "Unknown IPbus version, " , Integer ( lOptions.version ) );
65 return 1;
66 }
67
68 return 0;
69}
int main(int argc, char *argv[])
Concrete implementation of emulator of hardware using TCP.
void run()
Concrete implementation of the run function Starts the TCP server and runs indefinitely,...
_Integer< T, IntFmt<> > Integer(const T &aT)
Forward declare a function which creates an instance of the ultra-lightweight wrapper from an integer...
ErrorLevel Error
Definition: LogLevels.cpp:61
void log(FatalLevel &aFatal, const T0 &aArg0)
Function to add a log entry at Fatal level.
Definition: log.hxx:18
Struct to store the dummy hardware command line options.
uint16_t port
The port used by the dummy hardware.
uint32_t version
IPbus version number - 1 or 2.
static DummyHardwareOptions parseFromCommandLine(int argc, char *argv[])
Static function to parse the command line arguments into a struct containing the information.
uint32_t delay
The delay in seconds between the request and response of the first IPbus transaction.
bool bigendian
Whether we use the big-endian hack.