text: //--------------------------------------------------------------------------
  // Code generated by the SmartSoft MDSD Toolchain
  // The SmartSoft Toolchain has been developed by:
  //  
  // Service Robotics Research Center
  // University of Applied Sciences Ulm
  // Prittwitzstr. 10
  // 89075 Ulm (Germany)
  //
  // Information about the SmartSoft MDSD Toolchain is available at:
  // www.servicerobotik-ulm.de
  //
  // Please do not modify this file. It will be re-generated
  // running the code generator.
  //--------------------------------------------------------------------------
  #ifndef DOMAINPRINT_KEYVALUEDATATYPEENUM_ENUM_H_
  #define DOMAINPRINT_KEYVALUEDATATYPEENUM_ENUM_H_
  
  #include <DomainPrint/enumKeyValueDataTypeEnumData.hh>
  
  #include <string>
  #include <iostream>
  #include <locale>
  
  // SmartUtils used in from_xml method
  #include "smartKnuthMorrisPratt.hh"
  
  namespace DomainPrint {
  	
  	class KeyValueDataTypeEnum {
  	private:
  		DomainPrintIDL::KeyValueDataTypeEnum value;
  		
  	public:
  		enum ENUM_KeyValueDataTypeEnum {
  			ENUM_VALUE_UNDEFINED = 0,
  			STRING = 1,
  			NUMBER = 2,
  			BOOL = 3,
  			BYTE = 4
  		};
  		
  		// default constructor
  		KeyValueDataTypeEnum() { 
  			value = ENUM_VALUE_UNDEFINED;
  		}
  		
  		// copy constructor for enum type
  		KeyValueDataTypeEnum(ENUM_KeyValueDataTypeEnum e) {
  			value = static_cast<int>(e);
  		}
  		
  		// copy constructor for IDL type (which is typically int)
  		KeyValueDataTypeEnum(DomainPrintIDL::KeyValueDataTypeEnum e) {
  			value = e;
  		}
  		
  		//const DomainPrintIDL::KeyValueDataTypeEnum& get() const { return value; }
  		
  		// ENUM operator
  		operator ENUM_KeyValueDataTypeEnum() const {
  			return static_cast<ENUM_KeyValueDataTypeEnum>(value);
  		}
  		
  		// compare operator
  		bool operator == (const ENUM_KeyValueDataTypeEnum t) const {
  			return this->value == t;
  		}
  		
  		std::string to_string(const bool &use_fqn=true) const {
  			std::string result = "";
  			if(use_fqn == true) {
  				result = "KeyValueDataTypeEnum::";
  			}
  			switch (value) {
  				case STRING:
  					result += "STRING";
  					break;
  				case NUMBER:
  					result += "NUMBER";
  					break;
  				case BOOL:
  					result += "BOOL";
  					break;
  				case BYTE:
  					result += "BYTE";
  					break;
  				default:
  					result += "ENUM_VALUE_UNDEFINED";
  					break;
  			};
  			return result;
  		}
  		
  		static KeyValueDataTypeEnum from_string(const std::string &value) {
  			std::string input = value;
  			std::locale l;
  			for(auto &c: input) {
  				// convert all characters to lower case (so string comparison works regardless of small/capital letters)
  				c = std::tolower(c,l);
  			}
  			std::string base_name = "keyvaluedatatypeenum::";
  			if(input.compare(0, base_name.length(), base_name) == 0) {
  				// remove basename from comparing the actual enumeration
  				input.erase(0,base_name.length());
  			}
  			if(input == "string"){
  				return KeyValueDataTypeEnum(STRING);
  			}
  			if(input == "number"){
  				return KeyValueDataTypeEnum(NUMBER);
  			}
  			if(input == "bool"){
  				return KeyValueDataTypeEnum(BOOL);
  			}
  			if(input == "byte"){
  				return KeyValueDataTypeEnum(BYTE);
  			}
  			// default (if none of the preceding options match)
  			return KeyValueDataTypeEnum();
  		}
  		
  		// helper method to easily implement output stream
  		void to_ostream(std::ostream &os = std::cout) const {
  			os << to_string();
  		}
  		
  		// convert to xml stream
  		void to_xml(std::ostream &os, const std::string &indent = "") const {
  			os << indent << "<value>" << value << "</value>";
  		}
  		
  		// restore from xml stream
  		void from_xml(std::istream &is) {
  			static const Smart::KnuthMorrisPratt kmp_value("<value>");
  			if(kmp_value.search(is)) {
  				is >> value;
  			}
  		}
  	
  	};
  	
  	inline std::ostream &operator<<(std::ostream &os, const KeyValueDataTypeEnum &e)
  	{
  		e.to_ostream(os);
  		return os;
  	}
  };
  
  #endif
  