![]() |
Jazz 1.25.+
|
A Jazz Service is a globally instanced configurable object that may allocate RAM. More...
#include <utils.h>
Public Member Functions | |
Service (pLogger a_logger, pConfigFile a_config) | |
virtual StatusCode | start () |
A simple start()/shut_down() interface (Restart is: shut_down(TRUE):start()) | |
virtual StatusCode | shut_down () |
virtual pChar const | id () |
void | log (int loglevel, const char *message) |
void | log_printf (int loglevel, const char *fmt,...) |
bool | get_conf_key (const char *key, int &value) |
bool | get_conf_key (const char *key, double &value) |
bool | get_conf_key (const char *key, std::string &value) |
Data Fields | |
pLogger | p_log |
The logger. | |
pConfigFile | p_conf |
The configuration file. | |
A Jazz Service is a globally instanced configurable object that may allocate RAM.
A service is anything that requires configuration and a logger. Only a service can own (alloc from the system) RAM, anything else allocates RAM from a service. Only Services (and some callback functions) are instantiated in Jazz instances and there is only one of each. The abstract class just defines the API.
A Service should NOT read the configuration before its .start() method is called as it may change between construction (at loading) and .start() (at running).
jazz_elements::Service::Service | ( | pLogger | a_logger, |
pConfigFile | a_config | ||
) |
Initialize the Service without starting it.
a_logger | A Logger. |
a_config | Possibly a configuration file as a ConfigFile object. NULL is okay if the object does not expect any configuration. |
Rather than using the private p_log and p_conf pointers, it is recommended to use the inline methods log() and log_printf() for logging and get_conf_key() for accessing the configuration.
|
virtual |
A simple start()/shut_down() interface (Restart is: shut_down(TRUE):start())
Start (or restart) the Service
This method should be overriden by something that actually starts the service, possibly using the configuration file in pConf.
Reimplemented in jazz_bebop::BaseAPI, jazz_bebop::Core, jazz_bebop::DataSpaces, jazz_bebop::Fields, jazz_bebop::OpCodes, jazz_bebop::Space, jazz_elements::Channels, jazz_elements::Container, jazz_elements::Persisted, jazz_elements::Volatile, jazz_main::API, jazz_models::Model, jazz_models::ModelsAPI, and jazz_models::SemSpaces.
|
virtual |
Stop the Service
This method should be overriden by something that actually stops the service, possibly using the configuration file in pConf.
Reimplemented in jazz_bebop::BaseAPI, jazz_bebop::Core, jazz_bebop::OpCodes, jazz_bebop::Space, jazz_elements::Channels, jazz_elements::Container, jazz_elements::Persisted, jazz_elements::Volatile, jazz_main::API, jazz_main::HttpServer, jazz_models::Model, and jazz_models::ModelsAPI.
|
virtual |
Return object ID.
Reimplemented in jazz_bebop::BaseAPI, jazz_bebop::Core, jazz_bebop::DataSpaces, jazz_bebop::Fields, jazz_elements::Channels, jazz_elements::Persisted, jazz_elements::Volatile, jazz_main::API, jazz_main::HttpServer, jazz_models::ModelsAPI, and jazz_models::SemSpaces.
|
inline |
|
inline |
|
inline |
Wrapper method to get configuration values when the ConfigFile was passed to the constructor of this class.
key | The configuration key to be searched. |
value | Value to be returned only when the function returns true. |
See ConfigFile for details.
|
inline |
Wrapper method to get configuration values when the ConfigFile was passed to the constructor of this class.
key | The configuration key to be searched. |
value | Value to be returned only when the function returns true. |
See ConfigFile for details.
|
inline |
Wrapper method to get configuration values when the ConfigFile was passed to the constructor of this class.
key | The configuration key to be searched. |
value | Value to be returned only when the function returns true. |
See ConfigFile for details.