nidas  v1.2-1520
SampleOutputStream.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_SAMPLEOUTPUTSTREAM_H
28 #define NIDAS_DYNLD_SAMPLEOUTPUTSTREAM_H
29 
30 
32 
33 namespace nidas { namespace dynld {
34 
35 using namespace nidas::core;
36 
41 {
42 public:
43 
45 
50 
51  virtual ~SampleOutputStream();
52 
57  SampleOutput* connected(IOChannel* ochan) throw();
58 
67  IOStream* getIOStream() { return _iostream; }
68 
69  void close() throw(nidas::util::IOException);
70 
71  bool receive(const Sample *s) throw();
72 
73  void flush() throw();
74 
75  size_t write(const void* buf, size_t len, bool streamFlush)
76  throw(nidas::util::IOException);
77 
86  void setLatency(float val)
87  throw(nidas::util::InvalidParameterException);
88 
89 protected:
90 
91  SampleOutputStream* clone(IOChannel* iochannel);
92 
97 
98  size_t write(const Sample* samp, bool streamFlush) throw(nidas::util::IOException);
99 
100  IOStream* _iostream;
101 
102 private:
103 
107  int _maxUsecs;
108 
112  dsm_time_t _lastFlushTT;
113 
117  SampleOutputStream(const SampleOutputStream&);
118 
122  SampleOutputStream& operator=(const SampleOutputStream&);
123 
124 };
125 
126 }} // namespace nidas namespace core
127 
128 #endif
Interface for an object that requests connections SampleOutputs.
Definition: ConnectionRequester.h:42
A base class for buffering data.
Definition: IOStream.h:41
A class for serializing Samples on an OutputStream.
Definition: SampleOutputStream.h:40
IOStream * getIOStream()
Get the IOStream of this SampleOutputStream.
Definition: SampleOutputStream.h:67
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
Implementation of portions of SampleOutput.
Definition: SampleOutput.h:147
A channel for Input or Output of data.
Definition: IOChannel.h:64
int len
Definition: sing.cc:934
Interface to a data sample.
Definition: Sample.h:189
Definition: IOException.h:37
Definition: InvalidParameterException.h:35