gstlearn
1.0.0
CCC
|
#include <NamingConvention.hpp>
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) | |
NamingConvention & | operator= (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) | |
AStringable & | operator= (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 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) |
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... | |
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'
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:
Then the non-conditional simulation procedure generates variables such as:
MyPrefix.2 (for second simulation) ...
Then the conditional simulation procedure generates variables such as:
Ultimately, the newly created variables are assigned a locator.
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::NamingConvention | ( | const NamingConvention & | m | ) |
|
virtual |
|
private |
Defines the names of the output variables.
names | Vector of Names (dimension: nvar) |
qualifier | Optional qualifier |
nitems | Number of items to be renamed |
|
private |
Defines the names of the output variables. These variables are located in 'dbout'; they have consecutive UIDs, starting from 'iattout_start'
dbout | Pointer to the output Db structure |
iattout_start | Rank of the first variable to be named |
names | Vector of Names (dimension: nvar) |
qualifier | Optional qualifier |
nitems | Number of items to be renamed |
|
static |
Construct an item of the Naming Convention Class
prefix | Name given to the prefix |
flag_varname | When TRUE, the 'varname' is included in the output names |
flag_qualifier | When TRUE, the 'qualifier' is included in the output names |
flag_locator | When TRUE, the output variables receive a 'locator' |
locatorOutType | Type of locator assigned to the output variables |
delim | Symbol used as a delimitor separating the different parts of the output names |
cleanSameLocator | When TRUE and if 'flag_locator' is TRUE, all variables assigned to the same locator are cancelled beforehand |
|
inline |
|
inline |
NamingConvention & NamingConvention::operator= | ( | const NamingConvention & | m | ) |
|
inline |
|
inline |
|
inline |
void NamingConvention::setLocators | ( | Db * | dbout, |
int | iattout_start, | ||
int | nvar, | ||
int | nitems = 1 , |
||
int | locatorShift = 0 |
||
) | const |
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'
dbin | Pointer to the input Db (kept for symmetry) |
iatts | Vector of attribute indices of the variables in Input Db |
dbout | Pointer to the output Db |
iattout_start | Starting attribute index |
qualifier | Optional qualifier |
nitems | Number of items |
flagSetLocator | True if the variable must be assigned the locator |
locatorShift | Shift to be applied to the locator currently defined |
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'
dbin | Pointer to the input Db (kept for symmetry) |
names | Vector of names (from 'dbin'). If not defined, use the locator instead |
locatorInType | Locator Type of the variables in Input Db |
nvar | Number of items belonging to the locatorType (if -1, all the items available for this locator are used) |
dbout | Pointer to the output Db |
iattout_start | Starting attribute index |
qualifier | Optional qualifier |
nitems | Number of items |
flagSetLocator | True if the variable must be assigned the locator |
locatorShift | Shift to be applied to the locator currently defined |
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'
dbin | Pointer to the input Db (kept for symmetry) |
iatt | Attribute index of the variables in Input Db |
dbout | Pointer to the output Db |
iattout_start | Starting attribute index |
qualifier | Optional qualifier |
nitems | Number of items |
flagSetLocator | True if the variable must be assigned the locator |
locatorShift | Shift to be applied to the locator currently defined |
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'
namin | variable name |
dbout | Pointer to the output Db |
iattout_start | Starting attribute index |
qualifier | Optional qualifier |
nitems | Number of items |
flagSetLocator | True if the variable must be assigned the locator |
locatorShift | Shift to be applied to the locator currently defined |
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'
names | Vector of variable names |
dbout | Pointer to the output Db |
iattout_start | Starting attribute index |
qualifier | Optional qualifier |
nitems | Number of items |
flagSetLocator | True if the variable must be assigned the locator |
locatorShift | Shift to be applied to the locator currently defined |
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'
dbout | Pointer to the output Db |
iattout_start | Starting attribute index |
qualifier | Optional qualifier |
nitems | Number of items |
flagSetLocator | True if the variable must be assigned the locator |
locatorShift | Shift to be applied to the locator currently defined |
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]"
dbout | Pointer to the output Db |
iattout_start | Starting attribute index |
names | Vector of output variable names |
flagSetLocator | True if the variable must be assigned the locator |
locatorShift | Shift to be applied to the locator currently defined |
|
inline |
|
overridevirtual |
AStringable Interface.
Reimplemented from AStringable.
|
private |
Clean variables with the same locator beforehand.
|
private |
Character used as the 'delimitor' between different parts of the names.
|
private |
When TRUE, assign a locator to the newly created variables.
|
private |
When TRUE, add the 'qualifier'.
|
private |
When TRUE, add the 'variable name'.
|
private |
Type of locator assigned (if 'flagLocator' is TRUE)
|
private |
String used as 'prefix'.