nidas v1.2.3
StatusThread.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_STATUSTHREAD_H
28#define NIDAS_CORE_STATUSTHREAD_H
29
31#include <nidas/util/Socket.h>
32#include <nidas/util/Thread.h>
33
34namespace nidas { namespace core {
35
36class DSMServer;
37
43{
44public:
48 StatusThread(const std::string& name);
49
50// Define this if you want to multicast over all available multicast interfaces.
51// #define SEND_ALL_INTERFACES
52
53#ifdef SEND_ALL_INTERFACES
67 std::vector<nidas::util::Inet4NetworkInterface>& ifaces,
68 const std::string& statstr);
69#endif
70
76 const std::string& statstr);
77
78private:
79
82
85};
86
87// ------------------
88
89
113{
114public:
115 DSMEngineStat(const std::string& name,const nidas::util::SocketAddress& saddr):
116 StatusThread(name),_sockAddr(saddr.clone()) {};
117
119 {
120 delete _sockAddr;
121 }
122
126 int run();
127
128private:
130
133
136};
137
176{
177public:
178
179 DSMServerStat(const std::string& name,DSMServer* svr);
180
184 int run();
185
186private:
187
188 void setup();
189
191
196
199
202};
203
204}} // namespace nidas namespace core
205
206#endif
Thread which provides status in XML form from a dsm on a datagram socket, to be read by the status_li...
Definition StatusThread.h:113
~DSMEngineStat()
Definition StatusThread.h:118
DSMEngineStat & operator=(const DSMEngineStat &)
No assignment.
DSMEngineStat(const DSMEngineStat &)
No copying.
DSMEngineStat(const std::string &name, const nidas::util::SocketAddress &saddr)
Definition StatusThread.h:115
nidas::util::SocketAddress * _sockAddr
Definition StatusThread.h:129
int run()
Definition StatusThread.cc:88
Thread which provides status from a dsm_server on a datagram socket.
Definition StatusThread.h:176
int _uSecPeriod
Wakeup period.
Definition StatusThread.h:195
DSMServerStat(const DSMServerStat &)
No copying.
DSMServerStat(const std::string &name, DSMServer *svr)
Definition StatusThread.cc:179
DSMServer * _server
Definition StatusThread.h:190
int run()
Definition StatusThread.cc:184
DSMServerStat & operator=(const DSMServerStat &)
No assignment.
A provider of services to a DSM.
Definition DSMServer.h:50
A thread that runs periodically checking and multicasting the status of a DSMEngine.
Definition StatusThread.h:43
StatusThread(const StatusThread &)
No copying.
StatusThread & operator=(const StatusThread &)
No assignment.
void sendStatus(nidas::util::DatagramSocket *dsock, nidas::util::SocketAddress *saddr, const std::string &statstr)
Send string over DatagramSocket.
Definition StatusThread.cc:57
StatusThread(const std::string &name)
Constructor.
Definition StatusThread.cc:52
A socket for sending or receiving datagrams, either unicast, broadcast or multicast.
Definition Socket.h:1178
Support for IP version 4 host address.
Definition Inet4Address.h:46
A datagram socket to be used for multicasts.
Definition Socket.h:1582
An interface for a socket address.
Definition SocketAddress.h:36
Definition Thread.h:83
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31