source: molecuilder/src/Parser/FormatParser.cpp@ 2704e2

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

WIP tremolo parser

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