Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Friends

BatchProgram Class Reference

Main object for 'standard' batch programs. More...

Inheritance diagram for BatchProgram:
NamedObject CallBacker

List of all members.

Public Member Functions

const IOParpars () const
IOParpars ()
int nrArgs () const
const char * arg (int idx) const
const char * fullPath () const
const char * progName () const
bool go (std::ostream &log_stream)
 This method must be defined by user.
char ** argv ()
int & argc ()
int argc () const
int realArgsStartAt () const
BufferStringSetcmdLineOpts ()
IOObjgetIOObjFromPars (const char *keybase, bool mknew, const IOObjContext &ctxt, bool msgiffail=true) const
bool pauseRequested () const
 pause requested (via socket) by master?
bool errorMsg (const char *msg, bool cc_stderr=false)
bool infoMsg (const char *msg, bool cc_stdout=false)

Static Public Member Functions

static void deleteInstance ()

Protected Member Functions

 BatchProgram ()
 ~BatchProgram ()
void init (int *, char **)
bool initOutput ()
void progKilled (CallBacker *)
void killNotify (bool yn)
MMSockCommunicmmComm ()
int jobId ()

Protected Attributes

int * pargc
char ** argv_
int argshift
FileNameString fullpath
bool stillok
bool inbg
StreamDatasdout
IOPariopar
BufferStringSet opts
BufferString parversion_
BufferStringSet requests_
BufferString finishmsg_

Static Protected Attributes

static BatchPrograminst_

Private Attributes

MMSockCommuniccomm
int jobid

Friends

class MMSockCommunic
mGlobal friend BatchProgramBP ()
int Execute_batch (int *, char **)

Detailed Description

Main object for 'standard' batch programs.

Most 'interesting' batch programs need a lot of parameters to do the work. Therefore, in OpendTect, BatchPrograms need a 'parameter file', with all the info needed in IOPar format, i.e. keyword/value pairs.

This object takes over the details of reading that file, extracting 'standard' components from the parameters, opening sockets, etc. etc.

To use the object, instead of defining a function 'main', you should define the function 'BatchProgramgo'.

If you need argc and/or argv outside go(), the BP() singleton instance can be accessed.


Constructor & Destructor Documentation

BatchProgram::BatchProgram (  )  [protected]
BatchProgram::~BatchProgram (  )  [protected]

Member Function Documentation

const char* BatchProgram::arg ( int  idx  )  const [inline]
int& BatchProgram::argc (  )  [inline]
int BatchProgram::argc (  )  const [inline]
char** BatchProgram::argv (  )  [inline]
BufferStringSet& BatchProgram::cmdLineOpts (  )  [inline]
static void BatchProgram::deleteInstance (  )  [static]
bool BatchProgram::errorMsg ( const char *  msg,
bool  cc_stderr = false 
)
const char* BatchProgram::fullPath (  )  const [inline]
IOObj* BatchProgram::getIOObjFromPars ( const char *  keybase,
bool  mknew,
const IOObjContext ctxt,
bool  msgiffail = true 
) const
bool BatchProgram::go ( std::ostream &  log_stream  ) 

This method must be defined by user.

bool BatchProgram::infoMsg ( const char *  msg,
bool  cc_stdout = false 
)
void BatchProgram::init ( int *  ,
char **   
) [protected]
bool BatchProgram::initOutput (  )  [protected]
int BatchProgram::jobId (  )  [inline, protected]
void BatchProgram::killNotify ( bool  yn  )  [protected]
MMSockCommunic* BatchProgram::mmComm (  )  [inline, protected]
int BatchProgram::nrArgs (  )  const [inline]
const IOPar& BatchProgram::pars (  )  const [inline]
IOPar& BatchProgram::pars (  )  [inline]
bool BatchProgram::pauseRequested (  )  const

pause requested (via socket) by master?

void BatchProgram::progKilled ( CallBacker  )  [protected]
const char* BatchProgram::progName (  )  const
int BatchProgram::realArgsStartAt (  )  const [inline]

Friends And Related Function Documentation

mGlobal friend BatchProgram& BP (  )  [friend]
int Execute_batch ( int *  ,
char **   
) [friend]
friend class MMSockCommunic [friend]

Member Data Documentation

int BatchProgram::argshift [protected]
char** BatchProgram::argv_ [protected]
FileNameString BatchProgram::fullpath [protected]
bool BatchProgram::inbg [protected]
BatchProgram* BatchProgram::inst_ [static, protected]
IOPar* BatchProgram::iopar [protected]
int BatchProgram::jobid [private]
int* BatchProgram::pargc [protected]
bool BatchProgram::stillok [protected]