Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
Clasp::Cli::ClaspCliConfig Class Reference

#include <clasp_options.h>

Inheritance diagram for Clasp::Cli::ClaspCliConfig:
Inheritance graph
[legend]

List of all members.

Classes

struct  ParseContext
class  ProgOption
struct  RawConfig
struct  ScopedSet

Public Member Functions

 ClaspCliConfig ()
 ~ClaspCliConfig ()
Raw interface
void init (uint32 solverId, ConfigKey config=config_asp_default)
 Initializes the i'th solver with the given configuration.
void initTester (uint32 solverId, ConfigKey config=config_default)
 Initializes the i'th tester solver with the given configuration.
bool set (OptionKey o, const char *value)
 Sets the given option in the master configuration.
bool set (uint32 solverId, OptionKey o, const char *value)
 Sets the given option in the i'th solver.
bool setTester (uint32 solverId, OptionKey o, const char *value)
 Sets the given option in the i'th tester solver.
bool finalize ()
 Validates and finalizes this configuration.
App interface
void addOptions (ProgramOptions::OptionContext &root)
 Adds all available options to root.
void addDisabled (ProgramOptions::ParsedOptions &parsed)
 Adds options that are disabled by the options contained in parsed to parsed.
bool finalize (const ProgramOptions::ParsedOptions &parsed, ProblemType type, bool applyDefaults)
 Applies the options in parsed and calls finalize().
template<class IT >
bool setConfig (IT first, IT last, ProblemType t)
 Populates this configuration with the options given in [first, last) and finalizes it.

Static Public Member Functions

static ConfigKey allocConfig ()
 Registers a new empty configuration and returns its key.
static void appendConfig (ConfigKey k, const char *name, const char *cmd)
 Appends cmd to the given configuration.
static ConfigIter getConfig (ConfigKey key)
 Returns the configuration with the given key as a double-null-terminated string list.
static const char * getDefaults (ProblemType f)
 Returns defaults for the given problem type.
static ConfigKey loadConfig (const char *fileName)
 Loads the configuration file with the given name and returns a configuration key for accessing it.
static bool releaseConfig (ConfigKey key)
 Discards the configuration with the given key.

Private Types

enum  ConfigOption { opt_configuration = -1, opt_tester = -2 }
typedef PodVector< std::string >
::type 
ConfigVec
typedef SingleOwnerPtr
< ParseContext
CtxPtr
typedef
ProgramOptions::OptionContext 
OptionContext
typedef
ProgramOptions::ParsedOptions 
ParsedOpts
typedef SingleOwnerPtr
< OptionContext
RootPtr

Private Member Functions

const UserConfigactive () const
UserConfigactive ()
ProgOptioncreateOption (int o)
void error (int opt) const
const ParsedOptsfinalizeParsed (UserConfig *active, const ParsedOpts &parsed, ParsedOpts &exclude) const
bool finalizeSolvers (UserConfig *active, const ParsedOpts &exclude, ProblemType t, bool defs)
bool finalizeTester (bool defs)
int get (OptionKey o, CtxOpts *&ctx, SolverParams *&solver, SolveParams *&solve)
void init (OptionContext *ctx, bool owned)
bool isGenerator () const
bool set (ConfigOption o, const char *value)
bool set (const ConfigIter &it, bool allowConfig, const ParsedOpts &exclude, ParsedOpts *out)
bool setConfig (const RawConfig &c, ProblemType t)
bool setDefaults (UserConfig *active, uint32 sId, const ParsedOpts &exclude, ProblemType t)

Private Attributes

CtxPtr opts_

Static Private Attributes

static ConfigVec configs_g
static const uint8 mode_relaxed = 4u
static const uint8 mode_solver = 1u
static const uint8 mode_tester = 2u
static const uint8 opt_applied = 0x80u

Detailed Description

Definition at line 81 of file clasp_options.h.


Member Typedef Documentation

typedef PodVector<std::string>::type Clasp::Cli::ClaspCliConfig::ConfigVec [private]

Definition at line 159 of file clasp_options.h.

Definition at line 157 of file clasp_options.h.

Definition at line 155 of file clasp_options.h.

Definition at line 160 of file clasp_options.h.

Definition at line 158 of file clasp_options.h.


Member Enumeration Documentation

Enumerator:
opt_configuration 
opt_tester 

Definition at line 150 of file clasp_options.h.


Constructor & Destructor Documentation

Definition at line 309 of file clasp_options.cpp.

Definition at line 310 of file clasp_options.cpp.


Member Function Documentation

const UserConfig* Clasp::Cli::ClaspCliConfig::active ( ) const [inline, private]

Definition at line 183 of file clasp_options.h.

Definition at line 184 of file clasp_options.h.

Adds options that are disabled by the options contained in parsed to parsed.

Definition at line 502 of file clasp_options.cpp.

Adds all available options to root.

Once options are added, an option source (e.g. the command-line) can be used to populate this object.

Definition at line 369 of file clasp_options.cpp.

Registers a new empty configuration and returns its key.

Definition at line 218 of file clasp_options.cpp.

void Clasp::Cli::ClaspCliConfig::appendConfig ( ConfigKey  k,
const char *  name,
const char *  cmd 
) [static]

Appends cmd to the given configuration.

Precondition:
k was previously acquired by a call to allocConfig().
Parameters:
kThe config to append to.
nameThe name of the new config.
cmdA space separated option-list in long-format (i.e. '--opt=value').

Definition at line 204 of file clasp_options.cpp.

Definition at line 311 of file clasp_options.cpp.

void Clasp::Cli::ClaspCliConfig::error ( int  opt) const [private]

Definition at line 566 of file clasp_options.cpp.

Validates and finalizes this configuration.

Definition at line 466 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::finalize ( const ProgramOptions::ParsedOptions parsed,
ProblemType  type,
bool  applyDefaults 
)

Applies the options in parsed and calls finalize().

Definition at line 478 of file clasp_options.cpp.

const ClaspCliConfig::ParsedOpts & Clasp::Cli::ClaspCliConfig::finalizeParsed ( UserConfig active,
const ParsedOpts parsed,
ParsedOpts exclude 
) const [private]

Definition at line 506 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::finalizeSolvers ( UserConfig active,
const ParsedOpts exclude,
ProblemType  t,
bool  defs 
) [private]

Definition at line 523 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::finalizeTester ( bool  defs) [private]

Definition at line 486 of file clasp_options.cpp.

int Clasp::Cli::ClaspCliConfig::get ( OptionKey  o,
CtxOpts *&  ctx,
SolverParams *&  solver,
SolveParams *&  solve 
) [private]

Definition at line 373 of file clasp_options.cpp.

Returns the configuration with the given key as a double-null-terminated string list.

Definition at line 261 of file clasp_options.cpp.

Returns defaults for the given problem type.

Definition at line 279 of file clasp_options.cpp.

void Clasp::Cli::ClaspCliConfig::init ( uint32  solverId,
ConfigKey  config = config_asp_default 
)

Initializes the i'th solver with the given configuration.

Definition at line 386 of file clasp_options.cpp.

void Clasp::Cli::ClaspCliConfig::init ( OptionContext ctx,
bool  owned 
) [private]

Definition at line 313 of file clasp_options.cpp.

void Clasp::Cli::ClaspCliConfig::initTester ( uint32  solverId,
ConfigKey  config = config_default 
)

Initializes the i'th tester solver with the given configuration.

Definition at line 391 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::isGenerator ( ) const [inline, private]

Definition at line 182 of file clasp_options.h.

ConfigKey Clasp::Cli::ClaspCliConfig::loadConfig ( const char *  fileName) [static]

Loads the configuration file with the given name and returns a configuration key for accessing it.

Definition at line 228 of file clasp_options.cpp.

Discards the configuration with the given key.

Definition at line 252 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::set ( OptionKey  o,
const char *  value 
)

Sets the given option in the master configuration.

Definition at line 404 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::set ( uint32  solverId,
OptionKey  o,
const char *  value 
)

Sets the given option in the i'th solver.

Definition at line 401 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::set ( ConfigOption  o,
const char *  value 
) [private]

Definition at line 426 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::set ( const ConfigIter it,
bool  allowConfig,
const ParsedOpts exclude,
ParsedOpts out 
) [private]

Definition at line 458 of file clasp_options.cpp.

template<class IT >
bool Clasp::Cli::ClaspCliConfig::setConfig ( IT  first,
IT  last,
ProblemType  t 
) [inline]

Populates this configuration with the options given in [first, last) and finalizes it.

Parameters:
[first,last)a range of options in argv format.

Definition at line 143 of file clasp_options.h.

bool Clasp::Cli::ClaspCliConfig::setConfig ( const RawConfig c,
ProblemType  t 
) [private]

Definition at line 589 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::setDefaults ( UserConfig active,
uint32  sId,
const ParsedOpts exclude,
ProblemType  t 
) [private]

Definition at line 444 of file clasp_options.cpp.

bool Clasp::Cli::ClaspCliConfig::setTester ( uint32  solverId,
OptionKey  o,
const char *  value 
)

Sets the given option in the i'th tester solver.

Definition at line 397 of file clasp_options.cpp.


Member Data Documentation

Definition at line 190 of file clasp_options.h.

const uint8 Clasp::Cli::ClaspCliConfig::mode_relaxed = 4u [static, private]

Definition at line 153 of file clasp_options.h.

const uint8 Clasp::Cli::ClaspCliConfig::mode_solver = 1u [static, private]

Definition at line 151 of file clasp_options.h.

const uint8 Clasp::Cli::ClaspCliConfig::mode_tester = 2u [static, private]

Definition at line 152 of file clasp_options.h.

const uint8 Clasp::Cli::ClaspCliConfig::opt_applied = 0x80u [static, private]

Definition at line 154 of file clasp_options.h.

Definition at line 191 of file clasp_options.h.


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


clasp
Author(s): Benjamin Kaufmann
autogenerated on Thu Aug 27 2015 12:41:41