1.5.1
CCC
 
AStringable.hpp File Reference
#include "geoslib_define.h"
#include "gstlearn_export.hpp"
#include "Enum/EJustify.hpp"
#include "Basic/AStringFormat.hpp"

Classes

class  AStringable
 

Functions

GSTLEARN_EXPORT void messageFlush (const String &string)
 
GSTLEARN_EXPORT void messerrFlush (const String &string)
 
GSTLEARN_EXPORT void messerr (const char *format,...)
 
GSTLEARN_EXPORT void message (const char *format,...)
 
GSTLEARN_EXPORT void messageNoDiff (const char *format,...)
 
GSTLEARN_EXPORT void mesArg (const char *title, int current, int nmax)
 
GSTLEARN_EXPORT bool checkArg (const char *title, int current, int nmax)
 
GSTLEARN_EXPORT void messageAbort (const char *format,...)
 
GSTLEARN_EXPORT void mestitle (int level, const char *format,...)
 
GSTLEARN_EXPORT void mes_process (const char *string, int ntot, int iech)
 
GSTLEARN_EXPORT String toTitle (int level, const char *format,...)
 
GSTLEARN_EXPORT String toMatrix (const String &title, const AMatrix &mat, bool flagOverride=false, bool flagSkipZero=false)
 
GSTLEARN_EXPORT String toMatrix (const String &title, const VectorString &colnames, const VectorString &rownames, bool bycol, int nrows, int ncols, const VectorDouble &tab, bool flagOverride=false, bool flagSkipZero=false)
 
GSTLEARN_EXPORT String toMatrix (const String &title, const VectorString &colnames, const VectorString &rownames, bool bycol, int nrows, int ncols, const VectorInt &tab, bool flagOverride=false, bool flagSkipZero=false)
 
GSTLEARN_EXPORT String toVector (const String &title, const VectorDouble &tab, bool flagOverride=true)
 
GSTLEARN_EXPORT String toVector (const String &title, const VectorVectorDouble &tab, bool flagOverride=true)
 
GSTLEARN_EXPORT String toVector (const String &title, const VectorInt &tab, bool flagOverride=true)
 
GSTLEARN_EXPORT String toVector (const String &title, const VectorString &tab, bool flagOverride=true)
 
GSTLEARN_EXPORT String toVector (const String &title, constvect tab, bool flagOverride=true)
 
GSTLEARN_EXPORT String toStr (const String &string, const EJustify &justify=EJustify::fromKey("RIGHT"), int localSize=0)
 
GSTLEARN_EXPORT String toDouble (double value, const EJustify &justify=EJustify::fromKey("RIGHT"))
 
GSTLEARN_EXPORT String toInt (int value, const EJustify &justify=EJustify::fromKey("RIGHT"))
 
GSTLEARN_EXPORT String toInterval (double zmin, double zmax)
 
GSTLEARN_EXPORT VectorString toVectorDouble (const VectorDouble &values, const EJustify &justify=EJustify::fromKey("RIGHT"))
 
GSTLEARN_EXPORT void tab_prints (const char *title, const char *string, int ncol=1, const EJustify &justify=EJustify::fromKey("RIGHT"))
 
GSTLEARN_EXPORT void tab_printg (const char *title, double value, int ncol=1, const EJustify &justify=EJustify::fromKey("RIGHT"))
 
GSTLEARN_EXPORT void tab_printd (const char *title, double value, int ncol=1, const EJustify &justify=EJustify::fromKey("RIGHT"))
 
GSTLEARN_EXPORT void tab_printi (const char *title, int value, int ncol=1, const EJustify &justify=EJustify::fromKey("RIGHT"))
 
GSTLEARN_EXPORT void tab_print_rc (const char *title, int mode, int value, int ncol=1, const EJustify &justify=EJustify::fromKey("RIGHT"))
 
GSTLEARN_EXPORT void tab_print_rowname (const char *string, int taille)
 
GSTLEARN_EXPORT void print_matrix (const char *title, int flag_limit, int bycol, int nx, int ny, const double *sel, const double *tab)
 
GSTLEARN_EXPORT void print_matrix (const char *title, int flag_limit, const AMatrix &mat)
 
GSTLEARN_EXPORT void print_trimat (const char *title, int mode, int neq, const double *tl)
 
GSTLEARN_EXPORT void print_imatrix (const char *title, int flag_limit, int bycol, int nx, int ny, const double *sel, const int *tab)
 
GSTLEARN_EXPORT void print_vector (const char *title, int flag_limit, int ntab, const double *tab)
 
GSTLEARN_EXPORT void print_vector (const char *title, int flag_limit, int ntab, const VectorDouble &tab)
 
GSTLEARN_EXPORT void print_ivector (const char *title, int flag_limit, int ntab, const int *itab)
 
GSTLEARN_EXPORT void print_ivector (const char *title, int flag_limit, int ntab, const VectorInt &itab)
 

Function Documentation

◆ checkArg()

GSTLEARN_EXPORT bool checkArg ( const char *  title,
int  current,
int  nmax 
)

◆ mes_process()

GSTLEARN_EXPORT void mes_process ( const char *  string,
int  ntot,
int  iech 
)

Conditionally print the progress of a procedure

Parameters
stringString to be printed
ntotTotal number of samples
iechRank of the current sample
Remarks
The value 'nproc' designates the quantile such that,
when changed, the printout is provoked.

◆ mesArg()

GSTLEARN_EXPORT void mesArg ( const char *  title,
int  current,
int  nmax 
)

Print a standard Error Message if an argument does not lie in Interval

Parameters
titleTitle to be printed
currentCurrent value of the argument
nmaxMaximum (inclusive) possible value

◆ message()

GSTLEARN_EXPORT void message ( const char *  format,
  ... 
)

Print a formatted message

Parameters
formatOutput format
...Additional arguments

◆ messageAbort()

GSTLEARN_EXPORT void messageAbort ( const char *  format,
  ... 
)

Function for aborting the API

Parameters
formatFatal error format
...Additional arguments

◆ messageFlush()

GSTLEARN_EXPORT void messageFlush ( const String string)

When message has been collected as a String, this function produces it out without passing through useless internal buffering

Parameters
stringString to be printed out

◆ messageNoDiff()

GSTLEARN_EXPORT void messageNoDiff ( const char *  format,
  ... 
)

Print a formatted message (with "#NO_DIFF#" prefix)

Parameters
formatOutput format
...Additional arguments

◆ messerr()

GSTLEARN_EXPORT void messerr ( const char *  format,
  ... 
)

Print Error message

Parameters
formatOutput format
...Additional arguments

◆ messerrFlush()

GSTLEARN_EXPORT void messerrFlush ( const String string)

When the error message has been collected as a String, this function produces it out without passing through useless internal buffering

Parameters
stringString to be produced
Remarks
This function is similar to messageFlush but dedicated to Errors

◆ mestitle()

GSTLEARN_EXPORT void mestitle ( int  level,
const char *  format,
  ... 
)

Print a message and underlines it with various formats

Parameters
levelLevel of the title
formatOutput format
...Additional arguments

◆ print_imatrix()

GSTLEARN_EXPORT void print_imatrix ( const char *  title,
int  flag_limit,
int  bycol,
int  nx,
int  ny,
const double *  sel,
const int *  tab 
)

Tabulated printout of a matrix (integer version)

Parameters
[in]titleTitle (Optional)
[in]flag_limitoption for the limits
  • 1 if limits must be applied
  • 0 if the whole matrix is printed
[in]bycol1 if values in 'tab' are sorted by column, 0 otherwise
[in]nxnumber of columns in the matrix
[in]nynumber of rows in the matrix
[in]selarray of selection or NULL
[in]tabarray containing the matrix

◆ print_ivector() [1/2]

GSTLEARN_EXPORT void print_ivector ( const char *  title,
int  flag_limit,
int  ntab,
const int *  itab 
)

Print a vector of integer values in a matrix form

Parameters
[in]titleTitle (Optional)
[in]flag_limit1 if NTCOL is used; 0 otherwise
[in]ntabNumber of elements in the array
[in]itabArray to be printed

◆ print_ivector() [2/2]

GSTLEARN_EXPORT void print_ivector ( const char *  title,
int  flag_limit,
int  ntab,
const VectorInt itab 
)

◆ print_matrix() [1/2]

GSTLEARN_EXPORT void print_matrix ( const char *  title,
int  flag_limit,
const AMatrix mat 
)

◆ print_matrix() [2/2]

GSTLEARN_EXPORT void print_matrix ( const char *  title,
int  flag_limit,
int  bycol,
int  nx,
int  ny,
const double *  sel,
const double *  tab 
)

Tabulated printout of a matrix

Parameters
[in]titleTitle (Optional)
[in]flag_limitoption for the limits
  • 1 if limits must be applied
  • 0 if the whole matrix is printed
[in]bycol1 if values in 'tab' are sorted by column, 0 otherwise
[in]nxnumber of columns in the matrix
[in]nynumber of rows in the matrix
[in]selarray of selection or NULL
[in]tabarray containing the matrix
Remarks
The order of the dimension (nx,ny) is opposite
of the one used in R-packages where dim[1]=nrow and dim[2]=ncol

◆ print_trimat()

GSTLEARN_EXPORT void print_trimat ( const char *  title,
int  mode,
int  neq,
const double *  tl 
)

Tabulated printout of a upper triangular matrix

Parameters
[in]titleTitle (Optional)
[in]mode1 if the matrix is stored linewise 2 if the matrix is stored columnwise
[in]neqsize of the matrix
[in]tlarray containing the upper triangular matrix
Remarks
The ordering (compatible with matrix_solve is mode==2)

◆ print_vector() [1/2]

GSTLEARN_EXPORT void print_vector ( const char *  title,
int  flag_limit,
int  ntab,
const double *  tab 
)

Print a vector of real values in a matrix form

Parameters
[in]titleTitle (Optional)
[in]flag_limit1 if NTCOL is used; 0 otherwise
[in]ntabNumber of elements in the array
[in]tabArray to be printed

◆ print_vector() [2/2]

GSTLEARN_EXPORT void print_vector ( const char *  title,
int  flag_limit,
int  ntab,
const VectorDouble tab 
)

◆ tab_print_rc()

GSTLEARN_EXPORT void tab_print_rc ( const char *  title,
int  mode,
int  value,
int  ncol,
const EJustify &  justify 
)

Tabulated printout of a row or column value

Parameters
[in]titleoptional title (NULL if not defined)
[in]modeCASE_ROW or CASE_COL
[in]valueValue to be written
[in]ncolnumber of columns for the printout
[in]justifyjustification flag (EJustify::LEFT, EJustify::CENTER or EJustify::RIGHT)

◆ tab_print_rowname()

GSTLEARN_EXPORT void tab_print_rowname ( const char *  string,
int  taille 
)

Tabulated printout of a string (character size provided)

Parameters
[in]stringString to be written
[in]tailleNumber of characters
Remarks
The string is printed (left-adjusted) on 'taille' characters

◆ tab_printd()

GSTLEARN_EXPORT void tab_printd ( const char *  title,
double  value,
int  ncol,
const EJustify &  justify 
)

Tabulated printout of a double value

Parameters
[in]titleoptional title (NULL if not defined)
[in]valueValue to be written
[in]ncolnumber of columns for the printout
[in]justifyjustification flag (EJustify::LEFT, EJustify::CENTER or EJustify::RIGHT)

◆ tab_printg()

GSTLEARN_EXPORT void tab_printg ( const char *  title,
double  value,
int  ncol,
const EJustify &  justify 
)

Tabulated printout of a real value

Parameters
[in]titleoptional title (NULL if not defined)
[in]valueValue to be written
[in]ncolnumber of columns for the printout
[in]justifyjustification flag (EJustify::LEFT, EJustify::CENTER or EJustify::RIGHT)

◆ tab_printi()

GSTLEARN_EXPORT void tab_printi ( const char *  title,
int  value,
int  ncol,
const EJustify &  justify 
)

Tabulated printout of an integer value

Parameters
[in]titleoptional title (NULL if not defined)
[in]valueValue to be written
[in]ncolnumber of columns for the printout
[in]justifyjustification flag (EJustify::LEFT, EJustify::CENTER or EJustify::RIGHT)

◆ tab_prints()

GSTLEARN_EXPORT void tab_prints ( const char *  title,
const char *  string,
int  ncol,
const EJustify &  justify 
)

Tabulated printout of a string

Parameters
[in]titleoptional title (NULL if not defined)
[in]stringString to be written
[in]ncolnumber of columns for the printout
[in]justifyjustification flag (EJustify::LEFT, EJustify::CENTER or EJustify::RIGHT)

◆ toDouble()

GSTLEARN_EXPORT String toDouble ( double  value,
const EJustify &  justify = EJustify::fromKey("RIGHT") 
)

◆ toInt()

GSTLEARN_EXPORT String toInt ( int  value,
const EJustify &  justify = EJustify::fromKey("RIGHT") 
)

◆ toInterval()

GSTLEARN_EXPORT String toInterval ( double  zmin,
double  zmax 
)

◆ toMatrix() [1/3]

GSTLEARN_EXPORT String toMatrix ( const String title,
const AMatrix mat,
bool  flagOverride,
bool  flagSkipZero 
)

Print the contents of a VectorDouble in a Matrix Form

Parameters
titleTitle of the printout
matContents of a AMatrix
flagOverridetrue to override printout limitations
flagSkipZerowhen true, skip the zero values (represented by a '.' as for sparse matrix) always true for sparse matrix

◆ toMatrix() [2/3]

GSTLEARN_EXPORT String toMatrix ( const String title,
const VectorString colnames,
const VectorString rownames,
bool  bycol,
int  nrows,
int  ncols,
const VectorDouble tab,
bool  flagOverride,
bool  flagSkipZero 
)

Print the contents of a VectorDouble in a Matrix Form

Parameters
titleTitle of the printout
colnamesNames of the columns (optional)
rownamesNames of the rows (optional)
bycoltrue if values as sorted by column; false otherwise
nrowsNumber of rows
ncolsNumber of columns
tabVectorDouble containing the values
flagOverridetrue to override printout limitations
flagSkipZerowhen true, skip the zero values (represented by a '.' as for sparse matrix)

◆ toMatrix() [3/3]

GSTLEARN_EXPORT String toMatrix ( const String title,
const VectorString colnames,
const VectorString rownames,
bool  bycol,
int  nrows,
int  ncols,
const VectorInt tab,
bool  flagOverride,
bool  flagSkipZero 
)

Print the contents of a VectorDouble in a Matrix Form

Parameters
titleTitle of the printout
colnamesNames of the columns (optional)
rownamesNames of the rows (optional)
bycoltrue if values as sorted by column; false otherwise
nrowsNumber of rows
ncolsNumber of columns
tabVectorInt containing the values
flagOverridetrue to override printout limitations
flagSkipZerowhen true, skip the zero values (represented by a '.' as for sparse matrix)

◆ toStr()

GSTLEARN_EXPORT String toStr ( const String string,
const EJustify &  justify = EJustify::fromKey("RIGHT"),
int  localSize = 0 
)

◆ toTitle()

GSTLEARN_EXPORT String toTitle ( int  level,
const char *  format,
  ... 
)

Print a message and underlines it with various formats

Parameters
levelLevel of the title
formatOutput format
...Additional arguments

◆ toVector() [1/5]

GSTLEARN_EXPORT String toVector ( const String title,
const VectorDouble tab,
bool  flagOverride 
)

Printout a vector in a formatted manner

Parameters
titleTitle of the printout (or empty string)
tabVector (real values) to be printed
flagOverridetrue to override printout limitations
Returns
The string (terminated with a newline)

◆ toVector() [2/5]

GSTLEARN_EXPORT String toVector ( const String title,
const VectorInt tab,
bool  flagOverride 
)

Printout a vector in a formatted manner

Parameters
titleTitle of the printout (or empty string)
tabVector (integer values) to be printed
flagOverridetrue to override printout limitations
Returns
The string (terminated with a newline)

◆ toVector() [3/5]

GSTLEARN_EXPORT String toVector ( const String title,
const VectorString tab,
bool  flagOverride = true 
)

◆ toVector() [4/5]

GSTLEARN_EXPORT String toVector ( const String title,
const VectorVectorDouble tab,
bool  flagOverride 
)

Printout a list of vectors in a formatted manner

Parameters
titleTitle of the printout (or empty string)
tabVector of vectors (real values) to be printed
flagOverridetrue to override printout limitations
Returns
The string (terminated with a newline)

◆ toVector() [5/5]

GSTLEARN_EXPORT String toVector ( const String title,
constvect  tab,
bool  flagOverride = true 
)

◆ toVectorDouble()

GSTLEARN_EXPORT VectorString toVectorDouble ( const VectorDouble values,
const EJustify &  justify = EJustify::fromKey("RIGHT") 
)