gstlearn  1.0.0
CCC
NamingConvention Class Reference

#include <NamingConvention.hpp>

Inheritance diagram for NamingConvention:
AStringable

Public Member Functions

 NamingConvention (String prefix="", bool flag_varname=true, bool flag_qualifier=true, bool flag_locator=true, const ELoc &locatorOutType=ELoc::fromKey("Z"), String delim=".", bool cleanSameLocator=true)
 
 NamingConvention (const NamingConvention &m)
 
NamingConventionoperator= (const NamingConvention &m)
 
virtual ~NamingConvention ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 AStringable Interface. More...
 
void setNamesAndLocators (Db *dbout, int iattout_start, const String &qualifier="", int nitems=1, bool flagSetLocator=true, int locatorShift=0) const
 
void setNamesAndLocators (const VectorString &names, Db *dbout, int iattout_start, const String &qualifier="", int nitems=1, bool flagSetLocator=true, int locatorShift=0) const
 
void setNamesAndLocators (Db *dbout, int iattout_start, const VectorString &names, bool flagSetLocator=true, int locatorShift=0) const
 
void setNamesAndLocators (const String &namin, Db *dbout, int iattout_start, const String &qualifier="", int nitems=1, bool flagSetLocator=true, int locatorShift=0) const
 
void setNamesAndLocators (const Db *dbin, const VectorString &names, const ELoc &locatorInType, int nvar, Db *dbout, int iattout_start, const String &qualifier="", int nitems=1, bool flagSetLocator=true, int locatorShift=0) const
 
void setNamesAndLocators (const Db *dbin, const VectorInt &iatts, Db *dbout, int iattout_start, const String &qualifier="", int nitems=1, bool flagSetLocator=true, int locatorShift=0) const
 
void setNamesAndLocators (const Db *dbin, int iatt, Db *dbout, int iattout_start, const String &qualifier="", int nitems=1, bool flagSetLocator=true, int locatorShift=0) const
 
void setDelim (const String &delim)
 
void setLocatorOutType (const ELoc &l)
 
void setPrefix (const String &prefix)
 
void setFlagClean (bool cleanSameLocator)
 
void setLocators (Db *dbout, int iattout_start, int nvar, int nitems=1, int locatorShift=0) const
 
bool isFlagQualifier () const
 
bool isFlagVarname () const
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 

Static Public Member Functions

static NamingConventioncreate (String prefix="", bool flag_varname=true, bool flag_qualifier=true, bool flag_locator=true, const ELoc &locatorOutType=ELoc::fromKey("Z"), String delim=".", bool cleanSameLocator=true)
 

Private Member Functions

void _setNames (Db *dbout, int iattout_start, const VectorString &names, const String &qualifier, int nitems) const
 
VectorString _createNames (const VectorString &names, const String &qualifier="", int nitems=1) const
 

Private Attributes

String _prefix
 String used as 'prefix'. More...
 
String _delim
 Character used as the 'delimitor' between different parts of the names. More...
 
bool _flagVarname
 When TRUE, add the 'variable name'. More...
 
bool _flagQualifier
 When TRUE, add the 'qualifier'. More...
 
bool _flagLocator
 When TRUE, assign a locator to the newly created variables. More...
 
ELoc _locatorOutType
 Type of locator assigned (if 'flagLocator' is TRUE) More...
 
bool _cleanSameLocator
 Clean variables with the same locator beforehand. More...
 

Detailed Description

Naming Convention facility This class describes the way variables created within the current procedure will be named afterwards and will possibly be assigned a locator.

The generic name is generated as follows: 'prefix'.'varname'.'qualifier'.'rank'

  • prefix: string provided in the constructor of this class
  • varname: name of the (input) variable on which the procedure is performed
  • qualifier: type of element stored in the variable
  • rank: rank of the output variable (if several variables of the same type are generated)

The choice of the 'prefix' is done by the user when launching the procedure the other parameters are usually defined within the procedure.

For example, when running 'kriging' function with several variables defined in the input Db - say "Pb" abd "Zn" (they are assigned a Z-locator), using the following command: kriging( ... namconv = NamingConvention("MyPrefix") )

Then the kriging procedure generates variables such as:

  • MyPrefix.Pb.estim (estimation of Pb by CoKriging)
  • MyPrefix.Zn.estim (estimation of Zn by CoKriging)
  • MyPrefix.Pb.stdev (St. Dev. of estimation error of Pb by CoKriging)
  • MyPrefix.Zn.stdev (St. Dev. of estimation error of Zn by CoKriging)

Then the non-conditional simulation procedure generates variables such as:

  • MyPrefix.1 (for first simulation)
  • MyPrefix.2 (for second simulation) ...

    Then the conditional simulation procedure generates variables such as:

  • MyPrefix.var.1 (for first simulation)
  • MyPrefix.var.2 (for second simulation) ...

Ultimately, the newly created variables are assigned a locator.

Constructor & Destructor Documentation

◆ NamingConvention() [1/2]

NamingConvention::NamingConvention ( String  prefix = "",
bool  flag_varname = true,
bool  flag_qualifier = true,
bool  flag_locator = true,
const ELoc &  locatorOutType = ELoc::fromKey("Z"),
String  delim = ".",
bool  cleanSameLocator = true 
)

◆ NamingConvention() [2/2]

NamingConvention::NamingConvention ( const NamingConvention m)

◆ ~NamingConvention()

NamingConvention::~NamingConvention ( )
virtual

Member Function Documentation

◆ _createNames()

VectorString NamingConvention::_createNames ( const VectorString names,
const String qualifier = "",
int  nitems = 1 
) const
private

Defines the names of the output variables.

Parameters
namesVector of Names (dimension: nvar)
qualifierOptional qualifier
nitemsNumber of items to be renamed

◆ _setNames()

void NamingConvention::_setNames ( Db dbout,
int  iattout_start,
const VectorString names,
const String qualifier,
int  nitems 
) const
private

Defines the names of the output variables. These variables are located in 'dbout'; they have consecutive UIDs, starting from 'iattout_start'

Parameters
dboutPointer to the output Db structure
iattout_startRank of the first variable to be named
namesVector of Names (dimension: nvar)
qualifierOptional qualifier
nitemsNumber of items to be renamed

◆ create()

NamingConvention * NamingConvention::create ( String  prefix = "",
bool  flag_varname = true,
bool  flag_qualifier = true,
bool  flag_locator = true,
const ELoc &  locatorOutType = ELoc::fromKey("Z"),
String  delim = ".",
bool  cleanSameLocator = true 
)
static

Construct an item of the Naming Convention Class

Parameters
prefixName given to the prefix
flag_varnameWhen TRUE, the 'varname' is included in the output names
flag_qualifierWhen TRUE, the 'qualifier' is included in the output names
flag_locatorWhen TRUE, the output variables receive a 'locator'
locatorOutTypeType of locator assigned to the output variables
delimSymbol used as a delimitor separating the different parts of the output names
cleanSameLocatorWhen TRUE and if 'flag_locator' is TRUE, all variables assigned to the same locator are cancelled beforehand
Returns

◆ isFlagQualifier()

bool NamingConvention::isFlagQualifier ( ) const
inline

◆ isFlagVarname()

bool NamingConvention::isFlagVarname ( ) const
inline

◆ operator=()

NamingConvention & NamingConvention::operator= ( const NamingConvention m)

◆ setDelim()

void NamingConvention::setDelim ( const String delim)
inline

◆ setFlagClean()

void NamingConvention::setFlagClean ( bool  cleanSameLocator)
inline

◆ setLocatorOutType()

void NamingConvention::setLocatorOutType ( const ELoc &  l)
inline

◆ setLocators()

void NamingConvention::setLocators ( Db dbout,
int  iattout_start,
int  nvar,
int  nitems = 1,
int  locatorShift = 0 
) const

◆ setNamesAndLocators() [1/7]

void NamingConvention::setNamesAndLocators ( const Db dbin,
const VectorInt iatts,
Db dbout,
int  iattout_start,
const String qualifier = "",
int  nitems = 1,
bool  flagSetLocator = true,
int  locatorShift = 0 
) const

Newly created variables are named as follow:

'prefix'.'v[i]'.'qualifier'.'item_rank'

where v[i] is the variable with rank 'i' within 'dbin'

Parameters
dbinPointer to the input Db (kept for symmetry)
iattsVector of attribute indices of the variables in Input Db
dboutPointer to the output Db
iattout_startStarting attribute index
qualifierOptional qualifier
nitemsNumber of items
flagSetLocatorTrue if the variable must be assigned the locator
locatorShiftShift to be applied to the locator currently defined

◆ setNamesAndLocators() [2/7]

void NamingConvention::setNamesAndLocators ( const Db dbin,
const VectorString names,
const ELoc &  locatorInType,
int  nvar,
Db dbout,
int  iattout_start,
const String qualifier = "",
int  nitems = 1,
bool  flagSetLocator = true,
int  locatorShift = 0 
) const

Newly created variables are named as follow:

'prefix'.'name'.'qualifier'.'item_rank'

where 'name' stands for the name of the variable(s) in 'names' or, if absent, the name of the variable with locator 'Loc' in 'dbin'

Parameters
dbinPointer to the input Db (kept for symmetry)
namesVector of names (from 'dbin'). If not defined, use the locator instead
locatorInTypeLocator Type of the variables in Input Db
nvarNumber of items belonging to the locatorType (if -1, all the items available for this locator are used)
dboutPointer to the output Db
iattout_startStarting attribute index
qualifierOptional qualifier
nitemsNumber of items
flagSetLocatorTrue if the variable must be assigned the locator
locatorShiftShift to be applied to the locator currently defined

◆ setNamesAndLocators() [3/7]

void NamingConvention::setNamesAndLocators ( const Db dbin,
int  iatt,
Db dbout,
int  iattout_start,
const String qualifier = "",
int  nitems = 1,
bool  flagSetLocator = true,
int  locatorShift = 0 
) const

Newly created variables are named as follow:

'prefix'.'v[iatt]'.'qualifier'.'item_rank'

Parameters
dbinPointer to the input Db (kept for symmetry)
iattAttribute index of the variables in Input Db
dboutPointer to the output Db
iattout_startStarting attribute index
qualifierOptional qualifier
nitemsNumber of items
flagSetLocatorTrue if the variable must be assigned the locator
locatorShiftShift to be applied to the locator currently defined

◆ setNamesAndLocators() [4/7]

void NamingConvention::setNamesAndLocators ( const String namin,
Db dbout,
int  iattout_start,
const String qualifier = "",
int  nitems = 1,
bool  flagSetLocator = true,
int  locatorShift = 0 
) const

Newly created variables are named as follow:

'prefix'.'namin'.'qualifier'.'item_rank'

Parameters
naminvariable name
dboutPointer to the output Db
iattout_startStarting attribute index
qualifierOptional qualifier
nitemsNumber of items
flagSetLocatorTrue if the variable must be assigned the locator
locatorShiftShift to be applied to the locator currently defined

◆ setNamesAndLocators() [5/7]

void NamingConvention::setNamesAndLocators ( const VectorString names,
Db dbout,
int  iattout_start,
const String qualifier = "",
int  nitems = 1,
bool  flagSetLocator = true,
int  locatorShift = 0 
) const

Newly created variables are named as follows:

'prefix'.'names[i]'.qualifier'.'item_rank'

Parameters
namesVector of variable names
dboutPointer to the output Db
iattout_startStarting attribute index
qualifierOptional qualifier
nitemsNumber of items
flagSetLocatorTrue if the variable must be assigned the locator
locatorShiftShift to be applied to the locator currently defined

◆ setNamesAndLocators() [6/7]

void NamingConvention::setNamesAndLocators ( Db dbout,
int  iattout_start,
const String qualifier = "",
int  nitems = 1,
bool  flagSetLocator = true,
int  locatorShift = 0 
) const

Newly created variables are named as follows:

'prefix'.'qualifier'.'item_rank'

Parameters
dboutPointer to the output Db
iattout_startStarting attribute index
qualifierOptional qualifier
nitemsNumber of items
flagSetLocatorTrue if the variable must be assigned the locator
locatorShiftShift to be applied to the locator currently defined

◆ setNamesAndLocators() [7/7]

void NamingConvention::setNamesAndLocators ( Db dbout,
int  iattout_start,
const VectorString names,
bool  flagSetLocator = true,
int  locatorShift = 0 
) const

Newly created variables are named as follows:

"names[i]"

Parameters
dboutPointer to the output Db
iattout_startStarting attribute index
namesVector of output variable names
flagSetLocatorTrue if the variable must be assigned the locator
locatorShiftShift to be applied to the locator currently defined

◆ setPrefix()

void NamingConvention::setPrefix ( const String prefix)
inline

◆ toString()

String NamingConvention::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

AStringable Interface.

Reimplemented from AStringable.

Member Data Documentation

◆ _cleanSameLocator

bool NamingConvention::_cleanSameLocator
private

Clean variables with the same locator beforehand.

◆ _delim

String NamingConvention::_delim
private

Character used as the 'delimitor' between different parts of the names.

◆ _flagLocator

bool NamingConvention::_flagLocator
private

When TRUE, assign a locator to the newly created variables.

◆ _flagQualifier

bool NamingConvention::_flagQualifier
private

When TRUE, add the 'qualifier'.

◆ _flagVarname

bool NamingConvention::_flagVarname
private

When TRUE, add the 'variable name'.

◆ _locatorOutType

ELoc NamingConvention::_locatorOutType
private

Type of locator assigned (if 'flagLocator' is TRUE)

◆ _prefix

String NamingConvention::_prefix
private

String used as 'prefix'.


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