ATLAS Offline Software
Loading...
Searching...
No Matches
SegMemSvc.h
Go to the documentation of this file.
1/* -*- C++ -*- */
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef CONTROL_STOREGATE_SEGMEMSVC_H
8#define CONTROL_STOREGATE_SEGMEMSVC_H 1
9
10#include "GaudiKernel/Service.h"
11#include "GaudiKernel/IIncidentListener.h"
12#include "GaudiKernel/IIncidentSvc.h"
13#include "GaudiKernel/MsgStream.h"
14#include "GaudiKernel/ServiceHandle.h"
15#include "AthAllocators/Arena.h"
16
17#include <string>
18
19
27
28class SegMemSvc: public extends<Service, IIncidentListener> {
29
30public:
31
32
33 enum LIFETIME {
34 EVENT = 0,
35 JOB = 1,
37 };
38
39 virtual StatusCode initialize() override;
40 virtual void handle(const Incident&) override;
41
44
45
46
50 template <typename T>
51 T* allocate(SegMemSvc::LIFETIME, bool cache=true);
52
54 template <typename T>
55 bool del(T*);
56
58
59
60 SegMemSvc( const std::string& name, ISvcLocator* svc );
61
62 // Destructor.
63 virtual ~SegMemSvc();
64
65
66private:
67
69
71 inline std::string cvt(SegMemSvc::LIFETIME life) {
72 switch (life) {
73 case SegMemSvc::EVENT : return "EVENT";
74 case SegMemSvc::JOB : return "JOB";
75 case SegMemSvc::INCIDENT: return "INCIDENT";
76 }
77 return "UNKNOWN";
78 }
79
83
84
85};
86
87
89
90#endif
Collection of memory allocators with a common lifetime, plus subsystem summary.
Proxy for a group of Arenas.
Definition ArenaHeader.h:54
Collection of memory allocators with a common lifetime,.
Definition Arena.h:238
SG::ArenaHeader m_ahead_job
three arenas for different lifetimes
Definition SegMemSvc.h:81
virtual void handle(const Incident &) override
Definition SegMemSvc.cxx:58
T * allocate(SegMemSvc::LIFETIME, bool cache=true)
Get pointer to an area in the arena, used for new with placement.
SG::ArenaHeader m_ahead_evt
Definition SegMemSvc.h:81
virtual ~SegMemSvc()
Definition SegMemSvc.cxx:30
SG::Arena m_arena_inc
Definition SegMemSvc.h:82
virtual StatusCode initialize() override
Definition SegMemSvc.cxx:39
SG::Arena m_arena_job
Definition SegMemSvc.h:82
SG::Arena m_arena_evt
Definition SegMemSvc.h:82
SegMemSvc(const std::string &name, ISvcLocator *svc)
Definition SegMemSvc.cxx:18
ServiceHandle< IIncidentSvc > p_incSvc
Definition SegMemSvc.h:68
bool del(T *)
free memory managed by arena
std::string cvt(SegMemSvc::LIFETIME life)
helper to for printout
Definition SegMemSvc.h:71
SG::ArenaHeader m_ahead_inc
Definition SegMemSvc.h:81