ATLAS Offline Software
Loading...
Searching...
No Matches
TPCnvTokenList_p1.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TPCnvTokenList_p1_h
6#define TPCnvTokenList_p1_h
7
8#include <vector>
9#include <string>
10#include <sstream>
11#include <stdexcept>
12
15
23
25public:
30 explicit
31 TPCnvToken_p1(unsigned short cnvID=0, const std::string& token="")
32 : m_converterID(cnvID), m_token(token) {}
33
35 unsigned short converterID() const { return m_converterID; }
36
38 const std::string& token() const { return m_token; }
39
40protected:
41 unsigned short m_converterID;
42 std::string m_token;
43};
44
45
46
53
55 : public std::vector<TPCnvToken_p1>
56{
57public:
62 void addToken( unsigned short cnvID, const std::string& token) {
63 push_back( TPCnvToken_p1(cnvID, token) );
64 }
65
70 const std::string& findToken(unsigned short id) {
71 for( const_iterator it = begin(); it != end(); ++it ) {
72 if( it->converterID() == id )
73 return it->token();
74 }
75 std::ostringstream error;
76 error << "TPCnvTokenList_p1::findToken(): could not find a token for converter ID=" << id << std::ends;
77 throw std::runtime_error( error.str() );
78 }
79};
80
81
82
83#endif
vector of TPCnvToken_p1 Each top-level persistent object that has extentions needs a data member of t...
const std::string & findToken(unsigned short id)
Retrieves token of the extending object given the converter ID.
void addToken(unsigned short cnvID, const std::string &token)
Stores a new reference to an extending object.
This class servers as a persistent pointer to maintain reference between the principal top-level obje...
const std::string & token() const
Returns token.
std::string m_token
token to the extending object
unsigned short m_converterID
ID of the top-level TP converter.
unsigned short converterID() const
Returns the topl level TP converter ID.
TPCnvToken_p1(unsigned short cnvID=0, const std::string &token="")
Constructor.