39 #ifndef ORO_CHANNEL_BUFFER_ELEMENT_HPP 40 #define ORO_CHANNEL_BUFFER_ELEMENT_HPP 42 #include "../base/ChannelElement.hpp" 43 #include "../base/BufferInterface.hpp" 69 : buffer(buffer), last_sample_p(0) {}
84 return buffer->
size();
96 virtual bool write(param_t sample)
98 if (buffer->
Push(sample))
99 return this->signal();
109 value_t *new_sample_p;
112 buffer->
Release(last_sample_p);
114 last_sample_p = new_sample_p;
115 sample = *new_sample_p;
120 sample = *(last_sample_p);
133 buffer->
Release(last_sample_p);
152 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.
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 void Release(value_t *item)=0
Releases the pointer.
virtual bool data_sample(param_t sample)
Provides a data sample to initialize this connection.
virtual value_t * PopWithoutRelease()=0
Returns a pointer to the first element in the buffer.
ChannelBufferElement(typename base::BufferInterface< T >::shared_ptr buffer)
virtual size_t getBufferFillSize() const =0
virtual void clear()=0
Clears all contents of this buffer.
virtual void data_sample(const T &sample)=0
Initializes this buffer with a data sample, such that for dynamical allocated types T...
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()
boost::call_traits< T >::reference reference_t
virtual bool write(param_t sample)
Appends a sample at the end of the FIFO.
virtual value_t data_sample()
base::ChannelElement< T >::reference_t reference_t
virtual std::string getElementName() const
Returns the class name of this element.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
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.
boost::shared_ptr< BufferInterface< T > > shared_ptr