ATLAS Offline Software
Loading...
Searching...
No Matches
HiveDataObj.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHEXHIVE_HIVEDATAOBJ_H
6#define ATHEXHIVE_HIVEDATAOBJ_H
7
8//sample data class for the Read/Write example
9//it just wraps an int. Notice that is does not inherit from Gaudi DataObject
10
11//a dummy base class to test the symlinks
12class BaseClass { };
13
15
16public:
17
19 HiveDataObj(int i): m_val(i) {};
20 virtual ~HiveDataObj() = default;
21
22 void val(int i) { m_val = i; }
23 int val() const { return m_val; }
24
25 typedef std::true_type thread_safe;
26
27private:
28 int m_val;
29};
30
31
32#include <format>
33namespace std {
34
35template <>
36struct formatter<HiveDataObj>
37 : public formatter<string_view>
38{
39 template <class FmtContext>
40 FmtContext::iterator format (const HiveDataObj& io, FmtContext& ctx) const
41 {
42 return std::format_to (ctx.out(), "{}", io.val());
43 }
44};
45
46} // namespace std
47
48
49//using the macros below we can assign an identifier (and a version)
50//to the type HiveDataObj
51//This is required and checked at compile time when you try to record/retrieve
53CLASS_DEF( HiveDataObj , 37539154 , 1 )
54
55#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
std::true_type thread_safe
Definition HiveDataObj.h:25
virtual ~HiveDataObj()=default
int val() const
Definition HiveDataObj.h:23
void val(int i)
Definition HiveDataObj.h:22
HiveDataObj(int i)
Definition HiveDataObj.h:19
STL namespace.
FmtContext::iterator format(const HiveDataObj &io, FmtContext &ctx) const
Definition HiveDataObj.h:40