12#include "GaudiKernel/DataHandle.h"
13#include "GaudiKernel/ToStream.h"
46 const std::string& sgkey,
47 Gaudi::DataHandle::Mode
a,
48 const std::string& storeName ,
50 : Gaudi::DataHandle (DataObjID (clid, sgkey), isCond,
a),
51 m_storeHandle (storeName,
"VarHandleKey")
53 parseKey (sgkey, storeName);
98 std::println (std::cerr,
"VarHandleKey::assign failure: {}", e.what());
99 return StatusCode::FAILURE;
101 return StatusCode::FAILURE;
107 return StatusCode::SUCCESS;
122 Gaudi::DataHandle::updateKey (
"" );
125 return StatusCode::SUCCESS;
131 <<
"Cannot initialize a Read/Write/Update handle with a null key.";
132 return StatusCode::FAILURE;
140 return StatusCode::FAILURE;
151 if (base_clid != this_clid) {
156 if (copy_clid != this_clid) {
162 return StatusCode::SUCCESS;
178 return StatusCode::SUCCESS;
189 return Gaudi::DataHandle::fullKey().clid();
228 const std::string& storeName)
232 std::string::size_type
sp = storeName.find(
'/');
233 if (
sp == std::string::npos) {
236 sn = storeName.substr(
sp+1,storeName.length()-
sp+1);
241 Gaudi::DataHandle::updateKey(
"");
249 if(
sp == std::string::npos) {
252 sn =
key.substr(0,
sp);
268 if (
m_sgKey.find(
'/') != std::string::npos) {
269 throw SG::ExcBadHandleKey(
"key \"" +
key
270 +
"\": keys with \"/\" only allowed for "
277 if (
sp != std::string::npos) {
284 throw SG::ExcBadHandleKey(
"key \"" +
key
285 +
"\": must not end with a \"/\"");
291 Gaudi::DataHandle::updateKey(
"");
321 const std::string& className = fullKey().className().empty() ?
322 Gaudi::DataHandle::default_type : fullKey().className();
324 std::ostringstream ost;
325 std::print (ost,
"DataHandle(");;
327 std::print (ost,
",");
329 case Gaudi::DataHandle::Writer:
334 std::print (ost,
",");
336 std::print (ost,
",");
338 std::print (ost,
")");
345 std::print (s,
"{}", m);
Helpers for checking error return status codes and reporting errors.
#define REPORT_ERROR(SC)
Report an error.
Exceptions that can be thrown from StoreGate.
uint32_t CLID
The Class ID type.
A property holding a SG store/key/clid from which a VarHandle is made.
constexpr char const storeSeparator
The non-template portion of the BaseInfo implementation.
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
std::vector< CLID > get_copy_conversions() const
Return known copy conversions.
Exception — Bad key format for VarHandleKey.
Exception — Forbidden method called.
A property holding a SG store/key/clid from which a VarHandle is made.
virtual void setKey(DataObjID key) override final
Don't allow calling these.
virtual void updateKey(std::string key) override final
Prevent this method from being called.
virtual std::string pythonRepr() const override
Python representation of Handle.
void parseKey(const std::string &sgkey, const std::string &storeName)
Handle assignment/construction from a string key.
VarHandleKey & operator=(const std::string &sgkey)
Change the key of the object to which we're referring.
SG::sgkey_t m_hashedKey
The hashed StoreGate key. May be 0 if not yet initialized.
CLID clid() const
Return the class ID for the referenced object.
ServiceHandle< IProxyDict > m_storeHandle
Handle to the referenced store.
const std::string & key() const
Return the StoreGate ID for the referenced object.
virtual StatusCode assign(const std::string &sgkey)
Change the key of the object to which we're referring.
std::string m_sgKey
StoreGate key, that doesn't include the storename.
bool m_isEventStore
Cache test for whether we're referencing the event store.
VarHandleKey(CLID clid, const std::string &sgkey, Gaudi::DataHandle::Mode a, const std::string &storeName=StoreID::storeName(StoreID::EVENT_STORE), bool isCond=false)
Constructor.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
bool empty() const
Test if the key is blank.
void updateHandle(const std::string &name)
Update the name of the store to which we're referring.
static const std::string & storeName(const StoreID::type &s)
static StoreID::type findStoreID(const std::string &storeName)
holding In fact this class is here in order to allow STL container for all features This class is sho...
singleton-like access to IMessageSvc via open function and helper
::StatusCode StatusCode
StatusCode definition for legacy code.
std::ostream & toStream(const SG::VarHandleKeyArray &v, std::ostream &o)
Gaudi function used to convert a property to a string.
std::ostream & operator<<(std::ostream &os, const ArenaAllocatorBase::Stats::Stat &stat)
Format a statistic structure.