00001 
00002 
00008 
00009 
00011 
00012 #ifndef __SSF_FUNCTOR_H__
00013 #define __SSF_FUNCTOR_H__
00014 
00015 #include <Matrix.h>
00016 #include "Time.h"
00017 #include "OrbitState.h"
00018 #include "AttitudeState.h"
00019 
00020 namespace O_SESSAME {
00021 
00063 class Functor
00064 {
00065 public:
00066 
00067       
00068       
00069       
00070       virtual Vector Call(const ssfTime&, const OrbitState&, const AttitudeState&) const =0;        
00071 };
00072 
00078 class SpecificFunctor : public Functor
00079 {
00080 private:
00081       Vector (*fpt)(const ssfTime&, const OrbitState&, const AttitudeState&);           
00082 
00083 public:
00084 
00085       
00086       SpecificFunctor(Vector(*_fpt)(const ssfTime&, const OrbitState&, const AttitudeState&)):fpt(_fpt) {};
00087 
00088       
00089       virtual Vector Call(const ssfTime &_ssfTime, const OrbitState &_orbState, const AttitudeState &_attState) const { return (*fpt)(_ssfTime, _orbState, _attState);};             
00090 };
00091 
00097 template <class TClass> class ObjectFunctor : public Functor
00098 {
00099 private:
00100       TClass* pt2Object;                        
00101       Vector (TClass::*fpt)(const ssfTime&, const OrbitState&, const AttitudeState&);           
00103 public:
00104 
00107       ObjectFunctor(TClass* _pt2Object, Vector(TClass::*_fpt)(const ssfTime&, const OrbitState&, const AttitudeState&)): pt2Object(_pt2Object),  fpt(_fpt) {};
00108       ObjectFunctor(): pt2Object(NULL),  fpt(NULL) {};
00109       void Set(TClass* _pt2Object, Vector(TClass::*_fpt)(const ssfTime&, const OrbitState&, const AttitudeState&)){ pt2Object = _pt2Object;  fpt=_fpt; };
00110       
00111       
00112       virtual Vector Call(const ssfTime &_ssfTime, const OrbitState &_orbState, const AttitudeState &_attState) const { return (*pt2Object.*fpt)(_ssfTime, _orbState, _attState);};             
00113 };
00114 } 
00115 
00116 #endif __SSF_FUNCTOR_H__
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125 
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149