ANNA Suite  2020b
Multipurpose development suite for Telco applications
Static Public Member Functions | List of all members
anna::app::functions Struct Reference

#include <functions.hpp>

Inheritance diagram for anna::app::functions:
Inheritance graph
[legend]
Collaboration diagram for anna::app::functions:
Collaboration graph
[legend]

Static Public Member Functions

static ApplicationgetApp () noexcept(false)
 
template<typename T >
static T * componentByName (const char *className, const char *fromFile, const int fromLine) noexcept(false)
 
- Static Public Member Functions inherited from anna::functions
static std::string getVersion ()
 
static std::string getArchitecture ()
 
static std::string asString (const int number)
 
static std::string asString (const unsigned int number)
 
static std::string asString (const S64 number)
 
static std::string asString (const U64 number)
 
static const char * asString (const bool _bool)
 
static std::string asString (const DataBlock &dataBlock, const int characterByLine=16)
 
static std::string asString (const double v, const char *format="%e")
 
static std::string asString (const float v, const char *format="%f")
 
static std::string asText (const char *comment, const int number)
 
static std::string asText (const char *comment, const S64 number)
 
static std::string asText (const char *comment, const bool _bool)
 
static std::string asText (const char *comment, const DataBlock &dataBlock, const int characterByLine=16)
 
static std::string asText (const char *comment, const float value, const char *format="%f")
 
static std::string asText (const char *comment, const double value, const char *format="%e")
 
static std::string asHexString (const int number)
 
static std::string asHexString (const S64 number)
 
static std::string asHexString (const U64 number)
 
static std::string asHexText (const char *comment, const int number)
 
static std::string asHexText (const char *comment, const S64 number)
 
static std::string asHexString (const DataBlock &dataBlock)
 
static DataBlockfromHexString (const std::string &hexString, DataBlock &target) noexcept(false)
 
static std::string asDateTime (const Second &second)
 
static const char * asDateTime (const Second &second, char *result)
 
static S64 hash (const char *str)
 
static S64 hash (const std::string &str)
 
static std::string asString (const char *format,...)
 
template<typename T >
static std::string asString (const T *t)
 
static const std::string & asString (const std::string &str)
 
static void sleep (const Millisecond &millisecond)
 
static Second second ()
 
static Microsecond microsecond ()
 
static Millisecond millisecond ()
 
static Microsecond hardwareClock ()
 
static bool asBool (const char *str) noexcept(false)
 
static int asInteger (const char *str)
 
static S64 asInteger64 (const char *str)
 
static pthread_t getCurrentThread ()
 
static bool supportMultithread ()
 
static bool isLike (const char *pattern, const std::string &value) noexcept(false)
 
static int bitsize (const int n)
 
static int bitsize (const S64 n)
 
static S64 merge (const char *whatis, const int n1, const int n2, const int bitShift) noexcept(false)
 
static int log2 (const unsigned int v)
 
static std::string entriesAsString (int number, const char *wordForSingular=NULL, const char *wordForPlural=NULL)
 
static std::string justify (const std::string &title, TextJustifyMode::_v mode=TextJustifyMode::Left, char filler=' ')
 
static std::string highlight (const std::string &title, TextHighlightMode::_v mode=TextHighlightMode::Underline, char filler='-', bool appendCR=true)
 
static std::string highlightJustify (const std::string &title, TextHighlightMode::_v hMode=TextHighlightMode::OverAndUnderline, TextJustifyMode::_v jMode=TextJustifyMode::Center, char highlightFiller='=', char justifyFiller=' ', bool appendCR=true)
 
static std::string tab (const std::string &text, int tabSpaces=3)
 
template<typename T >
static T * componentByName (const char *className, const char *fromFile, const int fromLine) noexcept(false)
 
template<typename T >
static T * component (const char *fromFile, const int fromLine) noexcept(false)
 
static bool endsWith (const std::string &pattern, const std::string &suffix)
 
static bool endsWith (const std::string &pattern, const std::string &suffix, std::string &preffix)
 
static bool startsWith (const std::string &pattern, const std::string &preffix)
 
static bool startsWith (const std::string &pattern, const std::string &preffix, std::string &suffix)
 
static std::string replace (const std::string &text, const char *item, const char *target, bool all=true)
 
static std::string addQuotationMarks (const std::string &str)
 
static std::string addQuotationMarks (const char *str)
 
static std::string addQuotationMarks (const int &integer)
 
static std::string vectorToStringRepresentation (const std::vector< int > &v, const char separator=' ')
 
static std::string vectorToStringRepresentation (const std::vector< std::string > &v, const char separator=' ')
 
static std::string socketLiteralAsString (const std::string &address, int port)
 
static std::string asAsciiString (const char *buffer, int size, bool &isFullyPrintable)
 
static std::string asAsciiString (const char *buffer, int size)
 
static std::string asAsciiString (const DataBlock &db, bool &isFullyPrintable)
 
static std::string asAsciiString (const DataBlock &db)
 
static DataBlock rawIpPresentationAsRaw (const std::string &rawPresentation) noexcept(false)
 
static std::string rawIpPresentationToIpAsString (const std::string &rawPresentation, bool normalize=false) noexcept(false)
 
static std::string rawIpAsRawIpPresentation (const DataBlock &db) noexcept(false)
 
static std::string getHostname ()
 
static std::string getDomainname ()
 
static std::string getFQDN (const char *hostname=NULL, const char *domainname=NULL)
 
static std::string getHostnameIP ()
 
static bool isIPv4 (const std::string &ip, IPv4Type::_v ipv4Type=IPv4Type::Estrict)
 
static bool isIPv6 (const std::string &ip)
 
static std::string IPv4To6 (const std::string &ipv4) noexcept(false)
 
static std::string normalizeIP (const std::string &ip) noexcept(false)
 
static bool sameIP (const std::string &ip1, const std::string &ip2) noexcept(false)
 
static bool matchIPv6 (const std::string &ipv6, const std::string &preffixedIpv6) noexcept(false)
 
static DataBlock ipAsRaw (const std::string &ip) noexcept(false)
 
static std::string rawIpAsString (const DataBlock &db, bool normalize=false) noexcept(false)
 
static std::string rawIpAsString (const char *buffer, int bufferLength, bool normalize=false) noexcept(false)
 
static std::string abbreviateIP (const std::string &ip) noexcept(false)
 
static void getAddressAndPortFromSocketLiteral (const std::string &literal, std::string &address, int &port)
 
static socket_v getSocketVectorFromString (const std::string &list)
 
static std::string socketVectorAsString (const socket_v &socketVector)
 
static bool littleEndian ()
 
static const char * codeInteger (char *result, const int n)
 
static const char * codeShort (char *result, const short int n)
 
static const char * codeInteger64 (char *result, const S64 n)
 
static const char * codeFloat (char *result, const float n)
 
static const char * codeDouble (char *result, const double n)
 
static int decodeInteger (const char *data)
 
static short int decodeShort (const char *data)
 
static S64 decodeInteger64 (const char *data)
 
static float decodeFloat (const char *data)
 
static double decodeDouble (const char *data)
 
static void decodeIsupNumber (const char *buffer, int length, isup_number_t &isupNumber, bool calledOrCalling) noexcept(false)
 
static void codeIsupNumber (const isup_number_t &isupNumber, bool calledOrCalling, char *buffer, int &length) noexcept(false)
 
static void codeIsupNumber (const isup_number_t &isupNumber, bool calledOrCalling, std::string &target) noexcept(false)
 
static std::string encodeBase64 (const U8 *buf, unsigned int bufLen)
 
static std::string encodeBase64 (const std::string &str)
 
static std::string decodeBase64 (const std::string &encodedString)
 
static bool getContentFromFile (const std::string &pathfile, std::string &content) noexcept(false)
 

Additional Inherited Members

- Static Public Attributes inherited from anna::functions
static const int DateTimeSizeString = 21
 
static const int intBitSize = sizeof(int) * 8
 
static const int int64BitSize = sizeof(S64) * 8
 

Detailed Description

functions - Metodos y variables

Member Function Documentation

◆ componentByName()

template<typename T >
static T* anna::app::functions::componentByName ( const char *  className,
const char *  fromFile,
const int  fromLine 
)
inlinestaticnoexcept

Pattern to obtain a multi named application component instance easily. Parameters are usually replaced by the macro C FILE_LOCATION.

Parameters
classNameApplication component class name
fromFileFile which called the method
fromLineLine number within the file from where the method is called.
Returns
Application component instance for the class provided at the pattern
See also
Component
44  {
45  T* result = static_cast <T*>(functions::getApp().find(className));
46 
47  if(result == NULL) {
48  std::string msg(className);
49  msg += " | Componente no registrado";
50  throw RuntimeException(msg, fromFile, fromLine);
51  }
52 
53  return result;
54  }
static Application & getApp() noexcept(false)
Component * find(const char *className)
Here is the call graph for this function:

◆ getApp()

static Application& anna::app::functions::getApp ( )
staticnoexcept

Devuelve la referencia de la instancia de nuestra aplicacion


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