Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule.hpp

    r8ab0407 r24a5e0  
    2727#include <vector>
    2828
     29#include <string>
     30
     31#include "defs.hpp"
    2932#include "graph.hpp"
    3033#include "stackclass.hpp"
    3134#include "tesselation.hpp"
     35#include "Patterns/Observer.hpp"
     36#include "Patterns/Cacheable.hpp"
    3237
    3338/****************************************** forward declarations *****************************/
     
    8085 * Class incorporates number of types
    8186 */
    82 class molecule : public PointCloud {
     87class molecule : public PointCloud , public Observable {
     88  friend molecule *NewMolecule();
     89  friend void DeleteMolecule(molecule *);
    8390  public:
    8491    double cell_size[6];//!< cell size
     
    99106    bool ActiveFlag;    //!< in a MoleculeListClass used to discern active from inactive molecules
    100107    Vector Center;      //!< Center of molecule in a global box
     108    int IndexNr;        //!< index of molecule in a MoleculeListClass
    101109    char name[MAXSTRINGSIZE];         //!< arbitrary name
    102     int IndexNr;        //!< index of molecule in a MoleculeListClass
    103 
    104   molecule(const periodentafel * const teil);
    105   virtual ~molecule();
     110
     111  private:
     112    Cacheable<string> formula;
     113    moleculeId_t id;
     114  protected:
     115    molecule(const periodentafel * const teil);
     116    virtual ~molecule();
     117
     118
     119public:
     120  //getter and setter
     121  const std::string getName();
     122  moleculeId_t getId();
     123  void setId(moleculeId_t);
     124  void setName(const std::string);
     125  const std::string getFormula();
     126  std::string calcFormula();
     127
    106128
    107129  // re-definition of virtual functions from PointCloud
     
    269291  int FragmentMolecule(int Order, config *configuration);
    270292  bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
    271   bool StoreBondsToFile(char *path, char *filename);
    272   bool StoreAdjacencyToFile(char *path, char *filename);
     293  bool StoreBondsToFile(char *path);
     294  bool StoreAdjacencyToFile(char *path);
    273295  bool CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms);
    274296  bool ParseOrderAtSiteFromFile(char *path);
     
    299321  bool OutputTemperatureFromTrajectories(ofstream * const output, int startstep, int endstep);
    300322
     323  // Manipulation routines
     324  void flipActiveFlag();
     325
    301326  private:
    302327  int last_atom;      //!< number given to last atom
     
    304329};
    305330
     331molecule *NewMolecule();
     332void DeleteMolecule(molecule* mol);
     333
    306334#include "molecule_template.hpp"
    307335
    308336/** A list of \a molecule classes.
    309337 */
    310 class MoleculeListClass {
     338class MoleculeListClass : public Observable {
    311339  public:
    312340    MoleculeList ListOfMolecules; //!< List of the contained molecules
    313341    int MaxIndex;
    314342
    315   MoleculeListClass();
     343  MoleculeListClass(World *world);
    316344  ~MoleculeListClass();
    317345
     
    322350  bool OutputConfigForListOfFragments(config *configuration, int *SortIndex);
    323351  int NumberOfActiveMolecules();
    324   void Enumerate(ofstream *out);
     352  void Enumerate(ostream *out);
    325353  void Output(ofstream *out);
    326354  void DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration);
    327355  int CountAllAtoms() const;
     356
     357  // Methods moved here from the menus
     358  // TODO: more refactoring needed on these methods
     359  void flipChosen();
     360  void createNewMolecule(periodentafel *periode);
     361  void loadFromXYZ(periodentafel *periode);
     362  void setMoleculeFilename();
     363  void parseXYZIntoMolecule();
     364  void eraseMolecule();
     365
    328366
    329367  // merging of molecules
     
    336374
    337375  private:
     376  World *world; //!< The world this List belongs to. Needed to avoid deadlocks in the destructor
    338377};
    339378
Note: See TracChangeset for help on using the changeset viewer.