RotoRcCmd Class Reference

#include <RotoRcCmd.h>

List of all members.

Public Member Functions

 RotoRcCmd ()
 RotoRcCmd (Int_t from, Int_t to, Int_t type, Int_t instr, Bool_t xdata)
 ~RotoRcCmd ()
 RotoRcCmd (Int_t encoded)
string AsStlString (string options="")
Int_t GetFrom ()
Int_t GetTo ()
Int_t GetType ()
Int_t GetInstr ()
Bool_t HasDataToFollow ()
void SetType (Int_t type)
void SetInstr (Int_t instr)
void SetDataToFollow (Bool_t xdata)
void SwapToFrom ()
void SwapFromTo ()
Bool_t TestAckAsBool ()

Static Public Member Functions

static string ElementAsStlString (Int_t element)
static string TypeAsStlString (Int_t type)
static string InstrAsStlString (Int_t type, Int_t instr)

Public Attributes

Int_t fEncoded

Friends

Bool_t operator== (const RotoRcCmd &lhs, const RotoRcCmd &rhs)
Bool_t operator!= (const RotoRcCmd &lhs, const RotoRcCmd &rhs)

Detailed Description

Definition at line 17 of file RotoRcCmd.h.


Constructor & Destructor Documentation

RotoRcCmd::RotoRcCmd (  )  [inline]

Definition at line 24 of file RotoRcCmd.h.

References fEncoded.

00024 { fEncoded = 0; }

RotoRcCmd::RotoRcCmd ( Int_t  from,
Int_t  to,
Int_t  type,
Int_t  instr,
Bool_t  xdata 
)

Definition at line 44 of file RotoRcCmd.cxx.

References bitDataToFollow, maskFrom, maskInstr, maskTo, maskType, shiftFrom, shiftInstr, shiftTo, and shiftType.

00045 {
00046    fEncoded =
00047       (( from  & maskFrom)  << shiftFrom) |
00048       (( to    & maskTo)    << shiftTo)   |
00049       ((xdata) ? bitDataToFollow : 0 )    |
00050       (( type  & maskType)  << shiftType) |
00051       (( instr & maskInstr) << shiftInstr)  ;
00052 }

RotoRcCmd::~RotoRcCmd (  )  [inline]

Definition at line 26 of file RotoRcCmd.h.

00026 { ; }

RotoRcCmd::RotoRcCmd ( Int_t  encoded  )  [inline]

Definition at line 28 of file RotoRcCmd.h.

References fEncoded.

00028 { fEncoded = encoded; }


Member Function Documentation

string RotoRcCmd::AsStlString ( string  options = ""  ) 

Definition at line 55 of file RotoRcCmd.cxx.

References ElementAsStlString(), fEncoded, Form(), GetFrom(), GetInstr(), GetTo(), GetType(), HasDataToFollow(), InstrAsStlString(), and TypeAsStlString().

Referenced by RotoClient::ReceiveCommandReply(), RotoClient::ReceiveRequestReply(), RotoServer::ReplyToCommand(), and RotoClient::SendCommand().

00056 {
00057 
00058    string result;
00059 
00060    bool is_x = ( "x" == options );
00061    bool is_b = ( "b" == options );
00062 
00063    if ( is_x | is_b ) result += Form("0x%8.8x",fEncoded);
00064    if ( is_x ) return result;
00065    if ( is_b ) result += " ";
00066 
00067    Int_t  from  = GetFrom();
00068    Int_t  to    = GetTo();
00069    Bool_t xdata = HasDataToFollow();
00070    Int_t  type  = GetType();
00071    Int_t  instr = GetInstr();
00072 
00073    result += ElementAsStlString(from);
00074    result += "->";
00075    result += ElementAsStlString(to);
00076    result += "(";
00077    result += TypeAsStlString(type);
00078    result += "|";
00079    result += InstrAsStlString(type,instr);
00080    result += ")";
00081    result += (xdata) ? "+" : "0";
00082 
00083    return result;
00084 }

string RotoRcCmd::ElementAsStlString ( Int_t  element  )  [static]

Definition at line 121 of file RotoRcCmd.cxx.

References MINOS_ROOTER_BEAMMON, MINOS_ROOTER_DCP, MINOS_ROOTER_DCS, and MINOS_ROOTER_ROOTER.

Referenced by AsStlString(), RotoServer::BuildStateReport(), RotoServer::CloseFile(), RotoServer::OpenFile(), and RotoServer::ProcessCommand().

00122 {
00123    string whoisthis = "unknown-element";
00124 
00125    switch (element) {
00126    case MINOS_ROOTER_ROOTER:   whoisthis = "Roto";          break;
00127    case MINOS_ROOTER_DCP:      whoisthis = "DCP";           break;
00128    case MINOS_ROOTER_DCS:      whoisthis = "DCS";           break;
00129    case MINOS_ROOTER_BEAMMON:  whoisthis = "BeamMon";       break;
00130    default:                    whoisthis = "unknown-agent"; break;
00131    }
00132 
00133    return whoisthis;
00134 }

Int_t RotoRcCmd::GetFrom (  ) 

Definition at line 87 of file RotoRcCmd.cxx.

References fEncoded, maskFrom, and shiftFrom.

Referenced by AsStlString(), RotoServer::ProcessCommand(), and SwapToFrom().

00087 { return (fEncoded>>shiftFrom)&maskFrom; }

Int_t RotoRcCmd::GetInstr (  ) 
Int_t RotoRcCmd::GetTo (  ) 

Definition at line 88 of file RotoRcCmd.cxx.

References fEncoded, maskTo, and shiftTo.

Referenced by AsStlString(), RotoServer::CheckTo(), RotoServer::ReplyToCommand(), and SwapToFrom().

00088 { return (fEncoded>>shiftTo)&maskTo; }

Int_t RotoRcCmd::GetType (  ) 
Bool_t RotoRcCmd::HasDataToFollow (  ) 
string RotoRcCmd::InstrAsStlString ( Int_t  type,
Int_t  instr 
) [static]

Definition at line 153 of file RotoRcCmd.cxx.

References MINOS_DAQ_ABORT_RUN, MINOS_DAQ_ACTIVATE_ENTITY, MINOS_DAQ_ADD_TO_GLOBAL, MINOS_DAQ_CONNECT, MINOS_DAQ_DEACTIVATE_ENTITY, MINOS_DAQ_NEW_SUB_RUN, MINOS_DAQ_PAUSE_RUN, MINOS_DAQ_PREPARE_RUN, MINOS_DAQ_REMOVE_FROM_GLOBAL, MINOS_DAQ_RESET, MINOS_DAQ_RESUME_RUN, MINOS_DAQ_SET_TARGET, MINOS_DAQ_START_RUN, MINOS_DAQ_STATE_ABORTING, MINOS_DAQ_STATE_COMMS_ERROR, MINOS_DAQ_STATE_CONNECTING, MINOS_DAQ_STATE_DISABLED, MINOS_DAQ_STATE_ERROR, MINOS_DAQ_STATE_IDLE, MINOS_DAQ_STATE_NOT_PRESENT, MINOS_DAQ_STATE_PAUSED, MINOS_DAQ_STATE_PAUSING, MINOS_DAQ_STATE_PREPARED, MINOS_DAQ_STATE_PREPARING, MINOS_DAQ_STATE_RESETTING, MINOS_DAQ_STATE_RESUMING, MINOS_DAQ_STATE_RUNNING, MINOS_DAQ_STATE_STARTING, MINOS_DAQ_STATE_SUB_RUN_CHANGING, MINOS_DAQ_STATE_TIMEOUT, MINOS_DAQ_STOP_RUN, MINOS_RC_REQ_ALL_STATES, MINOS_RC_REQ_NEXT_SUB_RUN, MINOS_RC_REQ_RUNSTOP, MINOS_RC_REQ_STATUS_UPDATE, MINOS_RC_REQ_YOUR_IDENTITY, MINOS_ROOTER_ACKNOWLEDGE, MINOS_ROOTER_CLOSEFILE, MINOS_ROOTER_CLOSESOCKET, MINOS_ROOTER_COMMAND, MINOS_ROOTER_OPENFILE, MINOS_ROOTER_OPENSOCKET, MINOS_ROOTER_RECBUFFER, MINOS_ROOTER_REPORT, MINOS_ROOTER_REQ_CURRENT_STATE, MINOS_ROOTER_REQ_STATUS_REPORT, MINOS_ROOTER_REQUEST, MINOS_ROOTER_SHUTDOWN, MINOS_ROOTER_STATE_CONNECTED, MINOS_ROOTER_STATE_DISCONNECTING, MINOS_ROOTER_STATE_FILE_OPEN, MINOS_ROOTER_STATE_REPORT, MINOS_ROOTER_STATE_SHUTDOWN_REQ, MINOS_ROOTER_STATE_STOPPING, MINOS_ROOTER_STATE_UNCONNECTED, MINOS_ROOTER_STATE_UNKNOWN, and MINOS_ROOTER_UNABLE_TO.

Referenced by AsStlString(), RotoServer::BuildStateReport(), and RotoServer::ProcessCommand().

00154 {
00155 
00156    string whatinstr = "unknown-instr";
00157    
00158    switch (type) {
00159    case MINOS_ROOTER_COMMAND:
00160    case MINOS_ROOTER_ACKNOWLEDGE:
00161    case MINOS_ROOTER_UNABLE_TO:
00162       switch (instr) {
00163       // special ROTO commands
00164       case MINOS_ROOTER_OPENSOCKET:  whatinstr = "OPENSOCKET";      break;
00165       case MINOS_ROOTER_CLOSESOCKET: whatinstr = "CLOSESOCKET";     break;
00166       case MINOS_ROOTER_OPENFILE:    whatinstr = "OPENFILE";        break;
00167       case MINOS_ROOTER_CLOSEFILE:   whatinstr = "CLOSEFILE";       break;
00168       case MINOS_ROOTER_RECBUFFER:   whatinstr = "RECBUFFER";       break;
00169       case MINOS_ROOTER_SHUTDOWN:    whatinstr = "SHUTDOWN";        break;
00170       // normal DAQ commands
00171       case MINOS_DAQ_PREPARE_RUN:    whatinstr = "PREPARE_RUN";     break;
00172       case MINOS_DAQ_START_RUN:      whatinstr = "START_RUN";       break;
00173       case MINOS_DAQ_PAUSE_RUN:      whatinstr = "PAUSE_RUN";       break;
00174       case MINOS_DAQ_RESUME_RUN:     whatinstr = "RESUME_RUN";      break;
00175       case MINOS_DAQ_STOP_RUN:       whatinstr = "STOP_RUN";        break;
00176       case MINOS_DAQ_ABORT_RUN:      whatinstr = "ABORT_RUN";       break;
00177       case MINOS_DAQ_NEW_SUB_RUN:    whatinstr = "NEW_SUB_RUN";     break;
00178       case MINOS_DAQ_RESET:          whatinstr = "RESET";           break;
00179       case MINOS_DAQ_CONNECT:        whatinstr = "CONNECT";         break;
00180       case MINOS_DAQ_ADD_TO_GLOBAL:  whatinstr = "ADD_TO_GLOBAL";      break;
00181       case MINOS_DAQ_REMOVE_FROM_GLOBAL:  whatinstr = "REMOVE_FROM_GLOBAL"; break;
00182       case MINOS_DAQ_ACTIVATE_ENTITY:     whatinstr = "ACTIVATE_ENTITY";    break;
00183       case MINOS_DAQ_DEACTIVATE_ENTITY:   whatinstr = "DEACTIVATE_ENTITY";  break;
00184       case MINOS_DAQ_SET_TARGET:          whatinstr = "SET_TARGET";         break;
00185       default:                            whatinstr = "unknown-(command)instr"; break;
00186       }
00187       break;
00188    case MINOS_ROOTER_REQUEST:
00189    case MINOS_ROOTER_REPORT:
00190       switch (instr) {
00191       // special ROTO requests
00192       case MINOS_ROOTER_REQ_CURRENT_STATE: whatinstr = "CURRENT_STATE"; break;
00193       case MINOS_ROOTER_REQ_STATUS_REPORT: whatinstr = "STATUS_REPORT"; break;
00194       // normal DAQ requests
00195       case MINOS_RC_REQ_STATUS_UPDATE:     whatinstr = "STATUS_UPDATE"; break;
00196       case MINOS_RC_REQ_NEXT_SUB_RUN:      whatinstr = "NEXT_SUB_RUN";  break;
00197       case MINOS_RC_REQ_ALL_STATES:        whatinstr = "ALL_STATES";    break;
00198       case MINOS_RC_REQ_YOUR_IDENTITY:     whatinstr = "YOUR_IDENTITY"; break;
00199       case MINOS_RC_REQ_RUNSTOP:           whatinstr = "RUN_STOP";      break;
00200       default:                             whatinstr = "unknown-(request)instr"; break;
00201       }
00202       break;
00203    case MINOS_ROOTER_STATE_REPORT:
00204       switch (instr) {
00205       // special ROTO states
00206       case MINOS_ROOTER_STATE_UNKNOWN:       whatinstr = "UNKNOWN STATE"; break;
00207       case MINOS_ROOTER_STATE_STOPPING:      whatinstr = "STOPPING";      break;
00208       case MINOS_ROOTER_STATE_UNCONNECTED:   whatinstr = "UNCONNECTED";   break;
00209       case MINOS_ROOTER_STATE_CONNECTED:     whatinstr = "CONNECTED";     break;
00210       case MINOS_ROOTER_STATE_DISCONNECTING: whatinstr = "DISCONNECTING"; break;
00211       case MINOS_ROOTER_STATE_FILE_OPEN:     whatinstr = "FILE_OPEN";     break;
00212       case MINOS_ROOTER_STATE_SHUTDOWN_REQ:  whatinstr = "SHUTDOWN_REQ";  break;
00213       // normal DAQ states
00214       case MINOS_DAQ_STATE_IDLE:        whatinstr = "IDLE";              break;
00215       case MINOS_DAQ_STATE_PREPARING:   whatinstr = "PREPARING";         break;
00216       case MINOS_DAQ_STATE_PREPARED:    whatinstr = "PREPARED";          break;
00217       case MINOS_DAQ_STATE_STARTING:    whatinstr = "STARTING";          break;
00218       case MINOS_DAQ_STATE_RUNNING:     whatinstr = "RUNNING";           break;
00219       case MINOS_DAQ_STATE_PAUSING:     whatinstr = "PAUSING";           break;
00220       case MINOS_DAQ_STATE_PAUSED:      whatinstr = "PAUSED";            break;
00221       case MINOS_DAQ_STATE_RESUMING:    whatinstr = "RESUMING";          break;
00222       case MINOS_DAQ_STATE_SUB_RUN_CHANGING: whatinstr = "SUBRUN CHANGING";   break;
00223       case MINOS_DAQ_STATE_ERROR:       whatinstr = "ERROR STATE";       break;
00224       case MINOS_DAQ_STATE_ABORTING:    whatinstr = "ABORTING";          break;
00225       case MINOS_DAQ_STATE_RESETTING:   whatinstr = "RESETTING";         break;
00226       case MINOS_DAQ_STATE_NOT_PRESENT: whatinstr = "NOT PRESENT STATE"; break;
00227       case MINOS_DAQ_STATE_DISABLED:    whatinstr = "DISABLED";          break;
00228       case MINOS_DAQ_STATE_COMMS_ERROR: whatinstr = "COMMS ERROR";       break;
00229       case MINOS_DAQ_STATE_TIMEOUT:     whatinstr = "TIMEOUT";           break;
00230       case MINOS_DAQ_STATE_CONNECTING:  whatinstr = "CONNECTING";        break;
00231       default:                          whatinstr = "unknown-(state_report)state";break;
00232       }
00233       break;
00234    default:  whatinstr = "uknown-instr"; break;
00235    }
00236 
00237    return whatinstr;
00238 }

void RotoRcCmd::SetDataToFollow ( Bool_t  xdata  ) 
void RotoRcCmd::SetInstr ( Int_t  instr  ) 

Definition at line 100 of file RotoRcCmd.cxx.

References fEncoded, maskInstr, shiftInstr, and zeroInstr.

Referenced by RotoServer::ReplyToCommand().

00101 { fEncoded = ((instr&maskInstr)<<shiftInstr) | (fEncoded & zeroInstr); }

void RotoRcCmd::SetType ( Int_t  type  ) 
void RotoRcCmd::SwapFromTo (  )  [inline]

Definition at line 47 of file RotoRcCmd.h.

References SwapToFrom().

Referenced by RotoServer::ReplyToCommand().

00047 { SwapToFrom(); }

void RotoRcCmd::SwapToFrom (  ) 

Definition at line 107 of file RotoRcCmd.cxx.

References fEncoded, GetFrom(), GetTo(), shiftFrom, shiftTo, and zeroFromTo.

Referenced by RotoClient::ReceiveCommandReply(), RotoClient::ReceiveRequestReply(), and SwapFromTo().

00108 { 
00109    Int_t newfrom = GetTo();
00110    Int_t newto   = GetFrom();
00111    fEncoded = (fEncoded&zeroFromTo) | (newto<<shiftTo) | (newfrom<<shiftFrom);
00112 }

Bool_t RotoRcCmd::TestAckAsBool (  ) 

Definition at line 115 of file RotoRcCmd.cxx.

References GetType(), and MINOS_ROOTER_ACKNOWLEDGE.

Referenced by RotoClient::ReceiveCommandReply().

00116 {
00117    return ((GetType() == MINOS_ROOTER_ACKNOWLEDGE) ? true : false);
00118 }

string RotoRcCmd::TypeAsStlString ( Int_t  type  )  [static]

Definition at line 136 of file RotoRcCmd.cxx.

References MINOS_ROOTER_ACKNOWLEDGE, MINOS_ROOTER_COMMAND, MINOS_ROOTER_REPORT, MINOS_ROOTER_REQUEST, MINOS_ROOTER_STATE_REPORT, and MINOS_ROOTER_UNABLE_TO.

Referenced by AsStlString(), and RotoServer::ProcessCommand().

00137 {
00138    string whattype;
00139 
00140    switch (type) {
00141    case MINOS_ROOTER_COMMAND:      whattype = "COMMAND";      break;
00142    case MINOS_ROOTER_ACKNOWLEDGE:  whattype = "ACKNOWLEDGE";  break;
00143    case MINOS_ROOTER_UNABLE_TO:    whattype = "UNABLE_TO";    break;
00144    case MINOS_ROOTER_REQUEST:      whattype = "REQUEST";      break;
00145    case MINOS_ROOTER_REPORT:       whattype = "REPORT";       break;
00146    case MINOS_ROOTER_STATE_REPORT: whattype = "STATE_REPORT"; break;
00147    default:                        whattype = "unknown-type"; break;
00148    }
00149 
00150    return whattype;
00151 }


Friends And Related Function Documentation

Bool_t operator!= ( const RotoRcCmd lhs,
const RotoRcCmd rhs 
) [friend]
Bool_t operator== ( const RotoRcCmd lhs,
const RotoRcCmd rhs 
) [friend]

Member Data Documentation


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1