00001 // -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*- 00002 #include "Configuration.h" 00003 #define _USE_MATH_DEFINES // for MSVC 00004 #include <math.h> 00005 #include <stdlib.h> 00006 00007 namespace PathEngine{ 00008 std::ostream& operator<< (std::ostream& out, const Configuration& cfg) 00009 { 00010 for (unsigned int i=0; i<cfg.size(); i++){ 00011 out << cfg.value(i) << " "; 00012 } 00013 return out; 00014 } 00015 } 00016 00017 using namespace PathEngine; 00018 00019 Configuration::Configuration(unsigned int i_size) 00020 { 00021 m_values.resize(i_size); 00022 } 00023 00024 const double Configuration::value(unsigned int i_rank) const 00025 { 00026 return m_values[i_rank]; 00027 } 00028 00029 double &Configuration::value(unsigned int i_rank) 00030 { 00031 return m_values[i_rank]; 00032 } 00033 00034 unsigned int Configuration::size() const 00035 { 00036 return m_values.size(); 00037 } 00038 00039 bool Configuration::operator!=(const Configuration& cfg) 00040 { 00041 if (size() != cfg.size()) return true; 00042 for (unsigned int i=0; i<size(); i++){ 00043 if (value(i) != cfg.value(i)) return true; 00044 } 00045 return false; 00046 } 00047 00048 bool Configuration::operator==(const Configuration& cfg) 00049 { 00050 if (size() != cfg.size()) return false; 00051 for (unsigned int i=0; i<size(); i++){ 00052 if (value(i) != cfg.value(i)) return false; 00053 } 00054 return true; 00055 }