27 #ifndef NIDAS_CORE_NEARESTRESAMPLERATRATE_H
28 #define NIDAS_CORE_NEARESTRESAMPLERATRATE_H
35 namespace nidas {
namespace core {
194 void flush() throw();
216 void ctorCommon(
const std::vector<const Variable*>& vars,
bool nansVariable);
256 std::map<dsm_sample_id_t,std::vector<
unsigned int> >
_lenmap;
261 std::map<dsm_sample_id_t,std::vector<
unsigned int> >
_outmap;
334 NearestResamplerAtRate(const NearestResamplerAtRate& x);
A simple, nearest-point resampler, for generating merged samples from variables from one or more samp...
Definition: NearestResamplerAtRate.h:75
double _rate
Definition: NearestResamplerAtRate.h:267
dsm_time_t _outputTT
Definition: NearestResamplerAtRate.h:306
Interface for a resampler, simply a SampleClient and a SampleSource.
Definition: Resampler.h:39
std::list< const SampleTag * > getSampleTags() const
Get the SampleTag of my merged output sample.
Definition: NearestResamplerAtRate.h:145
bool getMiddleTimeTags() const
Definition: NearestResamplerAtRate.h:120
SampleSourceSupport _source
Definition: NearestResamplerAtRate.h:233
int _deltatUsecD10
DeltaT over 10.
Definition: NearestResamplerAtRate.h:277
unsigned int dsm_sample_id_t
Definition: Sample.h:63
int * _samplesSinceOutput
Definition: NearestResamplerAtRate.h:318
std::map< dsm_sample_id_t, std::vector< unsigned int > > _lenmap
For each input sample, length of variables to read.
Definition: NearestResamplerAtRate.h:256
void flush()
Implementation of Resampler::flush().
Definition: NearestResamplerAtRate.cc:471
void removeSampleTag(const SampleTag *tag)
Definition: SampleSourceSupport.cc:67
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
dsm_time_t * _nearTT
Definition: NearestResamplerAtRate.h:312
Class describing a sampled variable.
Definition: Variable.h:46
Pure virtual interface for a source of Samples.
Definition: SampleSource.h:48
SampleTagIterator getSampleTagIterator() const
Definition: SampleSourceSupport.cc:75
void setMiddleTimeTags(bool val)
If true, generate output timetags that are the middle of the requested output periods.
Definition: NearestResamplerAtRate.h:115
float * _nearData
Definition: NearestResamplerAtRate.h:316
bool _exactDeltatUsec
True if simple integer math is used to increment output sample time tags.
Definition: NearestResamplerAtRate.h:290
std::map< dsm_sample_id_t, std::vector< unsigned int > > _outmap
For each input sample, index into output sample of each variable.
Definition: NearestResamplerAtRate.h:261
std::map< dsm_sample_id_t, std::vector< unsigned int > > _inmap
For each input sample, first index of variable data values to be read.
Definition: NearestResamplerAtRate.h:251
A source of samples.
Definition: SampleSourceSupport.h:47
void addSampleClient(SampleClient *client)
Implementation of SampleSource::addSampleClient().
Definition: NearestResamplerAtRate.h:161
void removeSampleClient(SampleClient *c)
Remove a SampleClient from this SampleSource This will also remove a SampleClient if it has been adde...
Definition: SampleSourceSupport.cc:88
void addSampleClient(SampleClient *c)
Add a SampleClient to this SampleSource.
Definition: SampleSourceSupport.cc:80
std::vector< Variable * > _reqVars
Requested variables.
Definition: NearestResamplerAtRate.h:240
int _deltatUsecD2
DeltaT over 2.
Definition: NearestResamplerAtRate.h:282
Pure virtual interface of a client of Samples.
Definition: SampleClient.h:38
int _outlen
Definition: NearestResamplerAtRate.h:265
const SampleStats & getSampleStats() const
Definition: SampleSourceSupport.h:149
void removeSampleClientForTag(SampleClient *client, const SampleTag *)
Remove a SampleClient for a given SampleTag from this SampleSource.
Definition: NearestResamplerAtRate.h:181
void setFillGaps(bool val)
Should output records of all missing data (nans), be generated, or just discarded.
Definition: NearestResamplerAtRate.h:128
dsm_time_t * _prevTT
Definition: NearestResamplerAtRate.h:310
bool receive(const Sample *s)
Method called to pass a sample to this client.
Definition: NearestResamplerAtRate.cc:261
const SampleStats & getSampleStats() const
Definition: NearestResamplerAtRate.h:196
SampleTag _outSample
Definition: NearestResamplerAtRate.h:235
void ctorCommon(const std::vector< const Variable * > &vars, bool nansVariable)
Common tasks of constructors.
Definition: NearestResamplerAtRate.cc:85
SampleSource * getProcessedSampleSource()
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
Definition: NearestResamplerAtRate.h:140
A typed Sample, with data of type DataT.
Definition: Sample.h:393
SampleTagIterator getSampleTagIterator() const
Implementation of SampleSource::getSampleTagIterator().
Definition: NearestResamplerAtRate.h:153
void addSampleTag(const SampleTag *tag)
Add a SampleTag to this SampleSource.
Definition: NearestResamplerAtRate.h:221
void removeSampleTag(const SampleTag *tag)
Definition: NearestResamplerAtRate.h:226
Interface to a data sample.
Definition: Sample.h:189
void disconnect(SampleSource *input)
Definition: NearestResamplerAtRate.cc:256
int getClientCount() const
How many SampleClients are currently in my list.
Definition: NearestResamplerAtRate.h:186
void connect(SampleSource *input)
Connect the resampler to a SampleSource.
Definition: NearestResamplerAtRate.cc:170
Class for iterating over the SampleTags of a Project, Site, DSMConfig, or a SampleSource.
Definition: NidsIterators.h:217
~NearestResamplerAtRate()
Definition: NearestResamplerAtRate.cc:72
Class describing a group of variables that are sampled and handled together.
Definition: SampleTag.h:87
bool _middleTimeTags
If true, generate output timetags that are the middle of the requested output periods.
Definition: NearestResamplerAtRate.h:304
int _deltatUsec
The output deltaT, 1/rate in microseconds.
Definition: NearestResamplerAtRate.h:272
bool _fillGaps
Definition: NearestResamplerAtRate.h:322
A source of samples.
Definition: SampleStats.h:41
void setRate(double val)
Set the requested output rate, in Hz.
Definition: NearestResamplerAtRate.cc:150
double getRate() const
Definition: NearestResamplerAtRate.h:98
SampleT< float > * _osamp
Definition: NearestResamplerAtRate.h:320
std::map< Variable *, unsigned int > _outVarIndices
Index of each requested output variable in the output sample.
Definition: NearestResamplerAtRate.h:245
bool getFillGaps() const
Definition: NearestResamplerAtRate.h:133
void removeSampleClient(SampleClient *client)
Remove a SampleClient from this SampleSource.
Definition: NearestResamplerAtRate.h:166
int getClientCount() const
How many SampleClients are currently in my list.
Definition: SampleSourceSupport.cc:136
SampleSource * getRawSampleSource()
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
Definition: NearestResamplerAtRate.h:138
int _ndataValues
Definition: NearestResamplerAtRate.h:263
void addSampleClientForTag(SampleClient *client, const SampleTag *)
Add a Client for a given SampleTag.
Definition: NearestResamplerAtRate.h:175
std::list< const SampleTag * > getSampleTags() const
What SampleTags am I a SampleSource for?
Definition: SampleSourceSupport.cc:54
float * _prevData
Definition: NearestResamplerAtRate.h:314
std::map< dsm_sample_id_t, unsigned int > _ttOutOfOrder
Definition: NearestResamplerAtRate.h:324
void sendSample(dsm_time_t)
Definition: NearestResamplerAtRate.cc:367
dsm_time_t _nextOutputTT
Definition: NearestResamplerAtRate.h:308
Definition: InvalidParameterException.h:35
void addSampleTag(const SampleTag *tag)
Add a SampleTag to this SampleSource.
Definition: SampleSourceSupport.cc:60
NearestResamplerAtRate(const std::vector< const Variable * > &vars, bool nansVariable=true)
Constructor.
Definition: NearestResamplerAtRate.cc:41