OpendTect  7.0
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ServiceMgrBase Class Reference

Base class for OpendTect Service Manager and external services/apps. More...

Inheritance diagram for ServiceMgrBase:
[legend]

Classes

struct  packetData
 

Public Member Functions

virtual ~ServiceMgrBase ()
 
Network::Authority getAuthority (bool islocal) const
 
bool isOK (bool islocal) const
 
virtual void stopServer (bool islocal)
 
- 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
 
virtual CallBackertrueCaller ()
 
- 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 &)
 
const name_typename () const override
 
NamedObjectoperator= (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 * sKeyCloseEv ()
 
static const char * sKeyDeregister ()
 
static const char * sKeyEvent ()
 
static const char * sKeyODServer ()
 
static const char * sKeyPyEnvChangeEv ()
 
static const char * sKeyRegister ()
 
static const char * sKeyStatusEv ()
 
static const char * sKeySurveyChangeEv ()
 
- Static Public Member Functions inherited from CallBacker
static void createReceiverForCurrentThread ()
 
static void removeReceiverForCurrentThread ()
 

Protected Member Functions

 ServiceMgrBase (const char *servicenm)
 
 ServiceMgrBase (const char *servicenm, bool assignport, Network::SpecAddr=Network::Any)
 
bool addLocalServer ()
 
bool addTCPServer (bool assignport=true, Network::SpecAddr=Network::Any)
 
virtual bool canParseAction (const char *, uiRetVal &)
 
virtual bool canParseRequest (const OD::JSON::Object &, uiRetVal &)
 
virtual void closeApp ()
 
virtual void doAppClosing (CallBacker *)
 
virtual uiRetVal doHandleAction (const char *action)
 
virtual uiRetVal doHandleRequest (const OD::JSON::Object &)
 
virtual void doPyEnvChange (CallBacker *)
 
virtual void doSurveyChanged (CallBacker *)
 
bool isMainService () const
 
void sendErr (uiRetVal &)
 
void sendOK ()
 
- Protected Member Functions inherited from NamedCallBacker
void sendDelNotif () const
 

Static Protected Member Functions

static bool addApplicationAuthority (bool local, OS::MachineCommand &)
 
static void debugMsg (const char *)
 
static void getPythEnvRequestInfo (OD::JSON::Object &)
 
static uiRetVal sendAction (const Network::Authority &, const char *servicenm, const char *action)
 
static uiRetVal sendRequest (const Network::Authority &, const char *servicenm, const char *reqkey, const OD::JSON::Object &)
 
static const char * sKeyClientAppCloseEv ()
 
static const ServiceMgrBasetheMain ()
 
static const ServiceMgrBasetheMain (bool local)
 

Protected Attributes

CNotifier< ServiceMgrBase, BufferStringstartHandleAction
 
CNotifier< ServiceMgrBase, const OD::JSON::Object * > startHandleRequest
 
- Protected Attributes inherited from NamedCallBacker
Threads::Atomic< bool > delalreadytriggered_
 
Notifier< NamedCallBackerdelnotif_
 
- Protected Attributes inherited from NamedObject
BufferString name_
 

Private Member Functions

 ServiceMgrBase (ServiceMgrBase &&)=delete
 
void appClosingCB (CallBacker *)
 
uiRetVal applyInOtherThread (const packetData &)
 
bool canDoAction (const OD::JSON::Object &, packetData &)
 
bool canDoRequest (const OD::JSON::Object &, packetData &)
 
void connClosedCB (CallBacker *)
 
void doHandleActionRequest (CallBacker *)
 
uiRetVal handleActionRequestInThread (const packetData &)
 
void init (bool islocal, bool assignport=true, Network::SpecAddr=Network::Any)
 
bool isServerOK (bool local) const
 
 mOD_DisableCopy (ServiceMgrBase)
 
void newConnectionCB (CallBacker *)
 
ServiceMgrBaseoperator= (ServiceMgrBase &&)=delete
 
void packetArrivedCB (CallBacker *)
 
void pyenvChangeCB (CallBacker *)
 
uiRetVal pythEnvChangedReq (const OD::JSON::Object &)
 
bool & serverIsMine (bool islocal)
 
uiRetVal survChangedReq (const OD::JSON::Object &)
 
void surveyChangedCB (CallBacker *)
 
bool useServer (Network::RequestServer *, bool islocal)
 

Static Private Member Functions

static uiRetVal sendRequest_ (const Network::Authority &, const char *servicenm, const OD::JSON::Object &)
 
static const char * sKeyAction ()
 
static const char * sKeyError ()
 
static const char * sKeyOK ()
 
static ServiceMgrBasetheNewMain (bool local, ServiceMgrBase *)
 
static ServiceMgrBasetheNewMain (ServiceMgrBase *)
 

Private Attributes

ObjectSet< packetDataapplydata_
 
Network::RequestConnectionlocalconn_ = nullptr
 
Network::RequestServerlocalserver_ = nullptr
 
bool localserverismine_ = true
 
RefMan< Network::RequestPacketpacket_
 
Network::RequestConnectiontcpconn_ = nullptr
 
Network::RequestServertcpserver_ = nullptr
 
bool tcpserverismine_ = true
 

Additional Inherited Members

- Public Types inherited from ObjectWithName
typedef OD::String name_type
 

Detailed Description

Base class for OpendTect Service Manager and external services/apps.

<>

Constructor & Destructor Documentation

◆ ~ServiceMgrBase()

virtual ServiceMgrBase::~ServiceMgrBase ( )
virtual

◆ ServiceMgrBase() [1/3]

ServiceMgrBase::ServiceMgrBase ( const char *  servicenm)
protected

◆ ServiceMgrBase() [2/3]

ServiceMgrBase::ServiceMgrBase ( const char *  servicenm,
bool  assignport,
Network::SpecAddr  = Network::Any 
)
protected

◆ ServiceMgrBase() [3/3]

ServiceMgrBase::ServiceMgrBase ( ServiceMgrBase &&  )
privatedelete

Member Function Documentation

◆ addApplicationAuthority()

static bool ServiceMgrBase::addApplicationAuthority ( bool  local,
OS::MachineCommand  
)
staticprotected

◆ addLocalServer()

bool ServiceMgrBase::addLocalServer ( )
protected

◆ addTCPServer()

bool ServiceMgrBase::addTCPServer ( bool  assignport = true,
Network::SpecAddr  = Network::Any 
)
protected

◆ appClosingCB()

void ServiceMgrBase::appClosingCB ( CallBacker )
private

◆ applyInOtherThread()

uiRetVal ServiceMgrBase::applyInOtherThread ( const packetData )
private

◆ canDoAction()

bool ServiceMgrBase::canDoAction ( const OD::JSON::Object ,
packetData  
)
private

◆ canDoRequest()

bool ServiceMgrBase::canDoRequest ( const OD::JSON::Object ,
packetData  
)
private

◆ canParseAction()

virtual bool ServiceMgrBase::canParseAction ( const char *  ,
uiRetVal  
)
protectedvirtual

◆ canParseRequest()

virtual bool ServiceMgrBase::canParseRequest ( const OD::JSON::Object ,
uiRetVal  
)
protectedvirtual

◆ closeApp()

virtual void ServiceMgrBase::closeApp ( )
protectedvirtual

◆ connClosedCB()

void ServiceMgrBase::connClosedCB ( CallBacker )
private

◆ debugMsg()

static void ServiceMgrBase::debugMsg ( const char *  )
staticprotected

◆ doAppClosing()

virtual void ServiceMgrBase::doAppClosing ( CallBacker )
protectedvirtual

◆ doHandleAction()

virtual uiRetVal ServiceMgrBase::doHandleAction ( const char *  action)
protectedvirtual

◆ doHandleActionRequest()

void ServiceMgrBase::doHandleActionRequest ( CallBacker )
private

◆ doHandleRequest()

virtual uiRetVal ServiceMgrBase::doHandleRequest ( const OD::JSON::Object )
protectedvirtual

◆ doPyEnvChange()

virtual void ServiceMgrBase::doPyEnvChange ( CallBacker )
inlineprotectedvirtual

Reimplemented in uiServiceClientMgr, and ServiceServerMgr.

◆ doSurveyChanged()

virtual void ServiceMgrBase::doSurveyChanged ( CallBacker )
inlineprotectedvirtual

Reimplemented in uiServiceClientMgr.

◆ getAuthority()

Network::Authority ServiceMgrBase::getAuthority ( bool  islocal) const

◆ getPythEnvRequestInfo()

static void ServiceMgrBase::getPythEnvRequestInfo ( OD::JSON::Object )
staticprotected

◆ handleActionRequestInThread()

uiRetVal ServiceMgrBase::handleActionRequestInThread ( const packetData )
private

◆ init()

void ServiceMgrBase::init ( bool  islocal,
bool  assignport = true,
Network::SpecAddr  = Network::Any 
)
private

◆ isMainService()

bool ServiceMgrBase::isMainService ( ) const
protected

◆ isOK()

bool ServiceMgrBase::isOK ( bool  islocal) const

◆ isServerOK()

bool ServiceMgrBase::isServerOK ( bool  local) const
private

◆ mOD_DisableCopy()

ServiceMgrBase::mOD_DisableCopy ( ServiceMgrBase  )
private

◆ newConnectionCB()

void ServiceMgrBase::newConnectionCB ( CallBacker )
private

◆ operator=()

ServiceMgrBase& ServiceMgrBase::operator= ( ServiceMgrBase &&  )
privatedelete

◆ packetArrivedCB()

void ServiceMgrBase::packetArrivedCB ( CallBacker )
private

◆ pyenvChangeCB()

void ServiceMgrBase::pyenvChangeCB ( CallBacker )
private

◆ pythEnvChangedReq()

uiRetVal ServiceMgrBase::pythEnvChangedReq ( const OD::JSON::Object )
private

◆ sendAction()

static uiRetVal ServiceMgrBase::sendAction ( const Network::Authority ,
const char *  servicenm,
const char *  action 
)
staticprotected

◆ sendErr()

void ServiceMgrBase::sendErr ( uiRetVal )
protected

◆ sendOK()

void ServiceMgrBase::sendOK ( )
protected

◆ sendRequest()

static uiRetVal ServiceMgrBase::sendRequest ( const Network::Authority ,
const char *  servicenm,
const char *  reqkey,
const OD::JSON::Object  
)
staticprotected

Reimplement these functions to intercept packets intended for your service Return true if the action/request can be handled

◆ sendRequest_()

static uiRetVal ServiceMgrBase::sendRequest_ ( const Network::Authority ,
const char *  servicenm,
const OD::JSON::Object  
)
staticprivate

◆ serverIsMine()

bool& ServiceMgrBase::serverIsMine ( bool  islocal)
private

◆ sKeyAction()

static const char* ServiceMgrBase::sKeyAction ( )
inlinestaticprivate

◆ sKeyClientAppCloseEv()

static const char* ServiceMgrBase::sKeyClientAppCloseEv ( )
inlinestaticprotected

◆ sKeyCloseEv()

static const char* ServiceMgrBase::sKeyCloseEv ( )
inlinestatic

◆ sKeyDeregister()

static const char* ServiceMgrBase::sKeyDeregister ( )
inlinestatic

◆ sKeyError()

static const char* ServiceMgrBase::sKeyError ( )
inlinestaticprivate

◆ sKeyEvent()

static const char* ServiceMgrBase::sKeyEvent ( )
inlinestatic

◆ sKeyODServer()

static const char* ServiceMgrBase::sKeyODServer ( )
inlinestatic

◆ sKeyOK()

static const char* ServiceMgrBase::sKeyOK ( )
inlinestaticprivate

◆ sKeyPyEnvChangeEv()

static const char* ServiceMgrBase::sKeyPyEnvChangeEv ( )
inlinestatic

◆ sKeyRegister()

static const char* ServiceMgrBase::sKeyRegister ( )
inlinestatic

◆ sKeyStatusEv()

static const char* ServiceMgrBase::sKeyStatusEv ( )
inlinestatic

◆ sKeySurveyChangeEv()

static const char* ServiceMgrBase::sKeySurveyChangeEv ( )
inlinestatic

◆ stopServer()

virtual void ServiceMgrBase::stopServer ( bool  islocal)
virtual

◆ survChangedReq()

uiRetVal ServiceMgrBase::survChangedReq ( const OD::JSON::Object )
private

◆ surveyChangedCB()

void ServiceMgrBase::surveyChangedCB ( CallBacker )
private

◆ theMain() [1/2]

static const ServiceMgrBase* ServiceMgrBase::theMain ( )
staticprotected

◆ theMain() [2/2]

static const ServiceMgrBase* ServiceMgrBase::theMain ( bool  local)
staticprotected

◆ theNewMain() [1/2]

static ServiceMgrBase* ServiceMgrBase::theNewMain ( bool  local,
ServiceMgrBase  
)
staticprivate

◆ theNewMain() [2/2]

static ServiceMgrBase* ServiceMgrBase::theNewMain ( ServiceMgrBase )
staticprivate

◆ useServer()

bool ServiceMgrBase::useServer ( Network::RequestServer ,
bool  islocal 
)
private

Member Data Documentation

◆ applydata_

ObjectSet<packetData> ServiceMgrBase::applydata_
private

◆ localconn_

Network::RequestConnection* ServiceMgrBase::localconn_ = nullptr
private

◆ localserver_

Network::RequestServer* ServiceMgrBase::localserver_ = nullptr
private

◆ localserverismine_

bool ServiceMgrBase::localserverismine_ = true
private

◆ packet_

RefMan<Network::RequestPacket> ServiceMgrBase::packet_
private

◆ startHandleAction

CNotifier<ServiceMgrBase,BufferString> ServiceMgrBase::startHandleAction
protected

◆ startHandleRequest

CNotifier<ServiceMgrBase,const OD::JSON::Object*> ServiceMgrBase::startHandleRequest
protected

◆ tcpconn_

Network::RequestConnection* ServiceMgrBase::tcpconn_ = nullptr
private

◆ tcpserver_

Network::RequestServer* ServiceMgrBase::tcpserver_ = nullptr
private

◆ tcpserverismine_

bool ServiceMgrBase::tcpserverismine_ = true
private

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024