ATLAS Offline Software
Loading...
Searching...
No Matches
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.
virtual ~AthenaRootSerializeSvc ()
 Destructor.
virtual StatusCode initialize () override
 Gaudi Service Interface method implementations:
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}
virtual void * deserialize(void *buffer, size_t &nbytes, const std::string &name) const override
static const TypeH forGuid(const Guid &info)
Access classes by Guid.

◆ 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}
Bool_t IsFundamental() const
Definition RootType.cxx:731
std::string Name(unsigned int mod=Reflex::SCOPED) const
Definition RootType.cxx:612

◆ 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}
#define ATH_MSG_INFO(x)

◆ 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}
virtual void * serialize(const void *object, const std::string &name, size_t &nbytes) const override

◆ 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}

◆ 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: