Changeset f2efcf


Ignore:
Timestamp:
Mar 5, 2010, 12:53:13 PM (16 years ago)
Author:
Saskia Metzler <metzler@…>
Children:
5aefaa
Parents:
4938aa
Message:

the XYZ parser

Location:
molecuilder/src
Files:
5 added
7 deleted
2 edited
5 moved

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Makefile.am

    r4938aa rf2efcf  
    1010ACTIONSSOURCE = Actions/Action.cpp Actions/Process.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp Actions/ErrorAction.cpp Actions/small_actions.cpp Actions/ManipulateAtomsProcess.cpp Actions/ActionRegistry.cpp
    1111ACTIONSHEADER = Actions/Action.hpp Actions/Process.hpp Actions/Calculation.hpp Actions/Calculation_impl.hpp Actions/MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp Actions/ErrorAction.hpp Actions/small_actions.hpp Actions/ManipulateAtomsProcess.hpp Actions/ActionRegistry.hpp
     12
     13PARSERSOURCE = Parser/ChangeTracker.cpp Parser/FormatParser.cpp Parser/XyzParser.cpp
     14PARSERHEADER = Parser/ChangeTracker.hpp Parser/FormatParser.hpp Parser/XyzParser.hpp
    1215
    1316PATTERNSOURCE = Patterns/Observer.cpp
     
    3235DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp Descriptors/AtomIdDescriptor.hpp Descriptors/AtomTypeDescriptor.hpp Descriptors/MoleculeDescriptor.hpp
    3336
    34 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} ${UISOURCE} ${DESCRIPTORSOURCE} ${LEGACYSOURCE} bond.cpp bondgraph.cpp boundary.cpp ChangeTracker.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp FormatParser.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp lists.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp WorldIterators.cpp
    35 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${PATTERNHEADER} ${UIHEADER} ${DESCRIPTORHEADER} ${LEGACYHEADER} bond.hpp bondgraph.hpp boundary.hpp ChangeTracker.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp FormatParser.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp World.hpp
     37SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PARSERSOURCE} ${PATTERNSOURCE} ${UISOURCE} ${DESCRIPTORSOURCE} ${LEGACYSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp lists.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp WorldIterators.cpp
     38HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${PARSERHEADER} ${PATTERNHEADER} ${UIHEADER} ${DESCRIPTORHEADER} ${LEGACYHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp World.hpp
    3639
    3740BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
  • molecuilder/src/Parser/ChangeTracker.cpp

    r4938aa rf2efcf  
    1010ChangeTracker* ChangeTracker::instance = NULL;
    1111
     12/**
     13 * Constructor. Signs on as an observer for the World.
     14 */
    1215ChangeTracker::ChangeTracker() {
    1316  isConsistent = true;
     
    1518}
    1619
     20/**
     21 * Destructor. Signs off from the World.
     22 */
    1723ChangeTracker::~ChangeTracker() {
    1824  World::get()->signOff(this);
    1925}
    2026
     27/**
     28 * Returns the change tracker instance.
     29 *
     30 * \return this
     31 */
    2132ChangeTracker* ChangeTracker::get() {
    2233  if (instance == NULL) {
     
    2738}
    2839
     40/**
     41 * Destroys the change tracker instance. Be careful, the change tracker is a
     42 * singleton and destruction might lead to a loss of consistency.
     43 */
    2944void ChangeTracker::destroy() {
    3045  delete instance;
     
    3247}
    3348
     49/**
     50 * With this, the World can update the change tracker's state.
     51 */
    3452void ChangeTracker::update(Observable *publisher) {
    3553  isConsistent = false;
    3654}
    3755
     56/**
     57 * Gets whether there are non-saved changes.
     58 *
     59 * \param true if there are any changes, false otherwise
     60 */
    3861bool ChangeTracker::hasChanged() {
    3962  return !isConsistent;
    4063}
    4164
     65/**
     66 * Tells all observers (which are the different parsers) that they are supposed
     67 * to save the current state.
     68 */
    4269void ChangeTracker::saveStatus() {
    4370  if (hasChanged()) {
  • molecuilder/src/Parser/FormatParser.hpp

    r4938aa rf2efcf  
    1313#include "parser.hpp"
    1414
    15 using namespace std;
    16 
     15/**
     16 * General parser which observes the change tracker.
     17 */
    1718class FormatParser : public Observer {
    1819public:
    1920  FormatParser();
    20   ~FormatParser();
    21   virtual void save(char* fileName);
    22   virtual void load(char* fileName);
     21  virtual ~FormatParser();
     22  virtual void save(std::ostream* file)=0;
     23  virtual void load(std::istream* file)=0;
     24  void setOstream(std::ostream* file);
     25  void update(Observable *publisher);
     26  void subjectKilled(Observable *publisher);
    2327
    2428private:
    25   MatrixContainer* readData(char* fileName, int skiplines, int skipcolumns);
    26   virtual int getHeaderSize(char identifier);
     29  std::ostream* saveStream;
    2730};
    2831
  • molecuilder/src/unittests/Makefile.am

    r4938aa rf2efcf  
    3030  CacheableTest \
    3131  DescriptorUnittest \
    32   MatrixUnitTest \
     32  ParserUnitTest \
    3333  manipulateAtomsTest \
    3434  atomsCalculationTest \
     
    6666  CacheableTest.cpp \
    6767  DescriptorUnittest.cpp \
    68   MatrixUnitTest.cpp \
     68  ParserUnitTest.cpp \
    6969  manipulateAtomsTest.cpp \
    7070  atomsCalculationTest.cpp \
     
    146146DescriptorUnittest_LDADD = ${ALLLIBS}
    147147
    148 MatrixUnitTest_SOURCES = UnitTestMain.cpp MatrixUnitTest.cpp MatrixUnitTest.hpp
    149 MatrixUnitTest_LDADD = ${ALLLIBS}
     148ParserUnitTest_SOURCES = UnitTestMain.cpp ParserUnitTest.cpp ParserUnitTest.hpp
     149ParserUnitTest_LDADD = ${ALLLIBS}
    150150
    151151manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp
Note: See TracChangeset for help on using the changeset viewer.