15 #ifndef ECL_CONTAINERS_PUSH_AND_POP_DYNAMIC_HPP_ 16 #define ECL_CONTAINERS_PUSH_AND_POP_DYNAMIC_HPP_ 22 #include <ecl/config/macros.hpp> 36 namespace formatters {
38 template <
typename Type,
size_t N>
class PushAndPopFormatter;
70 template<
typename Type>
74 typedef Type value_type;
75 typedef Type* iterator;
76 typedef const Type* const_iterator;
77 typedef Type& reference;
78 typedef const Type& const_reference;
79 typedef std::size_t size_type;
80 typedef std::ptrdiff_t difference_type;
81 typedef std::reverse_iterator<iterator> reverse_iterator;
82 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
83 typedef formatters::PushAndPopFormatter<Type,DynamicStorage>
Formatter;
90 PushAndPop() : size_fifo(0), leader(0), follower(0) {}
93 : size_fifo(
length+1), leader(0), follower(0)
96 data.resize( size_fifo );
105 data.resize( size_fifo );
108 virtual ~PushAndPop()
162 return reverse_iterator(end());
171 return const_reverse_iterator(end());
180 return reverse_iterator(begin());
189 return const_reverse_iterator(begin());
198 Type & operator[] (
int idx)
200 return data[ ((follower+idx)%size_fifo) ];
203 const Type & operator[] (
int idx)
const 205 return data[ ((follower+idx)%size_fifo) ];
208 void operator() (
const PushAndPop<Type,0> & otherOne )
210 leader = otherOne.leader;
211 follower = otherOne.follower;
212 for(
int i=0; i<size_fifo; i++ )
214 data[i] = otherOne.data[i];
224 void push_back(
const Type & datum )
226 data[ leader++ ] = datum;
228 if( leader == follower )
231 follower %= size_fifo;
240 follower %= size_fifo;
244 void fill(
const Type & d )
246 for(
unsigned int i=0; i<size_fifo; i++ ) data[i] = d;
249 void resize(
unsigned int length )
251 size_fifo = length+1;
253 data.resize( size_fifo );
268 unsigned int size()
const 270 if( leader > follower )
return leader - follower;
271 else if( leader < follower )
return size_fifo-follower+leader;
283 unsigned int size_fifo;
ecl_geometry_PUBLIC void resize(Trajectory2D &trajectory, const int &size)
#define LOC
Stringify the line of code you are at.
#define ecl_assert_throw(expression, exception)
Debug mode throw with a logical condition check.
ecl_geometry_PUBLIC int size(const Trajectory2D &trajectory)
#define ecl_assert_throw_decl(exception)
Assure throw exception declaration.
const GenericPointer< typename T::ValueType > T2 value
MatrixFormatter< Derived, Scalar > Formatter
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)