1#ifndef PODIO_ASCIIWRITER_H
2#define PODIO_ASCIIWRITER_H
26 T* col =
static_cast<T*
>(c);
27 o << col->size() << std::endl;
28 o << *col << std::endl;
32typedef std::map<std::string, ColWriterBase*>
FunMap;
45 bool registerForWrite(
const std::string& name);
53 std::string m_filename;
56 std::ofstream* m_file;
58 std::vector<CollectionBase*> m_storedCollections{};
59 std::vector<std::string> m_collectionNames{};
65 const T* tmp_coll(
nullptr);
66 if (!m_store->
get(name, tmp_coll)) {
67 std::cerr <<
"no such collection to write, throw exception." << std::endl;
70 T* coll =
const_cast<T*
>(tmp_coll);
72 m_storedCollections.emplace_back(coll);
73 m_collectionNames.emplace_back(name);
ASCIIWriter(const ASCIIWriter &)=delete
ASCIIWriter & operator=(const ASCIIWriter &)=delete
bool registerForWrite(const std::string &name)
bool get(const std::string &name, const T *&collection)
access a collection by name. returns true if successful
std::map< std::string, ColWriterBase * > FunMap
virtual void writeCollection(CollectionBase *, std::ostream &)=0
virtual ~ColWriterBase()=default
void writeCollection(CollectionBase *c, std::ostream &o) override