00001 00009 #ifndef CPOINTER_H 00010 #define CPOINTER_H 1 00011 00012 typedef long PTRTYPE ; 00013 #define CFORTRANPNTR LONG 00014 #define CFORTRANPNTRV LONGV 00015 00016 #include <vector> 00017 typedef std::vector<PTRTYPE> PointerVec ; 00018 00024 template<class T, class O> T* f2c_pointer(PTRTYPE ptr){ 00025 00026 if(! (ptr) ) return 0 ; 00027 00028 O* o_ptr = reinterpret_cast<O*>( ptr ) ; 00029 00030 return dynamic_cast<T*>( o_ptr ) ; 00031 } 00032 00033 #define C2F_POINTER(T,ptr) reinterpret_cast<PTRTYPE>( dynamic_cast<T>( (ptr) ) ) 00034 00035 #endif