/* * FormatParser_common_common.hpp * * Created on: Mar 1, 2010 * Author: metzler */ #ifndef FORMATPARSER_COMMON_HPP_ #define FORMATPARSER_COMMON_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include "CodePatterns/Observer.hpp" #include "FormatParserInterface.hpp" #include "FormatParser_Parameters.hpp" #include "types.hpp" namespace MoleCuilder { class MoleculeLoadAction; } /** * This class encapsulates everything that all specialized FormatParser variants * have in common. * * This is because template classes cannot be partially specialization in a few * functions. Hence, we place all stuff that is common into a separate class. */ class FormatParser_common : public Observer, virtual public FormatParserInterface { friend class MoleCuilder::MoleculeLoadAction; public: FormatParser_common(FormatParser_Parameters *_parameters); virtual ~FormatParser_common(); void setOstream(std::ostream* file); protected: void update(Observable *publisher); void recieveNotification(Observable *publisher, Notification_ptr notification); void subjectKilled(Observable *publisher); // these functions are called when atoms are inserted or removed virtual void AtomInserted(atomId_t) {}; virtual void AtomRemoved(atomId_t) {}; private: //!> Output stream to write to when save() is called. std::ostream* saveStream; }; #endif /* FORMATPARSER_COMMON_HPP_ */