PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
Loading...
Searching...
No Matches
podio::SIOCollectionIDTableBlock Class Reference

#include <SIOBlock.h>

+ Inheritance diagram for podio::SIOCollectionIDTableBlock:

Public Member Functions

 SIOCollectionIDTableBlock ()
 
 SIOCollectionIDTableBlock (podio::EventStore *store)
 
 SIOCollectionIDTableBlock (std::vector< std::string > &&names, std::vector< int > &&ids, std::vector< std::string > &&types, std::vector< short > &&isSubsetColl)
 
 SIOCollectionIDTableBlock (const SIOCollectionIDTableBlock &)=delete
 
SIOCollectionIDTableBlockoperator= (const SIOCollectionIDTableBlock &)=delete
 
void read (sio::read_device &device, sio::version_type version) override
 
void write (sio::write_device &device) override
 
podio::CollectionIDTablegetTable ()
 
const std::vector< std::string > & getTypeNames () const
 
const std::vector< short > & getSubsetCollectionBits () const
 

Detailed Description

A dedicated block for handling the I/O of the CollectionIDTable

Definition at line 99 of file SIOBlock.h.

Constructor & Destructor Documentation

◆ SIOCollectionIDTableBlock() [1/4]

podio::SIOCollectionIDTableBlock::SIOCollectionIDTableBlock ( )
inline

Definition at line 101 of file SIOBlock.h.

101 : sio::block("CollectionIDs", sio::version::encode_version(0, 4)) {
102 }

◆ SIOCollectionIDTableBlock() [2/4]

podio::SIOCollectionIDTableBlock::SIOCollectionIDTableBlock ( podio::EventStore store)

Definition at line 15 of file SIOBlock.cc.

15 :
16 sio::block("CollectionIDs", sio::version::encode_version(0, 3)) {
17 const auto table = store->getCollectionIDTable();
18 _names = table->names();
19 _ids = table->ids();
20 _types.reserve(_names.size());
21 _isSubsetColl.reserve(_names.size());
22 for (const int id : _ids) {
23 CollectionBase* tmp;
24 if (!store->get(id, tmp)) {
25 std::cerr
26 << "PODIO-ERROR cannot construct CollectionIDTableBlock because a collection is missing from the store (id: "
27 << id << ", name: " << table->name(id) << ")" << std::endl;
28 }
29
30 _types.push_back(tmp->getValueTypeName());
31 _isSubsetColl.push_back(tmp->isSubsetCollection());
32 }
33}
bool get(const std::string &name, const T *&collection)
access a collection by name. returns true if successful
Definition: EventStore.h:143
CollectionIDTable * getCollectionIDTable() const
Definition: EventStore.h:86

◆ SIOCollectionIDTableBlock() [3/4]

podio::SIOCollectionIDTableBlock::SIOCollectionIDTableBlock ( std::vector< std::string > &&  names,
std::vector< int > &&  ids,
std::vector< std::string > &&  types,
std::vector< short > &&  isSubsetColl 
)
inline

Definition at line 106 of file SIOBlock.h.

107 :
108 sio::block("CollectionIDs", sio::version::encode_version(0, 3)),
109 _names(std::move(names)),
110 _ids(std::move(ids)),
111 _types(std::move(types)),
112 _isSubsetColl(std::move(isSubsetColl)) {
113 }

◆ SIOCollectionIDTableBlock() [4/4]

podio::SIOCollectionIDTableBlock::SIOCollectionIDTableBlock ( const SIOCollectionIDTableBlock )
delete

Member Function Documentation

◆ getSubsetCollectionBits()

const std::vector< short > & podio::SIOCollectionIDTableBlock::getSubsetCollectionBits ( ) const
inline

Definition at line 127 of file SIOBlock.h.

127 {
128 return _isSubsetColl;
129 }

◆ getTable()

podio::CollectionIDTable * podio::SIOCollectionIDTableBlock::getTable ( )
inline

Definition at line 121 of file SIOBlock.h.

121 {
122 return new podio::CollectionIDTable(std::move(_ids), std::move(_names));
123 }

◆ getTypeNames()

const std::vector< std::string > & podio::SIOCollectionIDTableBlock::getTypeNames ( ) const
inline

Definition at line 124 of file SIOBlock.h.

124 {
125 return _types;
126 }

◆ operator=()

SIOCollectionIDTableBlock & podio::SIOCollectionIDTableBlock::operator= ( const SIOCollectionIDTableBlock )
delete

◆ read()

void podio::SIOCollectionIDTableBlock::read ( sio::read_device &  device,
sio::version_type  version 
)
override

Definition at line 35 of file SIOBlock.cc.

35 {
36 device.data(_names);
37 device.data(_ids);
38 device.data(_types);
39 if (version >= sio::version::encode_version(0, 2)) {
40 device.data(_isSubsetColl);
41 }
42}

◆ write()

void podio::SIOCollectionIDTableBlock::write ( sio::write_device &  device)
override

Definition at line 44 of file SIOBlock.cc.

44 {
45 device.data(_names);
46 device.data(_ids);
47
48 device.data(_types);
49 device.data(_isSubsetColl);
50}

The documentation for this class was generated from the following files: