00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef _PFPARTICLE_H_
00019 #define _PFPARTICLE_H_
00020 
00021 #include "Object.h"
00022 #include <iostream>
00023 
00024 namespace RobotFlow {
00025 
00026 typedef enum
00027 {
00028         e_PFP_Generic = 0,
00029         e_PFP_Unknown
00030 } e_PFP_type;
00031 
00032 
00033 
00034 
00035 
00036 
00037 class PFParticle : public FD::Object
00038 {
00039         friend std::ostream &operator<<(std::ostream &o_out, const PFParticle &i_ref)
00040         {
00041                 try {
00042                         i_ref.printOn(o_out);
00043                         
00044                         return o_out;
00045                 }
00046                 catch (FD::BaseException *e) {
00047                         throw e->add(new FD::GeneralException("Exception in PFParticle::operator<<:",__FILE__,__LINE__));
00048                 }
00049         }
00050         
00051         friend std::istream &operator>>(std::istream &i_in, PFParticle &o_ref)
00052         {
00053                 try {
00054                         o_ref.readFrom(i_in);
00055                         
00056                         return i_in;
00057                 }
00058                 catch (FD::BaseException *e) {
00059                         throw e->add(new FD::GeneralException("Exception in PFParticle::operator>>:",__FILE__,__LINE__));
00060                 }
00061         }
00062         
00063 public:
00064         PFParticle()
00065         : m_pfpType(e_PFP_Unknown)
00066         { 
00067         }
00068         
00069         PFParticle(e_PFP_type i_pfpType) 
00070         : m_pfpType(i_pfpType)
00071         { 
00072         }
00073         
00074         PFParticle(const PFParticle &i_ref) 
00075         { 
00076                 m_pfpType = i_ref.m_pfpType;
00077         }
00078 
00079         virtual ~PFParticle()
00080         {
00081         
00082         }
00083 
00084         virtual PFParticle & operator =(const PFParticle &i_ref)
00085         {
00086                 
00087                 if (&i_ref != this) {
00088                         this->m_pfpType = i_ref.m_pfpType;
00089                 }
00090                 
00091                 return *this;
00092         }
00093         
00094         virtual PFParticle* clone()  const
00095         {
00096                 return new PFParticle(*this);
00097         }
00098 
00099         
00100         virtual void printOn(std::ostream &out) const
00101         {
00102                 throw new FD::GeneralException("Exception in PFParticle::printOn: cannot use base class routine.",__FILE__,__LINE__);
00103         }
00104 
00105         
00106         virtual void readFrom(std::istream &in)
00107         {
00108                 throw new FD::GeneralException("Exception in PFParticle::readFrom: cannot use base class routine.",__FILE__,__LINE__);
00109         }
00110         
00111         e_PFP_type GetType() const 
00112         { 
00113                 return m_pfpType; 
00114         }
00115         
00116         void SetType(e_PFP_type i_type)
00117         { 
00118                 m_pfpType = i_type; 
00119         }
00120         
00121         virtual unsigned int GetStateSize() const
00122         {
00123                 throw new FD::GeneralException("Exception in PFParticle::GetStateSize: cannot use base class routine.",__FILE__,__LINE__);
00124         }
00125         
00126         virtual float *GetState()
00127         {
00128                 throw new FD::GeneralException("Exception in PFParticle::GetState: cannot use base class routine.",__FILE__,__LINE__);
00129         }
00130         
00131         virtual const float *GetCstState() const 
00132         {
00133                 throw new FD::GeneralException("Exception in PFParticle::GetCstState: cannot use base class routine.",__FILE__,__LINE__);
00134         }
00135         
00136         virtual float GetStateIdx(int i_idx) const
00137         {
00138                 throw new FD::GeneralException("Exception in PFParticle::GetStateIdx: cannot use base class routine.",__FILE__,__LINE__);
00139         }
00140         
00141         virtual float GetWeight() const
00142         {
00143                 throw new FD::GeneralException("Exception in PFParticle::GetWeight: cannot use base class routine.",__FILE__,__LINE__);
00144         }
00145         
00146         virtual void SetStateSize(unsigned int i_size) 
00147         {
00148                 throw new FD::GeneralException("Exception in PFParticle::SetStateSize: cannot use base class routine.",__FILE__,__LINE__);
00149         }
00150         
00151         virtual void SetState(const float *i_state) 
00152         {
00153                 throw new FD::GeneralException("Exception in PFParticle::SetState: cannot use base class routine.",__FILE__,__LINE__);
00154         }
00155         
00156         virtual void SetStateIdx(int i_idx, float i_val)
00157         {
00158                 throw new FD::GeneralException("Exception in PFParticle::SetStateIdx: cannot use base class routine.",__FILE__,__LINE__);
00159         }
00160         
00161         virtual void SetWeight(float i_weight) 
00162         {
00163                 throw new FD::GeneralException("Exception in PFParticle::SetWeight: cannot use base class routine.",__FILE__,__LINE__);
00164         }
00165 
00166 private:
00167         e_PFP_type m_pfpType;
00168 };
00169 
00170 }
00171 
00172 #endif