24 #include "TInterpreter.h" 25 #include "TBufferFile.h" 30 #define SERIALIZER_END "EOF" 33 struct DataObjectPush {
46 if ( level < m_currentItem->depth() ) {
47 if ( dir->
object() != 0 ) {
48 m_objects.push_back(dir->
object());
60 , m_verifyItems(false)
62 , m_addressCreator(ac)
93 string text(
"WARNING: Cannot retrieve TES object(s) for serialisation: ");
118 DataObjectPush p(pObj);
122 const type_info& objClass =
typeid(*pObj);
132 const char* clName = objClassName.c_str();
134 cl = gROOT->GetClass(clName);
143 cout <<
"WARNING: gROOT->GetClass fails for clname : " 144 << objClassName.c_str() <<
endl;
145 cout <<
"WARNING: Disregarding " << objClassName.c_str()
146 <<
"erasing from object list" <<
endl;
154 buffer.WriteString(loc.
c_str());
155 buffer.WriteString(cl->GetName());
156 cl->Streamer(pObj,buffer);
160 int numLinks = linkMgr->
size();
161 buffer.WriteInt(numLinks);
163 for (
int it = 0; it != numLinks; it++) {
164 const string& link = linkMgr->
link(it)->
path();
165 buffer.WriteString(link.
c_str());
173 const string *
par = iop->
par();
175 long clid = iop->
clID();
176 buffer.WriteLong(svcType);
177 buffer.WriteLong(clid);
178 buffer.WriteString(par->
c_str());
209 StatusCode sc, registerStat, createAddressStat;
212 buffer.SetReadMode();
213 buffer.SetBufferOffset();
215 buffer.ReadInt(nObjects);
216 for (
int i=0; i<nObjects; ++i) {
218 buffer.ReadString(text,
sizeof(text));
220 if (!location.
compare(
"EOF")) {
225 buffer.ReadString(text,
sizeof(text));
226 TClass* cl = gROOT->GetClass(text);
231 cout <<
"TESSerializer WARNING : gROOT->GetClass fails for clname : " << location.
c_str() <<
endl;
238 DataObjectPush push(obj);
239 cl->Streamer(obj, buffer);
246 buffer.ReadInt(nlink);
248 for (
int j = 0; j < nlink; ++j) {
249 buffer.ReadString(text,
sizeof(text));
258 if ( location ==
"/Event" ) {
261 throw GaudiException(
"Cannot set root at location " + location,
"", sc);
271 buffer.ReadInt(flag);
274 buffer.ReadLong(svcType);
276 buffer.ReadLong(clid);
277 buffer.ReadString(text,
sizeof(text));
289 buffer.ReadInt(flag);
297 buffer.ReadLong(svcType);
300 buffer.ReadLong(clid);
301 const CLID classid(clid);
304 cp = buffer.ReadString(text,
sizeof(text));
305 const string opaque(cp);
309 unsigned long ip1(0);
310 unsigned long ip2(0);
316 throw GaudiException(
"Failure in creating OpaqueAddress for reconstructed registry",
"", createAddressStat);
335 size_t sep = descriptor.
rfind(
"#");
336 if (sep > descriptor.
length()) {
338 obj_path = descriptor;
342 obj_path = descriptor.
substr(0,sep);
343 slevel = descriptor.
substr(sep+1);
347 if ( slevel ==
"*" ) {
356 size_t idx = obj_path.
find(
"/",1);
357 while(idx != std::string::npos) {
360 cout <<
"... calling addItem with arg : " << sub_item <<
endl;
363 idx = obj_path.
find(
"/",idx+1);
389 cout <<
"\tItem : " << (*i)->path() <<
endl;
393 cout <<
"\tItem : " << (*i)->path() <<
endl;
401 if ( (*i)->path() ==
path )
return (*i);
404 if ( (*j)->path() ==
path )
return (*j);
const std::string & path() const
Access to path of object.
void checkItems()
print out the contents of m_itemList and m_optItemList (std::cout)
Define general base for Gaudi exception.
virtual const CLID & clID() const =0
Retrieve class information from link.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
void loadBuffer(TBufferFile &)
Rebuild TES from items in a TBufferFile.
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
GAUDI_API void popCurrentDataObject()
bool isSuccess() const
Test for a status code of SUCCESS.
TESSerializer(IDataProviderSvc *svc, IAddressCreator *ac)
Constructor.
IAddressCreator interface definition.
Items m_optItemList
Vector of optional items to be saved to this stream (DataStoreItem ptrs)
bool m_verifyItems
Boolean Flag as used by GaudiSvc/PersistencySvc/OutputStreamer.
long addLink(const std::string &path, const DataObject *pObject) const
Add link by object reference and path.
Generic Transient Address.
Data provider interface definition.
virtual const std::string * par() const =0
Retrieve String parameters.
Description of the DataStoreItem class.
bool isFailure() const
Test for a status code of FAILURE.
IAddressCreator * m_addressCreator
IAddress Creator for Opaque Addresses.
IRegistry * registry() const
Get pointer to Registry.
Items m_itemList
Vector of items to be saved to this stream (DataStoreItem ptrs)
bool m_strict
Boolean Flag used to determine error tolerance.
LinkManager * linkMgr() const
Retrieve Link manager.
const std::string & path() const
Accessor: Retrieve load path.
IDataManagerSvc * m_TESMgr
TES pointer.
virtual StatusCode findObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Find object identified by its directory entry.
bool analyse(IRegistry *dir, int level) override
Analysis callback.
virtual const id_type & identifier() const =0
Full identifier (or key)
void dumpBuffer(TBufferFile &)
Dump TES contents listed in m_itemList/m_optItemList to a TBufferFile.
This class is used for returning status codes from appropriate routines.
const unsigned long * ipar() const override
Retrieve integer parameters.
const std::string * par() const override
Retrieve string parameters.
Link * link(long id)
Retrieve symbolic link identified by ID.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual long svcType() const =0
Retrieve service type.
void addItem(const std::string &path)
add an item to the TESSerializer's list (#notation)
unsigned int CLID
Class ID definition.
GAUDI_API void pushCurrentDataObject(DataObject **pobjAddr)
long svcType() const override
Access : retrieve the storage type of the class id.
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
virtual DataObject * object() const =0
Retrieve object behind the link.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
Objects m_objects
Selected list of Objects to be serialized (DataObject ptrs)
void addOptItem(const std::string &path)
add an item to the TESSerializer's optional list (#notation)
DataStoreItem * findItem(const std::string &path)
Find single item identified by its path (exact match)
Opaque address interface definition.
virtual StatusCode registerObject(const std::string &fullPath, DataObject *pObject)=0
Register object with the data store.
DataStoreItem * m_currentItem
Current item while traversing the TES tree.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
const CLID & clID() const override
Access : Retrieve class ID of the link.
virtual StatusCode traverseSubTree(const std::string &sub_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name...
A DataObject is the base class of any identifiable object on any data store.
A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of no...
IDataProviderSvc * m_TES
TES pointer.
long size() const
Retrieve number of link present.
std::map< std::string, TClass * > m_classMap
Map of gROOT class information.
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.