| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

# Property.cpp

Go to the documentation of this file.

    00001 // $Id: Property.cpp,v 1.24 2007/09/25 10:31:43 marcocle Exp $
    00002 // ============================================================================
    00003 // CVS tag $Name:  $, verison $Revision: 1.24 $
    00004 // ============================================================================
    00005 // Include files
    00006 // ============================================================================
    00007 // STD & STL
    00008 // ============================================================================
    00009 #include <iostream>
    00010 #include <stdexcept>
    00011 #include <vector>
    00012 #include <string>
    00013 #include <utility>
    00014 #include <map>
    00015 #include <algorithm>
    00016 #include <functional>
    00017 // ============================================================================
    00018 // GaudiKernel
    00019 // ============================================================================
    00020 #include "GaudiKernel/IProperty.h"
    00021 #include "GaudiKernel/SmartIF.h"
    00022 #include "GaudiKernel/Property.h"
    00023 #include "GaudiKernel/PropertyCallbackFunctor.h"
    00024 #include "GaudiKernel/GaudiHandle.h"
    00025 // ============================================================================
    00026 // Boost
    00027 // ============================================================================
    00028 #include "boost/algorithm/string/case_conv.hpp"
    00029 // ============================================================================
    00035 // ============================================================================
    00036 // The output operator for friendly printout
    00037 // ============================================================================
    00038 std::ostream& operator<<( std::ostream&   stream ,
    00039                           const Property& prop   )
    00040 { return prop.fillStream ( stream ) ; }
    00041 // ============================================================================
    00042 /*  constructor from the property name and the type
    00043  *  @param name proeprty name
    00044  *  @param type property C++/RTTI type
    00045  */
    00046 // ============================================================================
    00047 Property::Property
    00048 ( const std::type_info&  type ,
    00049   const std::string&     name )
    00050   : m_name            (  name )
    00051   , m_documentation   ( name )
    00052   , m_typeinfo        ( &type )
    00053   , m_readCallBack    (  0  )
    00054   , m_updateCallBack  (  0  )
    00055 {}
    00056 // ============================================================================
    00057 /*  constructor from the property name and the type
    00058  *  @param type property C++/RTTI type
    00059  *  @param name proeprty name
    00060  */
    00061 // ============================================================================
    00062 Property::Property
    00063 ( const std::string&     name ,
    00064   const std::type_info&  type )
    00065   : m_name            (  name )
    00066   , m_documentation   ( name )
    00067   , m_typeinfo        ( &type )
    00068   , m_readCallBack    (  0  )
    00069   , m_updateCallBack  (  0  )
    00070 {}
    00071 // ============================================================================
    00072 // copy contructor
    00073 // ============================================================================
    00074 Property::Property
    00075 ( const Property& right )
    00076   : m_name     ( right.m_name     )
    00077   , m_documentation ( right.m_documentation )
    00078   , m_typeinfo ( right.m_typeinfo )
    00079   , m_readCallBack   ( 0 )
    00080   , m_updateCallBack ( 0 )
    00081 {
    00082   if ( 0 != right.m_readCallBack   )
    00083   { m_readCallBack   = right.m_readCallBack   -> clone () ; }
    00084   if ( 0 != right.m_updateCallBack )
    00085   { m_updateCallBack = right.m_updateCallBack -> clone () ; }
    00086 }
    00087 // ============================================================================
    00088 // Assignement
    00089 // ============================================================================
    00090 Property& Property::operator=( const Property& right )
    00091 {
    00092   if ( &right == this ) { return *this ; }
    00093   //
    00094   m_name     = right.m_name ;
    00095   m_documentation = right.m_documentation ;
    00096   m_typeinfo = right.m_typeinfo ;
    00097   //
    00098   if ( 0 !=       m_readCallBack   )
    00099   { delete m_readCallBack   ; m_readCallBack   = 0 ; }
    00100   if ( 0 !=       m_updateCallBack )
    00101   { delete m_updateCallBack ; m_updateCallBack = 0 ; }
    00102   if ( 0 != right.m_readCallBack   )
    00103   { m_readCallBack   = right.m_readCallBack   -> clone () ; }
    00104   if ( 0 != right.m_updateCallBack )
    00105   { m_updateCallBack = right.m_updateCallBack -> clone () ; }
    00106   //
    00107   return *this ;
    00108 }
    00109 // ============================================================================
    00110 // virtual destructor
    00111 // ============================================================================
    00112 Property::~Property()
    00113 {
    00114   if ( 0 != m_readCallBack   )
    00115   { delete m_readCallBack    ; m_readCallBack    = 0 ; }
    00116   if ( 0 != m_updateCallBack )
    00117   { delete m_updateCallBack  ; m_updateCallBack  = 0 ; }
    00118 }
    00119 // ============================================================================
    00120 // Call-back functor at reading: the functor is ownered by property!
    00121 // ============================================================================
    00122 const PropertyCallbackFunctor* Property::readCallBack   () const
    00123 { return m_readCallBack ; }
    00124 // ============================================================================
    00125 // Call-back functor for update: the funtor is ownered by property!
    00126 // ============================================================================
    00127 const PropertyCallbackFunctor* Property::updateCallBack () const
    00128 { return m_updateCallBack ; }
    00129 // ============================================================================
    00130 // set new callback for reading
    00131 // ============================================================================
    00132 void  Property::declareReadHandler   ( PropertyCallbackFunctor* pf )
    00133 {
    00134   if ( 0 != m_readCallBack   )
    00135   { delete m_readCallBack    ; m_readCallBack    = 0 ; }
    00136   m_readCallBack = pf ;
    00137 }
    00138 // ============================================================================
    00139 // set new callback for update
    00140 // ============================================================================
    00141 void  Property::declareUpdateHandler ( PropertyCallbackFunctor* pf )
    00142 {
    00143   if ( 0 != m_updateCallBack   )
    00144   { delete m_updateCallBack    ; m_updateCallBack    = 0 ; }
    00145   m_updateCallBack = pf ;
    00146 }
    00147 // ============================================================================
    00148 // use the call-back function at reading
    00149 // ============================================================================
    00150 void Property::useReadHandler   () const
    00151 {
    00152   if ( 0 == m_readCallBack ) { return ; }               // RETURN
    00153   const Property& p = *this ;
    00154   PropertyCallbackFunctor* theCallBack = m_readCallBack;
    00155   // avoid infinite loop
    00156   m_readCallBack = 0;
    00157   (*theCallBack)( const_cast<Property&>(p) ) ;
    00158   m_readCallBack = theCallBack;
    00159 }
    00160 // ============================================================================
    00161 // use the call-back function at update
    00162 // ============================================================================
    00163 bool Property::useUpdateHandler ()
    00164 {
    00165   bool sc(true);
    00166   if ( 0 == m_updateCallBack ) { return sc; }  // RETURN
    00167   PropertyCallbackFunctor* theCallBack = m_updateCallBack;
    00168   // avoid infinite loop
    00169   m_updateCallBack = 0;
    00170   try {
    00171     (*theCallBack)( *this ) ;
    00172   } catch(...) {
    00173     sc = false;
    00174   }
    00175   m_updateCallBack = theCallBack;
    00176   return sc;
    00177 }
    00178 // ============================================================================
    00179 // the printout of the property value
    00180 // ============================================================================
    00181 std::ostream&
    00182 Property::fillStream ( std::ostream& stream ) const
    00183 { return stream << " '" <<name() << "':" << toString() ; }
    00184 // ============================================================================
    00185 /*  simple function which check the existence of the property with
    00186  *  the given name.
    00187  *
    00188  *  @code
    00189  *
    00190  *  IInterface* p = .
    00191  *
    00192  *  const bool = hasProperty( p , "Context" ) ;
    00193  *
    00194  *  @endcode
    00195  *
    00196  *  @param  p    pointer to IInterface   object (any component)
    00197  *  @param  name property name (case insensitive)
    00198  *  @return true if "p" has a property with such name
    00199  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00200  *  @date   2006-09-09
    00201  */
    00202 // ============================================================================
    00203 bool Gaudi::Utils::hasProperty
    00204 ( const IInterface*  p    ,
    00205   const std::string& name )
    00206 {
    00207   // trivial check
    00208   if ( 0 ==  p ) { return false ; }                                // RETURN
    00209   // gelegate to another method
    00210   return 0 != getProperty ( p , name ) ;
    00211 }
    00212 // ============================================================================
    00213 /*  simple function which check the existence of the property with
    00214  *  the given name.
    00215  *
    00216  *  @code
    00217  *
    00218  *  const IProperty* p = ... ;
    00219  *
    00220  *  const bool = hasProperty( p , "Context" ) ;
    00221  *
    00222  *  @endcode
    00223  *
    00224  *  @param  p    pointer to IProperty object
    00225  *  @param  name property name (case insensitive)
    00226  *  @return true if "p" has a property with such name
    00227  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00228  *  @date   2006-09-09
    00229  */
    00230 // ============================================================================
    00231 bool Gaudi::Utils::hasProperty
    00232 ( const IProperty*   p    ,
    00233   const std::string& name )
    00234 {
    00235   if ( 0 == p ) { return false ; }
    00236   // delegate the actual work to another method ;
    00237   return 0 != getProperty ( p , name ) ;
    00238 }
    00239 // ============================================================================
    00240 //
    00241 // GaudiHandleProperty implementation
    00242 //
    00243 GaudiHandleProperty::GaudiHandleProperty
    00244 ( const std::string& name, GaudiHandleBase& ref )
    00245   : Property( name, typeid( GaudiHandleBase ) ), m_pValue( &ref )
    00246 {
    00247   m_pValue->setPropertyName( name );
    00248 }
    00249
    00250 bool GaudiHandleProperty::setValue( const GaudiHandleBase& value ) {
    00251   m_pValue->setTypeAndName( value.typeAndName() );
    00252   return useUpdateHandler();
    00253 }
    00254
    00255 std::string GaudiHandleProperty::toString( ) const {
    00256   useReadHandler();
    00257   return m_pValue->typeAndName();
    00258 }
    00259
    00260 void GaudiHandleProperty::toStream(std::ostream& out) const {
    00261   useReadHandler();
    00262   out << m_pValue->typeAndName();
    00263 }
    00264
    00265 StatusCode GaudiHandleProperty::fromString( const std::string& s) {
    00266   m_pValue->setTypeAndName( s );
    00267   return useUpdateHandler()?StatusCode::SUCCESS:StatusCode::FAILURE;
    00268 }
    00269
    00270
    00271 //
    00272 // GaudiHandlePropertyArray implementation
    00273 //
    00274 GaudiHandleArrayProperty::GaudiHandleArrayProperty( const std::string& name, GaudiHandleArrayBase& ref )
    00275   : Property( name, typeid( GaudiHandleArrayBase ) ), m_pValue( &ref )
    00276 {
    00277   m_pValue->setPropertyName( name );
    00278 }
    00279
    00280 bool GaudiHandleArrayProperty::setValue( const GaudiHandleArrayBase& value ) {
    00281   m_pValue->setTypesAndNames( value.typesAndNames() );
    00282   return useUpdateHandler();
    00283 }
    00284
    00285 std::string GaudiHandleArrayProperty::toString() const {
    00286   // treat as if a StringArrayProperty
    00287   useReadHandler();
    00288   return Gaudi::Utils::toString( m_pValue->typesAndNames() );
    00289 }
    00290
    00291 void GaudiHandleArrayProperty::toStream(std::ostream &out) const {
    00292   // treat as if a StringArrayProperty
    00293   useReadHandler();
    00294   Gaudi::Utils::toStream( m_pValue->typesAndNames(), out );
    00295 }
    00296
    00297 StatusCode GaudiHandleArrayProperty::fromString( const std::string& source ) {
    00298   // treat as if a StringArrayProperty
    00299   std::vector< std::string > tmp;
    00300   StatusCode sc = Gaudi::Parsers::parse ( tmp , source );
    00301   if ( sc.isFailure() ) return sc;
    00302   if ( !m_pValue->setTypesAndNames( tmp ) ) return StatusCode::FAILURE;
    00303   return useUpdateHandler()?StatusCode::SUCCESS:StatusCode::FAILURE;
    00304 }
    00305
    00306
    00307
    00308 // ============================================================================
    00309 namespace
    00310 {
    00311   // get the property by name (case insensitive)
    00312   struct _ByName_ : public std::unary_function<const Property*,bool>
    00313   {
    00315     _ByName_ ( const std::string& name )
    00316       : m_name ( boost::algorithm::to_lower_copy( name ) ) {}
    00318     bool operator () ( const Property* p ) const
    00319     {
    00320       if ( 0 == p ) { return false ; }
    00321       return m_name == boost::algorithm::to_lower_copy( p->name() ) ;
    00322     } ;
    00323   protected:
    00324     _ByName_();
    00325   private:
    00326     std::string m_name ;
    00327   } ;
    00328 }
    00329 // ============================================================================
    00330 /*  simple function which gets the property with given name
    00331  *  from the component
    00332  *
    00333  *  @code
    00334  *
    00335  *  const IProperty* p = ... ;
    00336  *
    00337  *  const Property* pro = getProperty( p , "Context" ) ;
    00338  *
    00339  *  @endcode
    00340  *
    00341  *  @param  p    pointer to IProperty object
    00342  *  @param  name property name (case insensitive)
    00343  *  @return property with the given name (if exists), NULL otherwise
    00344  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00345  *  @date   2006-09-09
    00346  */
    00347 // ============================================================================
    00348 Property* Gaudi::Utils::getProperty
    00349 ( const IProperty*   p    ,
    00350   const std::string& name )
    00351 {
    00352   // trivial check
    00353   if ( 0 == p      ) { return 0 ; }                          // RETURN
    00354   // get all properties
    00355   typedef std::vector<Property*> List ;
    00356   const List& lst = p->getProperties() ;
    00357   if ( lst.empty() ) { return 0 ; }                          // RETURN
    00358   // comparison criteria:
    00359   List::const_iterator ifound =
    00360     std::find_if ( lst.begin() , lst.end() , _ByName_( name ) ) ;
    00361   if ( lst.end() == ifound ) { return 0 ; }                  // RETURN
    00362   // OK
    00363   return *ifound ;
    00364 }
    00365 // ============================================================================
    00366 /*  simple function which gets the property with given name
    00367  *  from the component
    00368  *
    00369  *  @code
    00370  *
    00371  *  const IInterface* p = ... ;
    00372  *
    00373  *  const Property* pro = getProperty( p , "Context" ) ;
    00374  *
    00375  *  @endcode
    00376  *
    00377  *  @param  p    pointer to IInterface object
    00378  *  @param  name property name (case insensitive)
    00379  *  @return property with the given name (if exists), NULL otherwise
    00380  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00381  *  @date   2006-09-09
    00382  */
    00383 // ============================================================================
    00384 Property* Gaudi::Utils::getProperty
    00385 ( const IInterface*   p , const std::string& name )
    00386 {
    00387   // trivial check
    00388   if ( 0 ==  p        ) { return 0 ; }                                // RETURN
    00389   // remove const-qualifier
    00390   IInterface* _i = const_cast<IInterface*>( p ) ;
    00391   if ( 0 == _i        ) { return 0 ; }                                // RETURN
    00392   SmartIF<IProperty> property ( _i ) ;
    00393   if ( !property      ) { return 0 ; }                                // RETURN
    00394   return getProperty ( property , name ) ;
    00395 }
    00396 // ============================================================================
    00397 /*  check  the property by name from  the list of the properties
    00398  *
    00399  *  @code
    00400  *
    00401  *   IJobOptionsSvc* svc = ... ;
    00402  *
    00403  *   const std::string client = ... ;
    00404  *
    00405  *  // get the property:
    00406  *  bool context =
    00407  *      hasProperty ( svc->getProperties( client ) , "Context" )
    00408  *
    00409  *  @endcode
    00410  *
    00411  *  @see IJobOptionsSvc
    00412  *
    00413  *  @param  p    list of properties
    00414  *  @param  name property name (case insensitive)
    00415  *  @return true if the property exists
    00416  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00417  *  @date   2006-09-09
    00418  */
    00419 // ============================================================================
    00420 bool Gaudi::Utils::hasProperty
    00421 ( const std::vector<const Property*>* p    ,
    00422   const std::string&                  name )
    00423 {
    00424   // delegate to another method
    00425   return 0 != getProperty ( p , name ) ;
    00426 }
    00427 // ============================================================================
    00428 /*  get the property by name from  the list of the properties
    00429  *
    00430  *  @code
    00431  *
    00432  *   IJobOptionsSvc* svc = ... ;
    00433  *
    00434  *   const std::string client = ... ;
    00435  *
    00436  *  // get the property:
    00437  *  const Property* context =
    00438  *      getProperty ( svc->getProperties( client ) , "Context" )
    00439  *
    00440  *  @endcode
    00441  *
    00442  *  @see IJobOptionsSvc
    00443  *
    00444  *  @param  p    list of properties
    00445  *  @param  name property name (case insensitive)
    00446  *  @return property with the given name (if exists), NULL otherwise
    00447  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00448  *  @date   2006-09-09
    00449  */
    00450 // ============================================================================
    00451 const Property* Gaudi::Utils::getProperty
    00452 ( const std::vector<const Property*>* p    ,
    00453   const std::string&                  name )
    00454 {
    00455   // trivial check
    00456   if ( 0 == p             ) { return 0 ; }                 // RETURN
    00457   std::vector<const Property*>::const_iterator ifound =
    00458     std::find_if ( p->begin() , p->end() , _ByName_( name ) ) ;
    00459   if ( p->end() == ifound ) { return 0 ; }                 // RETURN
    00460   // OK
    00461   return *ifound ;
    00462 }
    00463 // ============================================================================
    00464 /* the full specialization of the
    00465  *  method setProperty( IProperty, std::string, const TYPE&)
    00466  *  for C-strings
    00467  *
    00468  *  @param component component which needs to be configured
    00469  *  @param name      name of the property
    00470  *  @param value     value of the property
    00471  *  @param doc       the new documentation string
    00472  *
    00473  *  @see IProperty
    00474  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00475  *  @date 2007-05-13
    00476  */
    00477 // ============================================================================
    00478 StatusCode Gaudi::Utils::setProperty
    00479 ( IProperty*         component ,
    00480   const std::string& name      ,
    00481   const char*        value     ,
    00482   const std::string& doc       )
    00483 {
    00484   const std::string val = std::string( value ) ;
    00485   return Gaudi::Utils::setProperty ( component , name , val , doc ) ;
    00486 }
    00487 // ============================================================================
    00488 /* the full specialization of the
    00489  * method Gaudi::Utils::setProperty( IProperty, std::string, const TYPE&)
    00490  * for standard strings
    00491  *
    00492  *  @param component component which needs to be configured
    00493  *  @param name      name of the property
    00494  *  @param value     value of the property
    00495  *
    00496  *  @see IProperty
    00497  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00498  *  @date 2007-05-13
    00499  */
    00500 // ============================================================================
    00501 StatusCode Gaudi::Utils::setProperty
    00502 ( IProperty*         component ,
    00503   const std::string& name      ,
    00504   const std::string& value     ,
    00505   const std::string& doc       )
    00506 {
    00507   if ( 0 == component ) { return StatusCode::FAILURE ; }   // RETURN
    00508   if ( !hasProperty ( component , name ) ) { return StatusCode::FAILURE ; }
    00509   StatusCode sc = component -> setProperty ( name , value ) ;
    00510   if ( !doc.empty() )
    00511   {
    00512     Property* p = getProperty( component , name ) ;
    00513     if ( 0 != p ) { p -> setDocumentation ( doc ) ; }
    00514   }
    00515   sc.ignore() ;
    00516   return sc ;
    00517 }
    00518 // ============================================================================
    00519 /*  simple function to set the property of the given object from another
    00520  *  property
    00521  *
    00522  *  @code
    00523  *
    00524  *  IProperty* component = ... ;
    00525  *
    00526  *  const Property* prop = ... ;
    00527  *  StatusCode sc = setProperty ( component , "Data" ,  prop  ) ;
    00528  *
    00529  *  @endcode
    00530  *
    00531  * @param component component which needs to be configured
    00532  * @param name      name of the property
    00533  * @param property  the property
    00534  * @param doc       the new documentation string
    00535  *
    00536  * @see IProperty
    00537  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00538  * @date 2007-05-13
    00539  */
    00540 // ============================================================================
    00541 StatusCode Gaudi::Utils::setProperty
    00542 ( IProperty*         component ,
    00543   const std::string& name      ,
    00544   const Property*    property  ,
    00545   const std::string& doc       )
    00546 {
    00547   if ( 0 == component || 0 == property   ) { return StatusCode::FAILURE ; }
    00548   if ( !hasProperty ( component , name ) ) { return StatusCode::FAILURE ; }
    00549   Property* p = getProperty ( component , name ) ;
    00550   if ( 0 == p                            ) { return StatusCode::FAILURE ; }
    00551   if ( !p->assign ( *property )          ) { return StatusCode::FAILURE ; }
    00552   if ( !doc.empty()  ) { p->setDocumentation( doc ) ; }
    00553   return StatusCode::SUCCESS ;
    00554 }
    00555 // ============================================================================
    00556 /* simple function to set the property of the given object from another
    00557  *  property
    00558  *
    00559  *  @code
    00560  *
    00561  *  IProperty* component = ... ;
    00562  *
    00563  *  const Property& prop = ... ;
    00564  *  StatusCode sc = setProperty ( component , "Data" ,  prop  ) ;
    00565  *
    00566  *  @endcode
    00567  *
    00568  * @param component component which needs to be configured
    00569  * @param name      name of the property
    00570  * @param property  the property
    00571  * @param doc       the new documentation string
    00572  *
    00573  * @see IProperty
    00574  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00575  * @date 2007-05-13
    00576  */
    00577 // ============================================================================
    00578 StatusCode Gaudi::Utils::setProperty
    00579 ( IProperty*         component ,
    00580   const std::string& name      ,
    00581   const Property&    property  ,
    00582   const std::string& doc       )
    00583 { return setProperty ( component , name , &property , doc ) ; }
    00584 // ============================================================================
    00585 /*  the full specialization of the
    00586  *  method setProperty( IInterface , std::string, const TYPE&)
    00587  *  for standard strings
    00588  *
    00589  *  @param component component which needs to be configured
    00590  *  @param name      name of the property
    00591  *  @param value     value of the property
    00592  *  @param doc       the new documentation string
    00593  *
    00594  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00595  *  @date 2007-05-13
    00596  */
    00597 // ============================================================================
    00598 StatusCode Gaudi::Utils::setProperty
    00599 ( IInterface*        component ,
    00600   const std::string& name      ,
    00601   const std::string& value     ,
    00602   const std::string& doc       )
    00603 {
    00604   if ( 0 == component ) { return StatusCode::FAILURE ; }
    00605   SmartIF<IProperty> property ( component ) ;
    00606   if ( !property      ) { return StatusCode::FAILURE ; }
    00607   return setProperty ( property , name , value , doc ) ;
    00608 }
    00609 // ============================================================================
    00610 /*  the full specialization of the
    00611  *  method setProperty( IInterface , std::string, const TYPE&)
    00612  *  for C-strings
    00613  *
    00614  *  @param component component which needs to be configured
    00615  *  @param name      name of the property
    00616  *  @param value     value of the property
    00617  *  @param doc       the new documentation string
    00618  *
    00619  *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00620  *  @date 2007-05-13
    00621  */
    00622 // ============================================================================
    00623 StatusCode Gaudi::Utils::setProperty
    00624 ( IInterface*        component ,
    00625   const std::string& name      ,
    00626   const char*        value     ,
    00627   const std::string& doc       )
    00628 {
    00629   const std::string val = std::string( value ) ;
    00630   return setProperty ( component , name , val , doc ) ;
    00631 }
    00632 // ============================================================================
    00633 /*  simple function to set the property of the given object from another
    00634  *  property
    00635  *
    00636  *  @code
    00637  *
    00638  *  IInterface* component = ... ;
    00639  *
    00640  *  const Property* prop = ... ;
    00641  *  StatusCode sc = setProperty ( component , "Data" ,  prop  ) ;
    00642  *
    00643  *  @endcode
    00644  *
    00645  * @param component component which needs to be configured
    00646  * @param name      name of the property
    00647  * @param property  the property
    00648  * @param doc       the new documentation string
    00649  *
    00650  * @see IProperty
    00651  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00652  * @date 2007-05-13
    00653  */
    00654 // ============================================================================
    00655 StatusCode Gaudi::Utils::setProperty
    00656 ( IInterface*        component ,
    00657   const std::string& name      ,
    00658   const Property*    property  ,
    00659   const std::string& doc       )
    00660 {
    00661   if ( 0 == component ) { return StatusCode::FAILURE ; }
    00662   SmartIF<IProperty> prop  ( component ) ;
    00663   if ( !prop          ) { return StatusCode::FAILURE ; }
    00664   return setProperty ( prop  , name , property , doc ) ;
    00665 }
    00666 // ============================================================================
    00667 /*  simple function to set the property of the given object from another
    00668  *  property
    00669  *
    00670  *  @code
    00671  *
    00672  *  IInterface* component = ... ;
    00673  *
    00674  *  const Property& prop = ... ;
    00675  *  StatusCode sc = setProperty ( component , "Data" ,  prop  ) ;
    00676  *
    00677  *  @endcode
    00678  *
    00679  * @param component component which needs to be configured
    00680  * @param name      name of the property
    00681  * @param property  the property
    00682  * @param doc       the new documentation string
    00683  *
    00684  * @see IProperty
    00685  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
    00686  * @date 2007-05-13
    00687  */
    00688 // ============================================================================
    00689 StatusCode Gaudi::Utils::setProperty
    00690 ( IInterface*        component ,
    00691   const std::string& name      ,
    00692   const Property&    property  ,
    00693   const std::string& doc       )
    00694 { return setProperty ( component , name , &property , doc ) ; }
    00695 // ============================================================================
    00696
    00697
    00698
    00699
    00700
    00701 // ============================================================================
    00702 // The END
    00703 // ============================================================================
    00704

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines