nidas  v1.2-1520
RawSampleService.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_DYNLD_RAWSAMPLESERVICE_H
29 #define NIDAS_DYNLD_RAWSAMPLESERVICE_H
30 
31 #include <nidas/core/DSMService.h>
32 
33 namespace nidas {
34 
35 namespace core {
36 class DSMConfig;
37 class SamplePipeline;
38 class SampleInput;
39 class SampleOutput;
40 }
41 
42 namespace dynld {
43 
49 {
50 public:
52 
54 
55  void connect(nidas::core::SampleInput*) throw();
56 
57  void disconnect(nidas::core::SampleInput*) throw();
58 
59  void schedule(bool optionalProcessing) throw(nidas::util::Exception);
60 
61  void interrupt() throw();
62 
63  void fromDOMElement(const xercesc::DOMElement* node)
65 
66  void printClock(std::ostream& ostr) throw();
67 
68  void printStatus(std::ostream& ostr,float deltat) throw();
69 
73  float getRawSorterLength() const
74  {
75  return _rawSorterLength;
76  }
77 
81  void setRawSorterLength(float val)
82  {
83  _rawSorterLength = val;
84  }
85 
89  float getProcSorterLength() const
90  {
91  return _procSorterLength;
92  }
93 
97  void setProcSorterLength(float val)
98  {
99  _procSorterLength = val;
100  }
101 
107  size_t getRawHeapMax() const
108  {
109  return _rawHeapMax;
110  }
111 
117  void setRawHeapMax(size_t val)
118  {
119  _rawHeapMax = val;
120  }
121 
127  size_t getProcHeapMax() const
128  {
129  return _procHeapMax;
130  }
131 
137  void setProcHeapMax(size_t val)
138  {
139  _procHeapMax = val;
140  }
141 
146  unsigned int getRawLateSampleCacheSize() const
147  {
149  }
150 
156  void setRawLateSampleCacheSize(unsigned int val)
157  {
159  }
160 
165  unsigned int getProcLateSampleCacheSize() const
166  {
168  }
169 
175  void setProcLateSampleCacheSize(unsigned int val)
176  {
178  }
179 
180 private:
181 
183 
188  {
189  public:
191  ~Worker();
192  int run() throw(nidas::util::Exception);
193  void interrupt();
194  private:
198  Worker(const Worker&);
200  Worker& operator=(const Worker&);
201  };
202 
206  std::map<nidas::core::SampleInput*,Worker*> _workers;
207 
208  std::map<nidas::core::SampleInput*,const nidas::core::DSMConfig*> _dsms;
209 
211 
215  std::map<void*,size_t> _nsampsLast;
216 
220  std::map<void*,long long> _nbytesLast;
221 
223 
225 
226  size_t _rawHeapMax;
227 
228  size_t _procHeapMax;
229 
231 
233 
238 
243 };
244 
245 }} // namespace nidas namespace dynld
246 
247 #endif
void connect(nidas::core::SampleInput *)
Definition: RawSampleService.cc:175
RawSampleService & operator=(const RawSampleService &)
Assignment not supported.
A RawSampleService reads raw Samples from a socket connection and sends the samples to one or more Sa...
Definition: RawSampleService.h:48
unsigned int _procLateSampleCacheSize
Definition: RawSampleService.h:232
nidas::core::SampleInput * _input
Definition: RawSampleService.h:196
unsigned int _rawLateSampleCacheSize
Definition: RawSampleService.h:230
std::map< void *, size_t > _nsampsLast
Saved between calls to printStatus in order to compute data rates.
Definition: RawSampleService.h:215
void fromDOMElement(const xercesc::DOMElement *node)
Initialize myself from a xercesc::DOMElement.
Definition: RawSampleService.cc:579
void setProcSorterLength(float val)
Set the length of the SampleSorter of processed Samples, in seconds.
Definition: RawSampleService.h:97
unsigned int getProcLateSampleCacheSize() const
Get the size of the late sample cache in the processed sample sorter.
Definition: RawSampleService.h:165
std::map< nidas::core::SampleInput *, const nidas::core::DSMConfig * > _dsms
Definition: RawSampleService.h:208
void printStatus(std::ostream &ostr, float deltat)
Definition: RawSampleService.cc:409
void schedule(bool optionalProcessing)
schedule this service to run.
Definition: RawSampleService.cc:83
unsigned int getRawLateSampleCacheSize() const
Get the size of the late sample cache in the raw sample sorter.
Definition: RawSampleService.h:146
void setRawSorterLength(float val)
Set the length of the SampleSorter of raw Samples, in seconds.
Definition: RawSampleService.h:81
std::map< nidas::core::SampleInput *, Worker * > _workers
Keep track of the Worker for each SampleInput.
Definition: RawSampleService.h:206
Worker & operator=(const Worker &)
No assignment.
RawSampleService()
Definition: RawSampleService.cc:63
nidas::core::SamplePipeline * _pipeline
Definition: RawSampleService.h:182
RawSampleService * _svc
Definition: RawSampleService.h:195
void setProcLateSampleCacheSize(unsigned int val)
Cache this number of samples with potentially anomalous, late time tags in the processed sample sorte...
Definition: RawSampleService.h:175
Worker(RawSampleService *svc, nidas::core::SampleInput *input)
Definition: RawSampleService.cc:282
size_t _procHeapMax
Definition: RawSampleService.h:228
void disconnect(nidas::core::SampleInput *)
Definition: RawSampleService.cc:247
void interrupt()
Definition: RawSampleService.cc:158
Definition: Exception.h:35
void printClock(std::ostream &ostr)
Definition: RawSampleService.cc:397
~RawSampleService()
Definition: RawSampleService.cc:73
float _procSorterLength
Definition: RawSampleService.h:224
Definition: Thread.h:80
Worker thread that is run when a SampleInputConnection is established.
Definition: RawSampleService.h:187
float getProcSorterLength() const
Get the length of the SampleSorter of processed Samples, in seconds.
Definition: RawSampleService.h:89
size_t _rawHeapMax
Definition: RawSampleService.h:226
void setProcHeapMax(size_t val)
Set the size of in bytes of the processed SampleSorter.
Definition: RawSampleService.h:137
int run()
The method which will run in its own thread.
Definition: RawSampleService.cc:301
void interrupt()
Interrupt this thread.
Definition: RawSampleService.cc:293
size_t getProcHeapMax() const
Get the size of in bytes of the processed SampleSorter.
Definition: RawSampleService.h:127
float getRawSorterLength() const
Get the length of the SampleSorter of raw Samples, in seconds.
Definition: RawSampleService.h:73
void setRawLateSampleCacheSize(unsigned int val)
Cache this number of samples with potentially anomalous, late time tags in the raw sample sorter...
Definition: RawSampleService.h:156
SamplePipeline sorts samples that are coming from one or more inputs.
Definition: SamplePipeline.h:79
~Worker()
Definition: RawSampleService.cc:288
float _rawSorterLength
Definition: RawSampleService.h:222
size_t getRawHeapMax() const
Get the size of in bytes of the raw SampleSorter.
Definition: RawSampleService.h:107
A C++ wrapper for a POSIX mutex.
Definition: ThreadSupport.h:154
Base class for a service, as built from a &lt;service&gt; XML tag.
Definition: DSMService.h:47
std::map< void *, long long > _nbytesLast
Saved between calls to printStatus in order to compute sample rates.
Definition: RawSampleService.h:220
Definition: InvalidParameterException.h:35
nidas::util::Mutex _workerMutex
Definition: RawSampleService.h:210
void setRawHeapMax(size_t val)
Set the size of in bytes of the raw SampleSorter.
Definition: RawSampleService.h:117
Interface of an input SampleSource.
Definition: SampleInput.h:47