31 #ifndef VEC_CHRONOLOGIC_ORDER
32 #define VEC_CHRONOLOGIC_ORDER
55 std::string
policy()
const {
return "\t policy VecChronologic"; }
69 std::cout <<
"Policy <Chronologic> order b_chrono " << b_chronologic << std::endl;
76 std::cout <<
"Reverse " << std::endl;
78 std::reverse( vec.begin(), vec.end() );
84 return vec_ordered [ position ];
88 return vec_ordered [ vec_ordered.size() - position - 1 ];
93 void Erase_LastChrono( std::vector<T> & vec_ordered ) { vec_ordered.erase( vec_ordered.end()-1 ) ;}
104 void AddChronoToList( std::vector<T> & vec_ordered,
const std::vector<T> & new_vec,
const int first_to_skip ) {
106 std::cout <<
"AddChronoToList Chronologic " << std::endl;
108 vec_ordered.insert ( vec_ordered.end(), new_vec.begin()+first_to_skip, new_vec.end() );
112 time_t
FirstChronologic(
const std::vector<T> & vec_ordered )
const {
return vec_ordered[ 0 ].GetDate(); }
113 time_t
LastChronologic(
const std::vector<T> & vec_ordered)
const {
return vec_ordered[ vec_ordered.size()-1 ].GetDate(); }
130 std::string
policy()
const {
return "\t policy VecNoChronologic"; }
143 std::cout <<
"Policy <NoChronologic> order_impl b_chrono " << b_chronologic << std::endl;
150 std::cout <<
"Reverse " << std::endl;
152 std::reverse( vec.begin(), vec.end() );
158 return vec_no_ordered [ vec_no_ordered.size() - position - 1];
162 return vec_no_ordered [ position ];
166 void Erase_LastChrono ( std::vector<T> & vec_no_ordered ) { vec_no_ordered.erase ( vec_no_ordered.begin() );}
177 void AddChronoToList( std::vector<T> & vec_no_ordered,
const std::vector<T> & new_vec,
const int first_to_skip ) {
179 std::cout <<
"AddChronoToList NoChronologic " << std::endl;
182 vec_no_ordered.insert ( vec_no_ordered.begin(), new_vec.begin(), new_vec.end()-first_to_skip );
187 time_t
FirstChronologic (
const std::vector<T> & vec_no_ordered )
const {
return vec_no_ordered[ vec_no_ordered.size()-1 ].GetDate(); }
188 time_t
LastChronologic (
const std::vector<T> & vec_no_ordered )
const {
return vec_no_ordered[ 0 ].GetDate(); }
192 #endif // VEC_CHRONOLOGIC_ORDER
time_t LastChronologic(const std::vector< T > &vec_no_ordered) const
const T & no_chronologic_at_impl(const std::vector< T > &vec_no_ordered, unsigned int position) const
Policy implementation of NoChronologicalAt()
void order_impl(std::vector< T > &vec, EPChrono b_chronologic)
Policy implementation of Order().
const T & chronologic_at_impl(const std::vector< T > &vec_no_ordered, unsigned int position) const
Policy implementation of ChronologicalAt()
time_t FirstChronologic(const std::vector< T > &vec_ordered) const
Return dates of the first and last (chronologically) elements.
void Erase_LastChrono(std::vector< T > &vec_no_ordered)
Erase last chronological data, first in vector in this case.
EPChrono
Define convenient name for the chronology, makes algorithms clearer.
void order_impl(std::vector< T > &vec, EPChrono b_chronologic)
Policy implementation of Order().
time_t FirstChronologic(const std::vector< T > &vec_no_ordered) const
Return dates of the first and last (chronologically) elements.
void Erase_LastChrono(std::vector< T > &vec_ordered)
Delete last chronological data, last in vector in this case.
std::string policy() const
Return the policy as a string, for printing info.
Implements the functions related to the order of the data in the vector.
const T & chronologic_at_impl(const std::vector< T > &vec_ordered, unsigned int position) const
Policy implementation of ChronologicAt()
time_t LastChronologic(const std::vector< T > &vec_ordered) const
const T & no_chronologic_at_impl(const std::vector< T > &vec_ordered, unsigned int position) const
Policy implementation of NoChronologicalAt()
void AddChronoToList(std::vector< T > &vec_ordered, const std::vector< T > &new_vec, const int first_to_skip)
Insert the new_vec vector at the end (chronologically) of vec_ordered.
std::string policy() const
For printing info only.
EPChrono bpolicy() const
Return the current chronology policy, of type EPChrono.
void AddChronoToList(std::vector< T > &vec_no_ordered, const std::vector< T > &new_vec, const int first_to_skip)
Insert the new_vec vector at the beginning of a non-chronological vec_no_ordered. ...
Implements the functions related to the order of the data in the vector.
EPChrono bpolicy() const
Return the current chronology policy, of type EPChrono.