| 1 | /*
|
|---|
| 2 | * MoleculeListClass.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Oct 20, 2011
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef MOLECULELISTCLASS_HPP_
|
|---|
| 9 | #define MOLECULELISTCLASS_HPP_
|
|---|
| 10 |
|
|---|
| 11 | #ifdef HAVE_CONFIG_H
|
|---|
| 12 | #include <config.h>
|
|---|
| 13 | #endif
|
|---|
| 14 |
|
|---|
| 15 | #include <iosfwd>
|
|---|
| 16 | #include <list>
|
|---|
| 17 | #include <string>
|
|---|
| 18 |
|
|---|
| 19 | #include "CodePatterns/Observer.hpp"
|
|---|
| 20 | #include "CodePatterns/ObservedIterator.hpp"
|
|---|
| 21 | #include "CodePatterns/Cacheable.hpp"
|
|---|
| 22 |
|
|---|
| 23 | #include "Parser/ParserTypes.hpp"
|
|---|
| 24 |
|
|---|
| 25 | class molecule;
|
|---|
| 26 | class periodentafel;
|
|---|
| 27 | class World;
|
|---|
| 28 |
|
|---|
| 29 | typedef std::list<molecule *> MoleculeList;
|
|---|
| 30 | typedef std::pair<MoleculeList::iterator, bool> MoleculeListTest;
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | /** A list of \a molecule classes.
|
|---|
| 34 | */
|
|---|
| 35 | class MoleculeListClass : public Observable
|
|---|
| 36 | {
|
|---|
| 37 | public:
|
|---|
| 38 | MoleculeList ListOfMolecules; //!< List of the contained molecules
|
|---|
| 39 | int MaxIndex;
|
|---|
| 40 |
|
|---|
| 41 | MoleculeListClass(World *world);
|
|---|
| 42 | ~MoleculeListClass();
|
|---|
| 43 |
|
|---|
| 44 | bool AddHydrogenCorrection(std::string &path);
|
|---|
| 45 | bool StoreForcesFile(std::string &path, int *SortIndex);
|
|---|
| 46 | void insert(molecule *mol);
|
|---|
| 47 | void erase(molecule *mol);
|
|---|
| 48 | molecule * ReturnIndex(int index);
|
|---|
| 49 | bool OutputConfigForListOfFragments(std::string &prefix, int *SortIndex, ParserTypes type);
|
|---|
| 50 | int NumberOfActiveMolecules();
|
|---|
| 51 | void Enumerate(std::ostream *out);
|
|---|
| 52 | void Output(std::ostream *out);
|
|---|
| 53 | int CountAllAtoms() const;
|
|---|
| 54 |
|
|---|
| 55 | // Methods moved here from the menus
|
|---|
| 56 | // TODO: more refactoring needed on these methods
|
|---|
| 57 | void createNewMolecule(periodentafel *periode);
|
|---|
| 58 | void loadFromXYZ(periodentafel *periode);
|
|---|
| 59 | void setMoleculeFilename();
|
|---|
| 60 | void parseXYZIntoMolecule();
|
|---|
| 61 | void eraseMolecule();
|
|---|
| 62 |
|
|---|
| 63 | private:
|
|---|
| 64 | World *world; //!< The world this List belongs to. Needed to avoid deadlocks in the destructor
|
|---|
| 65 | };
|
|---|
| 66 |
|
|---|
| 67 | #endif /* MOLECULELISTCLASS_HPP_ */
|
|---|