nidas v1.2.3
SampleArchiver.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 ********************************************************************
6 ** NIDAS: NCAR In-situ Data Acquistion Software
7 **
8 ** 2011, Copyright University Corporation for Atmospheric Research
9 **
10 ** This program is free software; you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation; either version 2 of the License, or
13 ** (at your option) any later version.
14 **
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ** GNU General Public License for more details.
19 **
20 ** The LICENSE.txt file accompanying this software contains
21 ** a copy of the GNU General Public License. If it is not found,
22 ** write to the Free Software Foundation, Inc.,
23 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 **
25 ********************************************************************
26*/
27
28#ifndef NIDAS_CORE_SAMPLEARCHIVER_H
29#define NIDAS_CORE_SAMPLEARCHIVER_H
30
31#include "SampleIOProcessor.h"
32#include "SampleSorter.h"
33#include "FileSet.h"
35
36namespace nidas { namespace core {
37
39{
40public:
41
43
44 virtual ~SampleArchiver();
45
49 void flush() throw();
50
63 void setRaw(bool val)
64 {
66 }
67
68 bool getRaw() const
69 {
70 return _rawArchive;
71 }
72
76 void connectSource(SampleSource*) override;
77
81 void disconnectSource(SampleSource*) throw();
82
86 void connect(SampleOutput* output) throw();
87
91 void disconnect(SampleOutput* output) throw();
92
93 void printStatus(std::ostream&,float deltat,int&) throw();
94
95private:
96
98
99 std::set<SampleSource*> _connectedSources;
100
101 std::set<SampleOutput*> _connectedOutputs;
102
108 std::list<const nidas::core::FileSet*> _filesets;
109
115
120
124 long long _nbytesLast;
125
126 std::map<const nidas::core::FileSet*,long long> _nbytesLastByFileSet;
127
129
134
139
140
141};
142
143}} // namespace nidas namespace core
144
145#endif
Definition SampleArchiver.h:39
bool _rawArchive
Definition SampleArchiver.h:128
void setRaw(bool val)
By default a SampleArchiver is used for archiving raw samples, and any SampleOutputs that connect wil...
Definition SampleArchiver.h:63
void connect(SampleOutput *output)
Implementation of SampleConnectionRequester::connect(SampleOutput*).
Definition SampleArchiver.cc:136
virtual ~SampleArchiver()
Definition SampleArchiver.cc:51
void connectSource(SampleSource *) override
Implementation of SampleIOProcessor::connectSource(SampleSource*).
Definition SampleArchiver.cc:79
void printStatus(std::ostream &, float deltat, int &)
Definition SampleArchiver.cc:225
std::map< const nidas::core::FileSet *, long long > _nbytesLastByFileSet
Definition SampleArchiver.h:126
std::set< SampleOutput * > _connectedOutputs
Definition SampleArchiver.h:101
SampleArchiver(const SampleArchiver &x)
Copy not supported.
nidas::util::Mutex _filesetMutex
Mutex for controlling access to _filesets so that printStatus has valid pointers.
Definition SampleArchiver.h:114
void disconnect(SampleOutput *output)
Implementation of SampleConnectionRequester::disconnect(SampleOutput*).
Definition SampleArchiver.cc:169
SampleArchiver()
Definition SampleArchiver.cc:42
nidas::util::Mutex _connectionMutex
Definition SampleArchiver.h:97
size_t _nsampsLast
Saved between calls to printStatus in order to compute sample rates.
Definition SampleArchiver.h:119
std::set< SampleSource * > _connectedSources
Definition SampleArchiver.h:99
std::list< const nidas::core::FileSet * > _filesets
If my SampleOutput* is a nidas::core::FileSet then save the pointer for use in by printStatus(),...
Definition SampleArchiver.h:108
SampleArchiver & operator=(const SampleArchiver &x)
Assignment not supported.
long long _nbytesLast
Saved between calls to printStatus in order to compute data rates.
Definition SampleArchiver.h:124
void flush()
Implementation of SampleSource::flush().
Definition SampleArchiver.cc:214
bool getRaw() const
Definition SampleArchiver.h:68
void disconnectSource(SampleSource *)
Implementation of SampleIOProcessor::disconnectSource(SampleSource*).
Definition SampleArchiver.cc:114
Interface of a processor of samples.
Definition SampleIOProcessor.h:50
Interface of an output stream of samples.
Definition SampleOutput.h:49
Pure virtual interface for a source of Samples.
Definition SampleSource.h:48
A C++ wrapper for a POSIX mutex.
Definition ThreadSupport.h:161
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