ANNA Suite  2020b
Multipurpose development suite for Telco applications
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
anna::Second Class Reference

#include <Second.hpp>

Public Types

typedef int type_t
 

Public Member Functions

 Second ()
 
 Second (const type_t value)
 
 Second (const Second &other)
 
 Second (const Millisecond &other)
 
 Second (const Microsecond &other)
 
 operator type_t () const
 
type_trefValue ()
 
Secondoperator= (const type_t other)
 
Secondoperator= (const Second &other)
 
Secondoperator= (const Millisecond &other)
 
Secondoperator= (const Microsecond &other)
 
bool operator== (const Second &other) const
 
bool operator== (const Millisecond &other) const
 
bool operator== (const Microsecond &other) const
 
bool operator!= (const Second &other) const
 
bool operator!= (const Millisecond &other) const
 
bool operator!= (const Microsecond &other) const
 
bool operator> (const Second &other) const
 
bool operator> (const Millisecond &other) const
 
bool operator> (const Microsecond &other) const
 
bool operator< (const Second &other) const
 
bool operator< (const Millisecond &other) const
 
bool operator< (const Microsecond &other) const
 
bool operator>= (const Second &other) const
 
bool operator>= (const Millisecond &other) const
 
bool operator>= (const Microsecond &other) const
 
bool operator<= (const Second &other) const
 
bool operator<= (const Millisecond &other) const
 
bool operator<= (const Microsecond &other) const
 
type_t getValue () const
 
std::string asDateTime (const char *format="%d/%0m/%Y %T") const
 
const char * asDateTime (char *result, const char *format="%d/%0m/%Y %T") const
 
std::string asString () const
 

Static Public Member Functions

static Second getTime ()
 
static Second getLocalTime ()
 
static Second fromString (const std::string &value) noexcept(false)
 

Static Public Attributes

static const int DateTimeSizeString = 21
 

Friends

class Millisecond
 
class Microsecond
 
class Second operator+ (const Second &left, const Second &right)
 
class Second operator- (const Second &left, const Second &right)
 
class Second operator/ (const Second &left, const Second &right)
 
class Second operator/ (const Second &left, const int right)
 
class Second operator/ (const Second &left, const unsigned int right)
 

Detailed Description

Clase para modelar la unidad temporal segundos.

Member Typedef Documentation

◆ type_t

typedef int anna::Second::type_t

Constructor & Destructor Documentation

◆ Second() [1/5]

anna::Second::Second ( )
inline

Constructor

44 : a_value(0) {;}

◆ Second() [2/5]

anna::Second::Second ( const type_t  value)
inlineexplicit

Constructor.

Parameters
valueValor inicial de esta instancia.
50 : a_value(value) {;}

◆ Second() [3/5]

anna::Second::Second ( const Second other)
inline

Constructor copia.

Parameters
otherInstancia de la que copiar.
56 : a_value(other.a_value) {;}
Here is the call graph for this function:

◆ Second() [4/5]

anna::Second::Second ( const Millisecond other)

Constructor copia.

Parameters
otherInstancia de la que copiar.

◆ Second() [5/5]

anna::Second::Second ( const Microsecond other)

Constructor copia.

Parameters
otherInstancia de la que copiar.

Member Function Documentation

◆ asDateTime() [1/2]

std::string anna::Second::asDateTime ( const char *  format = "%d/%0m/%Y %T") const

Devuelve una cadena con la hora en formato 'dd/mm/yyyy hh:mm:ss'.

Parameters
formatIndicador de formato.
Returns
Un literal con la hora en el formato 'dd/mm/yyyy hh:mm:ss'.
See also
man strftime

◆ asDateTime() [2/2]

const char* anna::Second::asDateTime ( char *  result,
const char *  format = "%d/%0m/%Y %T" 
) const

Devuelve una cadena con la hora en formato 'dd/mm/yyyy hh:mm:ss'.

Parameters
formatIndicador de formato.
resultPuntero donde vamos a guardar el resultado de la conversin. Debe tener espacio reservado para contener DateTimeSizeString caracteres.
See also
man strftime

◆ asString()

std::string anna::Second::asString ( ) const

Devuelve una cadena con el valor de esta instancia y las unidades "sec".

Returns
una cadena con el valor de esta instancia y las unidades "sec".

◆ fromString()

static Second anna::Second::fromString ( const std::string &  value)
staticnoexcept

Obtiene los microsegundos del valor contenido en la cadena recibida como parámetro.

Parameters
valueCadena que contiene los microsegundos habrá sido obtenida con asString.
Returns
los microsegundos del valor contenido en la cadena recibida como parámetro.

◆ getLocalTime()

static Second anna::Second::getLocalTime ( )
static

Devuelve la hora actual de sistema expresada en segundos transcurridos desde el 1 de Enero de 1970 aplicando las correciones correspondientes a la hora local.

Returns
la hora actual de sistema expresada en segundos transcurridos desde el 1 de Enero de 1970

◆ getTime()

static Second anna::Second::getTime ( )
static

Devuelve la hora actual de sistema expresada en segundos transcurridos desde el 1 de Enero de 1970

Returns
la hora actual de sistema expresada en segundos transcurridos desde el 1 de Enero de 1970

◆ getValue()

type_t anna::Second::getValue ( ) const
inline

Devuelve el valor asociado a esta instancia.

Returns
el valor asociado a esta instancia.
129 { return a_value; }
Here is the call graph for this function:

◆ operator type_t()

anna::Second::operator type_t ( ) const
inline

Conversor a numérico.

Returns
El valor asociado a esta instancia.
74 { return a_value; }

◆ operator!=() [1/3]

bool anna::Second::operator!= ( const Second other) const
inline
95 { return a_value != other.a_value; }

◆ operator!=() [2/3]

bool anna::Second::operator!= ( const Millisecond other) const

◆ operator!=() [3/3]

bool anna::Second::operator!= ( const Microsecond other) const

◆ operator<() [1/3]

bool anna::Second::operator< ( const Second other) const
inline
107 { return a_value < other.a_value; }

◆ operator<() [2/3]

bool anna::Second::operator< ( const Millisecond other) const

◆ operator<() [3/3]

bool anna::Second::operator< ( const Microsecond other) const

◆ operator<=() [1/3]

bool anna::Second::operator<= ( const Second other) const
inline
119 { return a_value <= other.a_value; }

◆ operator<=() [2/3]

bool anna::Second::operator<= ( const Millisecond other) const
inline
121 { return (operator==(other) == true) ? true : operator<(other); }
bool operator<(const Second &other) const
Definition: Second.hpp:107
Here is the call graph for this function:

◆ operator<=() [3/3]

bool anna::Second::operator<= ( const Microsecond other) const
inline
123 { return (operator==(other) == true) ? true : operator<(other); }
bool operator<(const Second &other) const
Definition: Second.hpp:107
Here is the call graph for this function:

◆ operator=() [1/4]

Second& anna::Second::operator= ( const type_t  other)
inline
81 { a_value = other; return *this; }

◆ operator=() [2/4]

Second& anna::Second::operator= ( const Second other)
inline
83 { a_value = other.a_value; return *this; }
Here is the call graph for this function:

◆ operator=() [3/4]

Second& anna::Second::operator= ( const Millisecond other)

◆ operator=() [4/4]

Second& anna::Second::operator= ( const Microsecond other)

◆ operator==() [1/3]

bool anna::Second::operator== ( const Second other) const
inline
89 { return a_value == other.a_value; }

◆ operator==() [2/3]

bool anna::Second::operator== ( const Millisecond other) const

◆ operator==() [3/3]

bool anna::Second::operator== ( const Microsecond other) const

◆ operator>() [1/3]

bool anna::Second::operator> ( const Second other) const
inline
101 { return a_value > other.a_value; }

◆ operator>() [2/3]

bool anna::Second::operator> ( const Millisecond other) const

◆ operator>() [3/3]

bool anna::Second::operator> ( const Microsecond other) const

◆ operator>=() [1/3]

bool anna::Second::operator>= ( const Second other) const
inline
113 { return a_value >= other.a_value; }

◆ operator>=() [2/3]

bool anna::Second::operator>= ( const Millisecond other) const
inline
115 { return (operator==(other) == true) ? true : operator>(other); }
bool operator>(const Second &other) const
Definition: Second.hpp:101
Here is the call graph for this function:

◆ operator>=() [3/3]

bool anna::Second::operator>= ( const Microsecond other) const
inline
117 { return (operator==(other) == true) ? true : operator>(other); }
bool operator>(const Second &other) const
Definition: Second.hpp:101
Here is the call graph for this function:

◆ refValue()

type_t& anna::Second::refValue ( )
inline
79 { return a_value; }

Friends And Related Function Documentation

◆ Microsecond

friend class Microsecond
friend

◆ Millisecond

friend class Millisecond
friend

◆ operator+

class Second operator+ ( const Second left,
const Second right 
)
friend
191 {
192  return Second(left.a_value + right.a_value);
193 }
Second()
Definition: Second.hpp:44

◆ operator-

class Second operator- ( const Second left,
const Second right 
)
friend
196 {
197  return Second(left.a_value - right.a_value);
198 }
Second()
Definition: Second.hpp:44

◆ operator/ [1/3]

class Second operator/ ( const Second left,
const Second right 
)
friend
201 {
202  return Second(left.a_value / right.a_value);
203 }
Second()
Definition: Second.hpp:44

◆ operator/ [2/3]

class Second operator/ ( const Second left,
const int  right 
)
friend
206 {
207  return Second(left.a_value / right);
208 }
Second()
Definition: Second.hpp:44

◆ operator/ [3/3]

class Second operator/ ( const Second left,
const unsigned int  right 
)
friend
211 {
212  return Second(left.a_value / right);
213 }
Second()
Definition: Second.hpp:44

Member Data Documentation

◆ DateTimeSizeString

const int anna::Second::DateTimeSizeString = 21
static

Tamaño de la memoria reservada que debe tener la variable usada para guardar el resultado de convertir el 'time' en texto.

See also
asDateTime

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