ATLAS Offline Software
Public Member Functions | Friends | List of all members
AthenaRootSerializeSvc Class Reference

This class provides the AthenaSerializeSvc using ROOT. More...

#include <AthenaRootSerializeSvc.h>

Inheritance diagram for AthenaRootSerializeSvc:
Collaboration diagram for AthenaRootSerializeSvc:

Public Member Functions

 AthenaRootSerializeSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Service Constructor. More...
 
virtual ~AthenaRootSerializeSvc ()
 Destructor. More...
 
virtual StatusCode initialize () override
 Gaudi Service Interface method implementations: More...
 
virtual void * serialize (const void *object, const std::string &name, size_t &nbytes) const override
 
virtual void * serialize (const void *object, const Guid &id, size_t &nbytes) const override
 
virtual void * serialize (const void *object, const RootType &cltype, size_t &nbytes) const override
 
virtual void * deserialize (void *buffer, size_t &nbytes, const std::string &name) const override
 
virtual void * deserialize (void *buffer, size_t &nbytes, const Guid &id) const override
 
virtual void * deserialize (void *buffer, size_t &nbytes, const RootType &cltype) const override
 

Friends

class SvcFactory< AthenaRootSerializeSvc >
 

Detailed Description

This class provides the AthenaSerializeSvc using ROOT.

Definition at line 19 of file AthenaRootSerializeSvc.h.

Constructor & Destructor Documentation

◆ AthenaRootSerializeSvc()

AthenaRootSerializeSvc::AthenaRootSerializeSvc ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Standard Service Constructor.

Definition at line 17 of file AthenaRootSerializeSvc.cxx.

18  : base_class(name, pSvcLocator) {
19 }

◆ ~AthenaRootSerializeSvc()

AthenaRootSerializeSvc::~AthenaRootSerializeSvc ( )
virtual

Destructor.

Definition at line 22 of file AthenaRootSerializeSvc.cxx.

22  {
23 }

Member Function Documentation

◆ deserialize() [1/3]

void * AthenaRootSerializeSvc::deserialize ( void *  buffer,
size_t &  nbytes,
const Guid id 
) const
overridevirtual

Definition at line 62 of file AthenaRootSerializeSvc.cxx.

62  {
63  return(this->deserialize(buffer, nbytes, pool::DbReflex::forGuid(id)));
64 }

◆ deserialize() [2/3]

void * AthenaRootSerializeSvc::deserialize ( void *  buffer,
size_t &  nbytes,
const RootType cltype 
) const
overridevirtual

Definition at line 67 of file AthenaRootSerializeSvc.cxx.

67  {
68  void* obj = nullptr;
69  if (cltype.IsFundamental()) {
70  obj = new char[nbytes];
71  std::memcpy(obj, buffer, nbytes);
72  } else if (cltype.Name() == "Token") { // Token is C string
73  obj = new char[nbytes];
74  std::memcpy(obj, buffer, nbytes); static_cast<char*>(obj)[nbytes - 1] = 0;
75  } else {
76  TBufferFile readBuffer(TBuffer::kRead, nbytes, buffer, kFALSE);
77  obj = readBuffer.ReadObjectAny(cltype);
78  nbytes = readBuffer.Length();
79  }
80  return(obj);
81 }

◆ deserialize() [3/3]

void * AthenaRootSerializeSvc::deserialize ( void *  buffer,
size_t &  nbytes,
const std::string &  name 
) const
overridevirtual

Definition at line 57 of file AthenaRootSerializeSvc.cxx.

57  {
58  return(nullptr);
59 }

◆ initialize()

StatusCode AthenaRootSerializeSvc::initialize ( )
overridevirtual

Gaudi Service Interface method implementations:

Definition at line 26 of file AthenaRootSerializeSvc.cxx.

26  {
27  ATH_MSG_INFO("Initializing " << name());
28 
29  // Load message handler dictionary to avoid crashes when reporting
30  // possible errors during event processing (ATR-25049)
31  TClass::GetClass("TMessageHandler");
32 
33  return(StatusCode::SUCCESS);
34 }

◆ serialize() [1/3]

void * AthenaRootSerializeSvc::serialize ( const void *  object,
const Guid id,
size_t &  nbytes 
) const
overridevirtual

Definition at line 42 of file AthenaRootSerializeSvc.cxx.

42  {
43  return(this->serialize(object, pool::DbReflex::forGuid(id), nbytes));
44 }

◆ serialize() [2/3]

void * AthenaRootSerializeSvc::serialize ( const void *  object,
const RootType cltype,
size_t &  nbytes 
) const
overridevirtual

Definition at line 47 of file AthenaRootSerializeSvc.cxx.

47  {
48  TBufferFile writeBuffer(TBuffer::kWrite);
49  writeBuffer.WriteObjectAny(object, cltype);
50  void* buffer = writeBuffer.Buffer();
51  nbytes = writeBuffer.Length();
52  writeBuffer.ResetBit(TBuffer::kIsOwner); writeBuffer.SetBuffer(nullptr);
53  return(buffer);
54 }

◆ serialize() [3/3]

void * AthenaRootSerializeSvc::serialize ( const void *  object,
const std::string &  name,
size_t &  nbytes 
) const
overridevirtual

Definition at line 37 of file AthenaRootSerializeSvc.cxx.

37  {
38  return(nullptr);
39 }

Friends And Related Function Documentation

◆ SvcFactory< AthenaRootSerializeSvc >

friend class SvcFactory< AthenaRootSerializeSvc >
friend

Definition at line 1 of file AthenaRootSerializeSvc.h.


The documentation for this class was generated from the following files:
AthenaRootSerializeSvc::deserialize
virtual void * deserialize(void *buffer, size_t &nbytes, const std::string &name) const override
Definition: AthenaRootSerializeSvc.cxx:57
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
pool::DbReflex::forGuid
static const TypeH forGuid(const Guid &info)
Access classes by Guid.
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
TScopeAdapter::Name
std::string Name(unsigned int mod=Reflex::SCOPED) const
Definition: RootType.cxx:607
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TScopeAdapter::IsFundamental
Bool_t IsFundamental() const
Definition: RootType.cxx:726
python.PyAthena.obj
obj
Definition: PyAthena.py:135
AthenaRootSerializeSvc::serialize
virtual void * serialize(const void *object, const std::string &name, size_t &nbytes) const override
Definition: AthenaRootSerializeSvc.cxx:37