LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lcobv.cc
Go to the documentation of this file.
1 
2 #include "CPPFORT/lcobv.h"
4 
5 #include "lcio.h"
6 #include "IMPL/LCRelationImpl.h"
7 #include "EVENT/LCCollection.h"
8 #include "EVENT/LCObject.h"
9 #include "LCIOSTLTypes.h"
10 
11 #include <iostream>
12 #include <vector>
13 
14 using namespace lcio ;
15 
17 
18  int lcobvgetlength( PTRTYPE vector ){
19  const LCObjectVec* vec = reinterpret_cast<LCObjectVec*>( vector ) ;
20  return vec->size() ;
21  }
22 
23  PTRTYPE lcobvgetobject( PTRTYPE vector, int index){
24  const LCObjectVec* vec = reinterpret_cast<LCObjectVec*>( vector ) ;
25  // LCObject* obj = vec->at(index-1) ;
26  if( index < 1 || index > (int) vec->size() )
27  throw Exception("lcobvgetobject : out_of_range " ) ;
28 
29  LCObject* obj = (*vec)[ index-1 ] ;
30  return C2F_POINTER( LCObject*, obj ) ;
31  }
32 
33  int lcobvgetobjectid( PTRTYPE vector, int index){
34  const LCObjectVec* vec = reinterpret_cast<LCObjectVec*>( vector ) ;
35  // LCObject* obj = vec->at(index-1) ;
36  if( index < 1 || index > (int) vec->size() )
37  throw Exception("lcobvgetobjectid : out_of_range " ) ;
38 
39  LCObject* obj = (*vec)[ index-1 ] ;
40  return obj->id() ;
41  }
42 
43 float lcobvgetweight( PTRTYPE vector, int index){
44  const FloatVec* vec = reinterpret_cast<FloatVec*>( vector ) ;
45  // return vec->at(index-1) ;
46  if( index < 1 || index > (int) vec->size() )
47  throw Exception("lcobvgetweight : out_of_range " ) ;
48 
49  return (*vec)[ index-1 ] ;
50 }
51 
52 
INT lcobvgetweight
Definition: lcobv.h:29
std::vector< LCObject * > LCObjectVec
Vector of (pointers to) LCObjects.
Definition: LCObject.h:17
std::vector< float > FloatVec
Vector of floats.
Definition: LCIOSTLTypes.h:18
LCIO_DEPRECATED_CAPI int lcobvgetlength(PTRTYPE vector)
Header file for the f77-wrapper functions of the LCRelationNavigator class.
Definition: lcobv.cc:18
STL class.
lcobvgetobject
Definition: lcobv.h:25
std::map< EVENT::LCObject *, std::pair< EVENT::LCObjectVec, EVENT::FloatVec > > RelMap
Definition: lcobv.cc:16
long PTRTYPE
Fortran interface - define the length of pointers this has to made machine independent ...
Definition: cpointer.h:12
LCIO_DEPRECATED_CAPI int lcobvgetobjectid(PTRTYPE vector, int index)
Definition: lcobv.cc:33
T size(T...args)
#define C2F_POINTER(T, ptr)
Definition: cpointer.h:33