#include <ASCIIWriter.h>
Definition at line 34 of file ASCIIWriter.h.
◆ ASCIIWriter() [1/2]
podio::ASCIIWriter::ASCIIWriter |
( |
const std::string & |
filename, |
|
|
EventStore * |
store |
|
) |
| |
Definition at line 8 of file ASCIIWriter.cc.
8 :
9 m_filename(filename), m_store(store), m_file(new std::ofstream) {
10
11 m_file->open(filename, std::ofstream::binary);
12}
◆ ~ASCIIWriter()
podio::ASCIIWriter::~ASCIIWriter |
( |
| ) |
|
◆ ASCIIWriter() [2/2]
podio::ASCIIWriter::ASCIIWriter |
( |
const ASCIIWriter & |
| ) |
|
|
delete |
◆ finish()
void podio::ASCIIWriter::finish |
( |
| ) |
|
◆ operator=()
◆ registerForWrite()
template<typename T >
bool podio::ASCIIWriter::registerForWrite |
( |
const std::string & |
name | ) |
|
Definition at line 64 of file ASCIIWriter.h.
64 {
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;
68 return false;
69 }
70 T* coll = const_cast<T*>(tmp_coll);
71
72 m_storedCollections.emplace_back(coll);
73 m_collectionNames.emplace_back(name);
74 m_map[name] = new ColWriter<T>;
75 return true;
76}
bool get(const std::string &name, const T *&collection)
access a collection by name. returns true if successful
◆ writeEvent()
void podio::ASCIIWriter::writeEvent |
( |
| ) |
|
Definition at line 18 of file ASCIIWriter.cc.
18 {
19
20 unsigned i = 0;
21 for (auto& coll : m_storedCollections) {
22 coll->prepareForWrite();
23
24 const std::string& name = m_collectionNames[i++];
25 std::cout << " writing collection " << name << std::endl;
26
27 *m_file << name << " ";
28
29 ColWriterBase* wrt = m_map[name];
30
31 wrt->writeCollection(coll, *m_file);
32 }
33}
The documentation for this class was generated from the following files: