OpendTect
6.6
|
Main object for 'standard' batch programs. More...
Public Types | |
enum | Status { Start , ParseFail , ParseOK , CommFail , CommOK , LogFail , LogOK , WorkWait , WorkStarted , WorkFail , WorkPaused , MoreToDo , WorkOK , Killed } |
Public Types inherited from ObjectWithName | |
typedef OD::String | name_type |
Public Member Functions | |
const CommandLineParser & | clParser () |
mExp (Batch) bool doWork(od_ostream &) | |
mExp (Batch) bool errorMsg(const uiString & | |
mExp (Batch) bool infoMsg(const char * | |
mExp (Batch) bool isOK() const | |
mExp (Batch) bool pauseRequested() | |
mExp (Batch) void loadModules() | |
mExp (Batch) void setResumed() | |
IOPar & | pars () |
const IOPar & | pars () const |
Public Member Functions inherited from NamedCallBacker | |
NamedCallBacker (const char *nm=0) | |
NamedCallBacker (const NamedCallBacker &) | |
virtual Notifier< NamedCallBacker > & | objectToBeDeleted () const |
bool | operator== (const NamedCallBacker &oth) const |
bool | operator== (const NamedObject &oth) const |
Public Member Functions inherited from CallBacker | |
CallBacker () | |
CallBacker (const CallBacker &) | |
virtual | ~CallBacker () |
bool | attachCB (const NotifierAccess &, const CallBack &, bool onlyifnew=false) const |
bool | attachCB (const NotifierAccess *notif, const CallBack &cb, bool onlyifnew=false) const |
void | detachAllNotifiers () const |
Call from the destructor of your inherited object. More... | |
void | detachCB (const NotifierAccess &, const CallBack &) const |
void | detachCB (const NotifierAccess *notif, const CallBack &cb) const |
virtual bool | isCapsule () const |
bool | isNotifierAttached (const NotifierAccess *) const |
Only for debugging purposes, don't use. More... | |
void | stopReceivingNotifications () const |
Public Member Functions inherited from NamedObject | |
NamedObject (const char *nm=nullptr) | |
NamedObject (const NamedObject &oth) | |
virtual | ~NamedObject () |
virtual BufferString | getName () const |
bool | getNameFromPar (const IOPar &) |
virtual const name_type & | name () const |
NamedObject & | operator= (const NamedObject &) |
bool | operator== (const NamedObject &oth) const |
virtual void | setName (const char *nm) |
Public Member Functions inherited from ObjectWithName | |
virtual | ~ObjectWithName () |
bool | hasName (const char *nm) const |
bool | hasName (const name_type &nm) const |
void | putNameInPar (IOPar &) const |
Static Public Member Functions | |
static const char * | sKeyDataDir () |
static const char * | sKeyFinishMsg () |
static const char * | sKeySimpleBatch () |
static const char * | sKeySurveyDir () |
Static Public Member Functions inherited from CallBacker | |
static void | createReceiverForCurrentThread () |
static void | removeReceiverForCurrentThread () |
Public Attributes | |
bool | cc_stderr =false) |
bool | cc_stdout =false) |
Notifier< BatchProgram > | endWork |
Notifier< BatchProgram > | eventLoopStarted |
Notifier< BatchProgram > | killed |
Notifier< BatchProgram > | pause |
Notifier< BatchProgram > | resume |
Notifier< BatchProgram > | startDoWork |
Private Member Functions | |
BatchProgram () | |
~BatchProgram () | |
bool | canStartdoWork () const |
void | doFinalize () |
void | doWorkCB (CallBacker *) |
void | eventLoopStartedCB (CallBacker *) |
bool | initComm () |
bool | initLogging () |
Batch::ID | jobId () |
void | killNotify (bool yn) |
mExp (Batch) bool canReceiveRequests() const | |
mExp (Batch) bool init() | |
mExp (Batch) float getPriority() const | |
mExp (Batch) static void deleteInstance(int retcode) | |
mExp (Batch) void endWorkCB(CallBacker *) | |
mExp (Batch) void initWork() | |
mExp (Batch) void modulesLoaded() | |
mExp (Batch) void postWork(bool res) | |
mExp (Batch) void startTimer() | |
JobCommunic * | mmComm () |
bool | parseArguments () |
void | progKilled (CallBacker *) |
void | workMonitorCB (CallBacker *) |
Private Attributes | |
Threads::Lock | batchprogthreadlock_ |
CommandLineParser * | clparser_ = nullptr |
JobCommunic * | comm_ = nullptr |
IOPar * | iopar_ = nullptr |
Batch::ID | jobid_ |
float | priority_ = 0.f |
ObjectSet< OD::JSON::Object > | requests_ |
Threads::Lock | statelock_ |
Status | status_ = Start |
od_ostream * | strm_ = nullptr |
bool | strmismine_ = true |
Threads::Thread * | thread_ = nullptr |
Timer * | timer_ |
Static Private Attributes | |
static BatchProgram * | inst_ |
Friends | |
class | BatchServiceServerMgr |
BatchProgram & | BP () |
void | doWorkCB (CallBacker *) |
void | Execute_batch (int *, char **) |
void | launchDoWorkCB (CallBacker *) |
void | loadModulesCB (CallBacker *) |
Additional Inherited Members | |
Protected Member Functions inherited from NamedCallBacker | |
void | sendDelNotif () const |
Protected Attributes inherited from NamedCallBacker | |
Threads::Atomic< bool > | delalreadytriggered_ |
Notifier< NamedCallBacker > | delnotif_ |
Protected Attributes inherited from NamedObject | |
BufferString | name_ |
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.,
To use the object, instead of defining a function 'main', you should define both functions: 'BatchProgram::loadModules': to load the required basic modules 'BatchProgram::doWork': to perform the core work Both functions have full access to a Qt event loop (required for timer, networking, ...).
If you need argc and/or argv outside these two functions, the BP() singleton instance can be accessed.
<>
enum BatchProgram::Status |
|
private |
|
private |
|
private |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inlineprivate |
|
private |
|
private |
BatchProgram::mExp | ( | Batch | ) | & |
This method must be defined by user, and should contain the implementation
BatchProgram::mExp | ( | Batch | ) | const & |
BatchProgram::mExp | ( | Batch | ) | const |
|
private |
BatchProgram::mExp | ( | Batch | ) | const |
BatchProgram::mExp | ( | Batch | ) |
|
inlineprivate |
|
private |
|
private |
|
private |
BatchProgram::mExp | ( | Batch | ) |
Must be implemented to load the basic modules required by the batch program, for example: OD::ModDeps().ensureLoaded( "Attributes" ); Can only be empty if the batch program does not depend on modules above Network
|
private |
|
private |
BatchProgram::mExp | ( | Batch | ) |
|
private |
|
inlineprivate |
|
inline |
|
inline |
|
private |
|
private |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
private |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
bool BatchProgram::cc_stderr =false) |
bool BatchProgram::cc_stdout =false) |
|
private |
|
private |
Notifier<BatchProgram> BatchProgram::endWork |
Notifier<BatchProgram> BatchProgram::eventLoopStarted |
|
staticprivate |
|
private |
|
private |
Notifier<BatchProgram> BatchProgram::killed |
Notifier<BatchProgram> BatchProgram::pause |
|
private |
|
private |
Notifier<BatchProgram> BatchProgram::resume |
Notifier<BatchProgram> BatchProgram::startDoWork |
|
private |
|
private |
|
private |
|
private |
|
private |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2022