Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

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

/BdbEventStore/BdbOptBridgeOnly.cc

Go to the documentation of this file.
00001 #if !defined(BDBOPTBRIDGEONLY_CC)
00002 #define BDBOPTBRIDGEONLY_CC
00003 //--------------------------------------------------------------------------
00004 // File and Version Information:
00005 //      $Id: BdbOptBridgeOnly.cc,v 1.1 2001/10/01 22:28:20 patton Exp $
00006 //
00007 // Description:
00008 //      Class BdbOptBridgeOnly
00009 //
00010 // Environment:
00011 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00012 //
00013 // Author List:
00014 //      Simon Patton            Originator
00015 //
00016 // Copyright Information:
00017 //      Copyright (C) 1999      LBNL
00018 //
00019 //------------------------------------------------------------------------
00020 
00021 //-----------------------
00022 // This Class's Header --
00023 //-----------------------
00024 #include "BdbEventStore/BdbOptBridgeOnly.hh"
00025 
00026 //-------------
00027 // C Headers --
00028 //-------------
00029 extern "C" {
00030 #include <stdlib.h> // exit
00031 }
00032 
00033 //---------------
00034 // C++ Headers --
00035 //---------------
00036 
00037 //----------------
00038 // BaBar Header --
00039 //----------------
00040 #include "BaBar/BaBar.hh"
00041 
00042 //-------------------------------
00043 // Collaborating Class Headers --
00044 //-------------------------------
00045 #include "BdbApplication/BdbDomain.hh"
00046 #include "ErrLogger/ErrLog.hh"
00047 
00048 //------------------------------------
00049 // Collaborating Class Declarations --
00050 //------------------------------------
00051 
00052 //-----------------------------------------------------------------------
00053 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00054 //-----------------------------------------------------------------------
00055 
00056 //              -----------------------------------------------
00057 //              -- Static Data & Function Member Definitions --
00058 //              -----------------------------------------------
00059 
00060 const char*
00061 BdbOptBridgeOnly::setName()
00062 {
00063    return( "bridgeOnly" );
00064 }
00065 
00066 const char*
00067 BdbOptBridgeOnly::clearName()
00068 {
00069    return( "allCollections" );
00070 }
00071 
00072 bool
00073 BdbOptBridgeOnly::isSet( BdbDomain& domain )
00074 {
00075    domain.activate();
00076    BdbMode mode = domain.change( BdbcRead );
00077    BdbHandle( BdbContObj ) container( scopeContainer( domain.fd() ) );
00078    if( container.isNull() ) {
00079       domain.change( mode );
00080       domain.deactivate();
00081       return( false );
00082    }
00083 
00084    BdbHandle( BdbObj ) object;
00085    if( BdbcError == object.lookupObj( container ,
00086                                       setName(),
00087                                       BdbcNoOpen ) ) {
00088       domain.change( mode );
00089       domain.deactivate();
00090       return( false );
00091    }
00092 
00093    domain.change( mode );
00094    domain.deactivate();
00095    return( !false );
00096 }
00097 
00098 void
00099 BdbOptBridgeOnly::setOption( BdbDomain& domain,
00100                              bool aOptionSet )
00101 {
00102    domain.activate();
00103    BdbMode mode = domain.change( BdbcRead );
00104    BdbHandle( BdbContObj ) container( scopeContainer( domain.fd() ) );
00105    if( container.isNull() ) {
00106       if( !aOptionSet ) {
00107          domain.change( mode );
00108          domain.deactivate();
00109          return;
00110       }
00111       domain.change( BdbcUpdate );
00112       container = scopeContainer( domain.fd() );
00113    }
00114 
00115    BdbHandle( BdbObj ) object;
00116    if( BdbcSuccess == object.lookupObj( container ,
00117                                         setName(),
00118                                         BdbcNoOpen ) ) {
00119       if( aOptionSet ) {
00120          domain.change( mode );
00121          domain.deactivate();
00122          return;
00123       }
00124       object.unnameObj( container,
00125                         setName() );
00126    }
00127    else if( BdbcSuccess == object.lookupObj( container ,
00128                                              clearName(),
00129                                              BdbcNoOpen ) ) {
00130       if( !aOptionSet ) {
00131          domain.change( mode );
00132          domain.deactivate();
00133          return;
00134       }
00135       object.unnameObj( container,
00136                         clearName() );
00137    }
00138    else {
00139       object = new( container )BdbObj;
00140    }
00141 
00142    if( aOptionSet ) {
00143       object.nameObj( container,
00144                       setName() );
00145    }
00146    else {
00147       object.nameObj( container,
00148                       clearName() );
00149    }
00150 
00151    domain.change( mode,
00152                d_True );
00153    domain.deactivate();
00154    return;
00155 }
00156 
00157 void
00158 BdbOptBridgeOnly::clearOption( BdbDomain& domain )
00159 {
00160    setOption( domain,
00161               false );
00162 }
00163 
00164 //              ---------------------------------
00165 //              -- Member Function Definitions --
00166 //              ---------------------------------
00167 
00168 //----------------
00169 // Constructors --
00170 //----------------
00171 
00172 // BdbOptBridgeOnly::BdbOptBridgeOnly()
00173 // {
00174 // }
00175 
00176 // BdbOptBridgeOnly::BdbOptBridgeOnly( const BdbOptBridgeOnly& aRhs )
00177 // {
00178 // }
00179 
00180 //--------------
00181 // Destructor --
00182 //--------------
00183 
00184 // BdbOptBridgeOnly::~BdbOptBridgeOnly()
00185 // {
00186 // }
00187 
00188 //-------------
00189 // Operators --
00190 //-------------
00191     
00192 // const BdbOptBridgeOnly& BdbOptBridgeOnly::operator=( const BdbOptBridgeOnly& aRhs )
00193 // {
00194 // }
00195 
00196 //-------------
00197 // Selectors --
00198 //-------------
00199 
00200 //-------------
00201 // Modifiers --
00202 //-------------
00203 
00204 #endif // BDBOPTBRIDGEONLY_CC

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002