bpp-core  2.3.0
bpp::NumCalcApplicationTools Class Reference

#include <Bpp/App/NumCalcApplicationTools.h>

Public Member Functions

 NumCalcApplicationTools ()
virtual ~NumCalcApplicationTools ()

Static Public Member Functions

static std::vector< int > seqFromString (const std::string &s, const std::string &delim=",", const std::string &seqdelim="-")
 Build a vector of integers as described by a string. More...
static std::vector< double > getVector (const std::string &desc) throw (Exception)
 Build a vector of double from a structured text description. More...
static double getDefaultValue (const ParameterList &pl, const std::string &name, double x)
 Returns the value of the Parameter of the given name if it exists; otherwise returns the default value. More...
static ParameterGridgetParameterGrid (std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool warn=true) throw (Exception)
 Design a parameter grid from input options. More...

Detailed Description

Definition at line 51 of file NumCalcApplicationTools.h.

Constructor & Destructor Documentation

bpp::NumCalcApplicationTools::NumCalcApplicationTools ( )
virtual bpp::NumCalcApplicationTools::~NumCalcApplicationTools ( )

Member Function Documentation

double NumCalcApplicationTools::getDefaultValue ( const ParameterList pl,
const std::string &  name,
double  x 

Returns the value of the Parameter of the given name if it exists; otherwise returns the default value.

Laurent Gueguen
plA parameter list to look in.
nameA string name
xA double value

Definition at line 111 of file NumCalcApplicationTools.cpp.

References bpp::Parameter::getName(), bpp::Parameter::getValue(), and bpp::ParameterList::size().

ParameterGrid * NumCalcApplicationTools::getParameterGrid ( std::map< std::string, std::string > &  params,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  warn = true 
throw (Exception

Design a parameter grid from input options.


paramsThe attribute map where options may be found.
suffixA suffix to be applied to the parameter name.
suffixIsOptionalTell if the suffix is absolutely required.
warnTell if a warning must be sent in case the parameter is not found.
a parameter grid object.

Definition at line 124 of file NumCalcApplicationTools.cpp.

References bpp::ApplicationTools::getStringParameter(), and bpp::TextTools::toString().

vector< double > NumCalcApplicationTools::getVector ( const std::string &  desc)
throw (Exception

Build a vector of double from a structured text description.

The syntax may be one of the following:

  • Specified values: 1.23, 2.34, 3.45, 4.56
  • Sequence macro: seq(from=1.23,to=2.45,step=0.1) or seq(from=1.23,to=2.45,size=5) The meaning of these to form is equivalent as the R function: The first one start from 1.23 and increment 0.1 until it reaches the 2.45 value, wheras the seocnd one will compute 3 values at equal distance from 1.23 and 2.45. the 'from' and 'to' values are included, except for the first syntax when the interval is not an exact multiple of the 'step' argument.
Julien Dutheil
descThe string to parse.
A vector containing the corresponding values as double.
ExceptionIf the syntax describing the set is not correct.

Definition at line 71 of file NumCalcApplicationTools.cpp.

References bpp::StringTokenizer::hasMoreToken(), bpp::KeyvalTools::multipleKeyvals(), bpp::StringTokenizer::nextToken(), bpp::NumConstants::TINY(), bpp::TextTools::toDouble(), and bpp::TextTools::toInt().

vector< int > NumCalcApplicationTools::seqFromString ( const std::string &  s,
const std::string &  delim = ",",
const std::string &  seqdelim = "-" 

Build a vector of integers as described by a string.

Build a vector of integers following a description like: "2, 5, 7-10, 4" => [2, 5, 7, 8, 9, 10, 4]

Sylvain Gaillard
sThe string to parse.
delimDelimiter between elements.
seqdelimDelimiter between min and max for a sequence.
A vector containing the integers

Definition at line 48 of file NumCalcApplicationTools.cpp.

References bpp::VectorTools::append(), bpp::StringTokenizer::getToken(), bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), bpp::StringTokenizer::numberOfRemainingTokens(), bpp::VectorTools::seq(), and bpp::TextTools::toInt().

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