The Gaudi Framework  master (fb0007c6)
Loading...
Searching...
No Matches
RConverter.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
13// Include files
15#include <TDirectory.h>
16#include <map>
17#include <string>
18
19// Forward declarations
20class ISvcLocator;
21class TObject;
22class TTree;
23class TFile;
24
26 TDirectory* m_current;
27
28public:
30 virtual ~GlobalDirectoryRestore() { gDirectory = m_current; }
31};
32
33namespace RootHistCnv {
34
40 class RConverter : public Converter {
41 public:
43 StatusCode createRep( DataObject* pObj, IOpaqueAddress*& refpAddr ) override;
45 static long storageType() { return ROOT_StorageType; }
46 long repSvcType() const override { return i_repSvcType(); }
47
48 StatusCode error( const std::string& msg );
49 StatusCode regTFile( const std::string&, const TFile* );
50 StatusCode findTFile( const std::string&, TFile*& );
51
52 std::string diskDirectory( const std::string& loc );
53 std::string directory( const std::string& loc );
54 void setDirectory( const std::string& loc );
55 void setDiskDirectory( const std::string& loc );
56 StatusCode createDirectory( const std::string& loc );
57 StatusCode createDiskDirectory( const std::string& loc );
58 std::string getDirectory();
59
60 std::string convertId( const std::string& ) const;
61
62 protected:
64 RConverter( const CLID& clid, ISvcLocator* svc ) : Converter( storageType(), clid, svc ) {}
66 virtual StatusCode readObject( IOpaqueAddress* pAddr, DataObject*& refpObj );
68 virtual TObject* createPersistent( DataObject* pObj );
70 StatusCode createAddress( DataObject* pObject, TDirectory* pDir, TObject* pTObject, IOpaqueAddress*& refpAddr );
71
72 StatusCode createAddress( const std::string& rzdir, const CLID& clid, long id, TObject* pTobj,
73 IOpaqueAddress*& refpAddress );
74
75 StatusCode createAddress( const std::string& rzdir, const CLID& clid, const std::string& title, TObject* pTobj,
76 IOpaqueAddress*& refpAddress );
77
79 TDirectory* changeDirectory( DataObject* pObject );
80 };
81} // namespace RootHistCnv
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
const long ROOT_StorageType
Definition ClassID.h:60
Converter(long storage_type, const CLID &class_type, ISvcLocator *svc=0)
Standard Constructor.
virtual long i_repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition Converter.cpp:25
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
virtual ~GlobalDirectoryRestore()
Definition RConverter.h:30
TDirectory * m_current
Definition RConverter.h:26
Opaque address interface definition.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
StatusCode createDiskDirectory(const std::string &loc)
std::string directory(const std::string &loc)
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&refpAddr) override
Convert the transient object to the requested representation.
std::string diskDirectory(const std::string &loc)
static long storageType()
Inquire storage type.
Definition RConverter.h:45
long repSvcType() const override
Definition RConverter.h:46
StatusCode findTFile(const std::string &, TFile *&)
std::string getDirectory()
void setDirectory(const std::string &loc)
void setDiskDirectory(const std::string &loc)
StatusCode createDirectory(const std::string &loc)
StatusCode regTFile(const std::string &, const TFile *)
virtual StatusCode readObject(IOpaqueAddress *pAddr, DataObject *&refpObj)
Create the transient representation of an object.
TDirectory * changeDirectory(DataObject *pObject)
Switch to object directory (=Parent directory)
RConverter(const CLID &clid, ISvcLocator *svc)
Standard constructor.
Definition RConverter.h:64
virtual TObject * createPersistent(DataObject *pObj)
Create the persistent representation of an object.
StatusCode createAddress(DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
Create address of the transient object according to the requested representation.
StatusCode error(const std::string &msg)
std::string convertId(const std::string &) const
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64