The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
GaudiPython.Bindings.iDataSvc Class Reference
Inheritance diagram for GaudiPython.Bindings.iDataSvc:
Collaboration diagram for GaudiPython.Bindings.iDataSvc:

Public Member Functions

 __init__ (self, name, idp)
 
 registerObject (self, path, obj)
 
 unregisterObject (self, path)
 
 retrieveObject (self, path)
 
 findObject (self, path)
 
 getObject (self, path, *args)
 
 __getitem__ (self, path)
 
 __setitem__ (self, path, obj)
 
 __delitem__ (self, path)
 
 leaves (self, node=cppyy.nullptr)
 
 dump (self, node=cppyy.nullptr)
 
 getList (self, node=cppyy.nullptr, lst=[], rootFID=None)
 
 getHistoNames (self, node=cppyy.nullptr, lst=[])
 
 setRoot (self, name, obj)
 
 selectOnlyStore (self)
 
 selectStore (self, n)
 
 clearStore (self)
 
- Public Member Functions inherited from GaudiPython.Bindings.iService
 __init__ (self, name, isvc=cppyy.nullptr)
 
 retrieveInterface (self)
 
 initialize (self)
 
 start (self)
 
 stop (self)
 
 finalize (self)
 
 reinitialize (self)
 
 restart (self)
 
 isValid (self)
 
- Public Member Functions inherited from GaudiPython.Bindings.iProperty
 __init__ (self, name, ip=cppyy.nullptr)
 
 getInterface (self)
 
 __call_interface_method__ (self, ifname, method, *args)
 
 __setattr__ (self, name, value)
 
 __getattr__ (self, name)
 
 properties (self)
 
 name (self)
 

Protected Attributes

 _idp
 
 _idm
 
 _ihwb
 
- Protected Attributes inherited from GaudiPython.Bindings.iService
 _isvc
 
- Protected Attributes inherited from GaudiPython.Bindings.iProperty
 _ip
 
 _svcloc
 
 _name
 

Detailed Description

Definition at line 518 of file Bindings.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiPython.Bindings.iDataSvc.__init__ ( self,
name,
idp )

Definition at line 519 of file Bindings.py.

519 def __init__(self, name, idp):
520 iService.__init__(self, name, idp)
521 self.__dict__["_idp"] = InterfaceCast(gbl.IDataProviderSvc)(idp)
522 self.__dict__["_idm"] = InterfaceCast(gbl.IDataManagerSvc)(idp)
523 # do not use InterfaceCast as it prints an error on failure
524 self.__dict__["_ihwb"] = None
525 ip = makeNullPointer(gbl.IHiveWhiteBoard)
526 if idp.queryInterface(gbl.IHiveWhiteBoard.interfaceID(), ip).isSuccess():
527 self.__dict__["_ihwb"] = ip
528

Member Function Documentation

◆ __delitem__()

GaudiPython.Bindings.iDataSvc.__delitem__ ( self,
path )

Definition at line 605 of file Bindings.py.

605 def __delitem__(self, path):
606 if not self._idp:
607 raise IndexError("C++ service %s does not exist" % self.__dict__["_name"])
608 return self.unregisterObject(path)
609

◆ __getitem__()

GaudiPython.Bindings.iDataSvc.__getitem__ ( self,
path )

Definition at line 595 of file Bindings.py.

595 def __getitem__(self, path):
596 if not self._idp:
597 raise IndexError("C++ service %s does not exist" % self.__dict__["_name"])
598 return Helper.dataobject(self._idp, path)
599

◆ __setitem__()

GaudiPython.Bindings.iDataSvc.__setitem__ ( self,
path,
obj )

Definition at line 600 of file Bindings.py.

600 def __setitem__(self, path, obj):
601 if not self._idp:
602 raise IndexError("C++ service %s does not exist" % self.__dict__["_name"])
603 return self.registerObject(path, obj)
604

◆ clearStore()

GaudiPython.Bindings.iDataSvc.clearStore ( self)

Definition at line 691 of file Bindings.py.

691 def clearStore(self):
692 if not self._idm:
693 raise IndexError("C++ service %s does not exist" % self.__dict__["_name"])
694 return self._idm.clearStore()
695
696
697# ----iHistogramSvc class------------------------------------------------------

◆ dump()

GaudiPython.Bindings.iDataSvc.dump ( self,
node = cppyy.nullptr )

Definition at line 619 of file Bindings.py.

619 def dump(self, node=cppyy.nullptr):
620 if node == cppyy.nullptr:
621 root = self.retrieveObject("")
622 if root:
623 node = root.registry()
624 else:
625 return
626 print(node.identifier())
627 if node.object():
628 for l in self.leaves(node):
629 self.dump(l)
630

◆ findObject()

GaudiPython.Bindings.iDataSvc.findObject ( self,
path )
Get the existing object in TransientStore for the given location

- loading of object from persistency is NOT triggered
- 'data-on-demand' action is NOT triggered

>>> svc  =  ...                     ## get the service
>>> path =  ...                     ## get the path in Transient Store
>>> data = svc.findObject ( path )  ## use the method

Definition at line 550 of file Bindings.py.

550 def findObject(self, path):
551 """
552
553 Get the existing object in TransientStore for the given location
554
555 - loading of object from persistency is NOT triggered
556 - 'data-on-demand' action is NOT triggered
557
558 >>> svc = ... ## get the service
559 >>> path = ... ## get the path in Transient Store
560 >>> data = svc.findObject ( path ) ## use the method
561
562 """
563 if not self._idp:
564 raise IndexError("C++ service %s does not exist" % self.__dict__["_name"])
565 return Helper.findobject(self._idp, path)
566

◆ getHistoNames()

GaudiPython.Bindings.iDataSvc.getHistoNames ( self,
node = cppyy.nullptr,
lst = [] )

Definition at line 650 of file Bindings.py.

650 def getHistoNames(self, node=cppyy.nullptr, lst=[]):
651 if node == cppyy.nullptr:
652 root = self.retrieveObject("")
653 if root:
654 node = root.registry()
655 # rootFID = node.address().par()
656 lst = []
657 else:
658 return
659 Helper.dataobject(self._idp, node.identifier())
660 if node.object():
661 lst.append(node.identifier())
662 for l in self.leaves(node):
663 if l.name(): # and l.address().par() == rootFID :
664 self.getHistoNames(l, lst)
665 else:
666 continue
667 return lst
668

◆ getList()

GaudiPython.Bindings.iDataSvc.getList ( self,
node = cppyy.nullptr,
lst = [],
rootFID = None )

Definition at line 631 of file Bindings.py.

631 def getList(self, node=cppyy.nullptr, lst=[], rootFID=None):
632 if node == cppyy.nullptr:
633 root = self.retrieveObject("")
634 if root:
635 node = root.registry()
636 rootFID = node.address().par()
637 lst = []
638 else:
639 return
640 Helper.dataobject(self._idp, node.identifier())
641 if node.object():
642 lst.append(node.identifier())
643 for l in self.leaves(node):
644 if l.address() and l.address().par() == rootFID:
645 self.getList(l, lst, rootFID)
646 else:
647 continue
648 return lst
649

◆ getObject()

GaudiPython.Bindings.iDataSvc.getObject ( self,
path,
* args )
Get object from Transient Store  for the given location

arguments :
- path                           : Location of object in Transient Store
- retrieve          (bool) True  : retrieve versus find
- disable on-demand (bool) False : temporary disable 'on-demand' actions

>>> svc  = ...   ## get the service
>>> path = ...   ## get the path

>>> data = svc.getObject ( path , False )  ## find object in Transient Store

## find object in Transient Store
#  load form tape or use 'on-demand' action  for missing objects :
>>> data = svc.getObject ( path , True  )

## find object in Transient Store
#  load from tape or for missing objects, disable 'on-demand'-actions
>>> data = svc.getObject ( path , True  , True )

Definition at line 568 of file Bindings.py.

568 def getObject(self, path, *args):
569 """
570 Get object from Transient Store for the given location
571
572 arguments :
573 - path : Location of object in Transient Store
574 - retrieve (bool) True : retrieve versus find
575 - disable on-demand (bool) False : temporary disable 'on-demand' actions
576
577 >>> svc = ... ## get the service
578 >>> path = ... ## get the path
579
580 >>> data = svc.getObject ( path , False ) ## find object in Transient Store
581
582 ## find object in Transient Store
583 # load form tape or use 'on-demand' action for missing objects :
584 >>> data = svc.getObject ( path , True )
585
586 ## find object in Transient Store
587 # load from tape or for missing objects, disable 'on-demand'-actions
588 >>> data = svc.getObject ( path , True , True )
589
590 """
591 if not self._idp:
592 raise IndexError("C++ service %s does not exist" % self.__dict__["_name"])
593 return Helper.getobject(self._idp, path, *args)
594

◆ leaves()

GaudiPython.Bindings.iDataSvc.leaves ( self,
node = cppyy.nullptr )

Definition at line 610 of file Bindings.py.

610 def leaves(self, node=cppyy.nullptr):
611 if node == cppyy.nullptr:
612 node = self.retrieveObject("")
613 ll = gbl.std.vector("IRegistry*")()
614 if isinstance(node, str):
615 _ = self.retrieveObject(node)
616 if self._idm.objectLeaves(node, ll).isSuccess():
617 return ll
618

◆ registerObject()

GaudiPython.Bindings.iDataSvc.registerObject ( self,
path,
obj )

Definition at line 529 of file Bindings.py.

529 def registerObject(self, path, obj):
530 if not self._idp:
531 raise AttributeError(
532 "C++ service %s does not exist" % self.__dict__["_name"]
533 )
534 return Helper.registerObject(self._idp, path, obj)
535

◆ retrieveObject()

GaudiPython.Bindings.iDataSvc.retrieveObject ( self,
path )

Definition at line 543 of file Bindings.py.

543 def retrieveObject(self, path):
544 if not self._idp:
545 return cppyy.nullptr
546 return Helper.dataobject(self._idp, path)
547

◆ selectOnlyStore()

GaudiPython.Bindings.iDataSvc.selectOnlyStore ( self)

Definition at line 674 of file Bindings.py.

674 def selectOnlyStore(self):
675 # nothing to do if GaudiHive is not used
676 if not self._ihwb:
677 return
678 # check we have a single store raise an error if it' not the case
679 if self._ihwb.getNumberOfStores() > 1:
680 raise IndexError(
681 "Several stores available in Gaudihive mode, unable to figure out which one to use.\nPlease call selectStore instead of selectSingleStore\nIf you're only using GaudiPython, make sure you configure a single thread"
682 )
683 # select the only store
684 self.selectStore(0)
685

◆ selectStore()

GaudiPython.Bindings.iDataSvc.selectStore ( self,
n )

Definition at line 686 of file Bindings.py.

686 def selectStore(self, n):
687 if not self._ihwb:
688 raise IndexError("C++ service %s does not exist" % self.__dict__["_name"])
689 return self._ihwb.selectStore(n)
690

◆ setRoot()

GaudiPython.Bindings.iDataSvc.setRoot ( self,
name,
obj )

Definition at line 669 of file Bindings.py.

669 def setRoot(self, name, obj):
670 if not self._idm:
671 raise IndexError("C++ service %s does not exist" % self.__dict__["_name"])
672 return self._idm.setRoot(name, obj)
673

◆ unregisterObject()

GaudiPython.Bindings.iDataSvc.unregisterObject ( self,
path )

Definition at line 536 of file Bindings.py.

536 def unregisterObject(self, path):
537 if not self._idp:
538 raise AttributeError(
539 "C++ service %s does not exist" % self.__dict__["_name"]
540 )
541 return Helper.unregisterObject(self._idp, path)
542

Member Data Documentation

◆ _idm

GaudiPython.Bindings.iDataSvc._idm
protected

Definition at line 670 of file Bindings.py.

◆ _idp

GaudiPython.Bindings.iDataSvc._idp
protected

Definition at line 530 of file Bindings.py.

◆ _ihwb

GaudiPython.Bindings.iDataSvc._ihwb
protected

Definition at line 676 of file Bindings.py.


The documentation for this class was generated from the following file: