LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lcrnv.cc
Go to the documentation of this file.
1 
2 #include "CPPFORT/lcrnv.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 
13 using namespace lcio ;
14 
15  PTRTYPE lcrnvcreate( const char* fromType, const char* toType ){
16  LCRelationNavigator* relation = new LCRelationNavigator( fromType, toType ) ;
17  return reinterpret_cast<PTRTYPE>( relation ) ;
18 
19  }
20 
21  int lcrnvdelete( PTRTYPE relation ){
22  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
23  delete rel ;
24  return LCIO::SUCCESS ;
25 
26  }
27 
29  LCCollection* col = reinterpret_cast<LCCollection*>( collection ) ;
30  LCRelationNavigator* relation = new LCRelationNavigator( col ) ;
31  return reinterpret_cast<PTRTYPE>( relation ) ;
32 
33  }
34 
35  char* lcrnvgetfromtype( PTRTYPE relation ){
36  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
37  return const_cast<char*>(rel->getFromType().c_str() ) ;
38  }
39 
40  char* lcrnvgettotype( PTRTYPE relation ){
41  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
42  return const_cast<char*>(rel->getToType().c_str() ) ;
43  }
44 
46  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
47  LCObject* obj = f2c_pointer<LCObject,LCObject>( object ) ;
48  const LCObjectVec& vec = rel->getRelatedToObjects( obj ) ;
49  return reinterpret_cast<PTRTYPE>( &vec ) ;
50  }
51 
53  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
54  LCObject* obj = f2c_pointer<LCObject,LCObject>( object ) ;
55  const LCObjectVec& vec = rel->getRelatedFromObjects( obj ) ;
56  return reinterpret_cast<PTRTYPE>( &vec ) ;
57  }
58 
60  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
61  LCObject* obj = f2c_pointer<LCObject,LCObject>( object ) ;
62  const FloatVec & vec = rel->getRelatedToWeights( obj ) ;
63  return reinterpret_cast<PTRTYPE>( &vec ) ;
64  }
65 
67  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
68  LCObject* obj = f2c_pointer<LCObject,LCObject>( object ) ;
69  const FloatVec & vec = rel->getRelatedFromWeights( obj ) ;
70  return reinterpret_cast<PTRTYPE>( &vec ) ;
71  }
72 
73  int lcrnvgaddrelation(PTRTYPE relation, PTRTYPE objectfrom, PTRTYPE objectto, float weight ){
74  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
75  LCObject* objf = f2c_pointer<LCObject,LCObject>( objectfrom ) ;
76  LCObject* objt = f2c_pointer<LCObject,LCObject>( objectto ) ;
77  rel->addRelation( objf, objt, weight ) ;
78  return LCIO::SUCCESS ;
79  }
80 
81  int lcrnvgremoverelation(PTRTYPE relation, PTRTYPE objectfrom, PTRTYPE objectto ){
82  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
83  LCObject* objf = f2c_pointer<LCObject,LCObject>( objectfrom ) ;
84  LCObject* objt = f2c_pointer<LCObject,LCObject>( objectto ) ;
85  rel->removeRelation( objf, objt ) ;
86  return LCIO::SUCCESS ;
87  }
88 
90  LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
91  LCCollection* col = rel->createLCCollection() ;
92  return reinterpret_cast<PTRTYPE>( col ) ;
93 
94  }
95 
96 
LCIO_DEPRECATED_CAPI PTRTYPE lcrnvcreatecollection(PTRTYPE relation)
Definition: lcrnv.cc:89
std::vector< LCObject * > LCObjectVec
Vector of (pointers to) LCObjects.
Definition: LCObject.h:17
CFORTRANPNTR CFORTRANPNTR lcrnvgremoverelation
Definition: lcrnv.h:50
std::vector< float > FloatVec
Vector of floats.
Definition: LCIOSTLTypes.h:18
CFORTRANPNTR lcrnvgetrelatedfromweights
Definition: lcrnv.h:45
LCIO_DEPRECATED_CAPI char * lcrnvgettotype(PTRTYPE relation)
Definition: lcrnv.cc:40
LCIO_DEPRECATED_CAPI PTRTYPE lcrnvcreatefromcollection(PTRTYPE collection)
Definition: lcrnv.cc:28
LCIO_DEPRECATED_CAPI PTRTYPE lcrnvgetrelatedtoweights(PTRTYPE relation, PTRTYPE object)
Definition: lcrnv.cc:59
long PTRTYPE
Fortran interface - define the length of pointers this has to made machine independent ...
Definition: cpointer.h:12
lcrnvgetrelatedfromobjects
Definition: lcrnv.h:41
LCIO_DEPRECATED_CAPI char * lcrnvgetfromtype(PTRTYPE relation)
Definition: lcrnv.cc:35
LCIO_DEPRECATED_CAPI int lcrnvgaddrelation(PTRTYPE relation, PTRTYPE objectfrom, PTRTYPE objectto, float weight)
Definition: lcrnv.cc:73
LCIO_DEPRECATED_CAPI PTRTYPE lcrnvgetrelatedtoobjects(PTRTYPE relation, PTRTYPE object)
Definition: lcrnv.cc:45
LCIO_DEPRECATED_CAPI int lcrnvdelete(PTRTYPE relation)
Definition: lcrnv.cc:21
LCIO_DEPRECATED_CAPI PTRTYPE lcrnvcreate(const char *fromType, const char *toType)
Header file for the f77-wrapper functions of the LCRelationNavigator class.
Definition: lcrnv.cc:15