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

#include <AP_Param.h>

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

Public Member Functions

const T & operator[] (uint8_t i)
 
const T & operator[] (int8_t i)
 
get (uint8_t i) const
 
void set (uint8_t i, const T &v)
 
- 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 [N]
 

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, uint8_t N, ap_var_type PT>
class AP_ParamA< T, N, PT >

Template class for array variables.

Objects created using this template behave like arrays of the type T, but are stored like single variables.

Template Parameters
TThe scalar type of the variable
Nnumber of elements
PTthe AP_PARAM_* type

Definition at line 804 of file AP_Param.h.

Member Function Documentation

◆ get()

template<typename T , uint8_t N, ap_var_type PT>
T AP_ParamA< T, N, PT >::get ( uint8_t  i) const
inline

Value getter

Note
Returns zero for index values out of range.

Definition at line 826 of file AP_Param.h.

◆ operator[]() [1/2]

template<typename T , uint8_t N, ap_var_type PT>
const T& AP_ParamA< T, N, PT >::operator[] ( uint8_t  i)
inline

Array operator accesses members.

Note
It would be nice to range-check i here, but then what would we return?

Definition at line 814 of file AP_Param.h.

◆ operator[]() [2/2]

template<typename T , uint8_t N, ap_var_type PT>
const T& AP_ParamA< T, N, PT >::operator[] ( int8_t  i)
inline

Definition at line 818 of file AP_Param.h.

◆ set()

template<typename T , uint8_t N, ap_var_type PT>
void AP_ParamA< T, N, PT >::set ( uint8_t  i,
const T &  v 
)
inline

Value setter

Note
Attempts to set an index out of range are discarded.

Definition at line 838 of file AP_Param.h.

Member Data Documentation

◆ _value

template<typename T , uint8_t N, ap_var_type PT>
T AP_ParamA< T, N, PT >::_value[N]
protected

Definition at line 845 of file AP_Param.h.

◆ vtype

template<typename T , uint8_t N, ap_var_type PT>
const ap_var_type AP_ParamA< T, N, PT >::vtype = PT
static

Definition at line 808 of file AP_Param.h.


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