nidas  v1.2-1520
GOESOutput.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  ** 2006, 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_DYNLD_ISFF_GOESOUTPUT_H
28 #define NIDAS_DYNLD_ISFF_GOESOUTPUT_H
29 
30 #include "GOESXmtr.h"
33 #include <nidas/util/Thread.h>
34 
35 #include <vector>
36 
37 namespace nidas {
38 
39 namespace core {
40 class SampleTag;
41 class IOChannel;
42 }
43 
44 namespace dynld { namespace isff {
45 
50 
51 public:
52 
57 
61  ~GOESOutput();
62 
66  void flush() throw() {}
67 
69 
74  {
75  return new GOESOutput(*this, iochannel);
76  }
77 
84 
88  int getXmitInterval() const
89  {
90  if (_goesXmtr) return _goesXmtr->getXmitInterval();
91  return -1;
92  }
93 
97  int getXmitOffset() const
98  {
99  if (_goesXmtr) return _goesXmtr->getXmitOffset();
100  return -1;
101  }
102 
105 
108 
109  void close() throw();
110 
114  size_t write(const void*, size_t)
115  throw (nidas::util::IOException)
116  {
117  throw nidas::util::IOException(getName(),"default write","not supported");
118  }
119 
123  bool receive(const Sample*) throw ();
124 
125  void fromDOMElement(const xercesc::DOMElement* node)
126  throw(nidas::util::InvalidParameterException);
127 
128  int run() throw(nidas::util::Exception);
129 
130  void interrupt();
131 
132  bool isInterrupted() const
133  {
134  return _interrupted;
135  }
136 
137 protected:
138 
143 
144  void joinThread() throw();
145 
146  void cancelThread() throw();
147 
148  void killThread() throw();
149 
150 private:
151 
153 
154  std::map<dsm_sample_id_t,std::vector<std::vector<std::pair<int,int> > > > _sampleMap;
155 
156  std::vector<SampleT<float>*> _outputSamples;
157 
158  nidas::util::Mutex _sampleMutex;
159 
160  nidas::util::ThreadRunnable* _xmitThread;
161 
163 
165 
167 
171  long long _maxPeriodUsec;
172 
176  GOESOutput(const GOESOutput&);
177 
181  GOESOutput& operator=(const GOESOutput&);
182 
183 };
184 
185 }}} // namespace nidas namespace dynld namespace isff
186 
187 #endif
Interface for an object that requests connections SampleOutputs.
Definition: ConnectionRequester.h:42
bool _interrupted
Definition: GOESOutput.h:162
void flush()
Implementation of SampleClient::flush().
Definition: GOESOutput.h:66
const std::string & getName() const
Definition: SampleOutput.h:179
void cancelThread()
Definition: GOESOutput.cc:100
nidas::util::Mutex _sampleMutex
Definition: GOESOutput.h:158
int getXmitInterval() const
Definition: GOESXmtr.h:105
unsigned int dsm_sample_id_t
Definition: Sample.h:63
long long _maxPeriodUsec
Not sure what the plan was for this.
Definition: GOESOutput.h:171
void killThread()
Definition: GOESOutput.cc:113
int _stationNumber
Definition: GOESOutput.h:166
int getXmitOffset() const
Definition: GOESXmtr.h:119
Interface of an output stream of samples.
Definition: SampleOutput.h:47
Definition: Thread.h:41
GOESOutput * clone(nidas::core::IOChannel *iochannel=0)
Clone invokes copy constructor.
Definition: GOESOutput.h:73
nidas::util::ThreadRunnable * _xmitThread
Definition: GOESOutput.h:160
GOESXmtr * _goesXmtr
Definition: GOESOutput.h:152
size_t write(const void *, size_t)
Raw write not supported.
Definition: GOESOutput.h:114
Support for a GOES transmitter, implemented as an IOChannel.
Definition: GOESXmtr.h:47
int run()
The method which will run in its own thread.
Definition: GOESOutput.cc:442
void interrupt()
Interrupt this run method.
Definition: GOESOutput.cc:437
void fromDOMElement(const xercesc::DOMElement *node)
Initialize myself from a xercesc::DOMElement.
Definition: GOESOutput.cc:572
int getXmitInterval() const
The GOES transmit interval, in seconds.
Definition: GOESOutput.h:88
int getXmitOffset() const
The GOES transmit offset, in seconds.
Definition: GOESOutput.h:97
Implementation of portions of SampleOutput.
Definition: SampleOutput.h:147
~GOESOutput()
Destructor.
Definition: GOESOutput.cc:80
void joinThread()
Definition: GOESOutput.cc:86
SampleOutput * connected(nidas::core::IOChannel *ochan)
Implemention of IOChannelRequester::connected().
Definition: GOESOutput.cc:310
void addSourceSampleTag(const nidas::core::SampleTag *tag)
Some SampleOutputs like to be informed of what SampleTags they will be receiving from their SampleSou...
Definition: GOESOutput.cc:193
void addRequestedSampleTag(nidas::core::SampleTag *tag)
Some SampleOutputs don&#39;t send out all the Samples that they receive.
Definition: GOESOutput.cc:153
A channel for Input or Output of data.
Definition: IOChannel.h:64
A typed Sample, with data of type DataT.
Definition: Sample.h:393
std::map< dsm_sample_id_t, std::vector< std::vector< std::pair< int, int > > > > _sampleMap
Definition: GOESOutput.h:154
Interface to a data sample.
Definition: Sample.h:189
std::vector< SampleT< float > * > _outputSamples
Definition: GOESOutput.h:156
Definition: IOException.h:37
void close()
Definition: GOESOutput.cc:126
A SampleOutput for packaging data for a GOES DCP Transmitter.
Definition: GOESOutput.h:49
Class describing a group of variables that are sampled and handled together.
Definition: SampleTag.h:87
bool isInterrupted() const
Has the run method been interrupted?
Definition: GOESOutput.h:132
int _configid
Definition: GOESOutput.h:164
void setIOChannel(nidas::core::IOChannel *val)
Set the IOChannel for this SampleOutput.
Definition: GOESOutput.cc:133
GOESOutput(nidas::core::IOChannel *ioc=0, SampleConnectionRequester *rqstr=0)
Constructor.
Definition: GOESOutput.cc:43
bool receive(const Sample *)
Send a data record to the RPC server.
Definition: GOESOutput.cc:379
Definition: InvalidParameterException.h:35