nidas v1.2.3
DSMServerApp.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2009, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26
27#ifndef NIDAS_CORE_DSMSERVERAPP_H
28#define NIDAS_CORE_DSMSERVERAPP_H
29
30#include "Datasets.h"
31#include "XMLException.h"
32#include "NidasApp.h"
36
37#include <signal.h>
38
39namespace nidas { namespace core {
40
41class Project;
42class DSMServer;
43class DSMServerIntf;
44class DSMServerStat;
45
47public:
48
50
52
56 static int main(int argc, char** argv) throw();
57
58 static DSMServerApp* getInstance() { return _instance; }
59
60 void initLogger();
61
62 int initProcess();
63
64 int run() throw();
65
66 int parseRunstring(int argc, char** argv);
67
71 int usage();
72
80 void parseXMLConfigFile(const std::string& xmlFileName, Project&);
81
85 void startXmlRpcThread();
86
90 void killXmlRpcThread();
91
96
100 void killStatusThread();
101
105 const std::string& getXMLFileName() { return _xmlFileName; }
106
108
109private:
110
116 void setupSignals();
117
124 void waitForSignal(int timeoutSecs);
125
127
129
133 bool _debug;
134
138 std::string _xmlFileName;
139
143 std::string _configsXMLName;
144
146
149
151
153
155
156 sigset_t _signalMask;
157
158 pthread_t _myThreadId;
159
160 std::string _datasetName;
161
163
166
169
172};
173
174}} // namespace nidas namespace core
175
176#endif
int main()
Definition ck_arinc.cc:117
Definition DSMServerApp.h:46
Dataset getDataset()
Definition DSMServerApp.cc:456
void initLogger()
Definition DSMServerApp.cc:199
void setupSignals()
Create a signal mask, and block those masked signals.
Definition DSMServerApp.cc:375
int parseRunstring(int argc, char **argv)
Definition DSMServerApp.cc:88
NidasApp _app
Definition DSMServerApp.h:162
void killStatusThread()
Definition DSMServerApp.cc:350
std::string _configsXMLName
The xml file that contains all the project configurations, by date.
Definition DSMServerApp.h:143
void parseXMLConfigFile(const std::string &xmlFileName, Project &)
Invoke a XMLCachingParser to parse the XML and initialize the Project.
Definition DSMServerApp.cc:427
~DSMServerApp()
Definition DSMServerApp.cc:82
static DSMServerApp * getInstance()
Definition DSMServerApp.h:58
bool _externalControl
Definition DSMServerApp.h:152
const std::string & getXMLFileName()
What is the XML configuration file name.
Definition DSMServerApp.h:105
pthread_t _myThreadId
Definition DSMServerApp.h:158
bool _debug
-d option.
Definition DSMServerApp.h:133
void killXmlRpcThread()
Definition DSMServerApp.cc:324
runState
Definition DSMServerApp.h:128
@ QUIT
Definition DSMServerApp.h:128
@ RESTART
Definition DSMServerApp.h:128
@ RUN
Definition DSMServerApp.h:128
@ ERROR
Definition DSMServerApp.h:128
void startStatusThread(DSMServer *svr)
Definition DSMServerApp.cc:341
std::string _datasetName
Definition DSMServerApp.h:160
void waitForSignal(int timeoutSecs)
Unblock and wait for signals of interest up to timeoutSecs.
Definition DSMServerApp.cc:388
bool _optionalProcessing
Definition DSMServerApp.h:154
DSMServerApp & operator=(const DSMServerApp &)
Assignment not needed.
enum runState _runState
Definition DSMServerApp.h:145
DSMServerIntf * _xmlrpcThread
This thread provides XML-based Remote Procedure calls.
Definition DSMServerApp.h:148
int usage()
Send usage message to cerr.
Definition DSMServerApp.cc:134
int initProcess()
Definition DSMServerApp.cc:204
NidasAppArg ExternalControl
Definition DSMServerApp.h:164
DSMServerStat * _statusThread
Definition DSMServerApp.h:150
DSMServerApp(const DSMServerApp &)
Copy not needed.
sigset_t _signalMask
Definition DSMServerApp.h:156
void startXmlRpcThread()
Definition DSMServerApp.cc:315
NidasAppArg OptionalProcessing
Definition DSMServerApp.h:165
DSMServerApp()
Definition DSMServerApp.cc:62
std::string _xmlFileName
The xml file that is being used for configuration information.
Definition DSMServerApp.h:138
static DSMServerApp * _instance
Definition DSMServerApp.h:126
int run()
Definition DSMServerApp.cc:211
A thread that provides XML-based Remote Procedure Calls to web interfaces from the DSMServer.
Definition DSMServerIntf.h:44
Thread which provides status from a dsm_server on a datagram socket.
Definition StatusThread.h:176
A provider of services to a DSM.
Definition DSMServer.h:50
A Dataset is a named collection of parameters, that are used in data processing.
Definition Datasets.h:48
A NidasAppArg is command-line argument which can be handled by NidasApp.
Definition NidasApp.h:76
NidasApp handles common options for NIDAS applications.
Definition NidasApp.h:576
Definition Project.h:60
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31
static int timeoutSecs
Definition sing.cc:62