/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/SIO/SIOLCRelationHandler.cc

Go to the documentation of this file.
00001 #include "SIO/SIOLCRelationHandler.h"
00002 
00003 #include "SIO/LCSIO.h"
00004 
00005 #include "EVENT/LCIO.h"
00006 #include "EVENT/MCParticle.h"
00007 #include "EVENT/LCRelation.h"
00008 #include "IOIMPL/LCRelationIOImpl.h"
00009 #include "IMPL/LCFlagImpl.h"
00010 
00011 #include "SIO_functions.h"
00012 #include "SIO_block.h"
00013 
00014 
00015 using namespace EVENT ;
00016 using namespace IMPL ;
00017 using namespace IOIMPL ;
00018 
00019 
00020 namespace SIO{
00021     
00022   unsigned int SIOLCRelationHandler::read(SIO_stream* stream, 
00023                                       LCObject** objP){
00024     unsigned int status ; 
00025         
00026     // create a new object :
00027     LCRelationIOImpl* rel  = new LCRelationIOImpl ;
00028     *objP = rel ;
00029         
00030 
00031     SIO_PNTR( stream , &(rel->_from ) );
00032     SIO_PNTR( stream , &(rel->_to ) ) ;
00033     
00034     if( LCFlagImpl(_flag).bitSet( LCIO::LCREL_WEIGHTED ) ){
00035       
00036       SIO_DATA( stream ,  &(rel->_weight) , 1  ) ;
00037       
00038     } 
00039     return ( SIO_BLOCK_SUCCESS ) ;
00040   }
00041   
00042     
00043   unsigned int SIOLCRelationHandler::write(SIO_stream* stream, 
00044                                        const LCObject* obj){
00045     
00046     unsigned int status ; 
00047 
00048     const LCRelation* rel = dynamic_cast<const LCRelation*>(obj)  ;
00049     
00050     LCObject* from = rel->getFrom() ;
00051     SIO_PNTR( stream,  &from ) ;
00052 
00053     LCObject* to = rel->getTo() ;
00054     SIO_PNTR( stream,  &to ) ;
00055 
00056     if( LCFlagImpl(_flag).bitSet( LCIO::LCREL_WEIGHTED ) ){
00057 
00058       LCSIO_WRITE( stream ,  rel->getWeight() ) ;
00059 
00060     } 
00061 
00062 
00063     return ( SIO_BLOCK_SUCCESS ) ;
00064   }
00065   
00066 } // namespace

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7