00001 // $Id: RBCInput.h,v 1.5 2009/07/04 20:07:40 aosorio Exp $ 00002 #ifndef INTERFACE_RBCINPUT_H 00003 #define INTERFACE_RBCINPUT_H 1 00004 00005 // Include files 00006 #include <stdlib.h> 00007 #include <istream> 00008 #include <ostream> 00009 #include <iostream> 00010 #include <bitset> 00011 #include <vector> 00012 00022 class RBCInput { 00023 public: 00025 RBCInput( ) { 00026 input_sec = new std::bitset<15>[2]; 00027 needmapping = false; 00028 m_debug = false; 00029 hasData = false; 00030 }; 00031 00032 virtual ~RBCInput( ) { 00033 if ( input_sec ) delete[] input_sec; 00034 }; 00035 00036 RBCInput( const RBCInput & in ) 00037 { 00038 for(int i=0; i < 30; ++i) input[i] = in.input[i]; 00039 for(int i=0; i < 2; ++i) input_sec[i] = in.input_sec[i]; 00040 needmapping = in.needmapping; 00041 m_debug = in.m_debug; 00042 hasData = in.hasData; 00043 m_wheelId = in.m_wheelId; 00044 }; 00045 00046 RBCInput & operator=(const RBCInput & rhs) 00047 { 00048 if (this == &rhs) { 00049 std::cout << "RBCInput:(this=rhs)" << '\n'; return (*this); 00050 }; 00051 for(int i=0; i < 30; ++i) (*this).input[i] = rhs.input[i]; 00052 for(int i=0; i < 2; ++i) (*this).input_sec[i] = rhs.input_sec[i]; 00053 (*this).needmapping = rhs.needmapping; 00054 (*this).m_debug = rhs.m_debug; 00055 (*this).hasData = rhs.hasData; 00056 (*this).m_wheelId = rhs.m_wheelId; 00057 return (*this); 00058 }; 00059 00060 // io functions 00061 friend std::istream& operator>>(std::istream &istr, RBCInput &); 00062 friend std::ostream& operator<<(std::ostream &ostr, RBCInput &); 00063 00064 bool input[30]; 00065 std::bitset<15> * input_sec; 00066 00067 void printinfo() { 00068 std::cout << "RBCInput: " << (*this); 00069 }; 00070 00071 void mask ( const std::vector<int> & ); 00072 00073 void force( const std::vector<int> & ); 00074 00075 bool hasData; 00076 bool needmapping; 00077 00078 void setWheelId( int wid ) { 00079 m_wheelId = wid; 00080 }; 00081 00082 int wheelId() const { 00083 return m_wheelId; 00084 }; 00085 00086 00087 private: 00088 00089 bool m_debug; 00090 00091 int m_wheelId; 00092 00093 }; 00094 #endif // INTERFACE_RBCINPUT_H