1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Minimal item descriptor for archive I/O
#ifndef GENERS_ITEMDESCRIPTOR_HH_
#define GENERS_ITEMDESCRIPTOR_HH_
#include <string>
#include <typeinfo>
#include <utility>
#include "Alignment/Geners/interface/ClassId.hh"
namespace gs {
class ItemDescriptor {
public:
ItemDescriptor();
ItemDescriptor(const ClassId &classId, const char *ioPrototype, const char *name, const char *category);
inline virtual ~ItemDescriptor() {}
inline const ClassId &type() const { return classId_; }
inline const std::string &ioPrototype() const { return ioProto_; }
inline const std::string &name() const { return nameCat_.first; }
inline const std::string &category() const { return nameCat_.second; }
inline const std::pair<std::string, std::string> &nameAndCategory() const { return nameCat_; }
inline bool operator==(const ItemDescriptor &r) const { return (typeid(*this) == typeid(r)) && this->isEqual(r); }
inline bool operator!=(const ItemDescriptor &r) const { return !(*this == r); }
// The following returns "true" if the class id and
// I/O prototype of this item coincide with those of
// the argument
bool isSameClassIdandIO(const ItemDescriptor &r) const;
// The following method checks I/O prototype only
// allowing for class id mismatch
inline bool isSameIOPrototype(const ItemDescriptor &r) const { return ioProto_ == r.ioProto_; }
protected:
virtual bool isEqual(const ItemDescriptor &) const;
private:
ClassId classId_;
std::string ioProto_;
std::pair<std::string, std::string> nameCat_;
};
} // namespace gs
#endif // GENERS_ITEMDESCRIPTOR_HH_
|