Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
KM3NETDAQ::JDAQProcess Class Reference

Auxiliary class for itemization of process list. More...

#include <JRuncontrolToolkit.hh>

Inheritance diagram for KM3NETDAQ::JDAQProcess:
JNET::JHostname

Public Member Functions

 JDAQProcess ()
 Default constructor. More...
 
 JDAQProcess (const JHostname &hostname, const std::string &key="")
 Constructor. More...
 
JTag getUniqueTag () const
 Get unique tag. More...
 
bool equals (const JTag &tag) const
 Test whether given tag equals. More...
 
bool equals (int port) const
 Test whether given port equals. More...
 
bool equals (const JHostname &hostname) const
 Test whether given host name equals. More...
 
void set (const std::string &buffer)
 Set hostname and port number. More...
 

Public Attributes

std::string index
 index in process list More...
 
std::string hostname
 
int port
 

Static Public Attributes

static const char SEPARATOR = ':'
 Separation character between hostname and port number. More...
 

Friends

std::istream & operator>> (std::istream &in, JDAQProcess &object)
 Read process from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JDAQProcess &object)
 Write process to output stream. More...
 

Detailed Description

Auxiliary class for itemization of process list.

Definition at line 464 of file JRuncontrolToolkit.hh.

Constructor & Destructor Documentation

KM3NETDAQ::JDAQProcess::JDAQProcess ( )
inline

Default constructor.

Definition at line 471 of file JRuncontrolToolkit.hh.

471  :
472  JHostname(),
473  index ()
474  {}
std::string index
index in process list
JHostname()
Default constructor.
Definition: JHostname.hh:41
KM3NETDAQ::JDAQProcess::JDAQProcess ( const JHostname hostname,
const std::string key = "" 
)
inline

Constructor.

Parameters
hostnamehost name
keyindex

Definition at line 483 of file JRuncontrolToolkit.hh.

484  :
485  JHostname(),
486  index (key)
487  {}
std::string index
index in process list
JHostname()
Default constructor.
Definition: JHostname.hh:41

Member Function Documentation

JTag KM3NETDAQ::JDAQProcess::getUniqueTag ( ) const
inline

Get unique tag.

Returns
tag

Definition at line 495 of file JRuncontrolToolkit.hh.

496  {
497  using namespace std;
498  using namespace JSYSTEM;
499 
500  ostringstream os;
501 
502  os << hex << getSubaddress(getIPnumber(this->hostname)) << this->index;
503 
504  return JTag(os.str());
505  }
int getIPnumber(const std::string &host_name)
Get IP number.
Definition: JNetwork.hh:117
unsigned short getSubaddress(const int ip)
Get host identifier within network.
Definition: JNetwork.hh:190
std::string hostname
Definition: JHostname.hh:154
std::string index
index in process list
bool KM3NETDAQ::JDAQProcess::equals ( const JTag tag) const
inline

Test whether given tag equals.

The comparison is based on the unique tag.

Parameters
tagtag
Returns
true if match; else false

Definition at line 515 of file JRuncontrolToolkit.hh.

516  {
517  return this->getUniqueTag() == tag;
518  }
JTag getUniqueTag() const
Get unique tag.
bool KM3NETDAQ::JDAQProcess::equals ( int  port) const
inline

Test whether given port equals.

The comparison is based on the IP number and port number.

Parameters
portport
Returns
true if match; else false

Definition at line 528 of file JRuncontrolToolkit.hh.

529  {
530  return (JSYSTEM::getIPnumber() == JSYSTEM::getIPnumber(this->hostname) && port == this->port);
531  }
int getIPnumber(const std::string &host_name)
Get IP number.
Definition: JNetwork.hh:117
std::string hostname
Definition: JHostname.hh:154
bool KM3NETDAQ::JDAQProcess::equals ( const JHostname hostname) const
inline

Test whether given host name equals.

The comparison is based on the IP number and port number.

Parameters
hostnamehost name
Returns
true if match; else false

Definition at line 541 of file JRuncontrolToolkit.hh.

542  {
543  return (JSYSTEM::getIPnumber(hostname.hostname) == JSYSTEM::getIPnumber(this->hostname) && hostname.port == this->port);
544  }
int getIPnumber(const std::string &host_name)
Get IP number.
Definition: JNetwork.hh:117
then usage $script< detector file >< detectorfile > nIf the range of floors is the first detector file is aligned to the second before the comparison nIn this
std::string hostname
Definition: JHostname.hh:154
void JNET::JHostname::set ( const std::string buffer)
inlineinherited

Set hostname and port number.

The argument correponds to the hostname and an optional port number of the server. The syntax is hostname[:port]. The default port number is DISPATCH_PORT. If the complete buffer corresponds to an integer value, it is interpreted as the port number.

Parameters
bufferhost name and optional port number

Definition at line 87 of file JHostname.hh.

88  {
89  using namespace std;
90 
91  const string::size_type pos = buffer.find(SEPARATOR);
92 
93  if (pos != string::npos) {
94 
95  this->hostname = buffer.substr(0, pos);
96 
97  istringstream(buffer.substr(pos + 1)) >> this->port;
98 
99  } else {
100 
101  bool is_number = true;
102 
103  for (string::const_iterator i = buffer.begin(); is_number && i != buffer.end(); ++i) {
104  is_number &= isdigit(*i);
105  }
106 
107  if (is_number) {
108 
109  this->hostname = "";
110 
111  istringstream(buffer) >> this->port;
112 
113  } else {
114 
115  this->hostname = buffer;
116  this->port = DISPATCH_PORT;
117  }
118  }
119  }
static const int DISPATCH_PORT
Default ControlHost port.
Definition: JHostname.hh:24
std::string hostname
Definition: JHostname.hh:154
static const char SEPARATOR
Separation character between hostname and port number.
Definition: JHostname.hh:35

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JDAQProcess object 
)
friend

Read process from input stream.

Parameters
ininput stream
objectprocess
Returns
input stream

Definition at line 554 of file JRuncontrolToolkit.hh.

555  {
556  in >> object.index;
557  in >> static_cast<JHostname&>(object);
558 
559  return in;
560  }
JHostname()
Default constructor.
Definition: JHostname.hh:41
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
std::ostream& operator<< ( std::ostream &  out,
const JDAQProcess object 
)
friend

Write process to output stream.

Parameters
outoutput stream
objectprocess
Returns
output stream

Definition at line 570 of file JRuncontrolToolkit.hh.

571  {
572  out << object.index;
573  out << ' ';
574  out << static_cast<const JHostname&>(object);
575 
576  return out;
577  }

Member Data Documentation

std::string KM3NETDAQ::JDAQProcess::index

index in process list

Definition at line 580 of file JRuncontrolToolkit.hh.

const char JNET::JHostname::SEPARATOR = ':'
staticinherited

Separation character between hostname and port number.

Definition at line 35 of file JHostname.hh.

std::string JNET::JHostname::hostname
inherited

Definition at line 154 of file JHostname.hh.

int JNET::JHostname::port
inherited

Definition at line 155 of file JHostname.hh.


The documentation for this class was generated from the following file: