1.2.3
CCC
 
AStringable.hpp File Reference
#include "geoslib_define.h"
#include "gstlearn_export.hpp"
#include "Enum/EJustify.hpp"
#include "Basic/AStringFormat.hpp"
#include <sstream>

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, bool flagStartOne=false)
 
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 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 byrow, 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

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.
GSTLEARN_EXPORT void mesArg ( const char *  title,
int  current,
int  nmax,
bool  flagStartOne 
)

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
flagStartOneTrue if the count starts at 1 (instead of 0)
GSTLEARN_EXPORT void message ( const char *  format,
  ... 
)

Print a formatted message

Parameters
formatOutput format
...Additional arguments
GSTLEARN_EXPORT void messageAbort ( const char *  format,
  ... 
)

Function for aborting the API

Parameters
formatFatal error format
...Additional arguments
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
GSTLEARN_EXPORT void messageNoDiff ( const char *  format,
  ... 
)

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

Parameters
formatOutput format
...Additional arguments
GSTLEARN_EXPORT void messerr ( const char *  format,
  ... 
)

Print Error message

Parameters
formatOutput format
...Additional arguments
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
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
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
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
GSTLEARN_EXPORT void print_ivector ( const char *  title,
int  flag_limit,
int  ntab,
const VectorInt itab 
)
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
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 
)

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)
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
GSTLEARN_EXPORT void print_vector ( const char *  title,
int  flag_limit,
int  ntab,
const VectorDouble tab 
)
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)
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
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)
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)
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)
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)
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 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
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)
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)
GSTLEARN_EXPORT String toStr ( const String string,
const EJustify &  justify = EJustify::fromKey("RIGHT"),
int  localSize = 0 
)
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
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)
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)
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)
GSTLEARN_EXPORT String toVector ( const String title,
const VectorString tab,
bool  flagOverride = true 
)
GSTLEARN_EXPORT VectorString toVectorDouble ( const VectorDouble values,
const EJustify &  justify = EJustify::fromKey("RIGHT") 
)