13 #ifndef __stir_VectorWithOffset_H__ 14 #define __stir_VectorWithOffset_H__ 64 class VectorWithOffset
70 typedef value_type& reference;
71 typedef const value_type& const_reference;
72 typedef ptrdiff_t difference_type;
74 typedef T
const* const_iterator;
76 typedef std::reverse_iterator<iterator> reverse_iterator;
77 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
79 typedef size_t size_type;
83 inline VectorWithOffset();
86 inline explicit VectorWithOffset(
const int hsz);
89 inline VectorWithOffset(
const int min_index,
const int max_index);
91 #if STIR_VERSION < 070000 99 STIR_DEPRECATED VectorWithOffset(
const int hsz, T*
const data_ptr, T*
const end_of_data_ptr);
108 STIR_DEPRECATED inline VectorWithOffset(
const int min_index,
const int max_index, T*
const data_ptr, T*
const end_of_data_ptr);
112 VectorWithOffset(
const int hsz,
const T*
const data_ptr);
115 inline VectorWithOffset(
const int min_index,
const int max_index,
const T*
const data_ptr);
122 inline VectorWithOffset(
const int min_index,
const int max_index, shared_ptr<T[]> data_sptr);
145 swap(first.num, second.num);
146 swap(first.length, second.length);
147 swap(first.start, second.start);
148 swap(first.begin_allocated_memory, second.begin_allocated_memory);
149 swap(first.end_allocated_memory, second.end_allocated_memory);
150 swap(first.pointer_access, second.pointer_access);
151 swap(first.allocated_memory_sptr, second.allocated_memory_sptr);
162 inline void recycle();
172 inline int get_length()
const;
175 inline size_t size()
const;
178 inline int get_min_index()
const;
181 inline int get_max_index()
const;
184 inline void set_offset(
const int min_index);
187 inline void set_min_index(
const int min_index);
197 inline virtual void grow(
const int min_index,
const int max_index);
200 inline void grow(
const unsigned int new_size);
210 inline virtual void resize(
const int min_index,
const int max_index);
213 inline void resize(
const unsigned int new_size);
216 inline void reserve(
const int min_index,
const int max_index);
219 inline void reserve(
const unsigned int new_size);
222 inline size_t capacity()
const;
227 inline bool owns_memory_for_data()
const;
235 inline int get_capacity_min_index()
const;
243 inline int get_capacity_max_index()
const;
247 inline T& operator[](
int i);
250 inline const T& operator[](
int i)
const;
256 inline const T& at(
int i)
const;
259 inline bool empty()
const;
268 inline void fill(
const T& n);
271 inline void apply_lower_threshold(
const T& lower);
274 inline void apply_upper_threshold(
const T& upper);
278 inline T* get_data_ptr();
282 inline const T* get_const_data_ptr()
const;
285 inline void release_data_ptr();
288 inline void release_const_data_ptr()
const;
293 inline iterator begin();
296 inline const_iterator begin()
const;
298 inline iterator end();
300 inline const_iterator end()
const;
302 inline reverse_iterator rbegin();
303 inline reverse_iterator rend();
304 inline const_reverse_iterator rbegin()
const;
305 inline const_reverse_iterator rend()
const;
373 inline void check_state()
const;
378 inline void init(
const int min_index,
const int max_index, T*
const data_ptr,
bool copy_data);
386 T* begin_allocated_memory;
387 T* end_allocated_memory;
390 shared_ptr<T[]> allocated_memory_sptr;
396 inline void _destruct_and_deallocate();
400 mutable bool pointer_access;
407 #endif // __VectorWithOffset_H__ #define STIR_DEPRECATED
Deprecation macro.
Definition: deprecated.h:19
A templated class for vectors, but with indices starting not from 0.
Definition: ArrayFilter1DUsingConvolution.h:31
This file declares a deprecation macro.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
T * num
pointer to (*this)[0] (taking get_min_index() into account that is).
Definition: VectorWithOffset.h:370
friend void swap(VectorWithOffset &first, VectorWithOffset &second)
Swap content/members of 2 objects.
Definition: VectorWithOffset.h:141
inline implementations of stir::VectorWithOffset
VectorWithOffset(const int sz, shared_ptr< T[]> data_sptr)
Construct a VectorWithOffset sharing existing data.
Definition: VectorWithOffset.h:129