37 return StatusCode::SUCCESS;
45 return(::Converter::finalize());
55 bool ownTokAddr =
false;
56 if (tokAddr ==
nullptr || tokAddr->
getToken() ==
nullptr) {
58 auto token = std::make_unique<Token>();
59 token->fromString(*(pAddr->par()));
60 GenericAddress* genAddr =
dynamic_cast<GenericAddress*
>(pAddr);
62 ATH_MSG_ERROR(
"Dynamic cast failed in AthenaPoolConverter::createObj");
64 return StatusCode::FAILURE;
69 tokAddr->
getToken()->
setAuxString(CxxUtils::HexString<
"[CTXT={}]">(
static_cast<int>(*(pAddr->ipar()))));
74 std::string key = pAddr->par()[1];
79 }
catch (std::exception& e) {
83 if (pObj ==
nullptr) {
87 delete tokAddr; tokAddr =
nullptr;
89 if (pObj ==
nullptr) {
90 return StatusCode::FAILURE;
92 return StatusCode::SUCCESS;
97 if (proxy ==
nullptr) {
98 ATH_MSG_ERROR(
"AthenaPoolConverter CreateRep failed to cast DataProxy, key = " << pObj->name());
99 return StatusCode::FAILURE;
101 const CLID clid = proxy->clID();
102 if (pAddr ==
nullptr) {
106 GenericAddress* gAddr =
dynamic_cast<GenericAddress*
>(pAddr);
107 if (gAddr !=
nullptr) {
111 return StatusCode::SUCCESS;
118 return StatusCode::FAILURE;
120 }
catch (std::exception& e) {
121 ATH_MSG_ERROR(
"fillRepRefs - caught exception: " << e.what());
122 return StatusCode::FAILURE;
124 return StatusCode::SUCCESS;
134 ::
AthMessaging((pSvcLocator != nullptr ? msgSvc() : nullptr),
135 name ? name :
"AthenaPoolConverter"),
136 m_detStore(
"DetectorStore", name ? name :
"AthenaPoolConverter"),
137 m_athenaPoolCnvSvc(pSvcLocator && pSvcLocator->existsService(
"AthenaPoolSharedIOCnvSvc") ?
"AthenaPoolSharedIOCnvSvc" :
"AthenaPoolCnvSvc", name ? name :
"AthenaPoolConverter"){
145 std::string::size_type pos1 = output.find(
'[');
146 std::string outputConnectionSpec = output.substr(0, pos1);
152 std::string containerName{
""};
153 std::string containerNameHint{
""};
154 std::string branchNameHint{
""};
155 std::string containerFriendPostfix{
""};
156 while (pos1 != std::string::npos) {
157 const std::string::size_type pos2 = output.find(
'=', pos1);
158 const std::string thisKey = output.substr(pos1 + 1, pos2 - pos1 - 1);
159 const std::string::size_type pos3 = output.find(
']', pos2);
160 const std::string value = output.substr(pos2 + 1, pos3 - pos2 - 1);
161 if (thisKey ==
"OutputCollection") {
162 dhContainerPrefix = std::move(value);
163 }
else if (thisKey ==
"PoolContainerPrefix") {
164 containerPrefix = std::move(value);
165 }
else if (thisKey ==
"TopLevelContainerName") {
166 containerNameHint = std::move(value);
167 }
else if (thisKey ==
"SubLevelBranchName") {
168 branchNameHint = std::move(value);
169 }
else if (thisKey ==
"PoolContainerFriendPostfix") {
170 containerFriendPostfix = std::move(value);
172 pos1 = output.find(
'[', pos3);
176 if (
auto colonPost = containerPrefix.find(
':'); colonPost != std::string::npos) {
178 containerPrefix.erase(0, colonPost + 1);
183 containerName = std::format(
"{}{}({}{})",
186 key.back() ==
'/' ? key :
"",
191 containerName = std::format(
"{}({})",
197 constexpr std::string_view typeTok =
"<type>", keyTok =
"<key>";
198 containerName = std::format(
"{}{}{}{}",
200 containerFriendPostfix,
202 branchNameHint.empty() ?
"" : std::format(
"({})", branchNameHint));
203 if (
auto pos = containerName.find(typeTok); pos != std::string::npos) {
204 containerName.replace(pos, typeTok.size(), tname);
206 if (
auto pos = containerName.find(keyTok); pos != std::string::npos) {
207 containerName.replace(pos, keyTok.size(), key.empty() ? tname : key);
217 return(token ? (guid == token->
classID()) :
false);
221 ATH_MSG_DEBUG(
"AthenaPoolConverter cleanUp called for base class.");
222 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This file contains the class definition for the AthenaPoolConverter class.
uint32_t CLID
The Class ID type.
This file contains the class definition for the Guid class (migrated from POOL).
Provides a utility class to format integral types as hexadecimal strings at compile time or with VERY...
This file contains the class definition for the IAthenaPoolCnvSvc interface class.
This file contains the class definition for the Placement class (migrated from POOL).
This file contains the class definition for the TokenAddress class.
This file contains the class definition for the Token class (migrated from POOL).
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
bool compareClassGuid(const Token *token, const Guid &guid) const
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
ServiceHandle< StoreGateSvc > m_detStore
virtual ~AthenaPoolConverter()
Destructor.
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
virtual Placement setPlacementWithType(const std::string &tname, const std::string &key, const std::string &output)
Set POOL placement hint for a given type.
virtual long repSvcType() const override
virtual StatusCode PoolToDataObject(DataObject *&pObj, const Token *token, const std::string &key)=0
Read an object from POOL.
virtual StatusCode DataObjectToPool(IOpaqueAddress *pAddr, DataObject *pObj)=0
Write an object into POOL.
AthenaPoolConverter(const CLID &id, ISvcLocator *pSvcLocator, const char *name=nullptr)
Standard Service Constructor.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddr, DataObject *pObj) override
Create a POOL persistent representation for a transient object.
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Create a transient object from a POOL persistent representation.
virtual StatusCode cleanUp(const std::string &output) override
Implement cleanUp for AthenaPoolConverter to do nothing.
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr) override
Create a POOL persistent representation for a transient object.
static long storageType()
virtual StatusCode finalize() override
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
This class holds all the necessary information to guide the writing of an object in a physical place.
Placement & setContainerName(const std::string &containerName)
Set container name.
Placement & setFileName(const std::string &fileName)
Set file name.
Placement & setTechnology(int technology)
Set technology type.
This class provides a Generic Transient Address for POOL tokens.
This class provides a token that identifies in a unique way objects on the persistent storage.
const std::string & auxString() const
Access auxiliary string.
const Guid & classID() const
Access database identifier.
virtual const std::string toString() const
Retrieve the string representation of the token.
Token & setAuxString(std::string &&auxString)
Set auxiliary string.
static DbType getType(const std::string &name)
Access known storage type object by name.
const char * getEventDataName()
const char * getDataHeaderName()
const char * getEventTagName()
static constexpr const char * DataHeaderTypeName
static constexpr const char * EventTagTypeName
static constexpr const char * DataHeaderFormTypeName
static const DbType POOL_StorageType