DivXNetworks, Inc.
Main Page | Namespace List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals | Related Pages

Settings Class Reference

#include <Settings.h>


Detailed Description

API for controlling codec settings.

This abstract class provides access to a set of parameters. Each parameter has a type, a name and a value. This API is designed to manage interactions between parameters and to enforce restrictions on allowed values.

Each parameter has a predefined type so the codec can expose integer, double, boolean, string and enumerated parameters. Parameters may be marked as disabled or read-only by the codec, and they each have a default value. Numeric paremters have minimum and maximum limits. Enumerated parameters have a "mask" of allowable values.

Parameters are implicitly ordered by precedence. This allows the user to make certain assumtions about the behavior of the Settings API. Modifiying a paramater's value could affect parameters of lower precedence - their values could change, they could be enabled or disabled or their range or mask might be changed. Parameters of higher precedence that the modified parameter are guaranteed not to be affected.

The settings are guaranteed to be in a usable state after every user interaction. This means that some interactions will fail, for example attempting to change a disabled or read-only parameter.

Todo:
Documentation: example usage


Public Types

typedef uint32_t Enum
enum  Type {
  BOOLEAN, INTEGER, DOUBLE, ENUM,
  STRING, DATA
}

Public Member Functions

Settingsoperator= (const Settings &rhs)
virtual Name getName (int n) const =0
virtual Type getType (Name name) const =0
virtual bool isReadOnly (Name name) const =0
virtual bool isEnabled (Name name) const =0
virtual bool isDefault (Name name) const =0
virtual void setBool (Name name, bool value)=0
virtual bool getBool (Name name) const =0
virtual void setInt (Name name, int value)=0
virtual int getInt (Name name) const =0
virtual int getIntMin (Name name) const =0
virtual int getIntMax (Name name) const =0
virtual void setDouble (Name name, double value)=0
virtual double getDouble (Name name) const =0
virtual double getDoubleMin (Name name) const =0
virtual double getDoubleMax (Name name) const =0
virtual void setEnum (Name name, Enum value)=0
virtual Enum getEnum (Name name) const =0
virtual Enum getEnumMask (Name name) const =0
virtual void setStr (Name name, const char *value)=0
virtual const char * getStr (Name name) const =0
virtual void setData (Name name, const uint8_t *buff, int len)=0
virtual const uint8_t * getData (Name name) const =0
virtual int getDataLen (Name name) const =0
virtual void makeCurrentSettingsDefault ()=0
virtual void resetDefaults ()=0
virtual int getPrecedence (Settings::Name name) const =0

Static Public Member Functions

static Enum fourCC2Encoder (FourCC fourCC)
static bool isCorrectHeader (const char *version=SETTINGS_REVISION)

Protected Member Functions

 Settings (const Settings &rhs)
 Settings ()
virtual ~Settings ()

Data Structures

class  Exception
 C++ exception type used by the settings API. More...
class  Name
 Parameter name. Each parameter has a unique name. More...


Member Typedef Documentation

typedef uint32_t Settings::Enum
 

Type used for the value of enumerated (ENUM) parameters.


Member Enumeration Documentation

enum Settings::Type
 

Parameter type. Each parameter takes of one of these types.

Enumerator:
BOOLEAN  Boolean parameter.
INTEGER  Integer parameter.
DOUBLE  Double parameter.
ENUM  Enumerated parameter.
STRING  ASCII string parameter.
DATA  Binary data parameter.


Constructor & Destructor Documentation

Settings::Settings const Settings rhs  )  [protected]
 

Settings::Settings  )  [protected]
 

virtual Settings::~Settings  )  [protected, virtual]
 


Member Function Documentation

static Enum Settings::fourCC2Encoder FourCC  fourCC  )  [static]
 

Convenience function: converts a FourCC compression type to the appropriate ENUM parameter value.

Parameters:
fourCC FourCC video format type.
Returns:
ENUM value suitable for use with Settings::setEnum().

virtual bool Settings::getBool Name  name  )  const [pure virtual]
 

Queries the value of a BOOLEAN parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current value.

virtual const uint8_t* Settings::getData Name  name  )  const [pure virtual]
 

Queries the value of a DATA parameter.

Parameters:
name Name of the parameter in question.
Returns:
Pointer to a buffer containing the current data value.

virtual int Settings::getDataLen Name  name  )  const [pure virtual]
 

Queries the length of a DATA parameter.

Parameters:
name Name of the parameter in question.
Returns:
Length of the current data value in bytes.

virtual double Settings::getDouble Name  name  )  const [pure virtual]
 

Queries the value of a DOUBLE parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current value.

virtual double Settings::getDoubleMax Name  name  )  const [pure virtual]
 

Queries the maximum value of a DOUBLE parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current maximum allowable value.

virtual double Settings::getDoubleMin Name  name  )  const [pure virtual]
 

Queries the minimum value of a DOUBLE parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current minimum allowable value.

virtual Enum Settings::getEnum Name  name  )  const [pure virtual]
 

Queries the value of an ENUM parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current value.

virtual Enum Settings::getEnumMask Name  name  )  const [pure virtual]
 

Queries the current allowable settings for an ENUM parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current mask value.

virtual int Settings::getInt Name  name  )  const [pure virtual]
 

Queries the value of an INTEGER parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current value.

virtual int Settings::getIntMax Name  name  )  const [pure virtual]
 

Queries the maximum value of an INTEGER parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current maximum allowable value.

virtual int Settings::getIntMin Name  name  )  const [pure virtual]
 

Queries the minimum value of an INTEGER parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current minimum allowable value.

virtual Name Settings::getName int  n  )  const [pure virtual]
 

Used to get a list of the names of the currently active parameters.

Returns:
Name of parameter in precedence position n. If n is out of range, an invalid name will be returned.

virtual int Settings::getPrecedence Settings::Name  name  )  const [pure virtual]
 

Detirmines a parameter's position in the precedence hierarchy.

Parameters:
name Name of the parameter in question.
Returns:
Precedence of the specified parameter, higher value signifies higher precedence.

virtual const char* Settings::getStr Name  name  )  const [pure virtual]
 

Queries the value of a STRING parameter.

Parameters:
name Name of the parameter in question.
Returns:
The parameter's current value, as a null-terminated string.

virtual Type Settings::getType Name  name  )  const [pure virtual]
 

Queries the type of the specified paramter.

Parameters:
name Name of the parameter in question.
Returns:
Type of the parameter.

static bool Settings::isCorrectHeader const char *  version = SETTINGS_REVISION  )  [static]
 

Checks whether the user has the correct version of Settings.h. Call this method with no explicit parameters, allowing the default to be picked up. Any user of this header file may use this function to test, for example, that the macro definitions are current.

Parameters:
version Must be left undefined so that it takes its default value from Settings.h.
Returns:
True if the correct version of Settings.h is being used.

virtual bool Settings::isDefault Name  name  )  const [pure virtual]
 

Queries whether the specified paramter is equal to its default value.

Parameters:
name Name of the parameter in question.
Returns:
True if the parameter's value is the same as its default value.

virtual bool Settings::isEnabled Name  name  )  const [pure virtual]
 

Queries whether the specified paramter is enabled.

Parameters:
name Name of the parameter in question.
Returns:
True if the parameter is enabled.

virtual bool Settings::isReadOnly Name  name  )  const [pure virtual]
 

Queries whether the specified paramter is read-only.

Parameters:
name Name of the parameter in question.
Returns:
True if the parameter is read-only.

virtual void Settings::makeCurrentSettingsDefault  )  [pure virtual]
 

Uses the current set of parameter values as the new default settings. Current parameter values are unaffected but the previous set of default values will be lost. The next call to resetDefaults() will reset all parameters to the values at the time this method was called.

Settings& Settings::operator= const Settings rhs  ) 
 

Allows user to copy settings from one codec object to another.

virtual void Settings::resetDefaults  )  [pure virtual]
 

Resets all parameters to their default values.

virtual void Settings::setBool Name  name,
bool  value
[pure virtual]
 

Sets the value of a BOOLEAN parameter.

Parameters:
name Name of the parameter in question.
value The parameter's intended value.

virtual void Settings::setData Name  name,
const uint8_t *  buff,
int  len
[pure virtual]
 

Sets the value of a DATA parameter. The codec will make its own copy of the data value.

Parameters:
name Name of the parameter in question.
buff Pointer to a buffer containing the intended data value.
len Length of the data in bytes.

virtual void Settings::setDouble Name  name,
double  value
[pure virtual]
 

Sets the value of a DOUBLE parameter.

Parameters:
name Name of the parameter in question.
value The parameter's intended value.

virtual void Settings::setEnum Name  name,
Enum  value
[pure virtual]
 

Sets the value of an ENUM parameter.

Parameters:
name Name of the parameter in question.
value The parameter's intended value.

virtual void Settings::setInt Name  name,
int  value
[pure virtual]
 

Sets the value of an INTEGER parameter.

Parameters:
name Name of the parameter in question.
value The parameter's intended value.

virtual void Settings::setStr Name  name,
const char *  value
[pure virtual]
 

Sets the value of an STRING parameter. The codec will make its own copy of the string value.

Parameters:
name Name of the parameter in question.
value The parameter's intended value, as a null-terminated string.


The documentation for this class was generated from the following file:
Generated on Tue Jan 24 16:43:33 2006 for DivX Codec API Documentation.