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

DbAddress.cpp

Go to the documentation of this file.
00001 //====================================================================
00002 //      DbAddress implementation
00003 //--------------------------------------------------------------------
00004 //
00005 //      Package    : System ( The LHCb Offline System)
00006 //
00007 //  Description: Generic Db address implementation
00008 //
00009 //      Author     : M.Frank
00010 //  History    :
00011 // +---------+----------------------------------------------+---------
00012 // |    Date |                 Comment                      | Who     
00013 // +---------+----------------------------------------------+---------
00014 // | 11/02/99| Initial version                              | MF
00015 // +---------+----------------------------------------------+---------
00016 //====================================================================
00017 #define DBCNV_ADDRESS_CPP
00018 // $Header: /nfs/slac/g/glast/ground/cvs/GaudiDb/src/Base/DbAddress.cpp,v 1.1.1.1 2001/04/18 21:13:34 tlindner Exp $
00019 
00020 // Framework include files
00021 #include "GaudiKernel/IDataDirectory.h"
00022 #include "GaudiDb/DbAddress.h"
00023 #include "GaudiDb/DbDataBase.h"
00024 #include "GaudiDb/DbContainer.h"
00025 
00027 DbAddress::DbAddress(dbHandle<DbObject>& objH, const CLID& clid)    {
00028   m_cntH = objH.containedIn();
00029   if ( m_cntH.isValid() )   {
00030     dbHandle<DbDataBase> dbH = m_cntH.containedIn();
00031     if ( dbH.isValid() )    {
00032       const std::string cntName = m_cntH.name();
00033       //int len, loc;
00034       m_objH = objH;
00035       setClID(clid);
00036       setSvcType(m_objH.type());
00037       setContainerName(cntName);
00038       setDbName( dbH.name() );
00039       int loc = m_cntH.name().rfind(IDataDirectory::SEPARATOR);
00040       std::string oname(m_cntH.name(), loc>0 ? loc : 0, m_cntH.name().length());
00041       setObjectName(oname);
00042       dbHandle<DbLink> linkH(*this);
00043       if ( dbH.addAssocEntry(dbH.name(), cntName, oname, linkH) )  {
00044         if ( objH.prepare(m_objH, linkH, m_gene) )    {
00045           return;
00046         }
00047       }
00048     }
00049   }
00050   // Something went wrong: invalidate address information
00051   m_gene.m_info[0] = m_gene.m_info[1] = 0xFFFFFFFF;
00052 }
00053 
00054 DbAddress::DbAddress(dbHandle<DbContainer>& cntH, dbHandle<DbLink>& linkH)
00055 : GenericAddress(linkH), m_objH(linkH.svcType()), m_cntH(cntH)
00056 {
00057   if ( m_cntH.isValid() )   {
00058     setContainerName( m_cntH.name() );
00059     dbHandle<DbDataBase> dbH = m_cntH.containedIn();
00060     if ( dbH.isValid() )    {
00061       setDbName( dbH.name() );
00062       int loc = m_cntH.name().rfind(IDataDirectory::SEPARATOR);
00063       std::string oname(m_cntH.name(), loc>0 ? loc : 0, m_cntH.name().length());
00064       setObjectName(oname);
00065       if ( dbH.addAssocEntry(dbH.name(), m_cntH.name(), oname, linkH) )  {
00066         return;
00067       }
00068     }
00069   }
00070   // Something went wrong: invalidate address information
00071   m_gene.m_info[0] = m_gene.m_info[1] = 0xFFFFFFFF;
00072 }

Generated at Wed Nov 21 12:22:18 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000