The Sparta Modeling Framework
Loading...
Searching...
No Matches
ParameterSet.hpp File Reference

A set of sparta::Parameters per sparta::ResourceTreeNode. More...

#include <iostream>
#include <iomanip>
#include <string>
#include <ostream>
#include <vector>
#include <unordered_map>
#include "sparta/utils/Utils.hpp"
#include "sparta/simulation/TreeNode.hpp"
#include "sparta/simulation/Parameter.hpp"

Go to the source code of this file.

Classes

class  sparta::ParameterSet
 Generic container of Parameters. More...
 
class  sparta::ParameterSet::ParameterSetIterator< T >
 Non-const iterator for ParameterSet. More...
 

Namespaces

namespace  sparta
 Macros for handling exponential backoff.
 

Macros

#define PARAMETER(type, name, def, doc)    sparta::Parameter<type> name {#name, def, doc, __this_ps};
 Parameter declaration.
 
#define LOCKED_PARAMETER(type, name, def, doc)    sparta::Parameter<type> name {#name, def, doc, sparta::Parameter<type>::ParameterAttribute::LOCKED, __this_ps};
 
#define VOLATILE_LOCKED_PARAMETER(type, name, def, doc)    sparta::Parameter<type> name {#name, def, doc, sparta::Parameter<type>::ParameterAttribute::LOCKED, __this_ps, true};
 
#define HIDDEN_PARAMETER(type, name, def, doc)    sparta::Parameter<type> name {#name, def, doc, sparta::Parameter<type>::ParameterAttribute::HIDDEN, __this_ps};
 
#define VOLATILE_HIDDEN_PARAMETER(type, name, def, doc)    sparta::Parameter<type> name {#name, def, doc, sparta::Parameter<type>::ParameterAttribute::HIDDEN, __this_ps, true};
 
#define VOLATILE_PARAMETER(type, name, def, doc)    sparta::Parameter<type> name {#name, def, doc, __this_ps, true};
 Special-case PARAMETER declaration.
 
#define PARAMETER_CTORDEFAULT(type, name, doc)
 Define a Parameter who will get its default from the constructor.
 

Functions

std::ostream & operator<< (std::ostream &out, sparta::ParameterSet const &ps)
 ParameterSet Pretty-Printing stream operator.
 
std::ostream & operator<< (std::ostream &out, sparta::ParameterSet const *ps)
 

Detailed Description

A set of sparta::Parameters per sparta::ResourceTreeNode.

Definition in file ParameterSet.hpp.

Macro Definition Documentation

◆ HIDDEN_PARAMETER

#define HIDDEN_PARAMETER (   type,
  name,
  def,
  doc 
)     sparta::Parameter<type> name {#name, def, doc, sparta::Parameter<type>::ParameterAttribute::HIDDEN, __this_ps};

Definition at line 750 of file ParameterSet.hpp.

◆ LOCKED_PARAMETER

#define LOCKED_PARAMETER (   type,
  name,
  def,
  doc 
)     sparta::Parameter<type> name {#name, def, doc, sparta::Parameter<type>::ParameterAttribute::LOCKED, __this_ps};

Definition at line 744 of file ParameterSet.hpp.

◆ PARAMETER

#define PARAMETER (   type,
  name,
  def,
  doc 
)     sparta::Parameter<type> name {#name, def, doc, __this_ps};

Parameter declaration.

Parameters
typeC++ type of the parameter. Must be an entry supported by sparta::Parameter
nameName of the parameter. This will be a member variable of the ParameterSet subclass in which this macro is used as well as a string in a table of parameters held by that class.
defDefault value. Must be a valid construction of type which can be used to copy-construct an instance of type or assigned to an instance of type.
docDescription of this Parameter. It should include the semantics and allowed values.
Precondition
Invoke within public section of a class declaration which inherits from sparta::ParameterSet
Note
Validators may be attached to the parameter within the constructor of the sparta::ParameterSet subclass in which this macro was invoked. The PARAMETER macro was rewritten from a sub-class of sparta::Parameter to just an instance of it.

Definition at line 741 of file ParameterSet.hpp.

◆ PARAMETER_CTORDEFAULT

#define PARAMETER_CTORDEFAULT (   type,
  name,
  doc 
)
Value:
class _Parameter_##name : public sparta::Parameter<type> \
{ \
public: \
typedef type value_type; \
\
/* construction with no default is disallowed */ \
_Parameter_##name() = delete; \
\
/* construction with new default value */ \
_Parameter_##name(ParameterSet* ps, type default_value) : \
sparta::Parameter<type>(#name, default_value, doc) \
{ \
sparta_assert(ps, "Must construct Parameter " #name " with valid ParameterSet"); \
this->addToSet_(ps); \
} \
\
void operator=(const value_type& v) { \
/*return *this;*/ \
} \
}; \
_Parameter_##name name;
Parameter instance, templated to contain only a specific type.
void operator=(const Parameter &p)=delete
Copy assignment - deleted explicitly.
Macros for handling exponential backoff.

Define a Parameter who will get its default from the constructor.

See also
PARAMETER

Strictly speaking, this does not introduce any functionality that PARAMETER couldn't support. However, explicitly identifying parameters who get their default value from the ParameterSet subclass constructor may help reduce surpise default values - which would happen if the default for PARAMETER were allowed to be overridden in the ParameterSet initializer list

Definition at line 774 of file ParameterSet.hpp.

◆ VOLATILE_HIDDEN_PARAMETER

#define VOLATILE_HIDDEN_PARAMETER (   type,
  name,
  def,
  doc 
)     sparta::Parameter<type> name {#name, def, doc, sparta::Parameter<type>::ParameterAttribute::HIDDEN, __this_ps, true};

Definition at line 753 of file ParameterSet.hpp.

◆ VOLATILE_LOCKED_PARAMETER

#define VOLATILE_LOCKED_PARAMETER (   type,
  name,
  def,
  doc 
)     sparta::Parameter<type> name {#name, def, doc, sparta::Parameter<type>::ParameterAttribute::LOCKED, __this_ps, true};

Definition at line 747 of file ParameterSet.hpp.

◆ VOLATILE_PARAMETER

#define VOLATILE_PARAMETER (   type,
  name,
  def,
  doc 
)     sparta::Parameter<type> name {#name, def, doc, __this_ps, true};

Special-case PARAMETER declaration.

Note
This macro was rewritten from a sub-class of sparta::Parameter to just an instance of it.

Definition at line 761 of file ParameterSet.hpp.

Function Documentation

◆ operator<<() [1/2]

std::ostream & operator<< ( std::ostream &  out,
sparta::ParameterSet const &  ps 
)
inline

ParameterSet Pretty-Printing stream operator.

Definition at line 799 of file ParameterSet.hpp.

Here is the call graph for this function:

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  out,
sparta::ParameterSet const *  ps 
)
inline

Definition at line 804 of file ParameterSet.hpp.