14f982f4f776a2d393bc8cf118381ee27ac76644
[anna.git] / include / anna / diameter / codec / basetypes / Integer64.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_Integer64_hpp
10 #define anna_diameter_codec_basetypes_Integer64_hpp
11
12
13 // Local
14 #include <anna/diameter/codec/basetypes/AvpData.hpp>
15
16 #include <anna/core/util/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 Integer64 container
31 */
32 class Integer64 : public AvpData {
33
34   S64 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
44   // Class-specific ////////////////////////////////////////////////////////////////////////////////////
45   //
46   /**
47   * Gets the Integer64 value
48   *
49   * @return Integer64 value
50   */
51   const S64& getValue() const throw() { return a_value; }
52
53   /**
54   * Sets the Integer64 value
55   *
56   * @param value Integer64 value
57   */
58   void setValue(const S64& value) throw() { a_value = value; }
59   //
60   //////////////////////////////////////////////////////////////////////////////////////////////////////
61
62
63   // gets
64
65   virtual std::string getFormatName() const throw() { return "Integer64"; }
66   virtual int getSize() const throw() { return 8; }
67
68
69   // helpers
70
71   std::string asPrintableString() throw(anna::RuntimeException) {
72     return anna::functions::asString((anna::S64)a_value);
73   }
74
75   std::string asString() throw(anna::RuntimeException) {
76     return asPrintableString();
77   }
78
79
80   // sets
81
82   void decode(const char* buffer, const int size) throw(anna::RuntimeException);
83 };
84
85 }
86 }
87 }
88 }
89
90 #endif