00001 #ifndef _configuration_hh_ 00002 #define _configuration_hh_ 00003 00004 #include "vector.hh" 00005 #include "matrix.hh" 00006 #include <string> 00007 #include <stdlib.h> 00008 #include <list> 00009 00010 namespace anoid { 00012 namespace config { 00013 00014 class Configuration { 00015 public: 00016 Configuration() {} 00017 virtual ~Configuration() {} 00018 virtual std::string getString(const char *name) = 0; 00019 std::string getString(const std::string& name) { return getString(name.c_str()); } 00020 simple::Vector getVector(const char *name) { std::string s = getString(name); return simple::Vector(s); } 00021 simple::Vector getVector(const std::string& name) { return getVector(name.c_str()); } 00022 int getInteger(const char *name) { return atoi(getString(name).c_str()); } 00023 int getInteger(const std::string& name) { return getInteger(name.c_str()); } 00024 double getDouble(const char *name) { return atof(getString(name).c_str()); } 00025 double getDouble(const std::string& name) { return getDouble(name.c_str()); } 00026 00027 virtual bool hasElement(const char *name) = 0; 00028 bool hasElement(const std::string& name) { return hasElement(name.c_str()); } 00029 00030 virtual std::string getName() = 0; 00031 00032 virtual std::list<Configuration *> getChildren() = 0; 00033 }; 00034 00035 }; 00036 }; 00037 00038 #endif