#include <InputDevice.h>
Inheritance diagram for cmil::tInputIndex< T >:
Public Member Functions | |
tInputIndex (unsigned int size) | |
tInputIndex () | |
bool | addData (InputData *input) |
void | fill_indexes (const std::string &device_name, const std::string &input_name, unsigned int num, DeviceInputs &inputs) |
unsigned int | getSize () const |
bool | setData (unsigned int i, InputData *input) |
This particular member must be inline for some compilers. | |
T * | getData (unsigned int i) const |
std::string | getName () const |
bool | operator== (const tInputIndex< T > &other) const |
Private Attributes | |
std::vector< T * > | m_index |
Definition at line 82 of file InputDevice.h.
cmil::tInputIndex< T >::tInputIndex | ( | unsigned int | size | ) | [inline] |
cmil::tInputIndex< T >::tInputIndex | ( | ) | [inline] |
bool cmil::tInputIndex< T >::addData | ( | InputData * | input | ) |
Definition at line 319 of file InputDevice.cpp.
References Logger::log_error(), and cmil::tInputIndex< T >::m_index.
Referenced by cmil::tInputIndex< T >::fill_indexes().
00319 { 00320 T* tmp_input_type; 00321 00322 if(!input) { 00323 log_error("addData(input) failed to add due to null input passed."); 00324 return false; 00325 } 00326 if ( (tmp_input_type = dynamic_cast<T*>(input)) != 0 ) { 00327 m_index.push_back(tmp_input_type); 00328 return true; 00329 } 00330 else { 00331 log_error("addData(input) failed to add due to casting failure."); 00332 return false; 00333 } 00334 }
Here is the call graph for this function:
Here is the caller graph for this function:
void cmil::tInputIndex< T >::fill_indexes | ( | const std::string & | device_name, | |
const std::string & | input_name, | |||
unsigned int | num, | |||
DeviceInputs & | inputs | |||
) |
Definition at line 336 of file InputDevice.cpp.
References cmil::DeviceInputs::add(), cmil::tInputIndex< T >::addData(), and cmil::tInputIndex< T >::getData().
00339 { 00340 00341 std::ostringstream numeral_ss; 00342 T* tmp_input; 00343 00344 for(unsigned int i = 0; i < num; ++i) { 00345 numeral_ss << input_name << i; 00346 tmp_input = new T(numeral_ss.str()); 00347 00348 inputs.add(device_name, tmp_input); 00349 00350 addData(tmp_input); 00351 00352 numeral_ss.str(""); 00353 } 00354 00355 InputData *input_d = NULL; 00356 00357 for(unsigned int i = 0; i < num; ++i) { 00358 numeral_ss << input_name << i; 00359 input_d = getData(i); 00360 //std::cout << "input named: " << input_d->getName() << " stored in data indexed as:" << numeral_ss.str() << std::endl; 00361 numeral_ss.str(""); 00362 } 00363 }
Here is the call graph for this function:
T * cmil::tInputIndex< T >::getData | ( | unsigned int | i | ) | const |
Definition at line 369 of file InputDevice.cpp.
References cmil::tInputIndex< T >::m_index.
Referenced by cmil::tInputIndex< T >::fill_indexes().
Here is the caller graph for this function:
std::string cmil::tInputIndex< T >::getName | ( | ) | const [virtual] |
unsigned int cmil::tInputIndex< T >::getSize | ( | ) | const |
Definition at line 365 of file InputDevice.cpp.
References cmil::tInputIndex< T >::m_index.
00365 { 00366 return m_index.size(); 00367 }
bool cmil::tInputIndex< T >::operator== | ( | const tInputIndex< T > & | other | ) | const |
Definition at line 379 of file InputDevice.cpp.
References cmil::tInputIndex< T >::m_index.
00379 { 00380 if(m_index.size() != other.m_index.size()) 00381 return false; 00382 else 00383 for(unsigned int i = 0 ; i < m_index.size() ; ++i) 00384 if( typeid(*(m_index[i])) != typeid(*(other.m_index[i])) ) 00385 return false; 00386 00387 return true; 00388 }
bool cmil::tInputIndex< T >::setData | ( | unsigned int | i, | |
InputData * | input | |||
) | [inline] |
This particular member must be inline for some compilers.
Definition at line 95 of file InputDevice.h.
00095 { 00096 T* tmp_input_type; 00097 00098 if(m_index.size() >= i) 00099 if ( (tmp_input_type = dynamic_cast<T*>(input)) != 0 ) { 00100 if(m_index[i]) { 00101 log_error("setData() : InputData already present at key index value; memory will be leaked."); 00102 delete input; 00103 00104 return false; 00105 } 00106 else 00107 m_index[i] = tmp_input_type; 00108 } 00109 else 00110 return false; 00111 00112 return true; 00113 }
std::vector<T* > cmil::tInputIndex< T >::m_index [private] |
Definition at line 122 of file InputDevice.h.
Referenced by cmil::tInputIndex< T >::addData(), cmil::tInputIndex< T >::getData(), cmil::tInputIndex< T >::getSize(), cmil::tInputIndex< T >::operator==(), and cmil::tInputIndex< cmil::Hat >::setData().