Client data structure.  
 More...
#include <JClient.hh>
Client data structure. 
Definition at line 27 of file JClient.hh.
 
◆ JMode
Client modi. 
| Enumerator | 
|---|
| UNKNOWN  |  | 
| SLEEP  |  | 
| ACTIVE  |  | 
| IGNORE  |  | 
| ILLEGAL  |  | 
Definition at line 38 of file JClient.hh.
 
 
◆ JClient() [1/2]
  
  
      
        
          | KM3NETDAQ::JClient::JClient  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Default constructor. 
Definition at line 44 of file JClient.hh.
 
 
◆ JClient() [2/2]
  
  
      
        
          | KM3NETDAQ::JClient::JClient  | 
          ( | 
          const std::string &  | 
          __name,  | 
         
        
           | 
           | 
          const std::string &  | 
          __hostname,  | 
         
        
           | 
           | 
          const std::string &  | 
          __start_command = ""  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
Constructor. 
- Parameters
 - 
  
    | __name | name of client  | 
    | __hostname | host name  | 
    | __start_command | start command  | 
  
   
Definition at line 65 of file JClient.hh.
 
 
◆ start()
  
  
      
        
          | void KM3NETDAQ::JClient::start  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Start process. 
The start command is issued on the (remote) host. 
Definition at line 87 of file JClient.hh.
   92       if (start_command != 
"") {
 
   96         shell << start_command << endl;
 
 
 
 
◆ stop()
  
  
      
        
          | void KM3NETDAQ::JClient::stop  | 
          ( | 
          const int  | 
          signal = -9 | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Stop process. 
A kill command is issued on the (remote) host. To determine the PID for the kill command, the start command is compared to the output of a ps command on the (remote) host.
- Parameters
 - 
  
  
 
Definition at line 110 of file JClient.hh.
  115       if (start_command != 
"") {
 
  117         const string header  = 
"__header___";
 
  118         const string trailer = 
"__trailer__";
 
  122         os << 
"ssh " << hostname << 
' ' 
  124            << 
"echo" << 
' ' << header << 
";" 
  125            << 
"ps hax -o '%p %a'"     << 
";" 
  126            << 
"echo" << 
' ' << trailer
 
  131         shell << os.str() << endl;
 
  137         while (
getline(shell, buffer) && buffer.find(header)  == string::npos) {}
 
  141         while (
getline(shell, buffer) && buffer.find(trailer) == string::npos) {
 
  148           if (is >> pid && 
getline(is >> ws, buffer)) {
 
  149             if (start_command.find(buffer) != string::npos) {
 
  150               os << 
"ssh " << hostname << 
' ' 
  152                  << 
"kill " << signal << 
" " << pid << 
" </dev/null >&/dev/null" 
  160         if (os.str() != 
"") {
 
  161           shell << os.str() << endl;
 
 
 
 
◆ getName()
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getName  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get name of run control client. 
- Returns
 - name 
 
Definition at line 173 of file JClient.hh.
 
 
◆ getHostname()
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getHostname  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get host name of run control client. 
- Returns
 - host name 
 
Definition at line 184 of file JClient.hh.
 
 
◆ getFullName()
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getFullName  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get full name of run control client. 
- Returns
 - full name 
 
Definition at line 195 of file JClient.hh.
 
 
◆ getStartCommand()
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getStartCommand  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get start command of run control client. 
- Returns
 - name 
 
Definition at line 206 of file JClient.hh.
 
 
◆ isSleep()
  
  
      
        
          | bool KM3NETDAQ::JClient::isSleep  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check sleep mode. 
- Returns
 - true if sleep; else false 
 
Definition at line 217 of file JClient.hh.
 
 
◆ isActive()
  
  
      
        
          | bool KM3NETDAQ::JClient::isActive  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check active mode. 
- Returns
 - true if active; else false 
 
Definition at line 228 of file JClient.hh.
 
 
◆ isIgnore()
  
  
      
        
          | bool KM3NETDAQ::JClient::isIgnore  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check ignore mode. 
- Returns
 - true if ignore; else false 
 
Definition at line 239 of file JClient.hh.
 
 
◆ isIllegal()
  
  
      
        
          | bool KM3NETDAQ::JClient::isIllegal  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check illegal mode. 
- Returns
 - true if illegal; else false 
 
Definition at line 250 of file JClient.hh.
 
 
◆ update()
  
  
      
        
          | bool KM3NETDAQ::JClient::update  | 
          ( | 
          const JNET::JTag &  | 
          tag,  | 
         
        
           | 
           | 
          const std::string &  | 
          buffer  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
Update client. 
The client parameters are updated according to the ControlHost tag and message.
- Parameters
 - 
  
  
 
- Returns
 - true if OK; else false 
 
Definition at line 264 of file JClient.hh.
  271         this->is_alive  = 
true;
 
  278         this->is_alive  = 
false;
 
  291         istringstream is(buffer);
 
  299           this->event_name   = 
event.getName();
 
  300           this->event_number = 
event.getNumber();
 
  301           this->state_name   = state;
 
 
 
 
◆ getStatename()
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getStatename  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get name of current state. 
- Returns
 - state name 
 
Definition at line 316 of file JClient.hh.
 
 
◆ getEventname()
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getEventname  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get name of last event. 
- Returns
 - event name 
 
Definition at line 327 of file JClient.hh.
 
 
◆ getEventnumber()
  
  
      
        
          | int KM3NETDAQ::JClient::getEventnumber  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get number of last event. 
- Returns
 - event number 
 
Definition at line 338 of file JClient.hh.
 
 
◆ getAlive()
  
  
      
        
          | bool KM3NETDAQ::JClient::getAlive  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get alive status. 
- Returns
 - true if alive; else false 
 
Definition at line 349 of file JClient.hh.
 
 
◆ setAlive()
  
  
      
        
          | void KM3NETDAQ::JClient::setAlive  | 
          ( | 
          const bool  | 
          alive | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Set alive status. 
- Parameters
 - 
  
  
 
Definition at line 360 of file JClient.hh.
 
 
◆ getMode()
  
  
      
        
          | JMode KM3NETDAQ::JClient::getMode  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ setMode()
  
  
      
        
          | void KM3NETDAQ::JClient::setMode  | 
          ( | 
          const JMode  | 
          mode | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ getBorn()
  
  
      
        
          | int KM3NETDAQ::JClient::getBorn  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get born count. 
- Returns
 - number of times born 
 
Definition at line 393 of file JClient.hh.
 
 
◆ getDied()
  
  
      
        
          | int KM3NETDAQ::JClient::getDied  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get died count. 
- Returns
 - number of times died 
 
Definition at line 404 of file JClient.hh.
 
 
◆ configure()
  
  
      
        
          | void KM3NETDAQ::JClient::configure  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineprotected   | 
  
 
Configure client parameters. 
In this, the following tokens in the start command are substituted: $HOST$ by <host name>; $NAME$ by <process name>; $SERVER$ by JClient::SERVER; $LOGGER$ by JClient::LOGGER; $ARGS$ by part following last '/' in <process name>; 
Definition at line 464 of file JClient.hh.
  480       if (pos != string::npos) {
 
 
 
 
◆ operator>>
  
  
      
        
          | std::istream& operator>>  | 
          ( | 
          std::istream &  | 
          in,  | 
         
        
           | 
           | 
          JClient &  | 
          client  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
friend   | 
  
 
Read client from input. 
- Parameters
 - 
  
  
 
- Returns
 - istream 
 
Definition at line 417 of file JClient.hh.
  420       in >> client.hostname;
 
  424         getline(
in >> std::ws, client.start_command);
 
 
 
 
◆ operator<<
  
  
      
        
          | std::ostream& operator<<  | 
          ( | 
          std::ostream &  | 
          out,  | 
         
        
           | 
           | 
          const JClient &  | 
          client  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
friend   | 
  
 
Write client to output. 
- Parameters
 - 
  
  
 
- Returns
 - ostream 
 
Definition at line 442 of file JClient.hh.
  446       out << client.hostname;
 
  448       out << client.start_command;
 
 
 
 
◆ SERVER
  
  
      
        
          | std::string KM3NETDAQ::JClient::SERVER | 
         
       
   | 
  
static   | 
  
 
host name of message server 
- Author
 - mdejong 
 
Definition at line 31 of file JClient.hh.
 
 
◆ LOGGER
  
  
      
        
          | std::string KM3NETDAQ::JClient::LOGGER | 
         
       
   | 
  
static   | 
  
 
host name of message logger 
Definition at line 32 of file JClient.hh.
 
 
◆ name
  
  
      
        
          | std::string KM3NETDAQ::JClient::name | 
         
       
   | 
  
protected   | 
  
 
 
◆ hostname
  
  
      
        
          | std::string KM3NETDAQ::JClient::hostname | 
         
       
   | 
  
protected   | 
  
 
 
◆ start_command
◆ full_name
  
  
      
        
          | std::string KM3NETDAQ::JClient::full_name | 
         
       
   | 
  
protected   | 
  
 
 
◆ mode
  
  
      
        
          | JMode KM3NETDAQ::JClient::mode | 
         
       
   | 
  
protected   | 
  
 
 
◆ born
  
  
      
        
          | int KM3NETDAQ::JClient::born | 
         
       
   | 
  
protected   | 
  
 
 
◆ died
  
  
      
        
          | int KM3NETDAQ::JClient::died | 
         
       
   | 
  
protected   | 
  
 
 
◆ is_alive
  
  
      
        
          | bool KM3NETDAQ::JClient::is_alive | 
         
       
   | 
  
protected   | 
  
 
 
◆ state_name
  
  
      
        
          | std::string KM3NETDAQ::JClient::state_name | 
         
       
   | 
  
protected   | 
  
 
 
◆ event_name
  
  
      
        
          | std::string KM3NETDAQ::JClient::event_name | 
         
       
   | 
  
protected   | 
  
 
 
◆ event_number
  
  
      
        
          | int KM3NETDAQ::JClient::event_number | 
         
       
   | 
  
protected   | 
  
 
 
The documentation for this class was generated from the following files: