00001 /* 00002 * BaseOption.h 00003 * 00004 * Created on: Oct 11, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef BASEOPTION_HPP_ 00009 #define BASEOPTION_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 00013 //#include <telekyb_base/Options/OptionContainer.hpp> 00014 00015 #include <iostream> 00016 #include <map> 00017 00018 // YAML 00019 #include <yaml-cpp/yaml.h> 00020 00021 namespace TELEKYB_NAMESPACE 00022 { 00023 00024 // forward declaration 00025 class OptionContainer; 00026 class BaseOption; 00027 00028 typedef std::map<std::string, BaseOption*> OptionsMap; 00029 00030 class BaseOption { 00031 protected: 00032 // Parent OptionContainer, always correct since Options can only be created from 00033 // OptionContainer 00034 OptionContainer* parent; 00035 00036 // stuff 00037 std::string name; 00038 std::string description; 00039 00040 bool mandatory; 00041 bool readOnly; 00042 00043 // is value still at inital? 00044 bool initialValue; 00045 00046 // Constructor is protected 00047 BaseOption(OptionContainer* parent_, const std::string name_, const std::string description_, bool mandatory_, bool readOnly_); 00048 00049 // void setParent(OptionContainer* parent_); 00050 // 00051 // friend class OptionContainer; 00052 00053 public: 00054 virtual ~BaseOption(); 00055 00056 // print Option Information? 00057 static bool printOptions; 00058 00059 std::string getName() const; 00060 std::string getDescription() const; 00061 std::string getNamespace() const; 00062 std::string getNSName() const; 00063 00064 OptionContainer* getParent() const; 00065 00066 bool isMandatory() const; 00067 bool isReadOnly() const; 00068 bool isOnInitialValue() const; 00069 00070 00071 virtual void print() const = 0; 00072 virtual bool hasBounds() const = 0; 00073 virtual bool updateFromRawOptions(bool onlyUpdateIntial) = 0;\ 00074 virtual void get(YAML::Node& node) = 0; 00075 virtual bool set(const YAML::Node& node) = 0; 00076 00077 }; 00078 00079 } // namespace 00080 00081 #endif /* BASEOPTION_H_ */