Logo SoCRocket

Transaction-Level Modeling Framework for Space Applications

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sr_param_t< T > Class Template Referenceabstract

Template specialized base class for configuration parameters. More...

#include <sr_param_t.h>

Inheritance diagram for sr_param_t< T >:
Collaboration diagram for sr_param_t< T >:

Public Member Functions

my_typeoperator+= (val_type)
 
my_typeoperator-= (val_type)
 
my_typeoperator/= (val_type)
 
my_typeoperator*= (val_type)
 
val_type operator+ (val_type)
 
val_type operator- (val_type)
 
val_type operator/ (val_type)
 
val_type operator* (val_type)
 
my_typeoperator%= (val_type)
 
my_typeoperator^= (val_type)
 
my_typeoperator&= (val_type)
 
my_typeoperator|= (val_type)
 
my_typeoperator<<= (val_type)
 
my_typeoperator>>= (val_type)
 
my_typeoperator-- ()
 
val_type operator-- (int)
 
my_typeoperator++ ()
 
val_type operator++ (int)
 
 sr_param_t ()
 Empty constructor. Name will be set in base. Avoid using it! You MUST call init() after instantiation! More...
 
 sr_param_t (const bool force_top_level_name, gs_param_array *parent_array, const bool register_at_db)
 Constructor with the special parameters. Name will be set in base. Avoid using it! You MUST call init() after instantiation! More...
 
 sr_param_t (const std::string &nam)
 Constructor with (local or hierarchical) name. You MUST call init() after instantiation! More...
 
 sr_param_t (const std::string &nam, const bool force_top_level_name, gs_param_array *parent_array, const bool register_at_db)
 Constructor with (local or hierarchical) name and special parameters. You MUST call init() after instantiation! More...
 
void init (const val_type &default_val)
 Init method to set the value and add the parameter to the plugin db. More...
 
void init ()
 Init method without value. More...
 
virtual ~sr_param_t ()
 Destructor. More...
 
my_typeoperator= (const my_type &v)
 Set the value of this parameter to the value of another gs_param. More...
 
my_typeoperator= (const val_type &v)
 Set the value of this parameter. More...
 
 operator const val_type & () const
 Get the value of this parameter. More...
 
void setValue (const val_type &val)
 Set the value of this parameter. More...
 
const val_type & getValue () const
 Returns the value of this parameter. More...
 
const void * get_value_pointer () const
 
bool setString (const std::string &str)
 Set the value of this parameter with a string. More...
 
const std::string & getString () const
 Get the value of this parameter as a string. More...
 
virtual std::string convertValueToString (const val_type &val) const =0
 Conversion method value type –> string. To be implemented by the specialization. More...
 
virtual const bool deserialize (val_type &target_val, const std::string &str)=0
 Deserialize for this parameter. To be implemented by the specialization. More...
 
void mirror (T &original)
 Serialize this parameter. More...
 
void mirror (sr_param_t< T > &original)
 
- Public Member Functions inherited from sr_param_base
 sr_param_base (const std::string &n, const bool register_at_db=true, gs::cnf::gs_param_array *parent_array=NULL, const bool force_top_level_name=false)
 
void setProperty (std::string key, std::string value)
 
std::string getProperty (std::string key)
 
std::map< std::string,
std::string > 
getProperties ()
 
void deleteProperty (std::string key)
 
bool exists (std::string key)
 
easy_init add_properties ()
 

Protected Member Functions

gs::cnf::callback_return_type mirror_callback (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 
const val_type & convertStringToValue (const std::string &str)
 Get the value the string. Needed for construction of gs_param. More...
 

Protected Attributes

val_type my_value
 Value of this parameter. More...
 
std::string return_string
 String whose reference can be returned as string value. More...
 
sr_param_t< T > * m_mirror_param
 
T * m_mirror_val
 

Detailed Description

template<typename T>
class sr_param_t< T >

Template specialized base class for configuration parameters.

Constructor & Destructor Documentation

template<typename T>
sr_param_t< T >::sr_param_t ( )
inlineexplicit

Empty constructor. Name will be set in base. Avoid using it! You MUST call init() after instantiation!

template<typename T>
sr_param_t< T >::sr_param_t ( const bool  force_top_level_name,
gs_param_array *  parent_array,
const bool  register_at_db 
)
inlineexplicit

Constructor with the special parameters. Name will be set in base. Avoid using it! You MUST call init() after instantiation!

Parameters
register_at_dbsee gs::cnf::gs_param_base, default = true.
parent_arraysee gs::cnf::gs_param_base, default=NULL.
force_top_level_nameIf the given name n should be a top-level name (then no prefeix is attached to the name), default false, be carefull in using this.
template<typename T>
sr_param_t< T >::sr_param_t ( const std::string &  nam)
inlineexplicit

Constructor with (local or hierarchical) name. You MUST call init() after instantiation!

This constructor may be called with local or hierarchical name.

Explicit constructor to avoid implicit construction of parameters.

gs_param MUST call init() or init(value) after construction to add the parameter to the plugin database!!!

Parameters
namThe local (or full hierarchical) parameter name (local: not including points) (local: unique inside a module, hierarchical: unique in the system).
template<typename T>
sr_param_t< T >::sr_param_t ( const std::string &  nam,
const bool  force_top_level_name,
gs_param_array *  parent_array,
const bool  register_at_db 
)
inlineexplicit

Constructor with (local or hierarchical) name and special parameters. You MUST call init() after instantiation!

This constructor may be called with local or hierarchical name.

Explicit constructor to avoid implicit construction of parameters.

gs_param MUST call init() or init(value) after construction to add the parameter to the plugin database!!!

Parameters
namThe local (or full hierarchical) parameter name (local: not including points) (local: unique inside a module, hierarchical: unique in the system).
register_at_dbsee gs::cnf::gs_param_base, default = true.
parent_arraysee gs::cnf::gs_param_base, default=NULL.
force_top_level_nameIf the given name n should be a top-level name (then no prefeix is attached to the name), default false, be carefull in using this.
template<typename T>
virtual sr_param_t< T >::~sr_param_t ( )
inlinevirtual

Destructor.

Member Function Documentation

template<typename T>
const val_type& sr_param_t< T >::convertStringToValue ( const std::string &  str)
inlineprotected

Get the value the string. Needed for construction of gs_param.

Conversion string –> value type.

Parameters
strString that should be converted to a value
Returns
If the convert was successfull

Referenced by sr_param_t< sc_dt::sc_uint< W > >::init(), and sr_param< std::string >::sr_param().

template<typename T>
virtual std::string sr_param_t< T >::convertValueToString ( const val_type &  val) const
pure virtual
template<typename T>
virtual const bool sr_param_t< T >::deserialize ( val_type &  target_val,
const std::string &  str 
)
pure virtual

Deserialize for this parameter. To be implemented by the specialization.

Conversion string –> value type.

User implemented for each template specialization of gs_param: Do not write to target_val if deserialization fails!

Set target_val to the default value if str is empty (=="").

Do not use ANY member variables. Act as if the method is static.

Parameters
target_valReference to the value that should be set.
strString that should be converted to a value.
Returns
If the convertion was successfull

Implemented in sr_param< sc_core::sc_event >, and sr_param< std::string >.

Referenced by sr_param_t< sc_dt::sc_uint< W > >::convertStringToValue(), and sr_param_t< sc_dt::sc_uint< W > >::setString().

template<typename T>
const void* sr_param_t< T >::get_value_pointer ( ) const
inline
See Also
gs::cnf::gs_param_base::get_value_pointer
template<typename T>
const std::string& sr_param_t< T >::getString ( ) const
inline

Get the value of this parameter as a string.

Returns
String representation of the current value of this parameter.
template<typename T>
const val_type& sr_param_t< T >::getValue ( ) const
inline
template<typename T>
void sr_param_t< T >::init ( const val_type &  default_val)
inline

Init method to set the value and add the parameter to the plugin db.

Has to be called by the gs_param class after construction! Does set the value and add the parameter to the plugin db.

template<typename T>
void sr_param_t< T >::init ( )
inline
template<typename T>
void sr_param_t< T >::mirror ( T &  original)
inline

Serialize this parameter.

Uses the convertValueToString method

template<typename T>
void sr_param_t< T >::mirror ( sr_param_t< T > &  original)
inline
template<typename T>
gs::cnf::callback_return_type sr_param_t< T >::mirror_callback ( gs::gs_param_base &  changed_param,
gs::cnf::callback_type  reason 
)
inlineprotected
template<typename T>
sr_param_t< T >::operator const val_type & ( ) const
inline

Get the value of this parameter.

Returns
Value of the parameter.
template<typename T>
my_type& sr_param_t< T >::operator%= ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator&= ( val_type  )
template<typename T>
val_type sr_param_t< T >::operator* ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator*= ( val_type  )
template<typename T>
val_type sr_param_t< T >::operator+ ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator++ ( )
template<typename T>
val_type sr_param_t< T >::operator++ ( int  )
template<typename T>
my_type& sr_param_t< T >::operator+= ( val_type  )
template<typename T>
val_type sr_param_t< T >::operator- ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator-- ( )
template<typename T>
val_type sr_param_t< T >::operator-- ( int  )
template<typename T>
my_type& sr_param_t< T >::operator-= ( val_type  )
template<typename T>
val_type sr_param_t< T >::operator/ ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator/= ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator<<= ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator= ( const my_type v)
inline

Set the value of this parameter to the value of another gs_param.

To resolve the correct = operator in the (not specialized) class which inherits from this class has to use

using gs_param_t<val_type>::operator =;
Parameters
vParameter where the value should be read from.
Returns
Pointer to this.
template<typename T>
my_type& sr_param_t< T >::operator= ( const val_type &  v)
inline

Set the value of this parameter.

To resolve the correct = operator in the (not specialized) class which inherits from this class has to use

using gs_param_t<val_type>::operator =;
Parameters
vValue which has to be set.
Returns
Pointer to this.
template<typename T>
my_type& sr_param_t< T >::operator>>= ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator^= ( val_type  )
template<typename T>
my_type& sr_param_t< T >::operator|= ( val_type  )
template<typename T>
bool sr_param_t< T >::setString ( const std::string &  str)
inline

Set the value of this parameter with a string.

Parameters
strThe new value for this parameter, represented as a string.
Returns
If setting was successful
template<typename T>
void sr_param_t< T >::setValue ( const val_type &  val)
inline

Member Data Documentation

template<typename T>
sr_param_t<T>* sr_param_t< T >::m_mirror_param
protected
template<typename T>
T* sr_param_t< T >::m_mirror_val
protected
template<typename T>
val_type sr_param_t< T >::my_value
protected
template<typename T>
std::string sr_param_t< T >::return_string
mutableprotected

String whose reference can be returned as string value.

Referenced by sr_param_t< sc_dt::sc_uint< W > >::getString().


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