μHAL (v2.7.9)
Part of the IPbus software repository
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 
37 using namespace uhal;
38 using namespace uhal::tests;
39 
40 int 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 }
uhal::tests
Definition: definitions.hpp:37
uhal::tests::DummyHardwareOptions
Struct to store the dummy hardware command line options.
Definition: DummyHardwareOptions.hpp:50
uhal::tests::DummyHardwareOptions::delay
uint32_t delay
The delay in seconds between the request and response of the first IPbus transaction.
Definition: DummyHardwareOptions.hpp:52
uhal::tests::DummyHardwareOptions::parseFromCommandLine
static DummyHardwareOptions parseFromCommandLine(int argc, char *argv[])
Static function to parse the command line arguments into a struct containing the information.
Definition: DummyHardwareOptions.hpp:76
TCPDummyHardware.hpp
uhal
Definition: HttpResponseGrammar.hpp:49
uhal::tests::TCPDummyHardware
Concrete implementation of emulator of hardware using TCP.
Definition: TCPDummyHardware.hpp:47
uhal::tests::DummyHardwareOptions::bigendian
bool bigendian
Whether we use the big-endian hack.
Definition: DummyHardwareOptions.hpp:56
uhal::log
void log(FatalLevel &aFatal, const T0 &aArg0)
Function to add a log entry at Fatal level.
Definition: log.hxx:20
uhal::Integer
_Integer< T, IntFmt<> > Integer(const T &aT)
Forward declare a function which creates an instance of the ultra-lightweight wrapper from an integer...
Definition: log_inserters.integer.hxx:43
uhal::Error
ErrorLevel Error
Definition: LogLevels.cpp:61
uhal::tests::TCPDummyHardware::run
void run()
Concrete implementation of the run function Starts the TCP server and runs indefinitely,...
Definition: TCPDummyHardware.cpp:10
uhal::tests::DummyHardwareOptions::version
uint32_t version
IPbus version number - 1 or 2.
Definition: DummyHardwareOptions.hpp:58
DummyHardwareOptions.hpp
uhal::tests::DummyHardwareOptions::port
uint16_t port
The port used by the dummy hardware.
Definition: DummyHardwareOptions.hpp:54
main
int main(int argc, char *argv[])
Definition: DummyHardwareTcp.cxx:40