42 #ifndef ORO_CORELIB_BUFFER_LOCKED_HPP 43 #define ORO_CORELIB_BUFFER_LOCKED_HPP 45 #include "../os/Mutex.hpp" 46 #include "../os/MutexLock.hpp" 118 if (
cap == (size_type)
buf.size() ) {
128 buf.push_back( item );
132 size_type
Push(
const std::vector<value_t>& items)
135 typename std::vector<value_t>::const_iterator itl( items.begin() );
141 itl = items.begin() + ( items.size() -
cap );
142 }
else if (
mcircular && (size_type)(
buf.size() + items.size()) >
cap) {
144 assert( (size_type)items.size() <
cap );
145 while ( (size_type)(
buf.size() + items.size()) >
cap )
152 while ( ((size_type)
buf.size() !=
cap) && (itl != items.end()) ) {
153 buf.push_back( *itl );
157 size_type writtenSamples = itl - items.begin();
160 assert( writtenSamples == (size_type)items.size() );
164 return writtenSamples;
178 size_type
Pop(std::vector<value_t>& items )
183 while ( !
buf.empty() ) {
184 items.push_back(
buf.front() );
209 assert(item == &
lastSample &&
"Wrong pointer given back to buffer");
234 return (size_type)
buf.size() ==
cap;
252 #endif // BUFFERSIMPLE_HPP BufferLocked(size_type size, const Options &options=Options())
virtual bool data_sample(param_t sample, bool reset=true)
size_type Push(const std::vector< value_t > &items)
boost::call_traits< T >::reference reference_t
boost::call_traits< T >::param_type param_t
size_type dropped() const
BufferBase::Options Options
void Release(value_t *item)
value_t * PopWithoutRelease()
BufferBase::size_type size_type
std::deque< value_t > buf
BufferInterface< T >::size_type size_type
size_type Pop(std::vector< value_t > &items)
BufferInterface< T >::param_t param_t
BufferInterface< T >::reference_t reference_t
virtual value_t data_sample() const
size_type capacity() const
BufferLocked(size_type size, param_t initial_value, const Options &options=Options())
An object oriented wrapper around a non recursive mutex.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
FlowStatus Pop(reference_t item)
MutexLock is a scope based Monitor, protecting critical sections with a Mutex object through locking ...