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

IDbDataBase.cpp

Go to the documentation of this file.
00001 //====================================================================
00002 //      DbDataBase object implementation
00003 //--------------------------------------------------------------------
00004 //
00005 //      Package    : System ( The LHCb Offline System)
00006 //
00007 //  Description: Generic data persistency
00008 //
00009 //      Author     : M.Frank
00010 //  History    :
00011 // +---------+----------------------------------------------+---------
00012 // |    Date |                 Comment                      | Who     
00013 // +---------+----------------------------------------------+---------
00014 // | 11/07/99| Initial version                              | MF
00015 // +---------+----------------------------------------------+---------
00016 //====================================================================
00017 #define DBCNV_DBSESSION_CPP
00018 
00019 // DbCnv include files
00020 #include "GaudiDb/DbOOMs.h"
00021 #include "GaudiDb/DbObject.h"
00022 #include "GaudiDb/DbIter.h"
00023 #include "DbDataBaseObj.h"
00024 #include "DbContainerObj.h"
00025 
00026 // Gaudi include files
00027 #include "GaudiKernel/MsgStream.h"
00028 #include "GaudiKernel/StreamBuffer.h"
00029 
00030 
00031 IDbDataBase::Link::Link(const std::string& db, const std::string& cnt, const std::string& obj, const dbHandle<DbLink>& to, long int_id)
00032 : dbase(db), container(cnt), object(obj)
00033 {
00034   dbHandle<DbLink>::operator=(to);
00035   if ( m_gene.m_info[0] == 0xFFFFFFFF )   {
00036     m_gene.m_info[0] = int_id;
00037   }
00038   m_gene.m_info[1] = int_id;
00039 }
00040 void IDbDataBase::Link::serialize(StreamBuffer& buffer)  const   {
00041   const unsigned long *info = m_gene.m_info;
00042   buffer << dbase 
00043          << container 
00044          << object 
00045          << m_svcType 
00046          << m_clID
00047          << info[0]
00048          << info[1];
00049 }
00050 
00051 void IDbDataBase::Link::print(IMessageSvc* msg, const std::string& tag, const char* opt)   const {
00052   MsgStream log(msg,tag);
00053   const unsigned long *info = m_gene.m_info;
00054   log << MSG::VERBOSE
00055       << opt << dbase << ":" << container 
00056       << " -> " << object
00057       << endreq;
00058   log << "   ->Type:" << (long)m_svcType
00059       << " CL:"       << m_clID
00060       << " ID: ["     << (void*)info[0]
00061       << " /"         << (void*)info[1]
00062       << "]"
00063       << endreq;
00064 }
00065 
00066 void IDbDataBase::Link::serialize(StreamBuffer& buffer)   {
00067   unsigned long *info = m_gene.m_info;
00068   buffer >> dbase >> container >> object >> m_svcType >> m_clID >> info[0] >> info[1];  
00069 }
00070 
00071 DbResult DbDataBase::Link::set(dbHandle<DbLink>& link)  const  {
00072   // We just have to copy the entry ID number
00073   link.setClID(clID());
00074   link.setSvcType(svcType());
00075   if ( svcType() != OBJY_StorageType )   {
00076     link.genericInfo()->m_info[0] = m_gene.m_info[1];
00077   }
00078   return DbOOMs::DbSuccess;
00079 }
00080 
00081 void DbDataBase::Type::serialize(StreamBuffer& buffer)  const   {
00082   buffer << contName << objType << description;
00083 }
00084 void DbDataBase::Type::serialize(StreamBuffer& buffer)   {
00085   buffer >> contName >> objType >> description;
00086 }
00087 
00088 void DbDataBase::Type::print(IMessageSvc* msg, const std::string& tag, const char* opt)   const {
00089   MsgStream log(msg,tag);
00090   log << MSG::VERBOSE << opt << contName << ":" << objType << endreq; 
00091   log << MSG::VERBOSE << "     Desc:" << description << endreq; 
00092 }

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