EL::BackgroundSocket Class Reference

This class wraps around the socket used for communication to the background worker and implements a simple messaging mechanism. More...

#include <BackgroundSocket.h>

List of all members.

Public Types

enum  Type {
  T_START_JOB, T_SET_INPUT_FILE, T_SET_ENTRY, T_EXECUTE,
  T_EXECUTE_CONFIRM, T_END_JOB, T_END_JOB_CONFIRM, T_INVALID
}
 

the type of message we send around

More...

Public Member Functions

void testInvariant () const
 test the invariant of this object
 BackgroundSocket (int val_socket)
 standard constructor
 ~BackgroundSocket ()
 standard destructor
void write (Type type, const std::string &payload)
 write a message to the socket
void read (Type &type, std::string &payload)
 read a message from the socket

Static Public Member Functions

static void makeSockets (int sockets[2])
 make a pair of sockets suitable for communication
static std::auto_ptr
< BackgroundSocket
startWorker (const BackgroundJob &job)
 start a background worker connected by socket

Detailed Description

This class wraps around the socket used for communication to the background worker and implements a simple messaging mechanism.

Messages here just consist of a type and a string as a payload. We do not worry about bringing thinks into a portable format, as this is only meant for communicating between machines employing the same architecture.


Member Enumeration Documentation

the type of message we send around

Enumerator:
T_START_JOB 

start the job

the payload indicates a file containing the information about the job.

T_SET_INPUT_FILE 

set the next input file

the payload is the name of the file to open

T_SET_ENTRY 

set the tree entry

the payload is a Long64_t wrapped into a string that contains the tree entry

T_EXECUTE 

execute the event

there is no payload for this

T_EXECUTE_CONFIRM 

confirm a T_EXECUTE

T_END_JOB 

end the job

the payload indicates a file to which to save the histogram information.

T_END_JOB_CONFIRM 

confirm a T_END_JOB

T_INVALID 

an invalid message

this is guaranteed to be the last entry in the enum, so that it can be used to check that the enum is read correctly


Constructor & Destructor Documentation

EL::BackgroundSocket::BackgroundSocket ( int  val_socket  ) 

standard constructor

Guarantee
strong
Failures
out of memory I
EL::BackgroundSocket::~BackgroundSocket (  ) 

standard destructor

Guarantee
no-fail

Member Function Documentation

void EL::BackgroundSocket::makeSockets ( int  sockets[2]  )  [static]

make a pair of sockets suitable for communication

I rather do this myself instead of leaving it to the user, as this allows me to make sure the settings are correct.

Guarantee
strong
Failures
i/o errors
void EL::BackgroundSocket::read ( Type type,
std::string &  payload 
)

read a message from the socket

Guarantee
basic
Failures
i/o errors
std::auto_ptr< BackgroundSocket > EL::BackgroundSocket::startWorker ( const BackgroundJob job  )  [static]

start a background worker connected by socket

Guarantee
basic
Failures
low level failures
void EL::BackgroundSocket::testInvariant (  )  const

test the invariant of this object

Guarantee
no-fail
void EL::BackgroundSocket::write ( Type  type,
const std::string &  payload 
)

write a message to the socket

Guarantee
basic
Failures
i/o errors

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 15 Apr 2017 for RootCore Packages by  doxygen 1.6.1