ATLAS Offline Software
AthExStoreGateExample/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
14 class BaseClass { };
15 
16 class MyDataObj : public BaseClass {
17 
18 public:
19 
20  MyDataObj(): BaseClass(), m_val(0) {};
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 
27 private:
28  int m_val;
29 };
30 
31 
32 // This does inherit from DataObject.
34  : public DataObject
35 {
36 public:
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 
42 private:
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
50 #include "AthenaKernel/CLASS_DEF.h"
51 CLASS_DEF(MyDataObj, 8000, 1)
52 CLASS_DEF(BaseClass, 1434, 1)
53 CLASS_DEF(TestDataObject, 289238765, 1)
54 
55 #endif
MyDataObj::~MyDataObj
virtual ~MyDataObj()
Definition: AthExStoreGateExample/MyDataObj.h:22
TestDataObject::val
int val() const
Definition: AthExStoreGateExample/MyDataObj.h:40
TestDataObject::m_val
int m_val
Definition: AthExStoreGateExample/MyDataObj.h:43
MyDataObj::val
void val(int i)
Definition: AthExStoreGateExample/MyDataObj.h:24
TestDataObject
Definition: AthExStoreGateExample/MyDataObj.h:35
TestDataObject::val
void val(int i)
Definition: AthExStoreGateExample/MyDataObj.h:39
TestDataObject::TestDataObject
TestDataObject(int i=0)
Definition: AthExStoreGateExample/MyDataObj.h:37
MyDataObj::m_val
int m_val
Definition: AthExStoreGateExample/MyDataObj.h:28
lumiFormat.i
int i
Definition: lumiFormat.py:85
MyDataObj
Definition: AthExStoreGateExample/MyDataObj.h:16
BaseClass
Definition: HiveDataObj.h:12
MyDataObj::MyDataObj
MyDataObj(int i)
Definition: AthExStoreGateExample/MyDataObj.h:21
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
MyDataObj::MyDataObj
MyDataObj()
Definition: AthExStoreGateExample/MyDataObj.h:20
CLASS_DEF.h
macros to associate a CLID to a type
MyDataObj::val
int val() const
Definition: AthExStoreGateExample/MyDataObj.h:25