| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GiGaCnvUtils.h

Go to the documentation of this file.
00001 // $Id: GiGaCnvUtils.h,v 1.1 2002/01/22 18:24:41 ibelyaev Exp $
00002 // ============================================================================
00003 // CVS tag $Name: v18r6 $ 
00004 // ============================================================================
00005 // $Log: GiGaCnvUtils.h,v $
00006 // Revision 1.1  2002/01/22 18:24:41  ibelyaev
00007 //  Vanya: update for newer versions of Geant4 and Gaudi
00008 // 
00009 // ============================================================================
00010 #ifndef GIGACNV_GIGACNVUTILS_H 
00011 #define GIGACNV_GIGACNVUTILS_H 1
00012 // Include files
00013 // GauidiKernel
00014 #include "GaudiKernel/IRegistry.h"
00015 #include "GaudiKernel/IConversionSvc.h"
00016 #include "GaudiKernel/IOpaqueAddress.h"
00017 #include "GaudiKernel/IDataSelector.h"
00018 #include "GaudiKernel/IDataProviderSvc.h"
00019 #include "GaudiKernel/IDataManagerSvc.h"
00020 #include "GaudiKernel/SmartIF.h"
00021 #include "GaudiKernel/StatusCode.h"
00022 #include "GaudiKernel/DataObject.h"
00023 
00033 namespace  GiGaCnvUtils
00034 {
00035 
00036   enum
00037   {
00038     CNVSVC_IS_NULL = 300 ,
00039     OBJECT_IS_NULL       ,
00040     ADDRESS_IS_NULL      ,
00041     REGISTRY_IS_NULL     ,
00042     SELECTOR_IS_NULL
00043   };
00044   
00056   inline StatusCode createRep 
00057   ( IConversionSvc* cnvsvc , 
00058     DataObject*     object )
00059   {
00060     if( 0 == cnvsvc        ) { return StatusCode ( CNVSVC_IS_NULL   ) ; }
00061     if( 0 == object        ) { return StatusCode ( OBJECT_IS_NULL   ) ; }
00062     IOpaqueAddress* address = 0 ;
00064     StatusCode status = cnvsvc->createRep( object , address ) ;
00066     if( status.isFailure() ) { return status ; }
00067     if( 0 == address       ) { return StatusCode ( ADDRESS_IS_NULL  ) ; }
00069     IRegistry* registry = object->registry() ;
00070     if( 0 == registry      ) { return StatusCode ( REGISTRY_IS_NULL ) ; }
00071     registry->setAddress( address ) ;
00073     return cnvsvc->fillRepRefs( registry->address() , object );
00074   };
00075   
00087   inline StatusCode createReps 
00088   ( IConversionSvc* cnvsvc   , 
00089     IDataSelector*  selector )
00090   {
00091     if( 0 == cnvsvc        ) { return StatusCode ( CNVSVC_IS_NULL   ) ; }
00092     if( 0 == selector      ) { return StatusCode ( SELECTOR_IS_NULL ) ; }
00094     IDataSelector::iterator object;
00095     for( object = selector->begin() ; selector->end() != object ; ++object ) 
00096       {
00097         if( 0 == *object   ) { return StatusCode ( OBJECT_IS_NULL   ) ; }
00098         IOpaqueAddress* address = 0 ;
00100         StatusCode st = cnvsvc->createRep( *object , address ) ;
00102         if( st.isFailure() ) { return st ; }
00103         if( 0 == address   ) { return StatusCode ( ADDRESS_IS_NULL  ) ; }
00105         IRegistry* registry = (*object)->registry() ;
00106         if( 0 == registry  ) { return StatusCode ( REGISTRY_IS_NULL ) ; }
00107         registry->setAddress( address ) ;
00108       }
00110     for( object = selector->begin() ; selector->end() != object ; ++object ) 
00111       {
00112         IRegistry* registry = (*object)->registry();
00113         StatusCode st = cnvsvc->fillRepRefs( registry->address() , *object );
00114         if( st.isFailure() ) { return st ; }
00115       }
00117     return StatusCode::SUCCESS ;
00118   };
00119 
00131   inline  IRegistry* parent
00132   ( const IRegistry* registry , 
00133     IDataManagerSvc* manager  ) 
00134   {
00135     if( 0 == registry || 0 == manager ) { return 0 ; }
00136     IRegistry* reg = 0 ;
00137     StatusCode sc = manager->objectParent( registry , reg );
00138     return sc.isSuccess() ? reg : (IRegistry*) 0 ;
00139   };
00140   
00152   inline  IRegistry*  parent
00153   ( const IRegistry*  registry , 
00154     IDataProviderSvc* provider ) 
00155   {
00156     return 
00157       ( 0 == registry ) ? (IRegistry*) 0 :
00158       ( 0 == provider ) ? (IRegistry*) 0 :
00159       parent( registry , SmartIF<IDataManagerSvc>( provider ) );
00160   };
00161   
00172   inline IRegistry* parent( const IRegistry* registry ) 
00173   {
00174     return 
00175       ( 0 == registry ) ? (IRegistry*) 0 : 
00176       parent( registry  , registry->dataSvc() ) ;  
00177   };
00178   
00179 }; 
00180 
00181 // ============================================================================
00182 // End 
00183 // ============================================================================
00184 #endif // GIGACNV_GIGACNVUTILS_H
00185 // ============================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:03:52 2011 for GiGaCnv by doxygen 1.4.7