STK++ 0.9.13
|
In this subproject we define the fundamental types. More...
Namespaces | |
namespace | STK::Chrono |
The namespace Chrono is an utility namespace for computing elapsed time during the execution of a program. | |
Classes | |
class | STK::Proxy< Type > |
The Proxy class allow to surdefine operators and methods for every kind of class without using dynamic_cast. More... | |
class | STK::Proxy< String > |
Specialization of the Proxy class for String. More... | |
Enumerations | |
enum | STK::Binary { STK::zero_ =0 , STK::one_ =1 , STK::binaryNA_ =INT_MIN } |
STK fundamental type of a binary. More... | |
enum | STK::Sign { STK::negative_ =-1 , STK::positive_ = 1 , STK::signNA_ = INT_MIN } |
STK fundamental type of a sign. More... | |
Functions | |
Binary | STK::stringToBinary (String const &str) |
Convert a String to a Binary. | |
Binary | STK::stringToBinary (String const &str, std::map< String, Binary > const &mapping) |
Convert a String to a Binary using a map. | |
String | STK::binaryToString (Binary const &value, std::ios_base &(*f)(std::ios_base &)=std::dec) |
Convert a Binary to a String. | |
String | STK::binaryToString (Binary const &value, std::map< Binary, String > const &mapping) |
Convert a Binary to a String. | |
template<> | |
Binary | STK::stringToType< Binary > (String const &str) |
specialization for Binary | |
template<> | |
String | STK::typeToString< Binary > (Binary const &t, std::ios_base &(*f)(std::ios_base &)) |
specialization for Binary | |
void | STK::Chrono::start () |
Start the Chrono. | |
Real | STK::Chrono::elapsed () |
Compute the elapsed time (in second) since last start() call. | |
Integer | STK::stringToInt (String const &str) |
Convert a String to an Integer. | |
Integer | STK::stringToInt (String const &str, std::map< String, Integer > const &mapping) |
Convert a String to an Integer using a map. | |
String | STK::intToString (Integer const &value, std::ios_base &(*f)(std::ios_base &)=std::dec) |
Convert an Integer to a String. | |
String | STK::intToString (Integer const &value, std::map< Integer, String > const &mapping) |
Convert an Integer to a String. | |
template<> | |
Integer | STK::stringToType< Integer > (String const &s) |
specialization for Integer | |
template<> | |
String | STK::typeToString< Integer > (Integer const &t, std::ios_base &(*f)(std::ios_base &)) |
specialization for Integer | |
template<typename Type > | |
Type | STK::sign (Type const &x, Type const &y=Type(1)) |
template sign value sign(x) * y: Type should be an integral type | |
Real | STK::frand () |
frand() generate a Real uniform number. | |
bool | STK::isOdd (int const &x) |
is x a odd number ? | |
bool | STK::isEven (int const &x) |
is x an even number ? | |
Real | STK::norm (Real const &x, Real const &y) |
Computation of sqrt(x^2 + y^2) without underflow or overflow. | |
template<int Size_> | |
ostream & | STK::operator<< (ostream &os, TRange< Size_ > const &I) |
Write a TRange in the form first:last (MATLAB-like form) in an output stream. | |
Range | STK::stringToRange (String const &str) |
Convert a String to a Range. | |
template<int Size_> | |
TRange< Size_ > | STK::stringToRange (String const &str, std::map< String, TRange< Size_ > > const &mapping) |
Convert a String to a Range using a map. | |
template<int Size_> | |
String | STK::rangeToString (TRange< Size_ > const &value, std::ios_base &(*f)(std::ios_base &)=std::dec) |
Convert an Range to a String. | |
template<int Size_> | |
String | STK::rangeToString (TRange< Size_ > const &value, std::map< TRange< Size_ >, String > const &mapping) |
Convert a Range to a String. | |
template<> | |
String | STK::typeToString< Range > (Range const &t, std::ios_base &(*f)(std::ios_base &)) |
Specialization for Range. | |
Real | STK::stringToReal (String const &str) |
Convert a String to a Real. | |
Real | STK::stringToReal (String const &str, std::map< String, Real > const &mapping) |
Convert a String to a Real using a map. | |
String | STK::realToString (Real const &value, std::ios_base &(*f)(std::ios_base &)=std::dec) |
Convert a Real to a String. | |
String | STK::realToString (Real const &type, std::map< Real, String > const &mapping) |
Convert a real to a String. | |
template<> | |
Real | STK::stringToType< Real > (String const &str) |
specialization for Real | |
template<> | |
String | STK::typeToString< Real > (Real const &value, std::ios_base &(*f)(std::ios_base &)) |
specialization for Real | |
Sign | STK::stringToSign (String const &str) |
Convert a String to a Sign. | |
Sign | STK::stringToSign (String const &str, std::map< String, Sign > const &mapping) |
Convert a String to a Sign using a map. | |
String | STK::signToString (Sign const &value, std::ios_base &(*f)(std::ios_base &)=std::dec) |
Convert a Sign to a String. | |
String | STK::signToString (Sign const &value, std::map< Sign, String > mapping) |
Convert a Sign to a String. | |
template<> | |
Sign | STK::stringToType< Sign > (String const &str) |
specialization for Sign | |
template<> | |
String | STK::typeToString< Sign > (Sign const &t, std::ios_base &(*f)(std::ios_base &)) |
specialization for Sign | |
void | STK::setStringNa (String const &na) |
Set a new value to the na String representation and modify stringNaSize accordingly. | |
String const & | STK::toUpperString (String &s) |
convert the characters of the String to upper case | |
String | STK::toUpperString (String const &s) |
convert the characters of the String to upper case | |
String | STK::removeWhiteSpaces (String const &s) |
convert the characters of the String to upper case | |
template<class Type > | |
bool | STK::stringToType (Type &t, String const &s, std::ios_base &(*f)(std::ios_base &)=std::dec) |
convert a String to Type | |
template<class Type > | |
Type | STK::stringToType (String const &s) |
convert a String to Type without error check | |
template<class Type > | |
String | STK::typeToString (Type const &t, std::ios_base &(*f)(std::ios_base &)=std::dec) |
convert a Type to String | |
Variables | |
String | STK::stringNa = String(_T(".")) |
Representation of a Not Available value. | |
int | STK::stringNaSize = 1 |
Size (in number of Char) of a Not Available value. | |
In this subproject we define the fundamental types.
The Base subproject is composed of
|
inline |
Convert a Binary to a String.
value | the Binary we want to convert |
f | format, by default write every number in decimal |
Definition at line 160 of file STK_Binary.h.
References STK::stringNa.
Referenced by STK::typeToString< Binary >().
|
inline |
Convert a Binary to a String.
value | the Binary we want to convert |
mapping | the mapping between the Binary and the String |
Definition at line 174 of file STK_Binary.h.
References STK::Arithmetic< Type >::NA().
|
inline |
Compute the elapsed time (in second) since last start()
call.
Definition at line 62 of file STK_Chrono.h.
|
inline |
frand() generate a Real uniform number.
This is a very basic method and should only be used when speed is necessary only.
Definition at line 61 of file STK_Misc.h.
|
inline |
Convert an Integer to a String.
value | the Integer we want to convert |
f | format, by default write every number in decimal |
Definition at line 175 of file STK_Integer.h.
References STK::stringNa.
Referenced by STK::typeToString< Integer >().
|
inline |
Convert an Integer to a String.
value | the Integer we want to convert |
mapping | the mapping between Integer and String |
Definition at line 189 of file STK_Integer.h.
References STK::stringNa.
is x an even number ?
This method return true if the rest of the euclidian division of x by 2 is 1.
x | the value to test |
true
if x is even, false
otherwise Definition at line 83 of file STK_Misc.h.
Referenced by STK::Funct::gamma_raw().
is x a odd number ?
This method return true if the rest of the euclidian division of x by 2 is 0.
x | the value to test |
true
if x is odd, false
otherwise Definition at line 72 of file STK_Misc.h.
Computation of sqrt(x^2 + y^2) without underflow or overflow.
x | first value |
y | second value |
Definition at line 93 of file STK_Misc.h.
Referenced by STK::bidiag(), STK::Svd< Array >::diag(), STK::SymEigen< SquareArray >::diagonalize(), STK::gramSchmidt(), STK::leftEliminate(), and STK::Svd< Array >::rightEliminate().
Write a TRange in the form first:last (MATLAB-like form) in an output stream.
os | output stream |
I | Range to write |
Definition at line 515 of file STK_Range.h.
References _T, STK::isNA(), and STK::stringNa.
String STK::rangeToString | ( | TRange< Size_ > const & | value, |
std::ios_base &(*)(std::ios_base &) | f = std::dec |
||
) |
Convert an Range to a String.
value | the Range we want to convert |
f | format, by default write every number in decimal |
Definition at line 552 of file STK_Range.h.
References STK::isNA(), and STK::stringNa.
Referenced by STK::typeToString< Range >().
String STK::rangeToString | ( | TRange< Size_ > const & | value, |
std::map< TRange< Size_ >, String > const & | mapping | ||
) |
Convert a Range to a String.
value | the Range we want to convert |
mapping | the mapping between Range and String |
Definition at line 567 of file STK_Range.h.
References STK::stringNa.
Convert a real to a String.
type | the Real we want to convert |
mapping | the mapping between the Real and the String |
Definition at line 195 of file STK_Real.h.
References STK::stringNa.
|
inline |
Convert a Real to a String.
value | the Real we want to convert |
f | format, by default write every number in decimal |
Definition at line 181 of file STK_Real.h.
References STK::isNA(), and STK::stringNa.
Referenced by STK::typeToString< Real >().
convert the characters of the String to upper case
s | The String to convert |
Definition at line 165 of file STK_String.h.
Referenced by STK::Law::stringToUnivariateDistribution().
Set a new value to the na String representation and modify stringNaSize accordingly.
Definition at line 109 of file STK_String.h.
References STK::stringNa, and STK::stringNaSize.
template sign value sign(x) * y: Type should be an integral type
x | the sign value |
y | the signed value to return |
Definition at line 53 of file STK_Misc.h.
Referenced by STK::compGivens(), STK::Svd< Array >::diag(), STK::SymEigen< SquareArray >::diagonalize(), STK::ISvd< Derived >::finalize(), STK::ISymEigen< Derived >::finalizeStep(), STK::house(), and STK::RandBase::randGauss().
|
inline |
Convert a Sign to a String.
value | the Sign we want to convert |
f | format, by default write every number in decimal |
Definition at line 169 of file STK_Sign.h.
References STK::stringNa.
Referenced by STK::typeToString< Sign >().
Convert a Sign to a String.
value | the Sign we want to convert |
mapping | the mapping between the Sign and the String |
Definition at line 183 of file STK_Sign.h.
|
inline |
Convert a String to a Binary.
str | the String we want to convert |
str
. If the string does not match any known name, the binaryNA_
value is returned. Definition at line 134 of file STK_Binary.h.
References _T, STK::binaryNA_, STK::one_, STK::toUpperString(), and STK::zero_.
Referenced by STK::stringToType< Binary >().
|
inline |
Convert a String to a Binary using a map.
str | the String we want to convert |
mapping | the mapping between the String and the Binary |
str
. If the string does not match any known name, the binaryNA_
type is returned. Definition at line 148 of file STK_Binary.h.
References STK::binaryNA_.
Convert a String to an Integer.
str | the String we want to convert |
str
. If the string does not match any known name, the NA value is returned. Definition at line 149 of file STK_Integer.h.
Referenced by STK::stringToType< Integer >().
Convert a String to an Integer using a map.
str | the String we want to convert |
mapping | the mapping between the string and the Int |
type
. if the string does not match any known name, the unknown_
type is returned. Definition at line 163 of file STK_Integer.h.
References STK::Arithmetic< Type >::NA().
Convert a String to a Range.
str | the String we want to convert |
str
. if the string does not match any known name, the NA value is returned. Definition at line 528 of file STK_Range.h.
TRange< Size_ > STK::stringToRange | ( | String const & | str, |
std::map< String, TRange< Size_ > > const & | mapping | ||
) |
Convert a String to a Range using a map.
str | the String we want to convert |
mapping | the mapping between the string and the TRange |
str
. if the string does not match any known name, the NA value is returned. Definition at line 539 of file STK_Range.h.
Convert a String to a Real.
str | the String we want to convert |
Definition at line 154 of file STK_Real.h.
Referenced by STK::stringToType< Real >().
Convert a String to a Real using a map.
str | the String we want to convert |
mapping | the mapping between the string and the real |
str
. If the string does not match any known name, the NA
value is returned. Definition at line 169 of file STK_Real.h.
References STK::Arithmetic< Type >::NA().
Convert a String to a Sign.
str | the String we want to convert |
type
. if the string does not match any known name, the signNA_
value is returned. Definition at line 142 of file STK_Sign.h.
References _T, STK::negative_, STK::positive_, STK::signNA_, and STK::toUpperString().
Referenced by STK::stringToType< Sign >().
Convert a String to a Sign using a map.
str | the String we want to convert |
mapping | the mapping between the string and the Sign |
type
. if the string does not match any known name, the signNA_
value is returned. Definition at line 156 of file STK_Sign.h.
References STK::signNA_.
convert a String to Type without error check
This method return the String s
converted into a correct Type t without formatting. http://www.codeguru.com/forum/showpost.php?p=678440&postcount=1 http://c.developpez.com/faq/cpp/?page=strings#STRINGS_is_type
Type
. s | the String to convert |
Definition at line 216 of file STK_String.h.
bool STK::stringToType | ( | Type & | t, |
String const & | s, | ||
std::ios_base &(*)(std::ios_base &) | f = std::dec |
||
) |
convert a String to Type
This method return true if the String s
could be converted into a correct Type t. http://www.codeguru.com/forum/showpost.php?p=678440&postcount=1 http://c.developpez.com/faq/cpp/?page=strings#STRINGS_is_type
Proxy
class in order to return a NA value if the conversion fail.t,s | value to get from the String and String to convert |
f | flags |
true
if the conversion succeed, false
otherwise Definition at line 195 of file STK_String.h.
Referenced by STK::DManager::readList(), and STK::Option::setValue().
|
inline |
specialization for Binary
str | the String to convert |
Definition at line 186 of file STK_Binary.h.
References STK::stringToBinary().
|
inline |
specialization for Integer
s | the String to convert |
Definition at line 201 of file STK_Integer.h.
References STK::stringToInt().
|
inline |
specialization for Real
str | the String to convert |
Definition at line 208 of file STK_Real.h.
References STK::stringToReal().
|
inline |
specialization for Sign
str | the String to convert |
Definition at line 192 of file STK_Sign.h.
References STK::stringToSign().
convert the characters of the String to upper case
s | The String to convert |
Definition at line 134 of file STK_String.h.
Referenced by STK::DManager::checkStringToBoolean(), STK::IPage::findKeyword(), STK::IPage::IPage(), STK::Option::Option(), STK::IPage::option(), STK::IPage::option(), STK::Option::Option(), STK::ReadWritePages::p_page(), STK::ReadWritePages::p_page(), STK::IPage::processLine(), STK::Clust::stringToAlgo(), STK::stringToBinary(), STK::DManager::StringToBoolean(), STK::Clust::stringToCriterion(), STK::Clust::stringToInit(), STK::Kernel::stringToKernelType(), STK::Basis::stringToKnotsPosition(), STK::Regress::stringToKnotsPosition(), STK::Clust::stringToLearnAlgo(), STK::Clust::stringToMixture(), STK::Clust::stringToMixture(), STK::Clust::stringToPredictAlgo(), STK::stringToSign(), STK::Basis::stringToTypeBasisFunction(), STK::Model::stringToTypeCriterion(), STK::DManager::stringToTypeDataFile(), STK::Reduct::stringToTypeGraph(), STK::Import::stringToTypeImport(), STK::Reduct::stringToTypeReduction(), STK::Regress::stringToTypeRegression(), and STK::Law::stringToUnivariateDistribution().
convert the characters of the String to upper case
s | The String to convert |
Definition at line 149 of file STK_String.h.
String STK::typeToString | ( | Type const & | t, |
std::ios_base &(*)(std::ios_base &) | f = std::dec |
||
) |
convert a Type to String
This method return the Type t into a String s.
t | The value to convert to String |
f | flag, by default write every number in decimal |
Definition at line 235 of file STK_String.h.
References STK::stringNa.
Referenced by STK::ExportToCsv::append(), STK::ExportToCsv::append(), STK::ExportToCsv::append(), STK::ExportToCsv::append(), STK::ExportToCsv::appendData(), STK::ExportToCsv::ExportToCsv(), STK::ExportToCsv::ExportToCsv(), STK::ExportToCsv::ExportToCsv(), STK::ExportToCsv::ExportToCsv(), STK::DataHandler::readDataFromArray(), STK::DataHandler::readDataFromArray2D(), and STK::ExportToCsv::setColumnsNames().
|
inline |
specialization for Binary
t | The Binary to convert to String |
f | format, by default write every number in decimal |
Definition at line 195 of file STK_Binary.h.
References STK::binaryToString().
|
inline |
specialization for Integer
t | The Int to convert to String |
f | format, by default write every number in decimal |
Definition at line 210 of file STK_Integer.h.
References STK::intToString().
|
inline |
Specialization for Range.
t | The Range to convert to String |
f | format, by default write every number in decimal |
Definition at line 580 of file STK_Range.h.
References STK::rangeToString().
|
inline |
specialization for Real
value | The Real to convert to String |
f | format, by default write every number in decimal |
Definition at line 217 of file STK_Real.h.
References STK::realToString().
|
inline |
specialization for Sign
t | The Sign to convert to String |
f | format, by default write every number in decimal |
Definition at line 201 of file STK_Sign.h.
References STK::signToString().
Representation of a Not Available value.
By default we represent a Not Available value of any type as a "." (like in (SAS(R))) for the end-user. This value can be overloaded at runtime.
stringNaSize
have to be modified accordingly. It is safer to use the setStringNa function. Definition at line 50 of file STK_String.cpp.
Referenced by STK::binaryToString(), STK::Variable< Type_ >::importFromString(), STK::intToString(), STK::intToString(), STK::operator<<(), STK::operator<<(), STK::Variable< Type_ >::pushBackNAValues(), STK::rangeToString(), STK::rangeToString(), STK::TReadWriteCsv< Type >::read(), STK::DataHandler::readDataFromArray(), STK::DataHandler::readDataFromArray2D(), STK::DataHandler::readDataFromCsvFile(), STK::realToString(), STK::realToString(), STK::Option::setDefaultValue(), STK::setStringNa(), STK::signToString(), STK::typeToString(), and STK::TReadWriteCsv< Type >::writeSelection().
int STK::stringNaSize = 1 |
Size (in number of Char) of a Not Available value.
We represent a Not Available value of any type as a "." (like in (SAS(R))) for the end-user.
Definition at line 57 of file STK_String.cpp.
Referenced by STK::setStringNa().