nidas  v1.2-1520
AsciiOutput.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  ** 2006, 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_ASCIIOUTPUT_H
28 #define NIDAS_DYNLD_ASCIIOUTPUT_H
29 
31 
32 #include <iostream>
33 
34 namespace nidas {
35 
36 namespace core {
37 class SampleSource;
38 }
39 
40 namespace dynld {
41 
42 using namespace nidas::core;
43 
45 {
46 public:
47 
48  typedef enum format { DEFAULT, ASCII, HEX, SIGNED_SHORT, UNSIGNED_SHORT,
49  FLOAT, IRIG } format_t;
50 
51  AsciiOutput();
52 
53  AsciiOutput(IOChannel* iochannel,SampleConnectionRequester* rqstr=0);
54 
55  virtual ~AsciiOutput() {}
56 
60  void flush() throw() {}
61 
62  void requestConnection(SampleConnectionRequester* requester) throw();
63 
64  void connect(nidas::core::SampleSource* ) throw(nidas::util::IOException);
69  void setFormat(format_t val)
70  {
71  _format = val;
72  }
73 
74  bool receive(const Sample* samp) throw();
75 
76 protected:
77 
78  AsciiOutput* clone(IOChannel* iochannel);
79 
84 
85  void printHeader() throw(nidas::util::IOException);
86 
87 private:
88 
89  std::ostringstream _ostr;
90 
91  format_t _format;
92 
96  std::map<dsm_sample_id_t,dsm_time_t> _prevTT;
97 
98  bool _headerOut;
99 
103  AsciiOutput(const AsciiOutput&);
104 
105 };
106 
107 }} // namespace nidas namespace core
108 
109 #endif
Interface for an object that requests connections SampleOutputs.
Definition: ConnectionRequester.h:42
Definition: AsciiOutput.h:48
enum nidas::dynld::AsciiOutput::format format_t
unsigned int dsm_sample_id_t
Definition: Sample.h:63
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
void flush()
Implementation of SampleClient::flush().
Definition: AsciiOutput.h:60
Implementation of portions of SampleOutput.
Definition: SampleOutput.h:147
A channel for Input or Output of data.
Definition: IOChannel.h:64
Interface to a data sample.
Definition: Sample.h:189
format
Definition: AsciiOutput.h:48
Definition: IOException.h:37
virtual ~AsciiOutput()
Definition: AsciiOutput.h:55
Definition: AsciiOutput.h:44