ImFusion SDK 4.3
VitalsDataComponent::TimeSeries Class Reference

#include <ImFusion/Base/VitalsDataComponent.h>

A scalar time series. More...

+ Inheritance diagram for VitalsDataComponent::TimeSeries:

Detailed Description

A scalar time series.

Public Member Functions

std::optional< Sampleclosest (TimePoint queryTimestamp, Duration maxDifference=std::chrono::milliseconds{100}) const
 Find the sample closest in time to the given timestamp.
 
void trimBefore (TimePoint earliestTimeToKeep)
 Remove all samples older than a set threshold.
 
bool operator== (const TimeSeries &other) const
 
bool operator!= (const TimeSeries &other) const
 
- Public Member Functions inherited from BinarySerializable
std::string saveToString () const
 Saves the state of this object into a string. Internally uses saveToBuffer.
 
void loadFromString (const std::string &str)
 Restores the state of this object from a string, internally using loadFromBuffer.
 

Public Attributes

std::deque< double > m_signal
 
std::deque< TimePoint > m_timestamps
 Maintained to be sorted with increasing time.
 
std::pair< double, double > m_signalRange
 
std::pair< TimePoint, TimePoint > m_timestampRange
 

Protected Member Functions

void add (TimePoint timestamp, double signalSample)
 Add a sample with corresponding timestamp.
 
void updateRanges ()
 Update the cached signal and timestamp ranges. To be used after bulk operations.
 
void validateSeries () const
 Checks that the containers have the same length and time is sorted.
 
size_t saveBufferSize () const override
 Returns the total amount of bytes required for serialization.
 
size_t saveBufferSize (size_t seriesLength) const
 
void loadFromBuffer (const char *buffer, size_t len) override
 Restores the state of this object from a memory buffer, using maximum len bytes.
 
void saveToBuffer (char *buffer) const override
 Saves the state of this object into a memory buffer, using maximum saveBufferSize() bytes.
 
- Protected Member Functions inherited from BinarySerializable
template<typename T>
size_t serializeMember (char *&buffer, const T *data, size_t n=1) const
 Convenience method to memcpy n*sizeof(T) bytes of data to buffer, followed by an increment of buffer by n*sizeof(T).
 
template<typename T>
size_t deserializeMember (const char *&buffer, T *data, size_t n=1)
 Convenience method to memcpy n*sizeof(T) bytes of buffer to data, followed by an increment of buffer by n*sizeof(T).
 

Protected Attributes

friend VitalsDataComponent
 

Member Function Documentation

◆ saveBufferSize()

size_t saveBufferSize ( ) const
overrideprotectedvirtual

Returns the total amount of bytes required for serialization.

Implements BinarySerializable.

◆ loadFromBuffer()

void loadFromBuffer ( const char * buffer,
size_t len )
overrideprotectedvirtual

Restores the state of this object from a memory buffer, using maximum len bytes.

Implements BinarySerializable.

◆ saveToBuffer()

void saveToBuffer ( char * buffer) const
overrideprotectedvirtual

Saves the state of this object into a memory buffer, using maximum saveBufferSize() bytes.

Implements BinarySerializable.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close