APM:Libraries
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
AP_ParamT< T, PT > Class Template Reference

#include <AP_Param.h>

Inheritance diagram for AP_ParamT< T, PT >:
[legend]
Collaboration diagram for AP_ParamT< T, PT >:
[legend]

Public Member Functions

const T & get (void) const
 
void set (const T &v)
 
void set_default (const T &v)
 
void set_and_notify (const T &v)
 
bool set_and_save (const T &v)
 
bool set_and_save_ifchanged (const T &v)
 
 operator const T & () const
 
AP_ParamT< T, PT > & operator= (const T &v)
 
AP_ParamT< T, PT > & operator|= (const T &v)
 
AP_ParamT< T, PT > & operator&= (const T &v)
 
AP_ParamT< T, PT > & operator+= (const T &v)
 
AP_ParamT< T, PT > & operator-= (const T &v)
 
float cast_to_float (void) const
 
- Public Member Functions inherited from AP_Param
 AP_Param (const struct Info *info)
 
 AP_Param ()
 
void copy_name_info (const struct AP_Param::Info *info, const struct GroupInfo *ginfo, const struct GroupNesting &group_nesting, uint8_t idx, char *buffer, size_t bufferSize, bool force_scalar=false) const
 
void copy_name_token (const ParamToken &token, char *buffer, size_t bufferSize, bool force_scalar=false) const
 
void notify () const
 
bool save (bool force_save=false)
 
bool load (void)
 
void set_float (float value, enum ap_var_type var_type)
 
float cast_to_float (enum ap_var_type type) const
 cast a variable to a float given its type More...
 
bool configured_in_defaults_file (void) const
 
bool configured_in_storage (void) const
 
bool configured (void) const
 

Static Public Attributes

static const ap_var_type vtype = PT
 

Protected Attributes

_value
 

Additional Inherited Members

- Public Types inherited from AP_Param
enum  { CONVERT_FLAG_REVERSE =1, CONVERT_FLAG_FORCE =2 }
 
- Static Public Member Functions inherited from AP_Param
static bool setup ()
 
static bool initialised (void)
 
static uint32_t group_id (const struct GroupInfo *grpinfo, uint32_t base, uint8_t i, uint8_t shift)
 
static AP_Paramfind (const char *name, enum ap_var_type *ptype)
 
static bool set_default_by_name (const char *name, float value)
 
static bool set_by_name (const char *name, float value)
 
static bool set_and_save_by_name (const char *name, float value)
 
static AP_Paramfind_by_index (uint16_t idx, enum ap_var_type *ptype, ParamToken *token)
 
static bool find_key_by_pointer_group (const void *ptr, uint16_t vindex, const struct GroupInfo *group_info, ptrdiff_t offset, uint16_t &key)
 
static bool find_key_by_pointer (const void *ptr, uint16_t &key)
 
static AP_Paramfind_object (const char *name)
 
static bool load_all (bool check_defaults_file=true)
 
static void reload_defaults_file (bool panic_on_error=true)
 
static void load_object_from_eeprom (const void *object_pointer, const struct GroupInfo *group_info)
 
static void set_value (enum ap_var_type type, void *ptr, float def_value)
 
static void setup_object_defaults (const void *object_pointer, const struct GroupInfo *group_info)
 
static bool set_object_value (const void *object_pointer, const struct GroupInfo *group_info, const char *name, float value)
 
static void setup_sketch_defaults (void)
 
static bool find_old_parameter (const struct ConversionInfo *info, AP_Param *value)
 
static void convert_old_parameters (const struct ConversionInfo *conversion_table, uint8_t table_size, uint8_t flags=0)
 
static void convert_old_parameter (const struct ConversionInfo *info, float scaler, uint8_t flags=0)
 
static void convert_parent_class (uint8_t param_key, void *object_pointer, const struct AP_Param::GroupInfo *group_info)
 
static void erase_all (void)
 
static AP_Paramfirst (ParamToken *token, enum ap_var_type *ptype)
 
static AP_Paramnext (ParamToken *token, enum ap_var_type *ptype)
 
static AP_Paramnext_scalar (ParamToken *token, enum ap_var_type *ptype)
 
static bool check_var_info (void)
 
static uint16_t count_parameters (void)
 
static void set_hide_disabled_groups (bool value)
 
static void set_frame_type_flags (uint16_t flags_to_set)
 
static bool check_frame_type (uint16_t flags)
 

Detailed Description

template<typename T, ap_var_type PT>
class AP_ParamT< T, PT >

Template class for scalar variables.

Objects of this type have a value, and can be treated in many ways as though they were the value.

Template Parameters
TThe scalar type of the variable
PTThe AP_PARAM_* type

Definition at line 622 of file AP_Param.h.

Member Function Documentation

◆ cast_to_float()

template<typename T , ap_var_type PT>
float AP_ParamT< T, PT >::cast_to_float ( void  ) const
inline

AP_ParamT types can implement AP_Param::cast_to_float

Definition at line 721 of file AP_Param.h.

◆ get()

template<typename T , ap_var_type PT>
const T& AP_ParamT< T, PT >::get ( void  ) const
inline

Value getter

Definition at line 629 of file AP_Param.h.

◆ operator const T &()

template<typename T , ap_var_type PT>
AP_ParamT< T, PT >::operator const T & ( ) const
inline

Conversion to T returns a reference to the value.

This allows the class to be used in many situations where the value would be legal.

Definition at line 686 of file AP_Param.h.

◆ operator&=()

template<typename T , ap_var_type PT>
AP_ParamT<T,PT>& AP_ParamT< T, PT >::operator &= ( const T &  v)
inline

Definition at line 704 of file AP_Param.h.

◆ operator+=()

template<typename T , ap_var_type PT>
AP_ParamT<T,PT>& AP_ParamT< T, PT >::operator+= ( const T &  v)
inline

Definition at line 709 of file AP_Param.h.

◆ operator-=()

template<typename T , ap_var_type PT>
AP_ParamT<T,PT>& AP_ParamT< T, PT >::operator-= ( const T &  v)
inline

Definition at line 714 of file AP_Param.h.

◆ operator=()

template<typename T , ap_var_type PT>
AP_ParamT<T,PT>& AP_ParamT< T, PT >::operator= ( const T &  v)
inline

Copy assignment from T is equivalent to ::set.

Definition at line 692 of file AP_Param.h.

◆ operator|=()

template<typename T , ap_var_type PT>
AP_ParamT<T,PT>& AP_ParamT< T, PT >::operator|= ( const T &  v)
inline

bit ops on parameters

Definition at line 699 of file AP_Param.h.

◆ set()

template<typename T , ap_var_type PT>
void AP_ParamT< T, PT >::set ( const T &  v)
inline

Value setter

Definition at line 635 of file AP_Param.h.

◆ set_and_notify()

template<typename T , ap_var_type PT>
void AP_ParamT< T, PT >::set_and_notify ( const T &  v)
inline

Value setter - set value, tell GCS

Definition at line 649 of file AP_Param.h.

Here is the call graph for this function:

◆ set_and_save()

template<typename T , ap_var_type PT>
bool AP_ParamT< T, PT >::set_and_save ( const T &  v)
inline

Combined set and save

Definition at line 663 of file AP_Param.h.

Here is the call graph for this function:

◆ set_and_save_ifchanged()

template<typename T , ap_var_type PT>
bool AP_ParamT< T, PT >::set_and_save_ifchanged ( const T &  v)
inline

Combined set and save, but only does the save if the value if different from the current ram value, thus saving us a scan(). This should only be used where we have not set() the value separately, as otherwise the value in EEPROM won't be updated correctly.

Definition at line 674 of file AP_Param.h.

Here is the call graph for this function:

◆ set_default()

template<typename T , ap_var_type PT>
void AP_ParamT< T, PT >::set_default ( const T &  v)
inline

Sets if the parameter is unconfigured

Definition at line 641 of file AP_Param.h.

Here is the call graph for this function:

Member Data Documentation

◆ _value

template<typename T , ap_var_type PT>
T AP_ParamT< T, PT >::_value
protected

Definition at line 726 of file AP_Param.h.

◆ vtype

template<typename T , ap_var_type PT>
const ap_var_type AP_ParamT< T, PT >::vtype = PT
static

Definition at line 625 of file AP_Param.h.


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