Changeset adcdf8


Ignore:
Timestamp:
Feb 2, 2010, 12:21:13 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
4bb871a
Parents:
795b4d
git-author:
Tillmann Crueger <crueger@…> (01/15/10 15:53:29)
git-committer:
Tillmann Crueger <crueger@…> (02/02/10 12:21:13)
Message:

Moved method to rename molecules to a seperate Action

Location:
molecuilder/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Actions/small_actions.cpp

    r795b4d radcdf8  
    3232  dialog->queryString("Enter name: ",&filename);
    3333  if(dialog->display()) {
    34     strcpy(mol->name, filename.c_str());
     34    mol->setName(filename);
    3535  }
    3636
  • molecuilder/src/molecule.cpp

    r795b4d radcdf8  
    6161  delete(start);
    6262};
     63
     64
     65// getter and setter
     66const std::string molecule::getName(){
     67  return std::string(name);
     68}
     69
     70void molecule::setName(const std::string _name){
     71  START_OBSERVER;
     72  strncpy(name,_name.c_str(),MAXSTRINGSIZE);
     73  FINISH_OBSERVER;
     74}
    6375
    6476
  • molecuilder/src/molecule.hpp

    r795b4d radcdf8  
    2626#include <list>
    2727#include <vector>
     28
     29#include <string>
    2830
    2931#include "graph.hpp"
     
    8183 * Class incorporates number of types
    8284 */
    83 class molecule : public PointCloud {
     85class molecule : public PointCloud , public Observable {
    8486  public:
    8587    double cell_size[6];//!< cell size
     
    100102    bool ActiveFlag;    //!< in a MoleculeListClass used to discern active from inactive molecules
    101103    Vector Center;      //!< Center of molecule in a global box
     104    int IndexNr;        //!< index of molecule in a MoleculeListClass
    102105    char name[MAXSTRINGSIZE];         //!< arbitrary name
    103     int IndexNr;        //!< index of molecule in a MoleculeListClass
    104 
     106
     107public:
    105108  molecule(const periodentafel * const teil);
    106109  virtual ~molecule();
     110
     111  //getter and setter
     112  const std::string getName();
     113  void setName(const std::string);
    107114
    108115  // re-definition of virtual functions from PointCloud
  • molecuilder/src/moleculelist.cpp

    r795b4d radcdf8  
    5050void MoleculeListClass::insert(molecule *mol)
    5151{
     52  START_OBSERVER;
    5253  mol->IndexNr = MaxIndex++;
    5354  ListOfMolecules.push_back(mol);
     55  mol->signOn(this);
     56  FINISH_OBSERVER;
    5457};
    5558
Note: See TracChangeset for help on using the changeset viewer.