Classes | Public Member Functions | Static Public Member Functions

NameValuePairs Class Reference

interface for retrieving values given their names More...

#include <cryptlib.h>

Inheritance diagram for NameValuePairs:
AlgorithmParameters CombinedNameValuePairs CryptoMaterial NullNameValuePairs TestDataNameValuePairs GeneratableCryptoMaterial PublicKey CryptoParameters PrivateKey ASN1CryptoMaterial< PublicKey > LUCFunction RabinFunction RWFunction DL_GroupParameters< T > DL_GroupParameters< Integer > DL_GroupParameters< typenameEcPrecomputation< EC >::Element > XTR_DH ASN1CryptoMaterial< PrivateKey > InvertibleESIGNFunction InvertibleLUCFunction InvertibleRabinFunction InvertibleRWFunction ESIGNFunction X509PublicKey InvertibleLUCFunction InvertibleRabinFunction InvertibleRWFunction

List of all members.


class  ValueTypeMismatch
 exception thrown when trying to retrieve a value using a different type than expected More...

Public Member Functions

template<class T >
bool GetThisObject (T &object) const
 get a copy of this object or a subobject of it
template<class T >
bool GetThisPointer (T *&p) const
 get a pointer to this object, as a pointer to T
template<class T >
bool GetValue (const char *name, T &value) const
 get a named value, returns true if the name exists
template<class T >
GetValueWithDefault (const char *name, T defaultValue) const
 get a named value, returns the default if the name doesn't exist
std::string GetValueNames () const
 get a list of value names that can be retrieved
bool GetIntValue (const char *name, int &value) const
 get a named value with type int
int GetIntValueWithDefault (const char *name, int defaultValue) const
 get a named value with type int, with default
template<class T >
void GetRequiredParameter (const char *className, const char *name, T &value) const
void GetRequiredIntParameter (const char *className, const char *name, int &value) const
virtual bool GetVoidValue (const char *name, const std::type_info &valueType, void *pValue) const =0
 to be implemented by derived classes, users should use one of the above functions instead

Static Public Member Functions

static void ThrowIfTypeMismatch (const char *name, const std::type_info &stored, const std::type_info &retrieving)
 used by derived classes to check for type mismatch

Detailed Description

interface for retrieving values given their names

This class is used to safely pass a variable number of arbitrarily typed arguments to functions and to read values from keys and crypto parameters.
To obtain an object that implements NameValuePairs for the purpose of parameter passing, use the MakeParameters() function.
To get a value from NameValuePairs, you need to know the name and the type of the value. Call GetValueNames() on a NameValuePairs object to obtain a list of value names that it supports. Then look at the Name namespace documentation to see what the type of each value is, or alternatively, call GetIntValue() with the value name, and if the type is not int, a ValueTypeMismatch exception will be thrown and you can get the actual type from the exception object.

Definition at line 225 of file cryptlib.h.

Member Function Documentation

bool NameValuePairs::GetIntValue ( const char *  name,
int &  value 
) const [inline]

get a named value with type int

used to ensure we don't accidentally try to get an unsigned int or some other type when we mean int (which is the most common case)

Definition at line 282 of file cryptlib.h.

Referenced by InvertibleRWFunction::GenerateRandom(), InvertibleRSAFunction::GenerateRandom(), InvertibleRabinFunction::GenerateRandom(), InvertibleLUCFunction::GenerateRandom(), DL_GroupParameters_IntegerBased::GenerateRandom(), DL_GroupParameters_DSA::GenerateRandom(), and InvertibleESIGNFunction::GenerateRandom().

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