nidas  v1.2-1520
SampleThread.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  ** 2009, 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_SAMPLETHREAD_H
28 #define NIDAS_CORE_SAMPLETHREAD_H
29 
30 #include "SampleSource.h"
31 #include "SampleClient.h"
32 
33 #include <nidas/util/Thread.h>
35 
36 namespace nidas { namespace core {
37 
53  public SampleClient, public SampleSource
54 {
55 public:
56 
57  SampleThread(const std::string& name): Thread(name) {}
58 
59  virtual ~SampleThread() {}
60 
65  virtual void flush() throw() = 0;
66 
67  virtual void setKeepStats(bool val) = 0;
68 
69  virtual bool getKeepStats() const = 0;
70 
74  virtual size_t size() const = 0;
75 
76  virtual void setLengthSecs(float val) = 0;
77 
78  virtual float getLengthSecs() const = 0;
79 
84  virtual void setHeapMax(size_t val) = 0;
85 
86  virtual size_t getHeapMax() const = 0;
87 
91  virtual size_t getHeapSize() const = 0;
92 
100  virtual void setHeapBlock(bool val) = 0;
101 
102  virtual bool getHeapBlock() const = 0;
103 
108  virtual size_t getNumDiscardedSamples() const = 0;
109 
114  virtual size_t getNumFutureSamples() const = 0;
115 
123  virtual void setRealTime(bool val) = 0;
124 
125  virtual bool getRealTime() const = 0;
126 
127  virtual void setLateSampleCacheSize(unsigned int val) = 0;
128 
129  virtual unsigned int getLateSampleCacheSize() const = 0;
130 
131 };
132 
133 }} // namespace nidas namespace core
134 
135 #endif
virtual bool getRealTime() const =0
virtual void setKeepStats(bool val)=0
virtual bool getHeapBlock() const =0
virtual size_t size() const =0
Number of samples that have not be distributed.
Interface for a Thread for buffering samples.
Definition: SampleThread.h:52
virtual float getLengthSecs() const =0
Pure virtual interface for a source of Samples.
Definition: SampleSource.h:48
virtual size_t getNumDiscardedSamples() const =0
Number of samples discarded because of _heapSize &gt; _heapMax and heapBlock == true.
virtual ~SampleThread()
Definition: SampleThread.h:59
virtual size_t getHeapMax() const =0
virtual void setHeapBlock(bool val)=0
Pure virtual interface of a client of Samples.
Definition: SampleClient.h:38
virtual void flush()=0
Both SampleClient and SampleSource have a flush() method.
virtual void setHeapMax(size_t val)=0
Set the maximum amount of heap memory to use for sorting samples.
Definition: Thread.h:80
virtual bool getKeepStats() const =0
SampleThread(const std::string &name)
Definition: SampleThread.h:57
virtual void setRealTime(bool val)=0
Is this thread running in real-time, meaning is it handling recently sampled data? If so then we can screen for bad sample time-tags by checking against the system clock, which is trusted.
virtual void setLateSampleCacheSize(unsigned int val)=0
virtual size_t getHeapSize() const =0
Get the current amount of heap being used for sorting.
virtual size_t getNumFutureSamples() const =0
Number of samples discarded because their timetags were in the future.
virtual void setLengthSecs(float val)=0
virtual unsigned int getLateSampleCacheSize() const =0
Thread(const std::string &name, bool detached=false)
Constructor for a thread, giving it a name.
Definition: Thread.cc:141