1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
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 //
9 #ifndef anna_diameter_helpers_tme_codectypes_Unsigned16_hpp
10 #define anna_diameter_helpers_tme_codectypes_Unsigned16_hpp
14 #include <anna/diameter/codec/basetypes/OctetString.hpp>
16 #include <anna/config/defines.hpp>
31 namespace codectypes {
34 * Diameter Unsigned16 container
36 class Unsigned16 : codec::basetypes::OctetString {
41 // Only for derived diameter type:
42 void updateBasic() throw(anna::RuntimeException);
43 void setPrintableString(const char * printableString) throw(anna::RuntimeException);
48 // Class-specific ////////////////////////////////////////////////////////////////////////////////////
51 * Gets the Unsigned16 value
53 * @return Unsigned16 value
55 const U16& getValue() const throw() { return a_value; }
58 * Sets the Unsigned16 value
60 * @param value Unsigned16 value
62 void setValue(const U16& value) throw() { a_value = value; updateBasic(); }
64 //////////////////////////////////////////////////////////////////////////////////////////////////////
69 std::string getFormatName() const throw() { return "Unsigned16"; }
74 std::string asPrintableString() throw(anna::RuntimeException) {
75 return anna::functions::asString(a_value);
78 std::string asString() throw(anna::RuntimeException) {
79 return asPrintableString();
85 void decode(const char* buffer, const int size) throw(anna::RuntimeException);
88 // exports /////////////////////////////
89 using AvpData::getSize;
91 //using OctetString::asPrintableString;
92 using AvpData::asDataBlockString;
93 //using OctetString::asString;
94 using AvpData::asHexString;
95 //using OctetString::decode;
96 using AvpData::fromPrintableString;
97 using AvpData::fromHexString;