75 #ifndef SLIP_RANGE_HPP
76 #define SLIP_RANGE_HPP
82 #include <boost/serialization/access.hpp>
83 #include <boost/serialization/split_member.hpp>
84 #include <boost/serialization/version.hpp>
90 template <
typename SubType>
93 template <
typename SubType>
95 const Range<SubType>& b);
97 template <
typename SubType>
99 const Range<SubType>& b2);
101 template <
typename SubType>
103 const Range<SubType>& b2);
115 template <
typename SubType>
138 Range(
const SubType& start_sub,
139 const SubType& stop_sub,
154 friend std::ostream& operator<< <>(std::ostream & out,
191 std::string
name()
const;
197 SubType
start()
const;
203 SubType
stop()
const;
235 friend class boost::serialization::access;
236 template<
class Archive>
237 void save(Archive & ar,
const unsigned int version)
const
243 template<
class Archive>
244 void load(Archive & ar,
const unsigned int version)
250 BOOST_SERIALIZATION_SPLIT_MEMBER()
258 template<
typename SubType>
261 start_sub_(0),stop_sub_(0),stride_(0)
264 template<
typename SubType>
267 const SubType& stop_sub,
269 start_sub_(start_sub),stop_sub_(stop_sub),stride_(stride)
273 template<
typename SubType>
282 template<
typename SubType>
289 template<
typename SubType>
296 template<
typename SubType>
303 template<
typename SubType>
310 ret = ( (stop_sub_ - start_sub_) / stride_ );
316 return (std::size_t)ret;
320 template<
typename SubType>
326 result = (start_sub_ <= stop_sub_);
328 result = (start_sub_ >= stop_sub_);
337 template<
typename SubType>
342 out<<
"[ "<<b.start_sub_<<
":"<<b.stop_sub_<<
":"<<b.stride_<<
" ]";
346 template<
typename SubType>
352 return (r1.start_sub_ == r2.start_sub_)
353 && (r1.stop_sub_ == r2.stop_sub_)
354 && (r1.stride_ == r2.stride_);
357 template<
typename SubType>
367 #endif //SLIP_RANGE_HPP
bool operator!=(const Array< T > &x, const Array< T > &y)
std::size_t iterations() const
Rerturns the number of iterations of the range.
std::string name() const
Returns the name of the class.
Range()
Constructs a default Range start_sub = stop_sub = stride = 0.
bool is_valid() const
Returns true if the range is valid :
SubType start() const
Accessor of the start subscript of the Range.
std::ostream & operator<<(std::ostream &out, const Array< T > &a)
int stride() const
Accessor of the stride of the Range.
bool operator==(const Array< T > &x, const Array< T > &y)
SubType stop() const
Accessor of the stop subscript of the Range.