![]() |
Home | Libraries | License | Support | People | ALPS Web Site |
alps::ObservableSet
// In header: <alps/alea/observableset.h> class ObservableSet { public: // construct/copy/destruct ObservableSet(); ObservableSet(const ObservableSet &); ObservableSet& operator=(const ObservableSet &); ~ObservableSet(); // public static functions template<typename T> static void register_observable(); // public member functions ObservableSet & operator<<(const ObservableSet &); ObservableSet & operator<<(const Observable &); ObservableSet & operator<<(const boost::shared_ptr< Observable > &); void addObservable(Observable *); void addObservable(const Observable &); void removeObservable(const std::string &); Observable & operator[](const std::string &); const Observable & operator[](const std::string &) const; bool has(const std::string &) const; void reset(bool = true); template<typename F> void do_for_all(F) const; template<typename F> void do_for_all(F); template<typename T> T & get(const std::string &); template<typename T> const T & get(const std::string &) const; uint32_t number_of_runs() const; ObservableSet get_run(uint32_t) const; void save(ODump &) const; void load(IDump &); void save(hdf5::archive &) const; void load(hdf5::archive &); template<typename Archive> void save(Archive &, const unsigned) const; template<typename Archive> void load(Archive &, const unsigned); void update_signs(); void set_sign(const std::string &); void compact(); void write_xml(oxstream &, const boost::filesystem::path & = boost::filesystem::path()) const; void write_xml_with_id(oxstream &, int, const boost::filesystem::path & = boost::filesystem::path()) const; void read_xml(std::istream &, const XMLTag &); void write_hdf5(boost::filesystem::path const &, std::size_t = 0, std::size_t = 0) const; void read_hdf5(boost::filesystem::path const &, std::size_t = 0, std::size_t = 0); void clear(); };
ObservableSet
public
construct/copy/destructObservableSet();the default constructor
ObservableSet(const ObservableSet & m);sign problem support requires a non-trivial copy constructor
ObservableSet& operator=(const ObservableSet & m);sign problem support requires non-trivial assignment
~ObservableSet();a non-trivial destructor
ObservableSet
public member functionsObservableSet & operator<<(const ObservableSet & obs);
merge two observable set. If observables with identical names exist in both sets, a merger of the observables is attempted. In case of failure an exception is thrown.
Throws: |
std::bad_cast if merging fails |
ObservableSet & operator<<(const Observable & obs);
merge an observable into the set. If an observables with identical names exists, a merger of the observables is attempted. In case of failure an exception is thrown.
Throws: |
std::bad_cast if merging fails |
ObservableSet & operator<<(const boost::shared_ptr< Observable > & obs);
void addObservable(Observable * obs);
add an observable to the set. The ObservableSet
will delete the object at the end. If an observable with the same name exists, it is replaced. This is different behavior than operator<<.
void addObservable(const Observable & obs);
void removeObservable(const std::string & name);remove an observable with a given name
Observable & operator[](const std::string & name);
get an observable with the given name
Throws: |
throws a std::runtime_error if no observable exists with the given name |
const Observable & operator[](const std::string & name) const;
get an observable with the given name
Throws: |
throws a std::runtime_error if no observable exists with the given name |
bool has(const std::string & name) const;check if an observable with the given name exists
void reset(bool = true);
reset all observables
template<typename F> void do_for_all(F f) const;apply a unary function to all observables
template<typename F> void do_for_all(F f);apply a unary function to all observables
template<typename T> T & get(const std::string & name);
get an observable with the given name and type
Throws: |
throws a std::runtime_error if no observable exists with the given name |
template<typename T> const T & get(const std::string & name) const;
get an observable with the given name and type
Throws: |
throws a std::runtime_error if no observable exists with the given name |
uint32_t number_of_runs() const;
the number of runs from which the observables were collected. Care must be taken that if some observables did not occur in all sets the numbering is not consistent and problems can result.
ObservableSet get_run(uint32_t) const;
the number of runs from which the observables were collected. Care must be taken that if some observables did not occur in all sets the numbering is not consistent and problems can result.
void save(ODump & dump) const;
void load(IDump & dump);
void save(hdf5::archive &) const;
void load(hdf5::archive &);
template<typename Archive> void save(Archive & ar, const unsigned int) const;support for Boost serialization
template<typename Archive> void load(Archive & ar, const unsigned int);support for Boost serialization
void update_signs();
void set_sign(const std::string &);
void compact();compact the observables to save space, discarding e.g. time series information
void write_xml(oxstream & oxs, const boost::filesystem::path & = boost::filesystem::path()) const;
void write_xml_with_id(oxstream & oxs, int id, const boost::filesystem::path & = boost::filesystem::path()) const;
void read_xml(std::istream & infile, const XMLTag & tag);
void write_hdf5(boost::filesystem::path const &, std::size_t realization = 0, std::size_t clone = 0) const;
void read_hdf5(boost::filesystem::path const &, std::size_t realization = 0, std::size_t clone = 0);
void clear();
Copyright © 1994, 2002-2004, 2012 Matthias Troyer, Synge Todo, Maximilian Poprawe |