nidas  v1.2-1520
SyncRecordGenerator.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_DYNLD_RAF_SYNCRECORDGENERATOR_H
28 #define NIDAS_DYNLD_RAF_SYNCRECORDGENERATOR_H
29 
31 #include "SyncRecordSource.h"
32 
33 namespace nidas { namespace dynld { namespace raf {
34 
35 using namespace nidas::core;
36 
38 {
39 public:
40 
45 
46  virtual ~SyncRecordGenerator();
47 
51  void connectSource(SampleSource* source) override;
52 
56  void disconnectSource(SampleSource* source) throw();
57 
61  void connect(SampleOutput* output) throw();
62 
66  void disconnect(SampleOutput* output) throw();
67 
71  void sendHeader(dsm_time_t thead,SampleOutput* output)
73 
74  void init(dsm_time_t sampleTime) throw();
75 
76  std::list<const SampleTag*> getSampleTags() const
77  {
78  return _syncRecSource.getSampleTags();
79  }
80 
85  {
86  return _syncRecSource.getSampleTagIterator();
87  }
88 
92  void addSampleClient(SampleClient* client) throw();
93 
94  void removeSampleClient(SampleClient* client) throw()
95  {
96  _syncRecSource.removeSampleClient(client);
97  }
98 
103  void addSampleClientForTag(SampleClient* client,const SampleTag* tag) throw()
104  {
105  _syncRecSource.addSampleClientForTag(client,tag);
106  }
107 
108  void removeSampleClientForTag(SampleClient* client,const SampleTag* tag) throw()
109  {
110  _syncRecSource.removeSampleClientForTag(client,tag);
111  }
112 
113  int getClientCount() const throw()
114  {
115  return _syncRecSource.getClientCount();
116  }
117 
121  void flush() throw()
122  {
123  _syncRecSource.flush();
124  }
125 
127  {
128  return _syncRecSource.getSampleStats();
129  }
130 
131  void printStatus(std::ostream&,float deltat,int&) throw();
132 
134  getSyncRecordSource()
135  {
136  return &_syncRecSource;
137  }
138 
139 protected:
140 
141  void scanSensors(const std::list<DSMSensor*>& sensors);
142 
143  void allocateRecord(dsm_time_t timetag);
144 
145 private:
146 
148 
149  std::set<SampleSource*> _connectedSources;
150 
151  std::set<SampleOutput*> _connectedOutputs;
152 
154 
156 
158 
160 
162 
165 
167  SyncRecordGenerator& operator=(const SyncRecordGenerator&);
168 
169 };
170 
171 }}} // namespace nidas namespace dynld namespace raf
172 
173 #endif
size_t _numInputSampsLast
Definition: SyncRecordGenerator.h:155
size_t _numOutputSampsLast
Definition: SyncRecordGenerator.h:157
nidas::util::Mutex _connectionMutex
Definition: SyncRecordGenerator.h:147
An interface for sending a SampleHeader to a SampleOutput.
Definition: HeaderSource.h:42
Interface of an output stream of samples.
Definition: SampleOutput.h:47
long long dsm_time_t
Posix time in microseconds, the number of non-leap microseconds since 1970 Jan 1 00:00 UTC...
Definition: Sample.h:61
Pure virtual interface for a source of Samples.
Definition: SampleSource.h:48
SampleTagIterator getSampleTagIterator() const
Implementation of SampleSource::getSampleTagIterator().
Definition: SyncRecordGenerator.h:84
std::set< SampleOutput * > _connectedOutputs
Definition: SyncRecordGenerator.h:151
Pure virtual interface of a client of Samples.
Definition: SampleClient.h:38
Definition: SyncRecordSource.h:55
std::set< SampleSource * > _connectedSources
Definition: SyncRecordGenerator.h:149
void removeSampleClientForTag(SampleClient *client, const SampleTag *tag)
Remove a SampleClient for a given SampleTag from this SampleSource.
Definition: SyncRecordGenerator.h:108
int getClientCount() const
How many SampleClients are currently in my list.
Definition: SyncRecordGenerator.h:113
SyncRecordSource _syncRecSource
Definition: SyncRecordGenerator.h:153
Definition: SyncRecordGenerator.h:37
long long _numOutputBytesLast
Definition: SyncRecordGenerator.h:161
Definition: IOException.h:37
Class for iterating over the SampleTags of a Project, Site, DSMConfig, or a SampleSource.
Definition: NidsIterators.h:217
void addSampleClientForTag(SampleClient *client, const SampleTag *tag)
Add a Client for a given SampleTag.
Definition: SyncRecordGenerator.h:103
Class describing a group of variables that are sampled and handled together.
Definition: SampleTag.h:87
Interface of a processor of samples.
Definition: SampleIOProcessor.h:49
std::list< const SampleTag * > getSampleTags() const
Implementation of SampleSource::getSampleTags().
Definition: SyncRecordGenerator.h:76
const SampleStats & getSampleStats() const
Definition: SyncRecordGenerator.h:126
A source of samples.
Definition: SampleStats.h:41
void flush()
Implementation of SampleSource::flush().
Definition: SyncRecordGenerator.h:121
A C++ wrapper for a POSIX mutex.
Definition: ThreadSupport.h:154
void removeSampleClient(SampleClient *client)
Remove a SampleClient from this SampleSource.
Definition: SyncRecordGenerator.h:94
long long _numInputBytesLast
Definition: SyncRecordGenerator.h:159