Remove warnings
[anna.git] / include / anna / diameter / codec / basetypes / Float32.hpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
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 //
7
8
9 #ifndef anna_diameter_codec_basetypes_Float32_hpp
10 #define anna_diameter_codec_basetypes_Float32_hpp
11
12
13 // Local
14 #include <anna/diameter/codec/basetypes/AvpData.hpp>
15
16 #include <anna/config/defines.hpp>
17
18 #include <anna/comm/functions.hpp>
19
20 namespace anna {
21
22 namespace diameter {
23
24 namespace codec {
25
26 class Avp;
27
28 namespace basetypes {
29
30 /**
31 * Diameter Float32 container
32 */
33 class Float32 : public AvpData {
34
35   F32 a_value;
36
37
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);
41
42 public:
43
44   virtual ~Float32() {;}
45
46   // Class-specific ////////////////////////////////////////////////////////////////////////////////////
47   //
48   /**
49   * Gets the Float32 value
50   *
51   * @return Float32 value
52   */
53   const F32& getValue() const throw() { return a_value; }
54
55   /**
56   * Sets the Float32 value
57   *
58   * @param value Float32 value
59   */
60   void setValue(const F32& value) throw() { a_value = value; }
61   //
62   //////////////////////////////////////////////////////////////////////////////////////////////////////
63
64
65   // gets
66
67   virtual std::string getFormatName() const throw() { return "Float32"; }
68   virtual int getSize() const throw() { return 4; }
69
70
71   // helpers
72
73   std::string asPrintableString() throw(anna::RuntimeException) {
74     return anna::functions::asString(a_value);
75   }
76
77   std::string asString() throw(anna::RuntimeException) {
78     return asPrintableString();
79   }
80
81
82   // sets
83
84   void decode(const char* buffer, const int size) throw(anna::RuntimeException);
85 };
86
87 }
88 }
89 }
90 }
91
92 #endif