37 StringProperty defContainerType(
"DefaultContainerType",
"ROOTTREEINDEX");
38 if(IProperty* propertyServer =
dynamic_cast<IProperty*
>(
m_poolSvc.get())) {
39 propertyServer->getProperty(&defContainerType).ignore();
43 return StatusCode::SUCCESS;
51 return(::Converter::finalize());
61 bool ownTokAddr =
false;
62 if (tokAddr ==
nullptr || tokAddr->
getToken() ==
nullptr) {
64 auto token = std::make_unique<Token>();
65 token->fromString(*(pAddr->par()));
66 GenericAddress* genAddr =
dynamic_cast<GenericAddress*
>(pAddr);
68 ATH_MSG_ERROR(
"Dynamic cast failed in AthenaPoolConverter::createObj");
70 return StatusCode::FAILURE;
76 const std::string contextStr = std::format(
"[CTXT={:08X}]",
static_cast<int>(*(pAddr->ipar())));
77 std::strncpy(text, contextStr.c_str(),
sizeof(text) - 1);
78 text[
sizeof(text) - 1] =
'\0';
85 std::string key = pAddr->par()[1];
90 }
catch (std::exception& e) {
94 if (pObj ==
nullptr) {
98 delete tokAddr; tokAddr =
nullptr;
100 if (pObj ==
nullptr) {
101 return StatusCode::FAILURE;
103 return StatusCode::SUCCESS;
108 if (proxy ==
nullptr) {
109 ATH_MSG_ERROR(
"AthenaPoolConverter CreateRep failed to cast DataProxy, key = " << pObj->name());
110 return StatusCode::FAILURE;
116 return StatusCode::FAILURE;
118 }
catch (std::exception& e) {
120 return StatusCode::FAILURE;
123 if (pAddr ==
nullptr) {
125 pAddr =
new TokenAddress(this->
storageType(), clid,
"",
"", 0, 0);
127 GenericAddress* gAddr =
dynamic_cast<GenericAddress*
>(pAddr);
128 if (gAddr !=
nullptr) {
132 return StatusCode::SUCCESS;
140 return StatusCode::FAILURE;
142 }
catch (std::exception& e) {
143 ATH_MSG_ERROR(
"fillRepRefs - caught exception: " << e.what());
144 return StatusCode::FAILURE;
146 return StatusCode::SUCCESS;
156 ::
AthMessaging((pSvcLocator != nullptr ? msgSvc() : nullptr),
157 name ? name :
"AthenaPoolConverter"),
158 m_detStore(
"DetectorStore", name ? name :
"AthenaPoolConverter"),
159 m_athenaPoolCnvSvc(pSvcLocator && pSvcLocator->existsService(
"AthenaPoolSharedIOCnvSvc") ?
"AthenaPoolSharedIOCnvSvc" :
"AthenaPoolCnvSvc", name ? name :
"AthenaPoolConverter"),
160 m_poolSvc(
"PoolSvc", name ? name :
"AthenaPoolConverter"),
172 std::string::size_type pos1 = output.find(
'[');
173 std::string outputConnectionSpec = output.substr(0, pos1);
179 std::string containerName{
""};
180 std::string containerNameHint{
""};
181 std::string branchNameHint{
""};
182 std::string containerFriendPostfix{
""};
183 while (pos1 != std::string::npos) {
184 const std::string::size_type pos2 = output.find(
'=', pos1);
185 const std::string thisKey = output.substr(pos1 + 1, pos2 - pos1 - 1);
186 const std::string::size_type pos3 = output.find(
']', pos2);
187 const std::string value = output.substr(pos2 + 1, pos3 - pos2 - 1);
188 if (thisKey ==
"OutputCollection") {
189 dhContainerPrefix = std::move(value);
190 }
else if (thisKey ==
"PoolContainerPrefix") {
191 containerPrefix = std::move(value);
192 }
else if (thisKey ==
"TopLevelContainerName") {
193 containerNameHint = std::move(value);
194 }
else if (thisKey ==
"SubLevelBranchName") {
195 branchNameHint = std::move(value);
196 }
else if (thisKey ==
"PoolContainerFriendPostfix") {
197 containerFriendPostfix = std::move(value);
199 pos1 = output.find(
'[', pos3);
204 if (
auto colonPost = containerPrefix.find(
':'); colonPost != std::string::npos) {
206 containerPrefix.erase(0, colonPost + 1);
211 containerName = std::format(
"{}{}({}{})",
214 key.back() ==
'/' ? key :
"",
219 containerName = std::format(
"{}({})",
225 constexpr std::string_view typeTok =
"<type>", keyTok =
"<key>";
226 containerName = std::format(
"{}{}{}{}",
228 containerFriendPostfix,
230 branchNameHint.empty() ?
"" : std::format(
"({})", branchNameHint));
231 if (
auto pos = containerName.find(typeTok); pos != std::string::npos) {
232 containerName.replace(pos, typeTok.size(), tname);
234 if (
auto pos = containerName.find(keyTok); pos != std::string::npos) {
235 containerName.replace(pos, keyTok.size(), key.empty() ? tname : key);
246 return(token ? (guid == token->
classID()) :
false);
250 ATH_MSG_DEBUG(
"AthenaPoolConverter cleanUp called for base class.");
251 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).
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
int m_defContainerType
Default container type (from PoolSvc)
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.
virtual StatusCode DataObjectToPers(DataObject *pObj, IOpaqueAddress *&pAddr)=0
Convert an object into Persistent.
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.
ServiceHandle< IPoolSvc > m_poolSvc
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.
Token & setAuxString(const std::string &auxString)
Set auxiliary string.
const Guid & classID() const
Access database identifier.
virtual const std::string toString() const
Retrieve the string representation of the token.
int type() const
Access to full type.
static DbType getType(const std::string &name)
Access known storage type object by name.
const char * getEventTagName()
static constexpr const char * DataHeaderTypeName
static constexpr const char * EventTagTypeName
const char * getEventDataName()
const char * getDataHeaderName()
static constexpr const char * DataHeaderFormTypeName
static const DbType POOL_StorageType