nidas  v1.2-1520
SampleInput.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_CORE_SAMPLEINPUT_H
28 #define NIDAS_CORE_SAMPLEINPUT_H
29 
30 
31 #include "SampleSource.h"
32 #include "IOStream.h"
33 #include "SampleSorter.h"
34 #include "SampleInputHeader.h"
35 
36 namespace nidas { namespace core {
37 
38 class DSMConfig;
39 class DSMSensor;
40 
47 class SampleInput: public SampleSource, public IOChannelRequester, public DOMable
48 {
49 public:
50 
51  virtual ~SampleInput() {}
52 
53  virtual std::string getName() const = 0;
54 
55  virtual void setKeepStats(bool val) = 0;
56 
57  virtual const DSMConfig* getDSMConfig() const = 0;
58 
59  // virtual void init() throw(nidas::util::IOException) = 0;
60 
61  virtual void requestConnection(DSMService*) throw(nidas::util::IOException) = 0;
62 
63  virtual SampleInput* getOriginal() const = 0;
64 
75  virtual bool readSamples() throw(nidas::util::IOException) = 0;
76 
81  virtual Sample* readSample() throw(nidas::util::IOException) = 0;
82 
83  virtual void close() throw(nidas::util::IOException) = 0;
84 
85  virtual void setNonBlocking(bool val) throw(nidas::util::IOException) = 0;
86 
87  virtual bool isNonBlocking() const throw(nidas::util::IOException) = 0;
88 
89  virtual int getFd() const = 0;
90 
91 };
92 
93 }} // namespace nidas namespace core
94 
95 #endif
virtual std::string getName() const =0
Class that should include all that is configurable about a DSM.
Definition: DSMConfig.h:55
Pure virtual interface for a source of Samples.
Definition: SampleSource.h:48
virtual void requestConnection(DSMService *)=0
virtual bool isNonBlocking() const =0
Interface of an object that can be instantiated from a DOM element, via the fromDOMElement method...
Definition: DOMable.h:51
virtual ~SampleInput()
Definition: SampleInput.h:51
virtual const DSMConfig * getDSMConfig() const =0
virtual int getFd() const =0
virtual void setNonBlocking(bool val)=0
virtual void setKeepStats(bool val)=0
Interface to a data sample.
Definition: Sample.h:189
virtual SampleInput * getOriginal() const =0
virtual void close()=0
virtual bool readSamples()=0
Read a buffer of data, serialize the data into samples, and distribute() samples to the receive() met...
Base class for a service, as built from a <service> XML tag.
Definition: DSMService.h:47
virtual Sample * readSample()=0
Blocking read of the next sample from the buffer.
Interface for an object that requests connections to Inputs or Outputs.
Definition: IOChannel.h:54
Interface of an input SampleSource.
Definition: SampleInput.h:47