ANNA Suite  2020b
Multipurpose development suite for Telco applications
Unsigned16.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_helpers_tme_codectypes_Unsigned16_hpp
10 #define anna_diameter_helpers_tme_codectypes_Unsigned16_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 class Avp;
25 }
26 
27 namespace helpers {
28 
29 namespace tme {
30 
31 namespace codectypes {
32 
37 
38  U16 a_value;
39 
40 
41  // Only for derived diameter type:
42  void updateBasic() noexcept(false);
43  void setPrintableString(const char * printableString) noexcept(false);
44 
45 public:
46 
47 
48  // Class-specific ////////////////////////////////////////////////////////////////////////////////////
49  //
55  const U16& getValue() const { return a_value; }
56 
62  void setValue(const U16& value) { a_value = value; updateBasic(); }
63  //
65 
66 
67  // gets
68 
69  std::string getFormatName() const { return "Unsigned16"; }
70 
71 
72  // helpers
73 
74  std::string asPrintableString() noexcept(false) {
75  return anna::functions::asString(a_value);
76  }
77 
78  std::string asString() noexcept(false) {
79  return asPrintableString();
80  }
81 
82 
83  // sets
84 
85  void decode(const char* buffer, const int size) noexcept(false);
86 
87 
88  // exports /////////////////////////////
89  using AvpData::getSize;
90  using AvpData::code;
91  //using OctetString::asPrintableString;
93  //using OctetString::asString;
95  //using OctetString::decode;
98 };
99 
100 }
101 }
102 }
103 }
104 }
105 
106 #endif
uint16_t U16
Definition: defines.hpp:69
std::string getFormatName() const
Definition: Unsigned16.hpp:69
void setValue(const U16 &value)
Definition: Unsigned16.hpp:62
void fromPrintableString(const char *printableString) noexcept(false)
Definition: AvpData.hpp:224
static std::string asString(const int number)
const U16 & getValue() const
Definition: Unsigned16.hpp:55
Definition: OctetString.hpp:30
std::string asString() noexcept(false)
Definition: Unsigned16.hpp:78
std::string asPrintableString() noexcept(false)
Definition: Unsigned16.hpp:74
std::string asDataBlockString() noexcept(false)
Definition: AvpData.hpp:171
std::string asHexString() noexcept(false)
Definition: AvpData.hpp:196
Definition: app.hpp:12
void code(char *buffer, int &size) noexcept(false)
Definition: AvpData.hpp:147
void fromHexString(const std::string &hexString) noexcept(false)
Definition: AvpData.hpp:240