14#include "GaudiKernel/DataHandle.h"
15#include "GaudiKernel/ToStream.h"
23#include <boost/tokenizer.hpp>
49 const std::string& sgkey,
50 Gaudi::DataHandle::Mode
a,
51 const std::string& storeName ,
53 : Gaudi::DataHandle (DataObjID (clid, sgkey), isCond,
a),
54 m_storeHandle (storeName,
"VarHandleKey")
56 parseKey (sgkey, storeName);
101 std::cerr <<
"VarHandleKey::assign failure: " << e.what() << std::endl;
102 return StatusCode::FAILURE;
104 return StatusCode::FAILURE;
110 return StatusCode::SUCCESS;
125 Gaudi::DataHandle::updateKey (
"" );
128 return StatusCode::SUCCESS;
134 <<
"Cannot initialize a Read/Write/Update handle with a null key.";
135 return StatusCode::FAILURE;
143 return StatusCode::FAILURE;
154 if (base_clid != this_clid) {
160 return StatusCode::SUCCESS;
176 return StatusCode::SUCCESS;
187 return Gaudi::DataHandle::fullKey().clid();
226 const std::string& storeName)
230 std::string::size_type
sp = storeName.find(
'/');
231 if (
sp == std::string::npos) {
234 sn = storeName.substr(
sp+1,storeName.length()-
sp+1);
239 Gaudi::DataHandle::updateKey(
"");
247 if(
sp == std::string::npos) {
250 sn =
key.substr(0,
sp);
266 if (
m_sgKey.find(
'/') != std::string::npos) {
267 throw SG::ExcBadHandleKey(
"key \"" +
key
268 +
"\": keys with \"/\" only allowed for "
275 if (
sp != std::string::npos) {
282 throw SG::ExcBadHandleKey(
"key \"" +
key
283 +
"\": must not end with a \"/\"");
289 Gaudi::DataHandle::updateKey(
"");
319 const std::string& className = fullKey().className().empty() ?
320 Gaudi::DataHandle::default_type : fullKey().className();
322 std::ostringstream ost;
323 ost <<
"DataHandle(";
327 case Gaudi::DataHandle::Writer:
344 s <<
"'" << m.objKey() <<
"'";
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).
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.
ostream & operator<<(ostream &s, const SG::VarHandleKey &m)