17 #ifndef __VisAOApp_standalone_h__
18 #define __VisAOApp_standalone_h__
22 #include "stdconfig.h"
29 #define SIG_MAINTHREAD (SIGRTMIN+6)
32 #define ERROR_REPORT(er) if(global_error_report) (*global_error_report)(er,__FILE__,__LINE__);
36 #define LOG_INFO(li) if(global_log_info) (*global_log_info)(li);
79 VisAOApp_standalone(
string name,
int id,
int logLevel = Logger::LOG_LEV_INFO)
throw (AOException);
81 void set_conffile( std::string name)
throw (AOException);
87 void set_conffile(std::string name,
const std::string& conffile)
throw (AOException);
95 static const std::string & ConfigFile() {
return _configFile;}
96 static const std::string & MyName() {
return _myName;}
97 static const std::string & MyFullName() {
return _myFullName;}
98 static int ID() {
return _ID;}
99 static Config_File & ConfigDictionary() {
return (*_cfg);}
100 static int Verbosity() {
return _logger->getLevel();}
110 static void SetMyName(
const std::string& name) {_myName=name;}
111 static void SetConfigFile(
const std::string& conffile)
throw (Config_File_Exception);
112 static void SetID(
int id) {_ID=id;}
114 static Logger* _logger;
116 std::string init_file;
117 Config_File* init_vars;
120 static int CONFIG_LOADER_LOG_LEVEL;
122 static int DEFAULT_LOG_LEVEL;
124 void setLogFile(
string fileName);
128 void CreateVisAOApp_standalone(
int logLevel)
throw (AOException);
130 static std::string _configFile;
131 static std::string _logFile;
132 static std::string _myName;
134 static std::string _myFullName;
135 static Config_File* _cfg;
149 void log_msg(
int LogLevel, std::string lmsg);
160 double signalth_sleeptime;
208 void sig_mainthread_catcher(
int signum, siginfo_t *siginf,
void *ucont);
211 void sigterm_handler(
int signum, siginfo_t *siginf,
void *ucont);
216 #endif //__VisAOApp_standalone_h__
VisAOApp_standalone()
Default constructor.
void log_msg(int LogLevel, std::string lmsg)
Report an error. Also calls log_msg. Overloaded from VisAOApp_base.
virtual int Run()
The application main loop, to be re-implemented in derived classes.
virtual int start_signal_catcher(bool inherit_sched=true)
Starts the signal catching loop.
pthread_mutex_t signal_mutex
Mutex for the condition signaling.
The standalone VisAO application, does not interface with the AO Supervisor.
void signal_catcher()
Signal loop, normally won't need to be overridden.
virtual std::string get_app_name()
Get the application name.
void * __start_signal_catcher(void *ptr)
Thread starter for the signal catcher.
pthread_cond_t signal_cond
Condition for telling main thread that something changed.
virtual int block_signal(int signum)
Sets the signal mask to block signal signum.
pthread_t signal_thread
Identifier for the separate signal handling thread.
virtual int block_sigio()
Sets the signal mask to block SIGIO and RTSIGIO.
static string getConffile(string identity)
Return configuration file path based on identity.
The base class for VisAO applications.
Declarations for VisAOApp_base.
virtual int install_sig_mainthread_catcher()
Install the SIG_MAINTHREAD signal catcher.
virtual int Exec()
Installs the term and XXXX signal handlers, and calls Run().
The namespace of VisAO software.
pthread_t main_thread
Identifier for the main thread.
virtual int kill_me()
Handle a timetodie condition upon exiting the signal catcher thread (e.g. tell main thread it is abou...