Remove dynamic exceptions
[anna.git] / source / diameter / codec / basetypes / Float64.cpp
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 // Local
10 #include <anna/diameter/codec/basetypes/Float64.hpp>
11
12
13 //------------------------------------------------------------------------------
14 //--------------------------------------------------------- Float64::codeBasic()
15 //------------------------------------------------------------------------------
16 void anna::diameter::codec::basetypes::Float64::codeBasic(char* buffer, int &size) noexcept(false) {
17   /*buffer=*/
18   anna::comm::functions::codeDouble(buffer, a_value);
19   size = getSize();
20 }
21
22
23 //------------------------------------------------------------------------------
24 //------------------------------------------------ Float64::setPrintableString()
25 //------------------------------------------------------------------------------
26 void anna::diameter::codec::basetypes::Float64::setPrintableString(const char * printableString) noexcept(false) {
27   setValue(atof/*strtod*/(printableString));
28 }
29
30
31 //------------------------------------------------------------------------------
32 //------------------------------------------------------------ Float64::decode()
33 //------------------------------------------------------------------------------
34 void anna::diameter::codec::basetypes::Float64::decode(const char* buffer, const int size) noexcept(false) {
35   if(!buffer)
36     throw anna::RuntimeException("Float64::decode | Null Buffer provided", ANNA_FILE_LOCATION);
37
38   if(size != 8)
39     throw anna::RuntimeException("Float64::decode | Buffer length must be 8 bytes", ANNA_FILE_LOCATION);
40
41   a_value = anna::comm::functions::decodeDouble(buffer);
42 }
43