ATLAS Offline Software
Loading...
Searching...
No Matches
MyDataObj.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHEXSTOREGATEEXAMPLE_MYDATAOBJ_H
6#define ATHEXSTOREGATEEXAMPLE_MYDATAOBJ_H
7
8#include "GaudiKernel/DataObject.h"
9
10//sample data class for the Read/Write example
11//it just wraps an int. Notice that is does not inherit from Gaudi DataObject
12
13//a dummy base class to test the symlinks
14class BaseClass { };
15
16class MyDataObj : public BaseClass {
17
18public:
19
21 MyDataObj(int i): m_val(i) {};
22 virtual ~MyDataObj(){};
23
24 void val(int i) { m_val = i; }
25 int val() const { return m_val; }
26
27private:
28 int m_val;
29};
30
31
32// This does inherit from DataObject.
34 : public DataObject
35{
36public:
37 TestDataObject(int i=0): m_val(i) {};
38
39 void val(int i) { m_val = i; }
40 int val() const { return m_val; }
41
42private:
43 int m_val;
44};
45
46
47//using the macros below we can assign an identifier (and a version)
48//to the type MyDataObj
49//This is required and checked at compile time when you try to record/retrieve
51CLASS_DEF(MyDataObj, 8000, 1)
52CLASS_DEF(BaseClass, 1434, 1)
53CLASS_DEF(TestDataObject, 289238765, 1)
54
55#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
virtual ~MyDataObj()
Definition MyDataObj.h:22
int m_val
Definition MyDataObj.h:28
int val() const
Definition MyDataObj.h:25
MyDataObj(int i)
Definition MyDataObj.h:21
void val(int i)
Definition MyDataObj.h:24
TestDataObject(int i=0)
Definition MyDataObj.h:37
int val() const
Definition MyDataObj.h:40
void val(int i)
Definition MyDataObj.h:39