TwiceAsNice  2019-02-18
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | List of all members
Nice::PropertyBridgeBuffer Struct Reference

An actor which can the attached to a Property. Any time its Property value changes the new value is stored in the buffer object together with the timestamp comming either from the Property itself or from the local process (if remote values are bufferd). The Size of the buffer is initially defined by a AttributeMap which contains the Attribute BUFSIZE or can be set during runtime by calling the setBufferSize in microseconds. For performance reasons all internal data is stored as Nice::Any types. When the data vector is requested for a certain data type, the Nice::Any vector has to be coppied to a vector of another type. This is very time consuming and shoould only be done with caution. More...

#include <BridgeBuffer.h>

Inheritance diagram for Nice::PropertyBridgeBuffer:
Inheritance graph
Collaboration diagram for Nice::PropertyBridgeBuffer:
Collaboration graph

Public Member Functions

 PropertyBridgeBuffer (Nice::I64 _bufsize=1000, bool _localTime=false)
 Contructor. More...
 
 PropertyBridgeBuffer (const std::string &_param)
 String based contructor. More...
 
 PropertyBridgeBuffer (const PropertyBridgeBuffer *_buffer)
 Copyconstructor. More...
 
virtual ~PropertyBridgeBuffer ()
 Destructor. More...
 
virtual void init (const PropertyPtr &_property)
 Initialize the buffer with a Property to buffer and Attributes which contain the initial buffer size. More...
 
virtual void clear ()
 Clear the buffer content. More...
 
virtual void setBufferSize (Nice::I64 _size)
 Set the buffer size. More...
 
template<typename E >
std::vector< E > getDataVector ()
 Get the vectorized data as a vector of Es. More...
 
std::vector< Nice::AnygetDataVector ()
 Get the vectorized data as a vector of Nice:::Any. More...
 
virtual std::vector< Nice::DategetTimeVector ()
 Get the vectorized time stamps as a vector of Nice::Date. More...
 
virtual Nice::I64 bufferSize ()
 Get the buffer size in microseconds. More...
 
void insertSorted (const Nice::Date &_date, const Nice::Any &_value)
 Insert new data according to a timestamp. More...
 
virtual void set (Nice::CompletionState, const Nice::Any &_value, Nice::I64, const Nice::DateVar &_date)
 Append new data to the buffer. More...
 
virtual std::string name () const
 return bridge name. More...
 
virtual const std::string & identity ()
 return bridge id. More...
 
virtual const std::string & type ()
 
virtual std::string toString () const
 return bridge name. More...
 
virtual PropertyBridgeBufferclone ()
 Clone this instance. More...
 
 PropertyBridgeBuffer (Nice::I64 _bufsize=1000, bool _localTime=false)
 Contructor. More...
 
 PropertyBridgeBuffer (const std::string &_param)
 String based contructor. More...
 
 PropertyBridgeBuffer (const PropertyBridgeBuffer *_buffer)
 Copyconstructor. More...
 
virtual ~PropertyBridgeBuffer ()
 Destructor. More...
 
virtual void init (const PropertyPtr &_property)
 Initialize the buffer with a Property to buffer and Attributes which contain the initial buffer size. More...
 
virtual void clear ()
 Clear the buffer content. More...
 
virtual void setBufferSize (Nice::I64 _size)
 Set the buffer size. More...
 
template<typename E >
std::vector< E > getDataVector ()
 Get the vectorized data as a vector of Es. More...
 
std::vector< Nice::AnygetDataVector ()
 Get the vectorized data as a vector of Nice:::Any. More...
 
virtual std::vector< Nice::DategetTimeVector ()
 Get the vectorized time stamps as a vector of Nice::Date. More...
 
virtual Nice::I64 bufferSize ()
 Get the buffer size in microseconds. More...
 
void insertSorted (const Nice::Date &_date, const Nice::Any &_value)
 Insert new data according to a timestamp. More...
 
virtual void set (Nice::CompletionState, const Nice::Any &_value, Nice::I64, const Nice::DateVar &_date)
 Append new data to the buffer. More...
 
virtual std::string name () const
 return bridge name. More...
 
virtual const std::string & identity ()
 return bridge id. More...
 
virtual const std::string & type ()
 
virtual std::string toString () const
 return bridge name. More...
 
virtual PropertyBridgeBufferclone ()
 Clone this instance. More...
 
- Public Member Functions inherited from Nice::PropertyBridge
 PropertyBridge ()
 Constructor. More...
 
virtual ~PropertyBridge ()
 Destructor. More...
 
virtual void disconnect ()
 Abstract function to connect an instance of THIS bridge to another bridge. More...
 
 PropertyBridge ()
 Constructor. More...
 
virtual ~PropertyBridge ()
 Destructor. More...
 
virtual void disconnect ()
 Abstract function to connect an instance of THIS bridge to another bridge. More...
 

Public Attributes

std::deque< Nice::Datem_time
 
std::deque< Nice::Anym_data
 
Nice::I64 m_bufsize
 
bool m_localTime
 
std::string m_identity
 

Protected Attributes

std::string m_type
 
- Protected Attributes inherited from Nice::PropertyBridge
Nice::Propertym_property
 

Private Attributes

Nice::Mutex m_mutex
 

Detailed Description

An actor which can the attached to a Property. Any time its Property value changes the new value is stored in the buffer object together with the timestamp comming either from the Property itself or from the local process (if remote values are bufferd). The Size of the buffer is initially defined by a AttributeMap which contains the Attribute BUFSIZE or can be set during runtime by calling the setBufferSize in microseconds. For performance reasons all internal data is stored as Nice::Any types. When the data vector is requested for a certain data type, the Nice::Any vector has to be coppied to a vector of another type. This is very time consuming and shoould only be done with caution.

Author
Berwein
Version
Date
2012-08-10 11:04:58 AM

Constructor & Destructor Documentation

◆ PropertyBridgeBuffer() [1/6]

Nice::PropertyBridgeBuffer::PropertyBridgeBuffer ( Nice::I64  _bufsize = 1000,
bool  _localTime = false 
)
inline

Contructor.

Parameters
_bufsizeBuffer size in microseconds @ param _localtime If true the time of the current process is taken as the timestamp. Otherwise the Property time stamp is taken.

◆ PropertyBridgeBuffer() [2/6]

Nice::PropertyBridgeBuffer::PropertyBridgeBuffer ( const std::string &  _param)
inline

String based contructor.

Parameters
_paramParamter to contruct an instance of this class.

◆ PropertyBridgeBuffer() [3/6]

Nice::PropertyBridgeBuffer::PropertyBridgeBuffer ( const PropertyBridgeBuffer _buffer)
inline

Copyconstructor.

Parameters
_bufferBuffer to copy.

◆ ~PropertyBridgeBuffer() [1/2]

virtual Nice::PropertyBridgeBuffer::~PropertyBridgeBuffer ( )
inlinevirtual

Destructor.

◆ PropertyBridgeBuffer() [4/6]

Nice::PropertyBridgeBuffer::PropertyBridgeBuffer ( Nice::I64  _bufsize = 1000,
bool  _localTime = false 
)
inline

Contructor.

Parameters
_bufsizeBuffer size in microseconds @ param _localtime If true the time of the current process is taken as the timestamp. Otherwise the Property time stamp is taken.

◆ PropertyBridgeBuffer() [5/6]

Nice::PropertyBridgeBuffer::PropertyBridgeBuffer ( const std::string &  _param)
inline

String based contructor.

Parameters
_paramParamter to contruct an instance of this class.

◆ PropertyBridgeBuffer() [6/6]

Nice::PropertyBridgeBuffer::PropertyBridgeBuffer ( const PropertyBridgeBuffer _buffer)
inline

Copyconstructor.

Parameters
_bufferBuffer to copy.

◆ ~PropertyBridgeBuffer() [2/2]

virtual Nice::PropertyBridgeBuffer::~PropertyBridgeBuffer ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ bufferSize() [1/2]

virtual Nice::I64 Nice::PropertyBridgeBuffer::bufferSize ( )
inlinevirtual

Get the buffer size in microseconds.

Returns
Buffer size in microseconds.

◆ bufferSize() [2/2]

virtual Nice::I64 Nice::PropertyBridgeBuffer::bufferSize ( )
inlinevirtual

Get the buffer size in microseconds.

Returns
Buffer size in microseconds.

◆ clear() [1/2]

virtual void Nice::PropertyBridgeBuffer::clear ( void  )
inlinevirtual

Clear the buffer content.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ clear() [2/2]

virtual void Nice::PropertyBridgeBuffer::clear ( )
inlinevirtual

Clear the buffer content.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ clone() [1/2]

virtual PropertyBridgeBuffer* Nice::PropertyBridgeBuffer::clone ( )
inlinevirtual

◆ clone() [2/2]

virtual PropertyBridgeBuffer* Nice::PropertyBridgeBuffer::clone ( )
inlinevirtual

◆ getDataVector() [1/4]

template<typename E >
std::vector<E> Nice::PropertyBridgeBuffer::getDataVector ( )
inline

Get the vectorized data as a vector of Es.

Returns
Vector of Es.

◆ getDataVector() [2/4]

template<typename E >
std::vector<E> Nice::PropertyBridgeBuffer::getDataVector ( )
inline

Get the vectorized data as a vector of Es.

Returns
Vector of Es.

◆ getDataVector() [3/4]

std::vector<Nice::Any> Nice::PropertyBridgeBuffer::getDataVector ( )
inline

Get the vectorized data as a vector of Nice:::Any.

Returns
Vector of Nice::Any.

◆ getDataVector() [4/4]

std::vector<Nice::Any> Nice::PropertyBridgeBuffer::getDataVector ( )
inline

Get the vectorized data as a vector of Nice:::Any.

Returns
Vector of Nice::Any.

◆ getTimeVector() [1/2]

virtual std::vector<Nice::Date> Nice::PropertyBridgeBuffer::getTimeVector ( )
inlinevirtual

Get the vectorized time stamps as a vector of Nice::Date.

Returns
Vector of Nice::Date.

◆ getTimeVector() [2/2]

virtual std::vector<Nice::Date> Nice::PropertyBridgeBuffer::getTimeVector ( )
inlinevirtual

Get the vectorized time stamps as a vector of Nice::Date.

Returns
Vector of Nice::Date.

◆ identity() [1/2]

virtual const std::string& Nice::PropertyBridgeBuffer::identity ( )
inlinevirtual

return bridge id.

Returns
id.

Implements Nice::PropertyBridge.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ identity() [2/2]

virtual const std::string& Nice::PropertyBridgeBuffer::identity ( )
inlinevirtual

return bridge id.

Returns
id.

Implements Nice::PropertyBridge.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ init() [1/2]

virtual void Nice::PropertyBridgeBuffer::init ( const PropertyPtr _property)
inlinevirtual

Initialize the buffer with a Property to buffer and Attributes which contain the initial buffer size.

Parameters
_fooPropertyFoo pointer containing the data to buffer.
_attrsAttribute map which caontains a BUFSIZE attribute.

Reimplemented from Nice::PropertyBridge.

◆ init() [2/2]

virtual void Nice::PropertyBridgeBuffer::init ( const PropertyPtr _property)
inlinevirtual

Initialize the buffer with a Property to buffer and Attributes which contain the initial buffer size.

Parameters
_fooPropertyFoo pointer containing the data to buffer.
_attrsAttribute map which caontains a BUFSIZE attribute.

Reimplemented from Nice::PropertyBridge.

◆ insertSorted() [1/2]

void Nice::PropertyBridgeBuffer::insertSorted ( const Nice::Date _date,
const Nice::Any _value 
)
inline

Insert new data according to a timestamp.

The new data is inserted at the right position into the vector. This function is very time consuming. Only use this function if data is set to the buffer in the wrong chronological order because of multithreading.

Parameters
_dateTimestamp.
_valueNew value.

◆ insertSorted() [2/2]

void Nice::PropertyBridgeBuffer::insertSorted ( const Nice::Date _date,
const Nice::Any _value 
)
inline

Insert new data according to a timestamp.

The new data is inserted at the right position into the vector. This function is very time consuming. Only use this function if data is set to the buffer in the wrong chronological order because of multithreading.

Parameters
_dateTimestamp.
_valueNew value.

◆ name() [1/2]

virtual std::string Nice::PropertyBridgeBuffer::name ( ) const
inlinevirtual

return bridge name.

Returns
Stringified Property.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ name() [2/2]

virtual std::string Nice::PropertyBridgeBuffer::name ( ) const
inlinevirtual

return bridge name.

Returns
Stringified Property.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ set() [1/2]

virtual void Nice::PropertyBridgeBuffer::set ( Nice::CompletionState  ,
const Nice::Any _value,
Nice::I64  ,
const Nice::DateVar _date 
)
inlinevirtual

Append new data to the buffer.

The timestamp is not validated and so the vectors time/data are not kept in the right chronological order.

Parameters
_dateTimestamp
Returns
_value New value.

Implements Nice::PropertyBridge.

Reimplemented in Nice::PropertyBridgePlotBufferImpl< std::vector< T > >, Nice::PropertyBridgePlotBufferImpl< std::vector< T > >, Nice::PropertyBridgePlotBufferImpl< T >, and Nice::PropertyBridgePlotBufferImpl< T >.

◆ set() [2/2]

virtual void Nice::PropertyBridgeBuffer::set ( Nice::CompletionState  ,
const Nice::Any _value,
Nice::I64  ,
const Nice::DateVar _date 
)
inlinevirtual

Append new data to the buffer.

The timestamp is not validated and so the vectors time/data are not kept in the right chronological order.

Parameters
_dateTimestamp
Returns
_value New value.

Implements Nice::PropertyBridge.

Reimplemented in Nice::PropertyBridgePlotBufferImpl< std::vector< T > >, Nice::PropertyBridgePlotBufferImpl< std::vector< T > >, Nice::PropertyBridgePlotBufferImpl< T >, and Nice::PropertyBridgePlotBufferImpl< T >.

◆ setBufferSize() [1/2]

virtual void Nice::PropertyBridgeBuffer::setBufferSize ( Nice::I64  _size)
inlinevirtual

Set the buffer size.

Parameters
_sizeNew buffer size in microseconds.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ setBufferSize() [2/2]

virtual void Nice::PropertyBridgeBuffer::setBufferSize ( Nice::I64  _size)
inlinevirtual

Set the buffer size.

Parameters
_sizeNew buffer size in microseconds.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ toString() [1/2]

virtual std::string Nice::PropertyBridgeBuffer::toString ( ) const
inlinevirtual

return bridge name.

Returns
Stringified Property.

Implements Nice::PropertyBridge.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ toString() [2/2]

virtual std::string Nice::PropertyBridgeBuffer::toString ( ) const
inlinevirtual

return bridge name.

Returns
Stringified Property.

Implements Nice::PropertyBridge.

Reimplemented in Nice::PropertyBridgePlotBuffer, and Nice::PropertyBridgePlotBuffer.

◆ type() [1/2]

virtual const std::string& Nice::PropertyBridgeBuffer::type ( )
inlinevirtual

◆ type() [2/2]

virtual const std::string& Nice::PropertyBridgeBuffer::type ( )
inlinevirtual

Member Data Documentation

◆ m_bufsize

Nice::I64 Nice::PropertyBridgeBuffer::m_bufsize

◆ m_data

std::deque< Nice::Any > Nice::PropertyBridgeBuffer::m_data

◆ m_identity

std::string Nice::PropertyBridgeBuffer::m_identity

◆ m_localTime

bool Nice::PropertyBridgeBuffer::m_localTime

◆ m_mutex

Nice::Mutex Nice::PropertyBridgeBuffer::m_mutex
private

Mutex

◆ m_time

std::deque< Nice::Date > Nice::PropertyBridgeBuffer::m_time

◆ m_type

std::string Nice::PropertyBridgeBuffer::m_type
protected

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