The Gaudi Framework  v41r0 (bdbe7744)
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 516 of file Bindings.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 517 of file Bindings.py.

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

Member Function Documentation

◆ __delitem__()

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

Definition at line 611 of file Bindings.py.

611 def __delitem__(self, path):
612 if not self._idp:
613 raise IndexError(
614 "C++ service {} does not exist".format(self.__dict__["_name"])
615 )
616 return self.unregisterObject(path)
617
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition MsgStream.cpp:93

◆ __getitem__()

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

Definition at line 597 of file Bindings.py.

597 def __getitem__(self, path):
598 if not self._idp:
599 raise IndexError(
600 "C++ service {} does not exist".format(self.__dict__["_name"])
601 )
602 return Helper.dataobject(self._idp, path)
603

◆ __setitem__()

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

Definition at line 604 of file Bindings.py.

604 def __setitem__(self, path, obj):
605 if not self._idp:
606 raise IndexError(
607 "C++ service {} does not exist".format(self.__dict__["_name"])
608 )
609 return self.registerObject(path, obj)
610

◆ clearStore()

GaudiPython.Bindings.iDataSvc.clearStore ( self)

Definition at line 703 of file Bindings.py.

703 def clearStore(self):
704 if not self._idm:
705 raise IndexError(
706 "C++ service {} does not exist".format(self.__dict__["_name"])
707 )
708 return self._idm.clearStore()
709
710
711# ----iHistogramSvc class------------------------------------------------------

◆ dump()

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

Definition at line 627 of file Bindings.py.

627 def dump(self, node=cppyy.nullptr):
628 if node == cppyy.nullptr:
629 root = self.retrieveObject("")
630 if root:
631 node = root.registry()
632 else:
633 return
634 print(node.identifier())
635 if node.object():
636 for l in self.leaves(node):
637 self.dump(l)
638

◆ 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 548 of file Bindings.py.

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

◆ getHistoNames()

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

Definition at line 658 of file Bindings.py.

658 def getHistoNames(self, node=cppyy.nullptr, lst=[]):
659 if node == cppyy.nullptr:
660 root = self.retrieveObject("")
661 if root:
662 node = root.registry()
663 # rootFID = node.address().par()
664 lst = []
665 else:
666 return
667 Helper.dataobject(self._idp, node.identifier())
668 if node.object():
669 lst.append(node.identifier())
670 for l in self.leaves(node):
671 if l.name(): # and l.address().par() == rootFID :
672 self.getHistoNames(l, lst)
673 else:
674 continue
675 return lst
676

◆ getList()

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

Definition at line 639 of file Bindings.py.

639 def getList(self, node=cppyy.nullptr, lst=[], rootFID=None):
640 if node == cppyy.nullptr:
641 root = self.retrieveObject("")
642 if root:
643 node = root.registry()
644 rootFID = node.address().par()
645 lst = []
646 else:
647 return
648 Helper.dataobject(self._idp, node.identifier())
649 if node.object():
650 lst.append(node.identifier())
651 for l in self.leaves(node):
652 if l.address() and l.address().par() == rootFID:
653 self.getList(l, lst, rootFID)
654 else:
655 continue
656 return lst
657

◆ 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(
593 "C++ service {} does not exist".format(self.__dict__["_name"])
594 )
595 return Helper.getobject(self._idp, path, *args)
596

◆ leaves()

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

Definition at line 618 of file Bindings.py.

618 def leaves(self, node=cppyy.nullptr):
619 if node == cppyy.nullptr:
620 node = self.retrieveObject("")
621 ll = gbl.std.vector("IRegistry*")()
622 if isinstance(node, str):
623 _ = self.retrieveObject(node)
624 if self._idm.objectLeaves(node, ll).isSuccess():
625 return ll
626

◆ registerObject()

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

Definition at line 527 of file Bindings.py.

527 def registerObject(self, path, obj):
528 if not self._idp:
529 raise AttributeError(
530 "C++ service {} does not exist".format(self.__dict__["_name"])
531 )
532 return Helper.registerObject(self._idp, path, obj)
533

◆ retrieveObject()

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

Definition at line 541 of file Bindings.py.

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

◆ selectOnlyStore()

GaudiPython.Bindings.iDataSvc.selectOnlyStore ( self)

Definition at line 684 of file Bindings.py.

684 def selectOnlyStore(self):
685 # nothing to do if GaudiHive is not used
686 if not self._ihwb:
687 return
688 # check we have a single store raise an error if it' not the case
689 if self._ihwb.getNumberOfStores() > 1:
690 raise IndexError(
691 "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"
692 )
693 # select the only store
694 self.selectStore(0)
695

◆ selectStore()

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

Definition at line 696 of file Bindings.py.

696 def selectStore(self, n):
697 if not self._ihwb:
698 raise IndexError(
699 "C++ service {} does not exist".format(self.__dict__["_name"])
700 )
701 return self._ihwb.selectStore(n)
702

◆ setRoot()

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

Definition at line 677 of file Bindings.py.

677 def setRoot(self, name, obj):
678 if not self._idm:
679 raise IndexError(
680 "C++ service {} does not exist".format(self.__dict__["_name"])
681 )
682 return self._idm.setRoot(name, obj)
683

◆ unregisterObject()

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

Definition at line 534 of file Bindings.py.

534 def unregisterObject(self, path):
535 if not self._idp:
536 raise AttributeError(
537 "C++ service {} does not exist".format(self.__dict__["_name"])
538 )
539 return Helper.unregisterObject(self._idp, path)
540

Member Data Documentation

◆ _idm

GaudiPython.Bindings.iDataSvc._idm
protected

Definition at line 678 of file Bindings.py.

◆ _idp

GaudiPython.Bindings.iDataSvc._idp
protected

Definition at line 528 of file Bindings.py.

◆ _ihwb

GaudiPython.Bindings.iDataSvc._ihwb
protected

Definition at line 686 of file Bindings.py.


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