SignalLogger
A library for signal logging.
signal_logger::LogElementBase< ValueType_ > Class Template Reference

Forward declaration of LogElementBase. More...

#include <typedefs.hpp>

Inheritance diagram for signal_logger::LogElementBase< ValueType_ >:
Inheritance graph

Public Member Functions

 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 () overridefinal
 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 saveDataToLogFile (const TimeElement &times, unsigned int nrCollectDataCalls, LogFileType type) override
 Writes local buffer copy to a file. 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 Member Functions

virtual void update ()
 Update the element. More...
 

Protected Attributes

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...
 

Detailed Description

template<typename ValueType_>
class signal_logger::LogElementBase< ValueType_ >

Forward declaration of LogElementBase.

Constructor & Destructor Documentation

template<typename ValueType_ >
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 
)
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
template<typename ValueType_ >
signal_logger::LogElementBase< ValueType_ >::LogElementBase ( const ValueType_ *const  ptr,
const BufferType  bufferType,
const std::size_t  bufferSize,
const LogElementOptions options 
)
inline

Constructor

Parameters
ptrpointer to the log var
bufferTypebuffer type of the log var
bufferSizebuffer size of the log var
optionsoptions of the log var
template<typename ValueType_ >
virtual signal_logger::LogElementBase< ValueType_ >::~LogElementBase ( )
inlinevirtual

Destructor.

Member Function Documentation

template<typename ValueType_ >
std::mutex& signal_logger::LogElementBase< ValueType_ >::acquireMutex ( ) const
inlinevirtual
Returns
mutex of the log element

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
virtual void signal_logger::LogElementBase< ValueType_ >::cleanup ( )
inlineoverridevirtual

Cleanup logger element.

Implements signal_logger::LogElementInterface.

Reimplemented in signal_logger_ros::LogElementRos< ValueType_ >.

template<typename ValueType_ >
void signal_logger::LogElementBase< ValueType_ >::collectData ( )
inlinefinaloverridevirtual

Data collection is not element specific.

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
virtual void signal_logger::LogElementBase< ValueType_ >::copy ( )
inlinevirtual

Stores a copy of the current buffer, file is saved from this.

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
const BufferInterface& signal_logger::LogElementBase< ValueType_ >::getBuffer ( ) const
inlinevirtual
Returns
buffer of the log element

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
BufferInterface& signal_logger::LogElementBase< ValueType_ >::getBuffer ( )
inlinevirtual
Returns
non const buffer interface

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
const LogElementOptions& signal_logger::LogElementBase< ValueType_ >::getCopyOptions ( ) const
inlinevirtual
Returns
options of the copy of log element

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
const LogElementOptions& signal_logger::LogElementBase< ValueType_ >::getOptions ( ) const
inlinevirtual
Returns
options of the log element

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
LogElementOptions& signal_logger::LogElementBase< ValueType_ >::getOptions ( )
inlinevirtual
Returns
options of the log element

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
template<typename V = ValueType_>
const Buffer<V>& signal_logger::LogElementBase< ValueType_ >::getTimeBuffer ( typename std::enable_if< std::is_same< TimestampPair, V >::value >::type *  = 0) const
inline
template<typename ValueType_ >
template<typename V = ValueType_>
const Buffer<V>& signal_logger::LogElementBase< ValueType_ >::getTimeBufferCopy ( typename std::enable_if< std::is_same< TimestampPair, V >::value >::type *  = 0) const
inline
template<typename ValueType_ >
virtual std::type_index signal_logger::LogElementBase< ValueType_ >::getType ( ) const
inlinevirtual
Returns
type_index

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
bool signal_logger::LogElementBase< ValueType_ >::isEnabled ( ) const
inlinevirtual
Returns
is log element enabled

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
virtual void signal_logger::LogElementBase< ValueType_ >::publishData ( const TimeElement time,
unsigned int  nrCollectDataCalls 
)
inlineoverridevirtual

Reads buffer and processes data (probably called from different thread)

Implements signal_logger::LogElementInterface.

Reimplemented in signal_logger_ros::LogElementRos< ValueType_ >.

template<typename ValueType_ >
vector_type<ValueType_> signal_logger::LogElementBase< ValueType_ >::readNewValues ( )
inline

Expose readNewValues function of buffer.

template<typename ValueType_ >
virtual void signal_logger::LogElementBase< ValueType_ >::reset ( )
inlineoverridevirtual

Reset logger element called before logger start.

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
virtual void signal_logger::LogElementBase< ValueType_ >::saveDataToLogFile ( const TimeElement times,
unsigned int  nrCollectDataCalls,
LogFileType  type 
)
inlineoverridevirtual
template<typename ValueType_ >
void signal_logger::LogElementBase< ValueType_ >::setIsEnabled ( const bool  isEnabled)
inlinevirtual
Parameters
enabledlog element

Implements signal_logger::LogElementInterface.

template<typename ValueType_ >
virtual void signal_logger::LogElementBase< ValueType_ >::update ( )
inlineprotectedvirtual

Update the element.

Reimplemented in signal_logger_ros::LogElementRos< ValueType_ >.

Member Data Documentation

template<typename ValueType_ >
Buffer<ValueType_> signal_logger::LogElementBase< ValueType_ >::buffer_
protected

Buffer (threadsafe)

template<typename ValueType_ >
Buffer<ValueType_> signal_logger::LogElementBase< ValueType_ >::bufferCopy_
protected

Buffer copy (actually the buffer is moved during saving)

template<typename ValueType_ >
std::atomic_bool signal_logger::LogElementBase< ValueType_ >::isEnabled_
protected

Indicates if log element is currently active.

template<typename ValueType_ >
std::mutex signal_logger::LogElementBase< ValueType_ >::mutex_
mutableprotected

Mutex protecting element.

template<typename ValueType_ >
std::mutex signal_logger::LogElementBase< ValueType_ >::mutexCopy_
mutableprotected

Mutex protecting element copy.

template<typename ValueType_ >
LogElementOptions signal_logger::LogElementBase< ValueType_ >::options_
protected

Options of the log element.

template<typename ValueType_ >
LogElementOptions signal_logger::LogElementBase< ValueType_ >::optionsCopy_
protected

Options copy of the log element.


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