nidas v1.2.3
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
32
33namespace nidas {
34
35namespace core {
36class DSMConfig;
37class SamplePipeline;
38class SampleInput;
39class SampleOutput;
40}
41
42namespace dynld {
43
49{
50public:
52
54
55 void connect(nidas::core::SampleInput*) throw();
56
58
62 void schedule(bool optionalProcessing);
63
64 void interrupt() throw();
65
69 void fromDOMElement(const xercesc::DOMElement* node);
70
71 void printClock(std::ostream& ostr) throw();
72
73 void printStatus(std::ostream& ostr,float deltat) throw();
74
78 float getRawSorterLength() const
79 {
80 return _rawSorterLength;
81 }
82
86 void setRawSorterLength(float val)
87 {
89 }
90
94 float getProcSorterLength() const
95 {
96 return _procSorterLength;
97 }
98
102 void setProcSorterLength(float val)
103 {
105 }
106
112 size_t getRawHeapMax() const
113 {
114 return _rawHeapMax;
115 }
116
122 void setRawHeapMax(size_t val)
123 {
125 }
126
132 size_t getProcHeapMax() const
133 {
134 return _procHeapMax;
135 }
136
142 void setProcHeapMax(size_t val)
143 {
145 }
146
151 unsigned int getRawLateSampleCacheSize() const
152 {
154 }
155
161 void setRawLateSampleCacheSize(unsigned int val)
162 {
164 }
165
170 unsigned int getProcLateSampleCacheSize() const
171 {
173 }
174
180 void setProcLateSampleCacheSize(unsigned int val)
181 {
183 }
184
185private:
186
188
193 {
194 public:
196 ~Worker();
197 int run();
198 void interrupt();
199 private:
203 Worker(const Worker&);
206 };
207
211 std::map<nidas::core::SampleInput*,Worker*> _workers;
212
213 std::map<nidas::core::SampleInput*,const nidas::core::DSMConfig*> _dsms;
214
216
220 std::map<void*,size_t> _nsampsLast;
221
225 std::map<void*,long long> _nbytesLast;
226
228
230
232
234
236
238
243
248};
249
250}} // namespace nidas namespace dynld
251
252#endif
Base class for a service, as built from a <service> XML tag.
Definition DSMService.h:48
Interface of an input SampleSource.
Definition SampleInput.h:48
SamplePipeline sorts samples that are coming from one or more inputs.
Definition SamplePipeline.h:80
Worker thread that is run when a SampleInputConnection is established.
Definition RawSampleService.h:193
nidas::core::SampleInput * _input
Definition RawSampleService.h:201
~Worker()
Definition RawSampleService.cc:293
RawSampleService * _svc
Definition RawSampleService.h:200
Worker(RawSampleService *svc, nidas::core::SampleInput *input)
Definition RawSampleService.cc:287
void interrupt()
Interrupt this thread.
Definition RawSampleService.cc:298
Worker & operator=(const Worker &)
No assignment.
int run()
The method which will run in its own thread.
Definition RawSampleService.cc:306
Worker(const Worker &)
No copying.
A RawSampleService reads raw Samples from a socket connection and sends the samples to one or more Sa...
Definition RawSampleService.h:49
void disconnect(nidas::core::SampleInput *)
Definition RawSampleService.cc:247
void setProcLateSampleCacheSize(unsigned int val)
Cache this number of samples with potentially anomalous, late time tags in the processed sample sorte...
Definition RawSampleService.h:180
void fromDOMElement(const xercesc::DOMElement *node)
Definition RawSampleService.cc:584
void setRawSorterLength(float val)
Set the length of the SampleSorter of raw Samples, in seconds.
Definition RawSampleService.h:86
unsigned int _procLateSampleCacheSize
Definition RawSampleService.h:237
std::map< void *, size_t > _nsampsLast
Saved between calls to printStatus in order to compute data rates.
Definition RawSampleService.h:220
nidas::util::Mutex _workerMutex
Definition RawSampleService.h:215
void connect(nidas::core::SampleInput *)
Definition RawSampleService.cc:175
size_t getRawHeapMax() const
Get the size of in bytes of the raw SampleSorter.
Definition RawSampleService.h:112
nidas::core::SamplePipeline * _pipeline
Definition RawSampleService.h:187
unsigned int _rawLateSampleCacheSize
Definition RawSampleService.h:235
void setRawLateSampleCacheSize(unsigned int val)
Cache this number of samples with potentially anomalous, late time tags in the raw sample sorter.
Definition RawSampleService.h:161
size_t getProcHeapMax() const
Get the size of in bytes of the processed SampleSorter.
Definition RawSampleService.h:132
void printStatus(std::ostream &ostr, float deltat)
Definition RawSampleService.cc:414
RawSampleService()
Definition RawSampleService.cc:63
unsigned int getRawLateSampleCacheSize() const
Get the size of the late sample cache in the raw sample sorter.
Definition RawSampleService.h:151
std::map< nidas::core::SampleInput *, const nidas::core::DSMConfig * > _dsms
Definition RawSampleService.h:213
void printClock(std::ostream &ostr)
Definition RawSampleService.cc:402
float _procSorterLength
Definition RawSampleService.h:229
float _rawSorterLength
Definition RawSampleService.h:227
size_t _rawHeapMax
Definition RawSampleService.h:231
std::map< nidas::core::SampleInput *, Worker * > _workers
Keep track of the Worker for each SampleInput.
Definition RawSampleService.h:211
~RawSampleService()
Definition RawSampleService.cc:73
RawSampleService & operator=(const RawSampleService &)
Assignment not supported.
unsigned int getProcLateSampleCacheSize() const
Get the size of the late sample cache in the processed sample sorter.
Definition RawSampleService.h:170
size_t _procHeapMax
Definition RawSampleService.h:233
void setProcHeapMax(size_t val)
Set the size of in bytes of the processed SampleSorter.
Definition RawSampleService.h:142
void interrupt()
Definition RawSampleService.cc:158
float getRawSorterLength() const
Get the length of the SampleSorter of raw Samples, in seconds.
Definition RawSampleService.h:78
float getProcSorterLength() const
Get the length of the SampleSorter of processed Samples, in seconds.
Definition RawSampleService.h:94
RawSampleService(const RawSampleService &)
Copying not supported.
std::map< void *, long long > _nbytesLast
Saved between calls to printStatus in order to compute sample rates.
Definition RawSampleService.h:225
void setRawHeapMax(size_t val)
Set the size of in bytes of the raw SampleSorter.
Definition RawSampleService.h:122
void setProcSorterLength(float val)
Set the length of the SampleSorter of processed Samples, in seconds.
Definition RawSampleService.h:102
void schedule(bool optionalProcessing)
Definition RawSampleService.cc:83
A C++ wrapper for a POSIX mutex.
Definition ThreadSupport.h:161
Definition Thread.h:83
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31