Client data structure.  
 More...
#include <JClient.hh>
Client data structure. 
Definition at line 28 of file JClient.hh.
 
Client modi. 
| Enumerator | 
|---|
| UNKNOWN  | 
 | 
| SLEEP  | 
 | 
| ACTIVE  | 
 | 
| IGNORE  | 
 | 
| ILLEGAL  | 
 | 
Definition at line 39 of file JClient.hh.
 
 
  
  
      
        
          | KM3NETDAQ::JClient::JClient  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Default constructor. 
Definition at line 45 of file JClient.hh.
JLANG::JString start_command
 
then fatal The output file must have the wildcard in the name
 
 
 
 
  
  
      
        
          | 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 66 of file JClient.hh.
JLANG::JString start_command
 
then fatal The output file must have the wildcard in the name
 
 
 
 
  
  
      
        
          | void KM3NETDAQ::JClient::start  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Start process. 
The start command is issued on the (remote) host. 
Definition at line 88 of file JClient.hh.
   93       if (start_command != 
"") {
 
   97         shell << start_command << endl;
 
static JShell & getInstance()
Get reference to unique instance of this class object. 
 
 
 
 
  
  
      
        
          | 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 111 of file JClient.hh.
  116       if (start_command != 
"") {
 
  118         const string header  = 
"__header___";
 
  119         const string trailer = 
"__trailer__";
 
  123         os << 
"ssh " << hostname << 
' ' 
  125            << 
"echo" << 
' ' << header << 
";" 
  126            << 
"ps hax -o '%p %a'"     << 
";" 
  127            << 
"echo" << 
' ' << trailer
 
  132         shell << os.str() << endl;
 
  138         while (
getline(shell, buffer) && buffer.find(header)  == string::npos) {}
 
  142         while (
getline(shell, buffer) && buffer.find(trailer) == string::npos) {
 
  149           if (is >> pid && 
getline(is >> ws, buffer)) {
 
  150             if (start_command.find(buffer) != string::npos) {
 
  151               os << 
"ssh " << hostname << 
' ' 
  153                  << 
"kill " << signal << 
" " << pid << 
" </dev/null >&/dev/null" 
  161         if (os.str() != 
"") {
 
  162           shell << os.str() << endl;
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line. 
 
static JShell & getInstance()
Get reference to unique instance of this class object. 
 
 
 
 
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getName  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get name of run control client. 
- Returns
 - name 
 
Definition at line 174 of file JClient.hh.
then fatal The output file must have the wildcard in the name
 
 
 
 
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getHostname  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get host name of run control client. 
- Returns
 - host name 
 
Definition at line 185 of file JClient.hh.
 
 
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getFullName  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get full name of run control client. 
- Returns
 - full name 
 
Definition at line 196 of file JClient.hh.
 
 
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getStartCommand  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get start command of run control client. 
- Returns
 - name 
 
Definition at line 207 of file JClient.hh.
JLANG::JString start_command
 
 
 
 
  
  
      
        
          | bool KM3NETDAQ::JClient::isSleep  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check sleep mode. 
- Returns
 - true if sleep; else false 
 
Definition at line 218 of file JClient.hh.
 
 
  
  
      
        
          | bool KM3NETDAQ::JClient::isActive  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check active mode. 
- Returns
 - true if active; else false 
 
Definition at line 229 of file JClient.hh.
 
 
  
  
      
        
          | bool KM3NETDAQ::JClient::isIgnore  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check ignore mode. 
- Returns
 - true if ignore; else false 
 
Definition at line 240 of file JClient.hh.
 
 
  
  
      
        
          | bool KM3NETDAQ::JClient::isIllegal  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check illegal mode. 
- Returns
 - true if illegal; else false 
 
Definition at line 251 of file JClient.hh.
 
 
  
  
      
        
          | 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 265 of file JClient.hh.
  272         this->is_alive  = 
true;
 
  279         this->is_alive  = 
false;
 
  292         istringstream 
is(buffer);
 
  300           this->event_name = 
event.getName();
 
  301           this->event_info = 
event.getInfo();
 
  302           this->state_name = state;
 
static const JTag DISPTAG_Died("Died")
 
static const std::string TOKEN_DELIMETER
 
static const std::string RUN_CONTROL_CLIENT
 
static const JNET::JTag RC_REPLY
 
then fatal The output file must have the wildcard in the name
 
static const JTag DISPTAG_Born("Born")
 
Auxiliary class to specify white space character(s) in currect locale. 
 
 
 
 
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getStatename  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get name of current state. 
- Returns
 - state name 
 
Definition at line 317 of file JClient.hh.
 
 
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getEventname  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get name of last event. 
- Returns
 - event name 
 
Definition at line 328 of file JClient.hh.
 
 
  
  
      
        
          | const std::string& KM3NETDAQ::JClient::getEventInfo  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get event information. 
- Returns
 - event information 
 
Definition at line 339 of file JClient.hh.
 
 
  
  
      
        
          | bool KM3NETDAQ::JClient::getAlive  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get alive status. 
- Returns
 - true if alive; else false 
 
Definition at line 350 of file JClient.hh.
 
 
  
  
      
        
          | void KM3NETDAQ::JClient::setAlive  | 
          ( | 
          const bool  | 
          alive | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Set alive status. 
- Parameters
 - 
  
  
 
Definition at line 361 of file JClient.hh.
 
 
  
  
      
        
          | JMode KM3NETDAQ::JClient::getMode  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
  
  
      
        
          | void KM3NETDAQ::JClient::setMode  | 
          ( | 
          const JMode  | 
          mode | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
  
  
      
        
          | int KM3NETDAQ::JClient::getBorn  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get born count. 
- Returns
 - number of times born 
 
Definition at line 394 of file JClient.hh.
 
 
  
  
      
        
          | int KM3NETDAQ::JClient::getDied  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get died count. 
- Returns
 - number of times died 
 
Definition at line 405 of file JClient.hh.
 
 
  
  
      
        
          | 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 465 of file JClient.hh.
  481       if (pos != string::npos) {
 
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable SERVER localhost define_variable LOGGER if do_usage *then usage $script< server >[logger] fi case set_variable LOGGER
 
JLANG::JString start_command
 
JString & trim()
Trim string. 
 
static const std::string CLIENTNAME_DELIMETER
 
then fatal The output file must have the wildcard in the name
 
JString & replace(const char target, const char replacement, const std::size_t max=std::numeric_limits< std::size_t >::max())
Replace characters. 
 
std::string getFullName(const std::string &hostname, const std::string &name)
Get full name of run control client. 
 
 
 
 
  
  
      
        
          | std::istream& operator>>  | 
          ( | 
          std::istream &  | 
          in,  | 
         
        
           | 
           | 
          JClient &  | 
          client  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
friend   | 
  
 
Read client from input. 
- Parameters
 - 
  
  
 
- Returns
 - istream 
 
Definition at line 418 of file JClient.hh.
JSocketInputChannel_t in
reader for incoming messages 
 
then echo Test string reversed by client(hit< return > to continue)." $DIR/JProcess -c "$DIR/JEcho-r" -C fi if (( 1 ))
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line. 
 
virtual void clear()
Clear status of reader. 
 
 
 
 
  
  
      
        
          | std::ostream& operator<<  | 
          ( | 
          std::ostream &  | 
          out,  | 
         
        
           | 
           | 
          const JClient &  | 
          client  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
friend   | 
  
 
Write client to output. 
- Parameters
 - 
  
  
 
- Returns
 - ostream 
 
Definition at line 443 of file JClient.hh.
JSocketNonblockingWriter out
writer for outgoing messages 
 
then echo Test string reversed by client(hit< return > to continue)." $DIR/JProcess -c "$DIR/JEcho-r" -C fi if (( 1 ))
 
 
 
 
  
  
      
        
          | std::string KM3NETDAQ::JClient::SERVER | 
         
       
   | 
  
static   | 
  
 
host name of message server 
- Author
 - mdejonghost name of message server 
 
Definition at line 32 of file JClient.hh.
 
 
  
  
      
        
          | std::string KM3NETDAQ::JClient::LOGGER | 
         
       
   | 
  
static   | 
  
 
host name of message logger 
Definition at line 33 of file JClient.hh.
 
 
  
  
      
        
          | std::string KM3NETDAQ::JClient::name | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | std::string KM3NETDAQ::JClient::hostname | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | std::string KM3NETDAQ::JClient::full_name | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | JMode KM3NETDAQ::JClient::mode | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | int KM3NETDAQ::JClient::born | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | int KM3NETDAQ::JClient::died | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | bool KM3NETDAQ::JClient::is_alive | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | std::string KM3NETDAQ::JClient::state_name | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | std::string KM3NETDAQ::JClient::event_name | 
         
       
   | 
  
protected   | 
  
 
 
  
  
      
        
          | std::string KM3NETDAQ::JClient::event_info | 
         
       
   | 
  
protected   | 
  
 
 
The documentation for this class was generated from the following files: