mirror of https://github.com/ArduPilot/ardupilot
Add an interface for locating a variable by key.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1811 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
5a841e41c0
commit
0431b6dc69
|
@ -159,6 +159,22 @@ AP_Var::find(const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Find a variable by key.
|
||||
//
|
||||
AP_Var *
|
||||
AP_Var::find(Key key)
|
||||
{
|
||||
AP_Var *vp;
|
||||
|
||||
for (vp = first(); vp; vp = vp->next()) {
|
||||
|
||||
if (key == vp->key()) {
|
||||
return vp;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Save the variable to EEPROM, if supported
|
||||
//
|
||||
|
|
|
@ -214,6 +214,14 @@ public:
|
|||
///
|
||||
static AP_Var *find(const char *name);
|
||||
|
||||
/// Find a variable by key.
|
||||
///
|
||||
/// @param key The key being looked up.
|
||||
/// @return A pointer to the variable, or NULL if
|
||||
/// it does not exist.
|
||||
///
|
||||
static AP_Var *find(Key key);
|
||||
|
||||
/// Save the current value of the variable to EEPROM.
|
||||
///
|
||||
/// This interface works for any subclass that implements
|
||||
|
|
Loading…
Reference in New Issue