/** * \file writers.h * \brief Base class for writing geometry to a file * * Copyright 2007-2010 IMP Inventors. All rights reserved. */ #ifndef IMPDISPLAY_INTERNAL_WRITERS_H #define IMPDISPLAY_INTERNAL_WRITERS_H #include "../display_config.h" #include IMPDISPLAY_BEGIN_NAMESPACE class Writer; IMPDISPLAY_END_NAMESPACE IMPDISPLAY_BEGIN_INTERNAL_NAMESPACE class WriterFactory { public: WriterFactory(); virtual ~WriterFactory(); virtual Writer *create(std::string name) const=0; }; template class WriterFactoryHelper: public WriterFactory { public: WriterFactoryHelper(){} Writer *create(std::string name) const { return new Wr(TextOutput(name)); } }; std::map& get_writer_factory_table(); struct WriterFactoryRegistrar { WriterFactoryRegistrar(std::string suffix, WriterFactory *wf) { get_writer_factory_table()[suffix]= wf; } }; IMPDISPLAY_END_INTERNAL_NAMESPACE #endif /* IMPDISPLAY_INTERNAL_WRITERS_H */