39 #ifndef ORO_CHANNEL_BUFFER_ELEMENT_HPP 40 #define ORO_CHANNEL_BUFFER_ELEMENT_HPP 42 #include "../base/ChannelElement.hpp" 43 #include "../base/BufferInterface.hpp" 44 #include "../ConnPolicy.hpp" 72 : buffer(buffer), last_sample_p(0), policy(policy) {}
87 return buffer->
size();
111 value_t *new_sample_p;
114 buffer->
Release(last_sample_p);
116 sample = *new_sample_p;
122 last_sample_p = new_sample_p;
130 sample = *(last_sample_p);
143 buffer->
Release(last_sample_p);
169 return "ChannelBufferElement";
virtual size_t getBufferSize() const =0
boost::call_traits< T >::param_type param_t
virtual void clear()
Removes all elements in the FIFO.
virtual size_t getBufferSize() const
virtual void clear()
Clears any data stored by the channel.
virtual size_type capacity() const =0
Returns the maximum number of items that can be stored in the buffer.
virtual FlowStatus read(reference_t sample, bool copy_old_data)
Pops and returns the first element of the FIFO.
FlowStatus
Returns the status of a data flow read operation.
virtual bool Push(param_t item)=0
Write a single value to the buffer.
A connection element that can store a fixed number of data samples.
virtual bool data_sample(param_t sample, bool reset=true)=0
Initializes this buffer with a data sample, such that for dynamical allocated types T...
virtual const ConnPolicy * getConnPolicy() const
Returns a pointer to the ConnPolicy that has been used to construct the underlying buffer...
virtual void Release(value_t *item)=0
Releases the pointer.
virtual value_t * PopWithoutRelease()=0
Returns a pointer to the first element in the buffer.
A connection policy object describes how a given connection should behave.
virtual WriteStatus write(param_t sample)
Appends a sample at the end of the FIFO.
virtual size_t getBufferFillSize() const =0
virtual void clear()=0
Clears all contents of this buffer.
virtual size_t getNumDroppedSamples() const =0
virtual size_t getBufferFillSize() const
virtual ~ChannelBufferElementBase()
A typed version of ChannelElementBase.
virtual size_t getNumDroppedSamples() const
base::ChannelElement< T >::value_t value_t
virtual ~ChannelBufferElement()
virtual WriteStatus data_sample(param_t sample, bool reset=true)
Provides a data sample to initialize this connection.
boost::call_traits< T >::reference reference_t
virtual value_t data_sample()
base::ChannelElement< T >::reference_t reference_t
virtual std::string getElementName() const
Returns the class name of this element.
int buffer_policy
The policy on how buffer elements will be installed for this connection, which influences the behavio...
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
virtual value_t data_sample()
ChannelBufferElement(typename base::BufferInterface< T >::shared_ptr buffer, const ConnPolicy &policy=ConnPolicy())
base::ChannelElement< T >::param_t param_t
virtual size_type dropped() const =0
Returns the number of dropped samples, because the buffer was full.
virtual size_type size() const =0
Returns the actual number of items that are stored in the buffer.
WriteStatus
Returns the status of a data flow write operation.
boost::shared_ptr< BufferInterface< T > > shared_ptr