21 #include <tjutils/tjvector.h>
22 #include <tjutils/tjlabel.h>
44 ValListData() : val(0), times(1), sublists(0), elements_size_cache(0), references(0) {}
46 ValListData(
const ValListData& vld) : times(vld.times), elements_size_cache(vld.elements_size_cache), references(0) {
47 if(vld.val) val=
new T(*vld.val);
49 if(vld.sublists) sublists=
new STD_list< ValList<T> >(*vld.sublists);
54 if(sublists)
delete sublists;
61 STD_list< ValList<T> >* sublists;
62 unsigned int elements_size_cache;
63 unsigned short references;
72 ValList(
const STD_string& object_label=
"unnamedValList",
unsigned int repetitions=1);
140 unsigned int size()
const {
return data->times*data->elements_size_cache;}
163 friend class ValListTest;
165 bool equalelements (
const ValList<T>& vl)
const;
167 ValList& increment_repetitions(
unsigned int reptimes) {copy_on_write(); data->times+=reptimes;
return *
this;}
169 unsigned int get_repetitions()
const {
return data->times;}
171 void flatten_sublists();
173 void copy_on_write();
bool parsevallist(const STD_string &str)
ValList & operator=(const ValList< T > &vl)
ValList(const ValList< T > &vl)
STD_vector< T > get_elements_flat() const
ValList(const STD_string &object_label="unnamedValList", unsigned int repetitions=1)
STD_vector< T > get_values_flat() const
ValList & multiply_repetitions(unsigned int reptimes)
ValList & add_sublist(const ValList< T > &vl)
bool operator==(const ValList< T > &vl) const
ValList & set_value(T value)
STD_ostream & print2stream(STD_ostream &os) const
bool operator<(const ValList< T > &vl) const
unsigned int size() const
STD_string printvallist() const
T operator[](unsigned int i) const