.TH "sc::PrefixKeyVal" 3 "Sun Oct 4 2020" "Version 2.3.1" "MPQC" \" -*- nroff -*- .ad l .nh .SH NAME sc::PrefixKeyVal \- \fBPrefixKeyVal\fP is a \fBKeyVal\fP that searches a different \fBKeyVal\fP using modified keys\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBsc::KeyVal\fP\&. .SS "Public Member Functions" .PP .RI "\fBConstructors\&.\fP" .br Construct a \fBPrefixKeyVal\fP, using the given prefix and indices\&. .PP .in +1c .in +1c .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, int i)" .br .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, int i, int j)" .br .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, int i, int j, int k)" .br .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, int i, int j, int k, int l)" .br .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, const char *prefix)" .br .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, const char *prefix, int i)" .br .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, const char *prefix, int i, int j)" .br .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, const char *prefix, int i, int j, int k)" .br .ti -1c .RI "\fBPrefixKeyVal\fP (const \fBRef\fP< \fBKeyVal\fP > &, const char *prefix, int i, int j, int k, int l)" .br .ti -1c .RI "\fB~PrefixKeyVal\fP ()" .br .ti -1c .RI "void \fBerrortrace\fP (std::ostream &fp=\fBExEnv::err0\fP())" .br .RI "Write a message to fp describing the error\&. " .ti -1c .RI "void \fBdump\fP (std::ostream &fp=\fBExEnv::err0\fP())" .br .RI "Write a message to fp describing the error\&. " .in -1c .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP \fBPrefixKeyVal\fP is a \fBKeyVal\fP that searches a different \fBKeyVal\fP using modified keys\&. This is convenient for reading keys grouped together with a common prefix\&. Consider the following code: .PP .nf sc::Ref keyval = new \fBsc::PrefixKeyVal\fP('A',original_keyval); int r = keyval->intvalue('x'); .fi .PP 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\&. .PP This class is important for implementing constructors that take \fBKeyVal\fP arguments\&. When an object is being constructed from a \fBKeyVal\fP, it may contain another object that must be constructed from a \fBKeyVal\fP\&. In order to let the sub-object read the correct keywords from the \fBKeyVal\fP, without knowledge of the containing objects keyword prefix, a \fBPrefixKeyVal\fP can be constructed\&. For example, the code .PP .nf class A: public DescribedClass { double f0_; public: A(const Ref &keyval): f0_(keyval->doublevalue("f0")) {} } class B: public DescribedClass { double f1_; Ref a_; public: B(const Ref &keyval): f1_(keyval->doublevalue("f1")), a_(new PrefixKeyVal(keyval,"a")) {} }; .fi .PP can be used to read \fBParsedKeyVal\fP input that looks like .PP .nf b: ( f1 = 1\&.0 a: ( f0 = 2\&.0 ) ) .fi .PP .SH "Author" .PP Generated automatically by Doxygen for MPQC from the source code\&.