nidas  v1.2-1520
DSMServer.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  ** 2005, 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_DSMSERVER_H
28 #define NIDAS_CORE_DSMSERVER_H
29 
30 #include "DOMable.h"
31 #include "NidsIterators.h"
32 #include "XMLException.h"
34 
35 #include <list>
36 
37 namespace nidas { namespace util {
38  class Thread;
39 }}
40 
41 namespace nidas { namespace core {
42 
43 class Project;
44 class Site;
45 class DSMService;
46 
50 class DSMServer: public DOMable {
51 public:
52 
53  DSMServer();
54 
55  virtual ~DSMServer();
56 
57  const std::string& getName() const { return _name; }
58 
59  void setName(const std::string& val) { _name = val; }
60 
61  const std::string& getXMLConfigFileName() const { return _xmlFileName; }
62 
63  void setXMLConfigFileName(const std::string& val) { _xmlFileName = val; }
64 
65  void addService(DSMService* service) { _services.push_back(service); }
66 
67  const std::list<DSMService*>& getServices() const { return _services; }
68 
69  void setProject(Project* val) { _project = val; }
70 
71  const Project* getProject() const { return _project; }
72 
73  void setSite(const Site* val) { _site = val; }
74 
75  const Site* getSite() const { return _site; }
76 
78 
80 
82 
84 
85  void addThread(nidas::util::Thread* thrd);
86 
87  void scheduleServices(bool optionalProcessing) throw(nidas::util::Exception);
88 
89  void interruptServices() throw();
90 
91  void joinServices() throw();
92 
93  void setStatusSocketAddr(const nidas::util::SocketAddress& val)
94  {
95  delete _statusSocketAddr;
96  _statusSocketAddr = val.clone();
97  }
98 
100  {
101  return *_statusSocketAddr;
102  }
103 
104  void fromDOMElement(const xercesc::DOMElement*)
105  throw(nidas::util::InvalidParameterException);
106 
107 private:
108 
113  std::string _name;
114 
116 
121  const Site* _site;
122 
126  std::list<DSMService*> _services;
127 
128  std::string _xmlFileName;
129 
130  nidas::util::SocketAddress* _statusSocketAddr;
131 
135  DSMServer(const DSMServer&);
136 
140  DSMServer& operator=(const DSMServer&);
141 
142 };
143 
144 }} // namespace nidas namespace core
145 
146 #endif
void joinServices()
Definition: DSMServer.cc:204
void addThread(nidas::util::Thread *thrd)
void setName(const std::string &val)
Definition: DSMServer.h:59
DSMServiceIterator getDSMServiceIterator() const
Definition: DSMServer.cc:73
void setProject(Project *val)
Definition: DSMServer.h:69
A measurement site.
Definition: Site.h:49
An interface for a socket address.
Definition: SocketAddress.h:36
Interface of an object that can be instantiated from a DOM element, via the fromDOMElement method...
Definition: DOMable.h:51
const nidas::util::SocketAddress & getStatusSocketAddr() const
Definition: DSMServer.h:99
void setStatusSocketAddr(const nidas::util::SocketAddress &val)
Definition: DSMServer.h:93
SampleTagIterator getSampleTagIterator() const
Definition: DSMServer.cc:90
void fromDOMElement(const xercesc::DOMElement *)
Initialize myself from a xercesc::DOMElement.
Definition: DSMServer.cc:95
void setSite(const Site *val)
Definition: DSMServer.h:73
Class for iterating over the Processors of a DSMServer or DSMConfig.
Definition: NidsIterators.h:149
Class for iterating over the DSMServices of a DSMServer.
Definition: NidsIterators.h:91
Definition: Exception.h:35
Project * _project
Definition: DSMServer.h:115
const Project * getProject() const
Definition: DSMServer.h:71
Definition: Thread.h:80
virtual ~DSMServer()
Definition: DSMServer.cc:51
std::string _name
Name of this server.
Definition: DSMServer.h:113
const std::string & getName() const
Definition: DSMServer.h:57
void setXMLConfigFileName(const std::string &val)
Definition: DSMServer.h:63
void addService(DSMService *service)
Definition: DSMServer.h:65
void interruptServices()
Definition: DSMServer.cc:194
Class for iterating over the SampleTags of a Project, Site, DSMConfig, or a SampleSource.
Definition: NidsIterators.h:217
DSMServer()
Definition: DSMServer.cc:45
const std::list< DSMService * > & getServices() const
Definition: DSMServer.h:67
ProcessorIterator getProcessorIterator() const
Definition: DSMServer.cc:78
Class for iterating over the DSMSensors of a Project, Site, or DSMConfig.
Definition: NidsIterators.h:185
SensorIterator getSensorIterator() const
Definition: DSMServer.cc:83
std::string _xmlFileName
Definition: DSMServer.h:128
const std::string & getXMLConfigFileName() const
Definition: DSMServer.h:61
Definition: Project.h:60
std::list< DSMService * > _services
The DSMServices that we&#39;ve been configured to start.
Definition: DSMServer.h:126
void scheduleServices(bool optionalProcessing)
Definition: DSMServer.cc:183
const Site * _site
What Site to I serve? Can be NULL if this DSMServer is not for a specific Site, but serves the Projec...
Definition: DSMServer.h:121
A provider of services to a DSM.
Definition: DSMServer.h:50
virtual SocketAddress * clone() const =0
Virtual constructor.
Base class for a service, as built from a &lt;service&gt; XML tag.
Definition: DSMService.h:47
nidas::util::SocketAddress * _statusSocketAddr
Definition: DSMServer.h:130
const Site * getSite() const
Definition: DSMServer.h:75