AP_Gripper: unify singleton naming to _singleton and get_singleton()

This commit is contained in:
Tom Pittenger 2019-02-10 10:31:01 -08:00 committed by Tom Pittenger
parent 95820c905d
commit 818c828a4a
2 changed files with 8 additions and 8 deletions

View File

@ -70,13 +70,13 @@ const AP_Param::GroupInfo AP_Gripper::var_info[] = {
AP_Gripper::AP_Gripper() AP_Gripper::AP_Gripper()
{ {
if (_s_instance) { if (_singleton) {
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL #if CONFIG_HAL_BOARD == HAL_BOARD_SITL
AP_HAL::panic("Too many grippers"); AP_HAL::panic("Too many grippers");
#endif #endif
return; return;
} }
_s_instance = this; _singleton = this;
AP_Param::setup_object_defaults(this, var_info); AP_Param::setup_object_defaults(this, var_info);
} }
@ -84,10 +84,10 @@ AP_Gripper::AP_Gripper()
/* /*
* Get the AP_Gripper singleton * Get the AP_Gripper singleton
*/ */
AP_Gripper *AP_Gripper::_s_instance = nullptr; AP_Gripper *AP_Gripper::_singleton = nullptr;
AP_Gripper *AP_Gripper::get_instance() AP_Gripper *AP_Gripper::get_singleton()
{ {
return _s_instance; return _singleton;
} }
void AP_Gripper::init() void AP_Gripper::init()
@ -155,7 +155,7 @@ namespace AP {
AP_Gripper *gripper() AP_Gripper *gripper()
{ {
return AP_Gripper::get_instance(); return AP_Gripper::get_singleton();
} }
}; };

View File

@ -26,8 +26,8 @@ public:
AP_Gripper(const AP_Gripper &other) = delete; AP_Gripper(const AP_Gripper &other) = delete;
AP_Gripper &operator=(const AP_Gripper&) = delete; AP_Gripper &operator=(const AP_Gripper&) = delete;
static AP_Gripper *get_instance(); static AP_Gripper *get_singleton();
static AP_Gripper *_s_instance; static AP_Gripper *_singleton;
// indicate whether this module is enabled or not // indicate whether this module is enabled or not
bool enabled() const { return _enabled; } bool enabled() const { return _enabled; }