14 #ifndef OHMMS_RECORDPROPERTYBASE_H__ 15 #define OHMMS_RECORDPROPERTYBASE_H__ 33 virtual void reset(
const char* fileroot,
bool append =
false) = 0;
34 virtual void report(
int i) = 0;
36 virtual bool put(xmlNodePtr cur) = 0;
52 RecordList_t::iterator it =
Properties.begin();
62 RecordList_t::iterator it =
Properties.begin();
72 RecordList_t::iterator it =
Properties.begin();
81 std::vector<RecordProperty*>::iterator it =
Properties.begin();
130 inline typename std::vector<T>::iterator
begin() {
return Values.begin(); }
131 inline typename std::vector<T>::iterator
end() {
return Values.end(); }
132 inline typename std::vector<T>::const_iterator
begin()
const {
return Values.begin(); }
133 inline typename std::vector<T>::const_iterator
end()
const {
return Values.end(); }
136 inline int add(
const std::string& aname)
139 while (i <
Names.size())
141 if (
Names[i] == aname)
145 Names.push_back(aname);
147 return Names.size() - 1;
156 inline int append(
const std::string& aroot,
int first,
int last)
158 for (
int i = first; i < last; ++i)
160 std::ostringstream o;
162 Names.push_back(o.str());
172 for (
int i = 0; i <
Values.size(); i++)
178 std::vector<T> a =
Values;
179 std::vector<std::string> b =
Names;
181 for (
int i = 0; i < a.size(); i++)
185 for (
int i = 0; i < a.size(); i++)
191 inline void reset(
const char* fileroot,
bool append =
false)
override 195 OutStream = std::ofstream(fileroot, std::ios_base::app);
203 OutStream->setf(std::ios::left, std::ios::adjustfield);
205 for (
int i = 0; i <
Names.size(); i++)
207 (*OutStream) << std::endl;
209 OutStream->setf(std::ios::scientific, std::ios::floatfield);
210 OutStream->setf(std::ios::right, std::ios::adjustfield);
217 for (
int i = 0; i <
Values.size(); i++)
219 (*OutStream) << std::endl;
224 bool put(xmlNodePtr cur)
override;
230 xmlAttrPtr att = cur->properties;
233 std::string aname((
const char*)(att->name));
234 if (aname ==
"stride")
236 stride = atoi((
const char*)(att->children->content));
std::vector< RecordProperty * > RecordList_t
virtual void finalize()=0
std::vector< T >::const_iterator end() const
void reset(const char *fileroot, bool append=false) override
implement virtual functions
bool put(xmlNodePtr cur) override
int append(const std::string &aroot, int first, int last)
add multiple items with the aroot
virtual void report(int i)=0
abstract base class to record any properties
std::optional< std::ofstream > OutStream
std::vector< T >::iterator begin()
iterators to use std algorithms
std::vector< T >::iterator end()
Vectorized record engine for scalar properties.
Declaration of OhmmsElementBase and define xml-related macros.
RecordNamedProperty(const RecordNamedProperty< T > &a)
std::vector< std::string > Names
virtual void reset(const char *fileroot, bool append=false)=0
RecordNamedProperty(int n)
int add(const std::string &aname)
std::vector< RecordProperty * > Properties
std::vector< T >::const_iterator begin() const
virtual bool put(xmlNodePtr cur)=0
void addRecord(RecordProperty *a)
void report(int iter) override
T operator[](int i) const
virtual ~RecordPropertyList()
virtual ~RecordProperty()