Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbBdbWDatabase.cc

Go to the documentation of this file.
00001 // File and Version Information:
00002 //      $Id: CdbBdbWDatabase.cc,v 1.18 2005/08/13 01:24:43 gapon Exp $
00003 
00004 /// The implementation of the CdbBdbWDatabase class.
00005 /**
00006   * @see CdbBdbWDatabase
00007   */
00008 #include "BaBar/BaBar.hh"
00009 
00010 #include "CdbBdbWrapper/CdbBdbWDatabase.hh"
00011 
00012 #include "CdbBase/Cdb.hh"
00013 #include "CdbBase/CdbView.hh"
00014 #include "CdbBase/CdbId.hh"
00015 #include "CdbBase/CdbCompositeName.hh"
00016 #include "CdbBase/CdbEnvironment.hh"
00017 #include "CdbBase/CdbPartition.hh"
00018 #include "CdbBase/CdbProperty.hh"
00019 #include "CdbBase/CdbOrigin.hh"
00020 
00021 #include "CdbBdbWrapper/CdbBdbWView.hh"
00022 #include "CdbBdbWrapper/CdbBdbWViewItr.hh"
00023 
00024 #include "ErrLogger/ErrLog.hh"
00025 
00026 #include <string.h>
00027 using std::endl;
00028 
00029 namespace {
00030 
00031 ///////////////////////////////
00032 // Class CdbBdbWPartitionItr //
00033 ///////////////////////////////
00034 
00035 /// The wrapper implementation of a transient partition iterator
00036 /**
00037   * This is an empty collection iterator sine there is no
00038   * partitions in the 'Wraper' implementation.
00039   */
00040 class CdbBdbWPartitionItr : public CdbIItr<unsigned short> {
00041 
00042 public:
00043 
00044   /// The default constructor
00045   /**
00046     */
00047     CdbBdbWPartitionItr( );
00048 
00049   /// The copy constructor
00050   /**
00051     * More details to come...
00052     */
00053     CdbBdbWPartitionItr( const CdbBdbWPartitionItr& theItr );
00054 
00055   /// The assignment operator
00056   /**
00057     * More details to come...
00058     */
00059     CdbBdbWPartitionItr& operator=( const CdbBdbWPartitionItr& theItr );
00060 
00061   /// The destructor
00062   /**
00063     * Details...
00064     */
00065     virtual ~CdbBdbWPartitionItr( );
00066 
00067   /// Reset an iterator to its initial state.
00068   /**
00069     * This implements the corresponding method of the base class.
00070     *
00071     * @see CdbIItr::reset
00072     * @see CdbStatus
00073     */
00074     virtual CdbStatus reset( );
00075 
00076   /// Advance an iterator to the next position.
00077   /**
00078     * This implements the corresponding method of the base class.
00079     *
00080     * @see CdbIItr::next()
00081     */
00082     virtual bool next( );
00083 
00084   /// Obtain the currently reffered value.
00085   /**
00086     * This implements the corresponding method of the base class.
00087     *
00088     * @see CdbIItr::value()
00089     *
00090     * @return the current value the iterator is set on
00091     */
00092     virtual unsigned short value( );
00093 
00094   /// Check if an iterator is valid.
00095   /**
00096     * This implements the corresponding method of the base class.
00097     *
00098     * @see CdbIItr::isValid()
00099     */
00100     virtual bool isValid( );
00101 
00102   /// Make a clone of itself
00103   /**
00104     * @see CdbIItr::clone()
00105     */
00106     virtual CdbIItr<unsigned short>* clone( ) const;
00107 };
00108 
00109 CdbBdbWPartitionItr::CdbBdbWPartitionItr( )
00110 { }
00111 
00112 CdbBdbWPartitionItr::CdbBdbWPartitionItr( const CdbBdbWPartitionItr& theItr )
00113 { }
00114 
00115 CdbBdbWPartitionItr::~CdbBdbWPartitionItr( )
00116 { }
00117 
00118 CdbBdbWPartitionItr&
00119 CdbBdbWPartitionItr::operator=( const CdbBdbWPartitionItr& theItr )
00120 {
00121     return *this;
00122 }
00123 
00124 CdbStatus
00125 CdbBdbWPartitionItr::reset( )
00126 {
00127     return CdbStatus::Success;
00128 }
00129 
00130 bool
00131 CdbBdbWPartitionItr::next( )
00132 {
00133   // There are no elements in this collection.
00134 
00135     return false;
00136 }
00137 
00138 unsigned short
00139 CdbBdbWPartitionItr::value( )
00140 {
00141     ErrMsg(fatal) << "this function should never been called." << endmsg;
00142     return 0;
00143 }
00144 
00145 bool
00146 CdbBdbWPartitionItr::isValid( )
00147 {
00148     return false;
00149 }
00150 
00151 CdbIItr<unsigned short>*
00152 CdbBdbWPartitionItr::clone( ) const
00153 {
00154     return new CdbBdbWPartitionItr( *this );
00155 }
00156 
00157 ////////////////////////////
00158 // Class CdbBdbWOriginItr //
00159 ////////////////////////////
00160 
00161 /// The wrapper implementation of a transient origin iterator
00162 /**
00163   * This is the "one-element" collection iterator sine there is just one
00164   * origin object in the 'Wraper' implementation. The iterator when successfully
00165   * advanced will return 0 value.
00166   */
00167 class CdbBdbWOriginItr : public CdbIItr<unsigned short> {
00168 
00169 public:
00170 
00171   /// The default constructor
00172   /**
00173     */
00174     CdbBdbWOriginItr( );
00175 
00176   /// The copy constructor
00177   /**
00178     * More details to come...
00179     */
00180     CdbBdbWOriginItr( const CdbBdbWOriginItr& theItr );
00181 
00182   /// The assignment operator
00183   /**
00184     * More details to come...
00185     */
00186     CdbBdbWOriginItr& operator=( const CdbBdbWOriginItr& theItr );
00187 
00188   /// The destructor
00189   /**
00190     * Details...
00191     */
00192     virtual ~CdbBdbWOriginItr( );
00193 
00194   /// Reset an iterator to its initial state.
00195   /**
00196     * This implements the corresponding method of the base class.
00197     *
00198     * @see CdbIItr::reset
00199     * @see CdbStatus
00200     */
00201     virtual CdbStatus reset( );
00202 
00203   /// Advance an iterator to the next position.
00204   /**
00205     * This implements the corresponding method of the base class.
00206     *
00207     * @see CdbIItr::next()
00208     */
00209     virtual bool next( );
00210 
00211   /// Obtain the currently reffered value.
00212   /**
00213     * This implements the corresponding method of the base class.
00214     *
00215     * @see CdbIItr::value()
00216     *
00217     * @return the current value the iterator is set on
00218     */
00219     virtual unsigned short value( );
00220 
00221   /// Check if an iterator is valid.
00222   /**
00223     * This implements the corresponding method of the base class.
00224     *
00225     * @see CdbIItr::isValid()
00226     */
00227     virtual bool isValid( );
00228 
00229   /// Make a clone of itself
00230   /**
00231     * @see CdbIItr::clone()
00232     */
00233     virtual CdbIItr<unsigned short>* clone( ) const;
00234 
00235 private:
00236 
00237     bool _isValid;
00238     bool _hasEverBeenAdvanced;
00239 };
00240 
00241 CdbBdbWOriginItr::CdbBdbWOriginItr( ) :
00242     _isValid(false),
00243     _hasEverBeenAdvanced(false)
00244 { }
00245 
00246 CdbBdbWOriginItr::CdbBdbWOriginItr( const CdbBdbWOriginItr& theItr ) :
00247     _isValid(theItr._isValid),
00248     _hasEverBeenAdvanced(theItr._hasEverBeenAdvanced)
00249 { }
00250 
00251 CdbBdbWOriginItr::~CdbBdbWOriginItr( )
00252 { }
00253 
00254 CdbBdbWOriginItr&
00255 CdbBdbWOriginItr::operator=( const CdbBdbWOriginItr& theItr )
00256 {
00257     if( &theItr != this ) {
00258         _isValid             = theItr._isValid;
00259         _hasEverBeenAdvanced = theItr._hasEverBeenAdvanced;
00260     }
00261     return *this;
00262 }
00263 
00264 CdbStatus
00265 CdbBdbWOriginItr::reset( )
00266 {
00267     _isValid             = false;
00268     _hasEverBeenAdvanced = false;
00269 
00270     return CdbStatus::Success;
00271 }
00272 
00273 bool
00274 CdbBdbWOriginItr::next( )
00275 {
00276     if( _isValid ) {
00277         _isValid             = false;
00278     } else {
00279         _isValid             = true;
00280         _hasEverBeenAdvanced = true;
00281     }
00282     return _isValid;
00283 }
00284 
00285 unsigned short
00286 CdbBdbWOriginItr::value( )
00287 {
00288     if( !isValid( )) ErrMsg(fatal) << "attempting to use a non-initialized iterator." << endmsg;
00289     return 0;
00290 }
00291 
00292 bool
00293 CdbBdbWOriginItr::isValid( )
00294 {
00295     return _isValid;
00296 }
00297 
00298 CdbIItr<unsigned short>*
00299 CdbBdbWOriginItr::clone( ) const
00300 {
00301     return new CdbBdbWOriginItr( *this );
00302 }
00303 
00304 ////////////////////////////////////
00305 // Class CdbBdbWOriginPropertyItr //
00306 ////////////////////////////////////
00307 
00308 /// The wrapper implementation of a transient origin's property iterator
00309 /**
00310   * This is an empty collection iterator sine there is no
00311   * properties at the origin of the 'Wraper' implementation.
00312   */
00313 class CdbBdbWOriginPropertyItr : public CdbIItr<CdbProperty> {
00314 
00315 public:
00316 
00317   /// The default constructor
00318   /**
00319     */
00320     CdbBdbWOriginPropertyItr( );
00321 
00322   /// The copy constructor
00323   /**
00324     * More details to come...
00325     */
00326     CdbBdbWOriginPropertyItr( const CdbBdbWOriginPropertyItr& theItr );
00327 
00328   /// The assignment operator
00329   /**
00330     * More details to come...
00331     */
00332     CdbBdbWOriginPropertyItr& operator=( const CdbBdbWOriginPropertyItr& theItr );
00333 
00334   /// The destructor
00335   /**
00336     * Details...
00337     */
00338     virtual ~CdbBdbWOriginPropertyItr( );
00339 
00340   /// Reset an iterator to its initial state.
00341   /**
00342     * This implements the corresponding method of the base class.
00343     *
00344     * @see CdbIItr::reset
00345     * @see CdbStatus
00346     */
00347     virtual CdbStatus reset( );
00348 
00349   /// Advance an iterator to the next position.
00350   /**
00351     * This implements the corresponding method of the base class.
00352     *
00353     * @see CdbIItr::next()
00354     */
00355     virtual bool next( );
00356 
00357   /// Obtain the currently reffered value.
00358   /**
00359     * This implements the corresponding method of the base class.
00360     *
00361     * @see CdbIItr::value()
00362     *
00363     * @return the current value the iterator is set on
00364     */
00365     virtual CdbProperty value( );
00366 
00367   /// Check if an iterator is valid.
00368   /**
00369     * This implements the corresponding method of the base class.
00370     *
00371     * @see CdbIItr::isValid()
00372     */
00373     virtual bool isValid( );
00374 
00375   /// Make a clone of itself
00376   /**
00377     * @see CdbIItr::clone()
00378     */
00379     virtual CdbIItr<CdbProperty>* clone( ) const;
00380 };
00381 
00382 CdbBdbWOriginPropertyItr::CdbBdbWOriginPropertyItr( )
00383 { }
00384 
00385 CdbBdbWOriginPropertyItr::CdbBdbWOriginPropertyItr( const CdbBdbWOriginPropertyItr& theItr )
00386 { }
00387 
00388 CdbBdbWOriginPropertyItr::~CdbBdbWOriginPropertyItr( )
00389 { }
00390 
00391 CdbBdbWOriginPropertyItr&
00392 CdbBdbWOriginPropertyItr::operator=( const CdbBdbWOriginPropertyItr& theItr )
00393 {
00394     return *this;
00395 }
00396 
00397 CdbStatus
00398 CdbBdbWOriginPropertyItr::reset( )
00399 {
00400     return CdbStatus::Success;
00401 }
00402 
00403 bool
00404 CdbBdbWOriginPropertyItr::next( )
00405 {
00406   // There are no elements in this collection.
00407 
00408     return false;
00409 }
00410 
00411 CdbProperty
00412 CdbBdbWOriginPropertyItr::value( )
00413 {
00414     ErrMsg(fatal) << "this function should never been called." << endmsg;
00415     return CdbProperty( );
00416 }
00417 
00418 bool
00419 CdbBdbWOriginPropertyItr::isValid( )
00420 {
00421     return false;
00422 }
00423 
00424 CdbIItr<CdbProperty>*
00425 CdbBdbWOriginPropertyItr::clone( ) const
00426 {
00427     return new CdbBdbWOriginPropertyItr( *this );
00428 }
00429 
00430 /////////////////////////
00431 // Class CdbBdbWOrigin //
00432 /////////////////////////
00433 
00434 /// The wrapper implementation of a transient origin
00435 /**
00436   * This is the only "origin" of the 'Wraper' implementation.
00437   */
00438 class CdbBdbWOrigin : public CdbOrigin {
00439 
00440 public:
00441 
00442 private:
00443 
00444   /// The constructor (NOT IMPLEMENTED)
00445   /**
00446     * Is disabled...
00447     */
00448     CdbBdbWOrigin( );
00449 
00450   /// The copy constructor (NOT IMPLEMENTED)
00451   /**
00452     * Is disabled...
00453     */
00454     CdbBdbWOrigin( const CdbBdbWOrigin& theOrigin );
00455 
00456   /// The assignment operator (NOT IMPLEMENTED)
00457   /**
00458     * Is disabled...
00459     */
00460     CdbBdbWOrigin& operator=( const CdbBdbWOrigin& theOrigin );
00461 
00462 public:
00463 
00464   /// The normal constructor.
00465   /**
00466     * Initialize context with specified parameters.
00467     *
00468     * @see CdbDatabase
00469     * @see CdbDatabasePtr
00470     */
00471     CdbBdbWOrigin( const CdbDatabasePtr& theDatabasePtr /**< the smart pointer providing a back back link to the parent database object */
00472                  );
00473 
00474   /// The destructor.
00475   /**
00476     * More details...
00477     */
00478     virtual ~CdbBdbWOrigin( );
00479 
00480   /// Obtain the creation time of the origin
00481   /**
00482     * This implements the corresponding method of the base class.
00483     *
00484     * @see CdbOrigin::created()
00485     */
00486     virtual BdbTime created( );
00487 
00488   /// Obtain the origin description
00489   /**
00490     * This implements the corresponding method of the base class.
00491     *
00492     * @see CdbOrigin::description()
00493     */
00494     virtual std::string description( );
00495 
00496   /// Check if this origin is the local one
00497   /**
00498     * This implements the corresponding method of the base class.
00499     *
00500     * @see CdbOrigin::isLocal()
00501     */
00502     virtual bool isLocal( ) const;
00503 
00504   /// Check if data corresponding to this origin are available in the local database
00505   /**
00506     * This implements the corresponding method of the base class.
00507     *
00508     * @see CdbOrigin::isInstantiated()
00509     */
00510     virtual bool isInstantiated( ) const;
00511 
00512   /// Check if this origin is the "master" one
00513   /**
00514     * This implements the corresponding method of the base class.
00515     *
00516     * @see CdbOrigin::isMaster()
00517     */
00518     virtual bool isMaster( ) const;
00519 
00520   /// Check if this origin is a "slave" one
00521   /**
00522     * This implements the corresponding method of the base class.
00523     *
00524     * @see CdbOrigin::isSlave()
00525     */
00526     virtual bool isSlave( ) const;
00527 
00528   /// Check if this origin is a "test" one
00529   /**
00530     * This implements the corresponding method of the base class.
00531     *
00532     * @see CdbOrigin::isTest()
00533     */
00534     virtual bool isTest( ) const;
00535 
00536   /// Set up an iterator of properties
00537   /**
00538     * This implements the corresponding method of the base class.
00539     *
00540     * @see CdbOrigin::propertyIterator()
00541     */
00542     virtual CdbStatus propertyIterator( CdbItr<CdbProperty>& theItr );
00543 };
00544 
00545 CdbBdbWOrigin::CdbBdbWOrigin( const CdbDatabasePtr& theDatabasePtr ) :
00546     CdbOrigin( theDatabasePtr,
00547                "<local>",
00548                0 )
00549 { }
00550 
00551 CdbBdbWOrigin::~CdbBdbWOrigin( )
00552 { }
00553 
00554 BdbTime
00555 CdbBdbWOrigin::created( )
00556 {
00557     return BdbTime::minusInfinity;
00558 }
00559 
00560 std::string
00561 CdbBdbWOrigin::description( )
00562 {
00563     return std::string( "<not available in current implementation>" );
00564 }
00565 
00566 bool
00567 CdbBdbWOrigin::isLocal( ) const
00568 {
00569     return true;
00570 }
00571 
00572 bool
00573 CdbBdbWOrigin::isInstantiated( ) const
00574 {
00575     return true;
00576 }
00577 
00578 bool
00579 CdbBdbWOrigin::isMaster( ) const
00580 {
00581     return true;
00582 }
00583 
00584 bool
00585 CdbBdbWOrigin::isSlave( ) const
00586 {
00587     return false;
00588 }
00589 
00590 bool
00591 CdbBdbWOrigin::isTest( ) const
00592 {
00593     return false;
00594 }
00595 
00596 CdbStatus
00597 CdbBdbWOrigin::propertyIterator( CdbItr<CdbProperty>& theItr )
00598 {
00599   // ATTENTION: This is not a memory leak - the created object
00600   //            will be destroyed by the iterator.
00601 
00602     theItr = CdbItr<CdbProperty>( new CdbBdbWOriginPropertyItr( ));
00603 
00604     return CdbStatus::Success;
00605 }
00606 
00607 };
00608 
00609 ///////////////////////////
00610 // Class CdbBdbWDatabase //
00611 ///////////////////////////
00612 
00613 CdbDatabase*
00614 CdbBdbWDatabase::clone( ) const
00615 {
00616   // Get rid of the "const" to access non-const methods
00617 
00618     CdbBdbWDatabase* mySelf = const_cast<CdbBdbWDatabase*>( this );
00619     return new CdbBdbWDatabase( mySelf->parent( ),
00620                                 mySelf->name( ));
00621 }
00622 
00623 CdbBdbWDatabase::CdbBdbWDatabase( const CdbPtr& theCdbPtr,
00624                                   const char*   theName ) :
00625     CdbDatabase( theCdbPtr,
00626                  theName )
00627 { }
00628 
00629 CdbBdbWDatabase::~CdbBdbWDatabase( )
00630 { }
00631 
00632 bool
00633 CdbBdbWDatabase::isValid( )
00634 {
00635     return true;
00636 }
00637 
00638 bool
00639 CdbBdbWDatabase::isOpen( )
00640 {
00641     return true;
00642 }
00643 
00644 CdbStatus
00645 CdbBdbWDatabase::open( )
00646 {
00647     return CdbStatus::Success;
00648 }
00649 
00650 CdbStatus
00651 CdbBdbWDatabase::close( )
00652 {
00653     return CdbStatus::Success;
00654 }
00655 
00656 BdbTime
00657 CdbBdbWDatabase::id( )
00658 {
00659     return BdbTime::minusInfinity;
00660 }
00661 
00662 
00663 BdbTime
00664 CdbBdbWDatabase::created( )
00665 {
00666     return BdbTime::minusInfinity;
00667 }
00668 
00669 std::string
00670 CdbBdbWDatabase::description( )
00671 {
00672     return std::string( "<not available in current implementation>" );
00673 }
00674 
00675 std::string
00676 CdbBdbWDatabase::defaultView( ) const
00677 {
00678     return CdbEnvironment::defaultView( parent( )->technologyName( ),
00679                                         parent( )->implementationName( ),
00680                                         name( ));
00681 }
00682 
00683 CdbStatus
00684 CdbBdbWDatabase::findView( CdbViewPtr& thePtr,
00685                            const char* theName )
00686 {
00687     CdbStatus result = CdbStatus::Error;
00688 
00689     thePtr = 0;
00690 
00691     do {
00692 
00693       // Verify and correct parameters if 0 pointer is passed to indicate
00694       // that default database is needed.
00695 
00696         std::string viewName = defaultView( );
00697         if( 0 != theName ) viewName = theName;
00698 
00699         if( viewName != defaultView( )) {
00700 
00701             ErrMsg(error) << "no such view in this implementation: \"" << viewName << "\"" << endl
00702                           << "The only name allowed is the default one: \"" << defaultView( ) << "\"" << endmsg;
00703 
00704             break;
00705         }
00706 
00707       // DESIGN NOTE: We need to construct a smart pointer against a clone since
00708       //              we don't know a smart pointer pointing to the current
00709       //              instance, therefore we can't guarantee the lifetime
00710       //              of the current instance.
00711       //
00712       // NOTE: The above corrected parameters object is used.
00713 
00714         CdbDatabasePtr myPtr( this->clone( ));
00715 
00716         thePtr = new CdbBdbWView( myPtr,
00717                                   viewName.c_str( ));
00718 
00719         result = CdbStatus::Success;
00720 
00721     } while( false );
00722 
00723     return result;
00724 }
00725 
00726 CdbStatus
00727 CdbBdbWDatabase::findView( CdbViewPtr&  thePtr,
00728                            const CdbId& theId )
00729 {
00730   // IMPLEMENTATION NOTE: Since the only view available in the "Wrapper"
00731   //                      implementation is the default one then we're
00732   //                      dispatching this call down to that default view.
00733 
00734     return findView( thePtr,
00735                      defaultView( ).c_str( ));
00736 }
00737 
00738 CdbStatus
00739 CdbBdbWDatabase::viewIterator( CdbViewItr& theItr )
00740 {
00741     CdbDatabasePtr myPtr = this->clone( );
00742 
00743   // ATTENTION: This is not a memory leak - the created object
00744   //            will be destroyed by the iterator.
00745 
00746     theItr = CdbViewItr( new CdbBdbWViewItr( myPtr ));
00747 
00748     return CdbStatus::Success;
00749 }
00750 
00751 CdbStatus
00752 CdbBdbWDatabase::physicalConditionIterator( CdbItr<CdbId>& theItr )
00753 {
00754     return CdbStatus::NotImplemented;
00755 }
00756 
00757 CdbStatus
00758 CdbBdbWDatabase::findCondition( CdbConditionPtr& thePtr,
00759                                 const CdbId&     theId )
00760 {
00761     return CdbStatus::NotImplemented;
00762 }
00763 
00764 CdbStatus
00765 CdbBdbWDatabase::findCondition( CdbConditionPtr&        thePtr,
00766                                 const CdbCompositeName& thePhysicalName )
00767 {
00768     return CdbStatus::NotImplemented;
00769 }
00770 
00771 CdbStatus
00772 CdbBdbWDatabase::historyEventIterator( CdbHistoryEventItr& theItr,
00773                                        const BdbTime&      theBeginTime,
00774                                        const BdbTime&      theEndTime,
00775                                        const char**        theEventsToSelect )
00776 {
00777     return CdbStatus::Error;
00778 }
00779 
00780 CdbStatus
00781 CdbBdbWDatabase::historyEventTypeIterator( CdbHistoryEventTypeItr& theItr )
00782 {
00783     return CdbStatus::Error;
00784 }
00785 
00786 CdbStatus
00787 CdbBdbWDatabase::partitionIterator( CdbItr<unsigned short>& theItr )
00788 {
00789   // ATTENTION: This is not a memory leak - the created object
00790   //            will be destroyed by the iterator.
00791 
00792     theItr = CdbItr<unsigned short>( new CdbBdbWPartitionItr( ));
00793 
00794     return CdbStatus::Success;
00795 }
00796 
00797 CdbStatus
00798 CdbBdbWDatabase::partitionIterator( CdbItr<unsigned short>& theItr,
00799                                     unsigned int            theOriginId )
00800 {
00801   // ATTENTION: This is not a memory leak - the created object
00802   //            will be destroyed by the iterator.
00803 
00804     theItr = CdbItr<unsigned short>( new CdbBdbWPartitionItr( ));
00805 
00806     return CdbStatus::Success;
00807 }
00808 
00809 CdbStatus
00810 CdbBdbWDatabase::partitionIterator( CdbItr<unsigned short>& theItr,
00811                                     const char*             theOriginName )
00812 {
00813   // ATTENTION: This is not a memory leak - the created object
00814   //            will be destroyed by the iterator.
00815 
00816     theItr = CdbItr<unsigned short>( new CdbBdbWPartitionItr( ));
00817 
00818     return CdbStatus::Success;
00819 }
00820 
00821 CdbStatus
00822 CdbBdbWDatabase::findPartition( CdbPartitionPtr& thePtr,
00823                                 unsigned short   thePartition )
00824 {
00825   // No partitions exist in this implementation
00826 
00827     return CdbStatus::NotFound;
00828 }
00829 
00830 CdbStatus
00831 CdbBdbWDatabase::findPartition( CdbPartitionPtr& thePtr,
00832                                 unsigned short   thePartition,
00833                                 unsigned int     theOriginId )
00834 {
00835   // No partitions exist in this implementation
00836 
00837     return CdbStatus::NotFound;
00838 }
00839 
00840 CdbStatus
00841 CdbBdbWDatabase::findPartition( CdbPartitionPtr& thePtr,
00842                                 unsigned short   thePartition,
00843                                 const char*      theOriginName )
00844 {
00845   // No partitions exist in this implementation
00846 
00847     return CdbStatus::NotFound;
00848 }
00849 
00850 CdbOriginPtr
00851 CdbBdbWDatabase::localOrigin( )
00852 {
00853   // DESIGN NOTE: We need to construct a smart pointer against a clone since
00854   //              we don't know a smart pointer pointing to the current
00855   //              instance, therefore we can't guarantee the lifetime
00856   //              of the current instance.
00857   //
00858   // NOTE: The above corrected parameters object is used.
00859 
00860     CdbDatabasePtr myPtr( this->clone( ));
00861 
00862     return new CdbBdbWOrigin( myPtr );
00863 }
00864 
00865 CdbStatus
00866 CdbBdbWDatabase::originIterator( CdbItr<unsigned short>& theItr )
00867 {
00868   // ATTENTION: This is not a memory leak - the created object
00869   //            will be destroyed by the iterator.
00870 
00871     theItr = CdbItr<unsigned short>( new CdbBdbWOriginItr( ));
00872 
00873     return CdbStatus::Success;
00874 }
00875 
00876 CdbStatus
00877 CdbBdbWDatabase::findOrigin( CdbOriginPtr& thePtr,
00878                              const char*   theName )
00879 {
00880     CdbStatus result = CdbStatus::NotFound;
00881     do {
00882 
00883       // Only this origin is allowed in thsi implementation
00884 
00885         if( 0 != strcmp( "<local>", theName )) break;
00886 
00887       // DESIGN NOTE: We need to construct a smart pointer against a clone since
00888       //              we don't know a smart pointer pointing to the current
00889       //              instance, therefore we can't guarantee the lifetime
00890       //              of the current instance.
00891       //
00892       // NOTE: The above corrected parameters object is used.
00893 
00894         CdbDatabasePtr myPtr( this->clone( ));
00895 
00896         thePtr = new CdbBdbWOrigin( myPtr );
00897 
00898       // Done
00899 
00900         result = CdbStatus::Success;
00901 
00902     } while( false );
00903 
00904     return result;
00905 }
00906 
00907 CdbStatus
00908 CdbBdbWDatabase::findOrigin( CdbOriginPtr&  thePtr,
00909                              unsigned short theId )
00910 {
00911     CdbStatus result = CdbStatus::NotFound;
00912     do {
00913 
00914       // Only this origin is allowed in thsi implementation
00915 
00916         if( 0 != theId ) break;
00917 
00918       // DESIGN NOTE: We need to construct a smart pointer against a clone since
00919       //              we don't know a smart pointer pointing to the current
00920       //              instance, therefore we can't guarantee the lifetime
00921       //              of the current instance.
00922       //
00923       // NOTE: The above corrected parameters object is used.
00924 
00925         CdbDatabasePtr myPtr( this->clone( ));
00926 
00927         thePtr = new CdbBdbWOrigin( myPtr );
00928 
00929       // Done
00930 
00931         result = CdbStatus::Success;
00932 
00933     } while( false );
00934 
00935     return result;
00936 }
00937 
00938 /////////////////
00939 // End Of File //
00940 /////////////////

Generated on Mon Dec 5 18:22:04 2005 for CDB by doxygen1.3-rc3