/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/CPPFORT/lcrnv.cc

Go to the documentation of this file.
00001 
00002 #include "CPPFORT/lcrnv.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 
00013 using namespace lcio ;
00014 
00015  PTRTYPE lcrnvcreate( const char* fromType, const char* toType ){
00016    LCRelationNavigator*  relation = new LCRelationNavigator( fromType, toType ) ;
00017    return reinterpret_cast<PTRTYPE>( relation ) ;
00018 
00019  }
00020 
00021  int lcrnvdelete( PTRTYPE relation ){
00022    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00023    delete rel ;
00024    return LCIO::SUCCESS ;
00025 
00026  }
00027 
00028  PTRTYPE lcrnvcreatefromcollection( PTRTYPE collection ){
00029    LCCollection*  col = reinterpret_cast<LCCollection*>( collection ) ;
00030    LCRelationNavigator*  relation = new LCRelationNavigator( col ) ;
00031    return reinterpret_cast<PTRTYPE>( relation ) ;
00032 
00033  }
00034 
00035  char* lcrnvgetfromtype( PTRTYPE relation ){
00036    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00037    return const_cast<char*>(rel->getFromType().c_str() ) ;
00038  }
00039 
00040  char* lcrnvgettotype( PTRTYPE relation ){
00041    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00042    return const_cast<char*>(rel->getToType().c_str() ) ;
00043  }
00044 
00045  PTRTYPE lcrnvgetrelatedtoobjects( PTRTYPE relation, PTRTYPE object ){
00046    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00047    LCObject* obj       = f2c_pointer<LCObject,LCObject>( object ) ;
00048    const LCObjectVec& vec    = rel->getRelatedToObjects( obj ) ;
00049    return reinterpret_cast<PTRTYPE>( &vec ) ;
00050  }
00051 
00052  PTRTYPE lcrnvgetrelatedfromobjects( PTRTYPE relation, PTRTYPE object ){
00053    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00054    LCObject* obj       = f2c_pointer<LCObject,LCObject>( object ) ;
00055    const LCObjectVec& vec    = rel->getRelatedFromObjects( obj ) ;
00056    return reinterpret_cast<PTRTYPE>( &vec ) ;
00057  }
00058 
00059  PTRTYPE lcrnvgetrelatedtoweights ( PTRTYPE relation, PTRTYPE object ){
00060    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00061    LCObject* obj       = f2c_pointer<LCObject,LCObject>( object ) ;
00062    const FloatVec &  vec     = rel->getRelatedToWeights( obj ) ;
00063    return reinterpret_cast<PTRTYPE>( &vec ) ;
00064  }
00065 
00066  PTRTYPE lcrnvgetrelatedfromweights ( PTRTYPE relation, PTRTYPE object ){
00067    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00068    LCObject* obj       = f2c_pointer<LCObject,LCObject>( object ) ;
00069    const FloatVec &  vec     = rel->getRelatedFromWeights( obj ) ;
00070    return reinterpret_cast<PTRTYPE>( &vec ) ;
00071  }
00072 
00073  int lcrnvgaddrelation(PTRTYPE relation, PTRTYPE objectfrom, PTRTYPE objectto, float weight ){
00074    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00075    LCObject* objf      = f2c_pointer<LCObject,LCObject>( objectfrom ) ;
00076    LCObject* objt      = f2c_pointer<LCObject,LCObject>( objectto ) ;
00077    rel->addRelation( objf, objt, weight ) ;
00078    return LCIO::SUCCESS ;
00079  }
00080 
00081  int lcrnvgremoverelation(PTRTYPE relation, PTRTYPE objectfrom, PTRTYPE objectto ){
00082    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00083    LCObject* objf      = f2c_pointer<LCObject,LCObject>( objectfrom ) ;
00084    LCObject* objt      = f2c_pointer<LCObject,LCObject>( objectto ) ;
00085    rel->removeRelation( objf, objt ) ;
00086    return LCIO::SUCCESS ;
00087  }
00088 
00089  PTRTYPE lcrnvcreatecollection(PTRTYPE relation ){
00090    LCRelationNavigator* rel = reinterpret_cast<LCRelationNavigator*>( relation ) ;
00091    LCCollection*  col = rel->createLCCollection() ;
00092    return reinterpret_cast<PTRTYPE>( col ) ;
00093 
00094  }
00095 
00096 

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