ALPS Home Libraries License Support People ALPS Web Site

PrevUpHomeNext

Class ObservableSet

alps::ObservableSet

Synopsis

// 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 &);
  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 clear();
};

Description

ObservableSet public construct/copy/destruct

  1. ObservableSet();
    the default constructor
  2. ObservableSet(const ObservableSet & m);
    sign problem support requires a non-trivial copy constructor
  3. ObservableSet& operator=(const ObservableSet & m);
    sign problem support requires non-trivial assignment
  4. ~ObservableSet();
    a non-trivial destructor

ObservableSet public static functions

  1. template<typename T> static void register_observable();

ObservableSet public member functions

  1. ObservableSet & 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
  2. 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
  3. ObservableSet & operator<<(const boost::shared_ptr< Observable > & obs);
  4. 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<<.

  5. void addObservable(const Observable & obs);
  6. void removeObservable(const std::string & name);
    remove an observable with a given name
  7. Observable & operator[](const std::string & name);

    get an observable with the given name

    Throws:

    throws
  8. const Observable & operator[](const std::string & name) const;

    get an observable with the given name

    Throws:

    throws
  9. bool has(const std::string & name) const;
    check if an observable with the given name exists
  10. void reset(bool = true);

    reset all observables

  11. template<typename F> void do_for_all(F f) const;
    apply a unary function to all observables
  12. template<typename F> void do_for_all(F f);
    apply a unary function to all observables
  13. template<typename T> T & get(const std::string & name);

    get an observable with the given name and type

    Throws:

    throws
  14. template<typename T> const T & get(const std::string & name) const;

    get an observable with the given name and type

    Throws:

    throws
  15. 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.

  16. 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.

  17. void save(ODump & dump) const;
  18. void load(IDump & dump);
  19. template<typename Archive> void save(Archive & ar, const unsigned int) const;
    support for Boost serialization
  20. template<typename Archive> void load(Archive & ar, const unsigned int);
    support for Boost serialization
  21. void update_signs();
  22. void set_sign(const std::string &);
  23. void compact();
    compact the observables to save space, discarding e.g. time series information
  24. void write_xml(oxstream & oxs, 
                   const boost::filesystem::path & = boost::filesystem::path()) const;
  25. void write_xml_with_id(oxstream & oxs, int id, 
                           const boost::filesystem::path & = boost::filesystem::path()) const;
  26. void read_xml(std::istream & infile, const XMLTag & tag);
  27. void clear();
Copyright © 1994, 2002-2005 Matthias Troyer, Synge Todo

PrevUpHomeNext