00001
00002 #include "CPPFORT/lcrel.h"
00003
00004 #include "lcio.h"
00005 #include "IMPL/LCRelationImpl.h"
00006 #include <iostream>
00007
00008 using namespace lcio ;
00009
00010 PTRTYPE lcrelcreate0(){
00011 LCRelationImpl* relation = new LCRelationImpl() ;
00012 return reinterpret_cast<PTRTYPE>( relation ) ;
00013 }
00014
00015 PTRTYPE lcrelcreate( PTRTYPE objectfrom, PTRTYPE objectto, float weight ){
00016 LCObject* objf = f2c_pointer<LCObject,LCObject>( objectfrom ) ;
00017 LCObject* objt = f2c_pointer<LCObject,LCObject>( objectto ) ;
00018 LCRelationImpl* relation = new LCRelationImpl( objf, objt, weight ) ;
00019 return reinterpret_cast<PTRTYPE>( relation ) ;
00020 }
00021
00022 int lcreldelete( PTRTYPE relation ){
00023 LCRelationImpl* rel = reinterpret_cast<LCRelationImpl*>( relation ) ;
00024 delete rel ;
00025 return LCIO::SUCCESS ;
00026 }
00027
00028 int lcrelid( PTRTYPE relation ){
00029 LCRelationImpl* rel = reinterpret_cast<LCRelationImpl*>( relation ) ;
00030 return rel->id() ;
00031 }
00032
00033 PTRTYPE lcrelgetfrom( PTRTYPE relation ){
00034 LCRelationImpl* rel = reinterpret_cast<LCRelationImpl*>( relation ) ;
00035 LCObject* object = rel->getFrom() ;
00036 return reinterpret_cast<PTRTYPE>( object ) ;
00037 }
00038
00039 PTRTYPE lcrelgetto( PTRTYPE relation ){
00040 LCRelationImpl* rel = reinterpret_cast<LCRelationImpl*>( relation ) ;
00041 LCObject* object = rel->getTo() ;
00042 return reinterpret_cast<PTRTYPE>( object ) ;
00043 }
00044
00045 float lcrelgetweight( PTRTYPE relation ){
00046 LCRelationImpl* rel = reinterpret_cast<LCRelationImpl*>( relation ) ;
00047 return rel->getWeight() ;
00048 }
00049
00050 int lcrelsetfrom(PTRTYPE relation, PTRTYPE object ){
00051 LCRelationImpl* rel = reinterpret_cast<LCRelationImpl*>( relation ) ;
00052 LCObject* obj = f2c_pointer<LCObject,LCObject>( object ) ;
00053 rel->setFrom( obj ) ;
00054 return LCIO::SUCCESS ;
00055 }
00056
00057 int lcrelsetto(PTRTYPE relation, PTRTYPE object ){
00058 LCRelationImpl* rel = reinterpret_cast<LCRelationImpl*>( relation ) ;
00059 LCObject* obj = f2c_pointer<LCObject,LCObject>( object ) ;
00060 rel->setTo( obj ) ;
00061 return LCIO::SUCCESS ;
00062 }
00063
00064 int lcrelsetweight(PTRTYPE relation, float weight ){
00065 LCRelationImpl* rel = reinterpret_cast<LCRelationImpl*>( relation ) ;
00066 rel->setWeight( weight ) ;
00067 return LCIO::SUCCESS ;
00068 }
00069