ANNA Suite  2020b
Multipurpose development suite for Telco applications
Public Member Functions | List of all members
anna::dbms::Float Class Reference

#include <Float.hpp>

Inheritance diagram for anna::dbms::Float:
Inheritance graph
[legend]
Collaboration diagram for anna::dbms::Float:
Collaboration graph
[legend]

Public Member Functions

 Float (const bool isNulleable=false, const char *format="%f")
 
 Float (const Float &other)
 
float getValue () const
 
const char * getFormat () const
 
Floatoperator= (const Float &other) noexcept(false)
 
Floatoperator= (const float value) noexcept(false)
 
 operator float () const
 
std::string asString () const
 
- Public Member Functions inherited from anna::dbms::Data
int getMaxSize () const
 
Type::_v getType () const
 
void * getBuffer ()
 
bool isNull () const
 
bool isNulleable () const
 
void setNull (const bool isNull)
 
void clear ()
 

Additional Inherited Members

- Protected Member Functions inherited from anna::dbms::Data
 Data (const Type::_v type, const int maxSize, const bool isNulleable)
 
 Data (const Data &other)
 
void setBuffer (void *buffer)
 

Detailed Description

Numero en coma flotante usado como entrada y/o salida de las sentencias SQL.

Constructor & Destructor Documentation

◆ Float() [1/2]

anna::dbms::Float::Float ( const bool  isNulleable = false,
const char *  format = "%f" 
)
inlineexplicit

Constructor.

Parameters
isNulleableIndica si el dato puede tomar valores nulos. format Indica el indicador de formato para pasar de cadena a numero. Usa la misma nomenclatura que printf, scanf, etc. Su uso dependerá del gestor de base de datos usado.
31  :
32  Data(Type::Float, sizeof(float), isNulleable),
33  a_format(format),
34  a_value(0.0) {
35  Data::setBuffer(&a_value);
36  }
Data(const Type::_v type, const int maxSize, const bool isNulleable)
Definition: Data.hpp:107
void setBuffer(void *buffer)
Definition: Data.hpp:131
bool isNulleable() const
Definition: Data.hpp:68
Definition: Data.hpp:33
Here is the call graph for this function:

◆ Float() [2/2]

anna::dbms::Float::Float ( const Float other)
inline

Constructor copia.

Parameters
otherInstancia de la que copiar.
42  : Data(other), a_value(other.a_value), a_format(other.a_format) {
43  Data::setBuffer(&a_value);
44  }
Data(const Type::_v type, const int maxSize, const bool isNulleable)
Definition: Data.hpp:107
void setBuffer(void *buffer)
Definition: Data.hpp:131
Here is the call graph for this function:

Member Function Documentation

◆ asString()

std::string anna::dbms::Float::asString ( ) const
virtual

Devuelve una cadena con la informacion referente a esta instancia.

Returns
Una cadena con la informacion referente a esta instancia.

Reimplemented from anna::dbms::Data.

◆ getFormat()

const char* anna::dbms::Float::getFormat ( ) const
inline

Devuelve el formato que indica la forma en la que el número será representado sobre una cadena, en caso de que fuera necesario.

64 { return a_format; }

◆ getValue()

float anna::dbms::Float::getValue ( ) const
inline

Metodo obsoleto, debería usar getValue. Devuelve el contenido del campo de tipo Float.

Returns
el contenido del campo de tipo Float.
Warning
Si el metodo Data::isNull devolvio true el resultado de este metodo no esta definido. Devuelve el valor asociado a este campo.
Returns
Devuelve el valor asociado a este campo.
58 { return a_value; }

◆ operator float()

anna::dbms::Float::operator float ( ) const
inline

Operador de conversion.

Warning
Si la columna asociada tiene un valor NULL, devolvera 0.0.
Returns
El contenido de esta cadena.
96 { return getValue(); }
float getValue() const
Definition: Float.hpp:58
Here is the call graph for this function:

◆ operator=() [1/2]

Float& anna::dbms::Float::operator= ( const Float other)
inlinenoexcept

Operador de copia.

Parameters
otherFloat del que copiar.
Returns
La instancia de esta cadena.
71  {
72  if(this != &other) {
73  setNull(other.isNull());
74  a_value = other.a_value;
75  }
76 
77  return *this;
78  }
void setNull(const bool isNull)
Definition: Data.hpp:76
Here is the call graph for this function:

◆ operator=() [2/2]

Float& anna::dbms::Float::operator= ( const float  value)
inlinenoexcept

Operador de asignacion.

Parameters
valueFloat del que copiar.
Returns
La instancia de esta cadena.
85  {
86  a_value = value;
87  setNull(false);
88  return *this;
89  }
void setNull(const bool isNull)
Definition: Data.hpp:76
Here is the call graph for this function:

The documentation for this class was generated from the following file: