ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
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
10namespace ChimeraTK {
11
12 /********************************************************************************************************************/
13
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
Simple class holding a unique ID for a TransferElement.
size_t _id
The actual ID value.
void makeUnique()
Assign an ID to this instance.
std::ostream & operator<<(std::ostream &stream, const DataDescriptor::FundamentalType &fundamentalType)