1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_diameter_codec_basetypes_Float32_hpp
10 #define anna_diameter_codec_basetypes_Float32_hpp
14 #include <anna/diameter/codec/basetypes/AvpData.hpp>
16 #include <anna/config/defines.hpp>
18 #include <anna/comm/functions.hpp>
31 * Diameter Float32 container
33 class Float32 : public AvpData {
38 // Mandatory for basic diameter type:
39 void codeBasic(char* buffer, int &size) throw(anna::RuntimeException);
40 void setPrintableString(const char * printableString) throw(anna::RuntimeException);
45 // Class-specific ////////////////////////////////////////////////////////////////////////////////////
48 * Gets the Float32 value
50 * @return Float32 value
52 const F32& getValue() const throw() { return a_value; }
55 * Sets the Float32 value
57 * @param value Float32 value
59 void setValue(const F32& value) throw() { a_value = value; }
61 //////////////////////////////////////////////////////////////////////////////////////////////////////
66 virtual std::string getFormatName() const throw() { return "Float32"; }
67 virtual int getSize() const throw() { return 4; }
72 std::string asPrintableString() throw(anna::RuntimeException) {
73 return anna::functions::asString(a_value);
76 std::string asString() throw(anna::RuntimeException) {
77 return asPrintableString();
83 void decode(const char* buffer, const int size) throw(anna::RuntimeException);