00001
00002 #include "CPPFORT/lcobv.h"
00003 #include "UTIL/LCRelationNavigator.h"
00004
00005 #include "lcio.h"
00006 #include "IMPL/LCRelationImpl.h"
00007 #include "EVENT/LCCollection.h"
00008 #include "EVENT/LCObject.h"
00009 #include "LCIOSTLTypes.h"
00010
00011 #include <iostream>
00012 #include <vector>
00013
00014 using namespace lcio ;
00015
00016 typedef std::map< EVENT::LCObject* , std::pair< EVENT::LCObjectVec , EVENT::FloatVec > > RelMap ;
00017
00018 int lcobvgetlength( PTRTYPE vector ){
00019 const LCObjectVec* vec = reinterpret_cast<LCObjectVec*>( vector ) ;
00020 return vec->size() ;
00021 }
00022
00023 PTRTYPE lcobvgetobject( PTRTYPE vector, int index){
00024 const LCObjectVec* vec = reinterpret_cast<LCObjectVec*>( vector ) ;
00025
00026 if( index < 1 || index > (int) vec->size() )
00027 throw Exception("lcobvgetobject : out_of_range " ) ;
00028
00029 LCObject* obj = (*vec)[ index-1 ] ;
00030 return C2F_POINTER( LCObject*, obj ) ;
00031 }
00032
00033 int lcobvgetobjectid( PTRTYPE vector, int index){
00034 const LCObjectVec* vec = reinterpret_cast<LCObjectVec*>( vector ) ;
00035
00036 if( index < 1 || index > (int) vec->size() )
00037 throw Exception("lcobvgetobjectid : out_of_range " ) ;
00038
00039 LCObject* obj = (*vec)[ index-1 ] ;
00040 return obj->id() ;
00041 }
00042
00043 float lcobvgetweight( PTRTYPE vector, int index){
00044 const FloatVec* vec = reinterpret_cast<FloatVec*>( vector ) ;
00045
00046 if( index < 1 || index > (int) vec->size() )
00047 throw Exception("lcobvgetweight : out_of_range " ) ;
00048
00049 return (*vec)[ index-1 ] ;
00050 }
00051
00052