Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

SIOObjectHandler.cc

Go to the documentation of this file.
00001 #include "SIO/SIOObjectHandler.h"
00002 #include "SIO/LCSIO.h"
00003 
00004 #include "EVENT/LCIO.h"
00005 #include "SIO_functions.h"
00006 #include "SIO/SIOLCParameters.h"
00007 
00008 
00009 using namespace EVENT ;
00010 // using namespace IMPL ;
00011 // using namespace IOIMPL ;
00012 
00013 namespace SIO{
00014 
00015 
00016   unsigned int SIOObjectHandler::init( SIO_stream* stream,  
00017                                        SIO_operation op, 
00018                                        EVENT::LCCollection* col , 
00019                                        unsigned int vers ) {
00020 
00021     unsigned int status ; 
00022     
00023     
00024     if( op == SIO_OP_READ ) {
00025 
00026 
00027       SIO_DATA( stream ,  &_flag , 1  ) ;
00028       
00029       if( vers > SIO_VERSION_ENCODE( 1, 1)   ) 
00030         SIOLCParameters::read( stream ,  col->parameters() , vers ) ;
00031       
00032       col->setFlag( _flag ) ;
00033       _vers = vers ;
00034 
00035     } 
00036 
00037     else if( op == SIO_OP_WRITE ) {
00038       
00039       _flag = col->getFlag() ;
00040 
00041       LCSIO_WRITE( stream, _flag  ) ;
00042       SIOLCParameters::write( stream , col->getParameters() ) ;
00043 
00044       _vers = vers ;  // not really needed !?
00045 
00046     }
00047     return ( SIO_BLOCK_SUCCESS ) ;
00048   }
00049   
00050   unsigned int SIOObjectHandler::readBase( SIO_stream* stream, EVENT::LCObject** objP ) {
00051 
00052     if( _flag & ( 1 << LCCollection::BITSubset ) ){
00053 
00054       int status ;
00055       // we only read the pointer 
00056       SIO_PNTR( stream , objP  ) ;
00057       
00058       return status ;
00059 
00060     } else {
00061 
00062       return  read( stream, objP ) ;
00063     }
00064 
00065   }
00066   
00067   unsigned int SIOObjectHandler::writeBase(SIO_stream* stream, const EVENT::LCObject* obj ) {
00068 
00069     if( _flag & ( 1 << LCCollection::BITSubset ) ){
00070   
00071       int status ;
00072 
00073       // we only write the pointer
00074       const EVENT::LCObject* objLocal = obj ; 
00075 
00076       SIO_PNTR( stream , &objLocal ) ;
00077       return status ;
00078  
00079     } else {
00080 
00081       return  write( stream, obj ) ;
00082     }
00083   }
00084   
00085 }

Generated on Sun Jun 3 06:32:06 2007 for A TPC Tracking Environment by  doxygen 1.3.9.1