source: molecuilder/src/Parser/FormatParser.cpp@ 5aefaa

Last change on this file since 5aefaa was f2efcf, checked in by Saskia Metzler <metzler@…>, 16 years ago

the XYZ parser

  • Property mode set to 100644
File size: 1016 bytes
Line 
1/*
2 * FormatParser.cpp
3 *
4 * Created on: Mar 1, 2010
5 * Author: metzler
6 */
7
8#include "FormatParser.hpp"
9
10using namespace std;
11
12/**
13 * Constructor.
14 */
15FormatParser::FormatParser() {
16 ChangeTracker::get()->signOn(this);
17 saveStream = NULL;
18}
19
20/**
21 * Destructor.
22 */
23FormatParser::~FormatParser() {
24 ChangeTracker::get()->signOff(this);
25}
26
27/**
28 * Update operation which can be invoked by the observable (which should be the
29 * change tracker here).
30 */
31void FormatParser::update(Observable *publisher) {
32 if (!saveStream) {
33// throw new Exception("Please invoke setOfstream() so the parser knows where to save the World's data.");
34 }
35
36 save(saveStream);
37}
38
39/**
40 * The observable can tell when it dies.
41 */
42void FormatParser::subjectKilled(Observable *publisher) {}
43
44
45/**
46 * Sets the output stream for save, so the save() method can be invoked on update
47 * automatically.
48 *
49 * \param ostream where to save the World's state
50 */
51void FormatParser::setOstream(ostream* output) {
52 saveStream = output;
53}
Note: See TracBrowser for help on using the repository browser.