RConverter.h
Go to the documentation of this file.
1 #ifndef ROOTHISTCNV_RCONVERTER_H
2 #define ROOTHISTCNV_RCONVERTER_H 1
3 
4 // Include files
5 #include "GaudiKernel/Converter.h"
6 #include "TDirectory.h"
7 #include <string>
8 #include <map>
9 
10 // Forward declarations
11 class ISvcLocator;
12 class TObject;
13 class TTree;
14 class TFile;
15 
17  TDirectory* m_current;
18 public:
20  m_current = gDirectory;
21  }
23  gDirectory = m_current;
24  }
25 };
26 
27 namespace RootHistCnv {
28 
34  class RConverter : public Converter {
35  public:
38  IOpaqueAddress*& refpAddr) override;
40  static long storageType() { return ROOT_StorageType; }
41  long repSvcType() const override { return i_repSvcType(); }
42 
43  StatusCode error(const std::string& msg);
44  StatusCode regTFile(const std::string, const TFile*);
45  StatusCode findTFile(const std::string, TFile*&);
46 
47  std::string diskDirectory(const std::string& loc);
48  std::string directory(const std::string& loc);
49  void setDirectory(const std::string& loc);
50  void setDiskDirectory(const std::string& loc);
51  StatusCode createDirectory(const std::string& loc);
52  StatusCode createDiskDirectory(const std::string& loc);
53  std::string getDirectory();
54 
55  std::string convertId(const std::string& ) const ;
56 
57  protected:
59  RConverter( const CLID& clid, ISvcLocator* svc )
60  : Converter(storageType(), clid, svc) { }
62  ~RConverter() override = default;
64  virtual StatusCode readObject( IOpaqueAddress* pAddr,
65  DataObject*& refpObj);
67  virtual TObject* createPersistent(DataObject* pObj);
70  TDirectory* pDir,
71  TObject* pTObject,
72  IOpaqueAddress*& refpAddr);
73 
74  StatusCode createAddress(const std::string& rzdir,
75  const CLID& clid,
76  long id,
77  TObject* pTobj,
78  IOpaqueAddress*& refpAddress);
79 
80  StatusCode createAddress(const std::string& rzdir,
81  const CLID& clid,
82  const std::string& title,
83  TObject* pTobj,
84  IOpaqueAddress*& refpAddress);
85 
87  TDirectory* changeDirectory(DataObject* pObject);
88  };
89 } // namespace RootHistCnv
90 
91 #endif // RootHistCnv_RConverter_H
std::string getDirectory()
Definition: RConverter.cpp:153
Root Converter.
Definition: RConverter.h:34
RConverter(const CLID &clid, ISvcLocator *svc)
Standard constructor.
Definition: RConverter.h:59
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
std::string diskDirectory(const std::string &loc)
Definition: RConverter.cpp:73
void setDirectory(const std::string &loc)
Definition: RConverter.cpp:112
StatusCode createDiskDirectory(const std::string &loc)
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&refpAddr) override
Convert the transient object to the requested representation.
Definition: RConverter.cpp:254
~RConverter() override=default
Standard destructor.
StatusCode regTFile(const std::string, const TFile *)
Definition: RConverter.cpp:299
StatusCode findTFile(const std::string, TFile *&)
Definition: RConverter.cpp:316
StatusCode createDirectory(const std::string &loc)
Definition: RConverter.cpp:24
TDirectory * changeDirectory(DataObject *pObject)
Switch to object directory (=Parent directory)
Definition: RConverter.cpp:226
static long storageType()
Inquire storage type.
Definition: RConverter.h:40
virtual TObject * createPersistent(DataObject *pObj)
Create the persistent representation of an object.
Definition: RConverter.cpp:292
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
TDirectory * m_current
Definition: RConverter.h:17
virtual ~GlobalDirectoryRestore()
Definition: RConverter.h:22
Converter base class.
Definition: Converter.h:24
std::string directory(const std::string &loc)
Definition: RConverter.cpp:105
virtual long i_repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition: Converter.cpp:19
StatusCode error(const std::string &msg)
Definition: RConverter.cpp:367
long repSvcType() const override
Definition: RConverter.h:41
std::string convertId(const std::string &) const
Definition: RConverter.cpp:351
virtual StatusCode readObject(IOpaqueAddress *pAddr, DataObject *&refpObj)
Create the transient representation of an object.
Definition: RConverter.cpp:279
Opaque address interface definition.
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode createAddress(DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
Create address of the transient object according to the requested representation. ...
Definition: RConverter.cpp:161
void setDiskDirectory(const std::string &loc)
Definition: RConverter.cpp:146
const long ROOT_StorageType
Definition: ClassID.h:52