SignalLogger
A library for signal logging.
signal_logger_std::LogElementStd< ValueType_ > Class Template Reference

#include <LogElementStd.hpp>

Inheritance diagram for signal_logger_std::LogElementStd< ValueType_ >:
Inheritance graph

Public Member Functions

 LogElementStd (const ValueType_ *const ptr, const signal_logger::BufferType bufferType, const std::size_t bufferSize, const std::string &name, const std::string &unit, const std::size_t divider, const signal_logger::LogElementAction action, std::stringstream *textStream, std::stringstream *binaryStream)
 
virtual ~LogElementStd ()
 Destructor. More...
 
void saveDataToLogFile (const signal_logger::TimeElement &times, unsigned int nrCollectDataCalls, signal_logger::LogFileType type) override
 Save Data to file. More...
 
- Public Member Functions inherited from signal_logger::LogElementBase< ValueType_ >
 LogElementBase (const ValueType_ *const ptr, const BufferType bufferType, const std::size_t bufferSize, const std::string &name, const std::string &unit, const std::size_t divider, const LogElementAction action)
 
 LogElementBase (const ValueType_ *const ptr, const BufferType bufferType, const std::size_t bufferSize, const LogElementOptions &options)
 
virtual ~LogElementBase ()
 Destructor. More...
 
void collectData () override final
 Data collection is not element specific. More...
 
virtual void publishData (const TimeElement &time, unsigned int nrCollectDataCalls) override
 Reads buffer and processes data (probably called from different thread) More...
 
virtual void copy ()
 Stores a copy of the current buffer, file is saved from this. More...
 
virtual void reset () override
 Reset logger element called before logger start. More...
 
virtual void cleanup () override
 Cleanup logger element. More...
 
const LogElementOptionsgetCopyOptions () const
 
const LogElementOptionsgetOptions () const
 
LogElementOptionsgetOptions ()
 
const BufferInterfacegetBuffer () const
 
BufferInterfacegetBuffer ()
 
std::mutex & acquireMutex () const
 
bool isEnabled () const
 
void setIsEnabled (const bool isEnabled)
 
virtual std::type_index getType () const
 
vector_type< ValueType_ > readNewValues ()
 Expose readNewValues function of buffer. More...
 
template<typename V = ValueType_>
const Buffer< V > & getTimeBufferCopy (typename std::enable_if< std::is_same< TimestampPair, V >::value >::type *=0) const
 
template<typename V = ValueType_>
const Buffer< V > & getTimeBuffer (typename std::enable_if< std::is_same< TimestampPair, V >::value >::type *=0) const
 
- Public Member Functions inherited from signal_logger::LogElementInterface
 LogElementInterface ()
 Default constructor. More...
 
virtual ~LogElementInterface ()
 Destructor. More...
 

Protected Attributes

std::stringstream * textStream_
 Text stream. More...
 
std::stringstream * binaryStream_
 Binary stream. More...
 
- Protected Attributes inherited from signal_logger::LogElementBase< ValueType_ >
Buffer< ValueType_ > buffer_
 Buffer (threadsafe) More...
 
LogElementOptions options_
 Options of the log element. More...
 
std::atomic_bool isEnabled_
 Indicates if log element is currently active. More...
 
std::mutex mutex_
 Mutex protecting element. More...
 
Buffer< ValueType_ > bufferCopy_
 Buffer copy (actually the buffer is moved during saving) More...
 
LogElementOptions optionsCopy_
 Options copy of the log element. More...
 
std::mutex mutexCopy_
 Mutex protecting element copy. More...
 

Additional Inherited Members

- Protected Member Functions inherited from signal_logger::LogElementBase< ValueType_ >
virtual void update ()
 Update the element. More...
 

Constructor & Destructor Documentation

◆ LogElementStd()

template<typename ValueType_ >
signal_logger_std::LogElementStd< ValueType_ >::LogElementStd ( const ValueType_ *const  ptr,
const signal_logger::BufferType  bufferType,
const std::size_t  bufferSize,
const std::string &  name,
const std::string &  unit,
const std::size_t  divider,
const signal_logger::LogElementAction  action,
std::stringstream *  textStream,
std::stringstream *  binaryStream 
)
inline

Constructor

Parameters
ptrpointer to the log var
bufferTypebuffer type of the log var
bufferSizebuffer size of the log var
namename of the log var
unitunit of the log var
dividerlog_freq = ctrl_freq/divider
actionsave, publish or save and publish
textStreamstring stream for text part of the log file
binaryStreamstring stream for binary part of the log file

◆ ~LogElementStd()

template<typename ValueType_ >
virtual signal_logger_std::LogElementStd< ValueType_ >::~LogElementStd ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ saveDataToLogFile()

template<typename ValueType_ >
void signal_logger_std::LogElementStd< ValueType_ >::saveDataToLogFile ( const signal_logger::TimeElement times,
unsigned int  nrCollectDataCalls,
signal_logger::LogFileType  type 
)
inlineoverridevirtual

Save Data to file.

Reimplemented from signal_logger::LogElementBase< ValueType_ >.

Member Data Documentation

◆ binaryStream_

template<typename ValueType_ >
std::stringstream* signal_logger_std::LogElementStd< ValueType_ >::binaryStream_
protected

Binary stream.

◆ textStream_

template<typename ValueType_ >
std::stringstream* signal_logger_std::LogElementStd< ValueType_ >::textStream_
protected

Text stream.


The documentation for this class was generated from the following file: