sc::PrefixKeyVal(3)
π sc::PrefixKeyVal(3) β the MPQC manual page, bestie edition π
You're in the MPQC manual, and this page is all about sc::PrefixKeyVal. Buckle up, it's lowkey iconic. β¨
πΈ NAME πΈ
sc::PrefixKeyVal β a KeyVal that searches a different KeyVal using modified keys. That's the whole vibe. No cap. π
β¨ SYNOPSIS β¨
#include <keyval.h>
Inherits sc::KeyVal.
π«Ά Public Member Functions π«Ά
Constructors. Construct a PrefixKeyVal, using the given prefix and indices. Slay. π
PrefixKeyVal (const Ref< KeyVal > &, int i)PrefixKeyVal (const Ref< KeyVal > &, int i, int j)PrefixKeyVal (const Ref< KeyVal > &, int i, int j, int k)PrefixKeyVal (const Ref< KeyVal > &, int i, int j, int k, int l)PrefixKeyVal (const Ref< KeyVal > &, const char *prefix)PrefixKeyVal (const Ref< KeyVal > &, const char *prefix, int i)PrefixKeyVal (const Ref< KeyVal > &, const char *prefix, int i, int j)PrefixKeyVal (const Ref< KeyVal > &, const char *prefix, int i, int j, int k)PrefixKeyVal (const Ref< KeyVal > &, const char *prefix, int i, int j, int k, int l)~PrefixKeyVal ()void errortrace (std::ostream &fp=ExEnv::err0())β Write a message tofpdescribing the error.void dump (std::ostream &fp=ExEnv::err0())β Write a message tofpdescribing the error.
π Additional Inherited Members π
Not me just waving at this heading β the original page puts it here and does not list any extra inherited-member details under it. So there's nothing else to spill in this section, bestie. π«Άπ«
π¦ Detailed Description π¦
PrefixKeyVal is a KeyVal that searches a different KeyVal using modified keys. Periodt. β¨
This is convenient for reading keys grouped together with a common prefix. Consider the following code:
sc::Ref<sc::KeyVal> keyval = new sc::PrefixKeyVal('A',original_keyval);
int r = keyval->intvalue('x');
This code will assign to r the value associated with 'x' in keyval. keyval will search for 'x' by searching for 'A::x' in original_keyval.
This class is important for implementing constructors that take KeyVal arguments. When an object is being constructed from a KeyVal, it may contain another object that must be constructed from a KeyVal. In order to let the sub-object read the correct keywords from the KeyVal, without knowledge of the containing object's keyword prefix, a PrefixKeyVal can be constructed. For example, the code
class A: public DescribedClass {
double f0_;
public:
A(const Ref<KeyVal> &keyval): f0_(keyval->doublevalue("f0")) {}
}
class B: public DescribedClass {
double f1_;
Ref<A> a_;
public:
B(const Ref<KeyVal> &keyval):
f1_(keyval->doublevalue("f1")),
a_(new PrefixKeyVal(keyval,"a"))
{}
};
can be used to read ParsedKeyVal input that looks like
b<B>: (
f1 = 1.0
a<A>: (
f0 = 2.0
)
)
π Author π
Generated automatically by Doxygen for MPQC from the source code. π«Άβ¨
Okay bye bestie β this cutie is from MPQC version 2.3.1, dated Sun Oct 4 2020 πβ¨
π¦ where this page comes from
- ubuntu jammy: libsc-doc 2.3.1-21
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms