Remove warnings
[anna.git] / include / anna / diameter / codec / basetypes / Unsigned32.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_Unsigned32_hpp
10 #define anna_diameter_codec_basetypes_Unsigned32_hpp
11
12
13 // Local
14 #include <anna/diameter/codec/basetypes/AvpData.hpp>
15
16 #include <anna/config/defines.hpp>
17
18
19 namespace anna {
20
21 namespace diameter {
22
23 namespace codec {
24
25 class Avp;
26
27 namespace basetypes {
28
29 /**
30 * Diameter Unsigned32 container
31 */
32 class Unsigned32 : public AvpData {
33
34   U32 a_value;
35
36
37   // Mandatory for basic diameter type:
38   void codeBasic(char* buffer, int &size) throw(anna::RuntimeException);
39   void setPrintableString(const char * printableString) throw(anna::RuntimeException);
40
41 public:
42
43   virtual ~Unsigned32() {;}
44
45   // Class-specific ////////////////////////////////////////////////////////////////////////////////////
46   //
47   /**
48   * Gets the Unsigned32 value
49   *
50   * @return Unsigned32 value
51   */
52   const U32& getValue() const throw() { return a_value; }
53
54   /**
55   * Sets the Unsigned32 value
56   *
57   * @param value Unsigned32 value
58   */
59   void setValue(const U32& value) throw() { a_value = value; }
60   //
61   //////////////////////////////////////////////////////////////////////////////////////////////////////
62
63
64   // gets
65
66   virtual std::string getFormatName() const throw() { return "Unsigned32"; }
67   virtual int getSize() const throw() { return 4; }
68
69
70   // helpers
71
72   std::string asPrintableString() throw(anna::RuntimeException) {
73     return anna::functions::asString(a_value);
74   }
75
76   std::string asString() throw(anna::RuntimeException) {
77     return asPrintableString();
78   }
79
80
81   // sets
82
83   void decode(const char* buffer, const int size) throw(anna::RuntimeException);
84 };
85
86 }
87 }
88 }
89 }
90
91 #endif