ANNA Suite  2020b
Multipurpose development suite for Telco applications
Integer32.hpp
Go to the documentation of this file.
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_Integer32_hpp
10 #define anna_diameter_codec_basetypes_Integer32_hpp
11 
12 
13 // Local
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 
32 class Integer32 : public AvpData {
33 
34  S32 a_value;
35 
36 
37  // Mandatory for basic diameter type:
38  void codeBasic(char* buffer, int &size) noexcept(false);
39  void setPrintableString(const char * printableString) noexcept(false);
40 
41 public:
42 
43  virtual ~Integer32() {;}
44 
45  // Class-specific ////////////////////////////////////////////////////////////////////////////////////
46  //
52  const S32& getValue() const { return a_value; }
53 
59  void setValue(const S32& value) { a_value = value; }
60  //
62 
63 
64  // gets
65 
66  virtual std::string getFormatName() const { return "Integer32"; }
67  virtual int getSize() const { return 4; }
68 
69 
70  // helpers
71 
72  std::string asPrintableString() noexcept(false) {
73  return anna::functions::asString(a_value);
74  }
75 
76  std::string asString() noexcept(false) {
77  return asPrintableString();
78  }
79 
80 
81  // sets
82 
83  void decode(const char* buffer, const int size) noexcept(false);
84 };
85 
86 }
87 }
88 }
89 }
90 
91 #endif
virtual std::string getFormatName() const
Definition: Integer32.hpp:66
virtual ~Integer32()
Definition: Integer32.hpp:43
void decode(const char *buffer, const int size) noexcept(false)
static std::string asString(const int number)
void setValue(const S32 &value)
Definition: Integer32.hpp:59
int32_t S32
Definition: defines.hpp:78
Definition: app.hpp:12
std::string asPrintableString() noexcept(false)
Definition: Integer32.hpp:72
std::string asString() noexcept(false)
Definition: Integer32.hpp:76
virtual int getSize() const
Definition: Integer32.hpp:67
const S32 & getValue() const
Definition: Integer32.hpp:52