nidas  v1.2-1520
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 
36 namespace nidas { namespace core {
37 
39 {
40 public:
41 
43 
44  virtual ~SampleArchiver();
45 
49  void flush() throw();
50 
63  void setRaw(bool val)
64  {
65  _rawArchive = val;
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 
95 private:
96 
97  nidas::util::Mutex _connectionMutex;
98 
100 
102 
108  std::list<const nidas::core::FileSet*> _filesets;
109 
114  nidas::util::Mutex _filesetMutex;
115 
119  size_t _nsampsLast;
120 
124  long long _nbytesLast;
125 
126  std::map<const nidas::core::FileSet*,long long> _nbytesLastByFileSet;
127 
129 
133  SampleArchiver(const SampleArchiver& x);
134 
138  SampleArchiver& operator=(const SampleArchiver& x);
139 
140 
141 };
142 
143 }} // namespace nidas namespace core
144 
145 #endif
nidas::util::Mutex _filesetMutex
Mutex for controlling access to _filesets so that printStatus has valid pointers. ...
Definition: SampleArchiver.h:114
bool getRaw() const
Definition: SampleArchiver.h:68
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
void disconnectSource(SampleSource *)
Implementation of SampleIOProcessor::disconnectSource(SampleSource*).
Definition: SampleArchiver.cc:114
Implementation of an IOChannel using an nidas::util::FileSet.
Definition: FileSet.h:42
std::map< const nidas::core::FileSet *, long long > _nbytesLastByFileSet
Definition: SampleArchiver.h:126
Interface of an output stream of samples.
Definition: SampleOutput.h:47
Pure virtual interface for a source of Samples.
Definition: SampleSource.h:48
void connectSource(SampleSource *) override
Implementation of SampleIOProcessor::connectSource(SampleSource*).
Definition: SampleArchiver.cc:79
std::set< SampleOutput * > _connectedOutputs
Definition: SampleArchiver.h:101
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
void setRaw(bool val)
By default a SampleArchiver is used for archiving raw samples, and any SampleOutputs that connect wil...
Definition: SampleArchiver.h:63
Definition: SampleArchiver.h:38
void connect(SampleOutput *output)
Implementation of SampleConnectionRequester::connect(SampleOutput*).
Definition: SampleArchiver.cc:136
void printStatus(std::ostream &, float deltat, int &)
Definition: SampleArchiver.cc:225
size_t _nsampsLast
Saved between calls to printStatus in order to compute sample rates.
Definition: SampleArchiver.h:119
void disconnect(SampleOutput *output)
Implementation of SampleConnectionRequester::disconnect(SampleOutput*).
Definition: SampleArchiver.cc:169
Interface of a processor of samples.
Definition: SampleIOProcessor.h:49
virtual ~SampleArchiver()
Definition: SampleArchiver.cc:51
SampleArchiver()
Definition: SampleArchiver.cc:42
bool _rawArchive
Definition: SampleArchiver.h:128
nidas::util::Mutex _connectionMutex
Definition: SampleArchiver.h:97
std::set< SampleSource * > _connectedSources
Definition: SampleArchiver.h:99