ChimeraTK-DeviceAccess
03.18.00
TransferElementID.cc
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3
4
#include "
TransferElementID.h
"
5
6
#include <atomic>
7
#include <cassert>
8
#include <sstream>
9
10
namespace
ChimeraTK
{
11
12
/********************************************************************************************************************/
13
14
void
TransferElementID::makeUnique
() {
15
static
std::atomic<size_t> nextId{0};
16
assert(
_id
== 0);
17
++nextId;
18
assert(nextId != 0);
19
_id
= nextId;
20
}
21
22
/********************************************************************************************************************/
23
24
std::ostream&
operator<<
(std::ostream& os,
const
TransferElementID
& me) {
25
std::stringstream ss;
26
ss << std::hex << std::showbase << me.
_id
;
27
os << ss.str();
28
return
os;
29
}
30
31
/********************************************************************************************************************/
32
33
}
// namespace ChimeraTK
TransferElementID.h
ChimeraTK::TransferElementID::makeUnique
void makeUnique()
Assign an ID to this instance.
Definition:
TransferElementID.cc:14
ChimeraTK::TransferElementID::_id
size_t _id
The actual ID value.
Definition:
TransferElementID.h:48
ChimeraTK::operator<<
std::ostream & operator<<(std::ostream &stream, const DataDescriptor::FundamentalType &fundamentalType)
Definition:
DataDescriptor.cpp:195
ChimeraTK::TransferElementID
Simple class holding a unique ID for a TransferElement.
Definition:
TransferElementID.h:17
ChimeraTK
Definition:
DummyBackend.h:16
sources
ChimeraTK-DeviceAccess
src
TransferElementID.cc
Generated by
1.8.17