nidas  v1.2-1520
SensorOpener.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 
28 #ifndef NIDAS_CORE_SENSOROPENER_H
29 #define NIDAS_CORE_SENSOROPENER_H
30 
31 #include <nidas/util/Thread.h>
33 #include <nidas/util/IOException.h>
34 
35 namespace nidas { namespace core {
36 
37 class SensorHandler;
38 
43 public:
44 
50 
51  ~SensorOpener();
52 
63  void openSensor(DSMSensor *sensor);
64 
72  void reopenSensor(DSMSensor *sensor);
73 
74  int run() throw(nidas::util::Exception);
75 
76  void interrupt();
77 
78 protected:
79 
81 
82  std::list<DSMSensor*> _sensors;
83 
84  std::list<DSMSensor*> _problemSensors;
85 
87 
88  /* Copy not needed */
89  SensorOpener(const SensorOpener&);
90 
91  /* Assignment not needed */
93 };
94 
95 }} // namespace nidas namespace core
96 
97 #endif
SensorHandler * _selector
Definition: SensorOpener.h:80
std::list< DSMSensor * > _sensors
Definition: SensorOpener.h:82
SensorHandler implements a DSMSensor event loop.
Definition: SensorHandler.h:87
int run()
Thread function, open sensors.
Definition: SensorOpener.cc:110
void reopenSensor(DSMSensor *sensor)
A SensorHandler calls this method to schedule a sensor to be reopened.
Definition: SensorOpener.cc:70
nidas::util::Cond _sensorCond
Definition: SensorOpener.h:86
~SensorOpener()
Note that SensorOpener does not own the sensors, and does not delete them.
Definition: SensorOpener.cc:52
Definition: Exception.h:35
SensorOpener & operator=(const SensorOpener &)
Definition: Thread.h:80
void interrupt()
Interrupt this SensorOpener.
Definition: SensorOpener.cc:82
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor a...
Definition: DSMSensor.h:87
A wrapper class for a Posix condition variable.
Definition: ThreadSupport.h:245
std::list< DSMSensor * > _problemSensors
Definition: SensorOpener.h:84
void openSensor(DSMSensor *sensor)
A SensorHandler calls this method to schedule a sensor to be opened.
Definition: SensorOpener.cc:59
SensorOpener(SensorHandler *)
Constructor.
Definition: SensorOpener.cc:41
Thread which opens DSMSensors.
Definition: SensorOpener.h:42