mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-02 05:58:30 -04:00
uncrustify libraries/AP_Common/AP_MetaClass.h
This commit is contained in:
parent
e79d9adea0
commit
0c99546f45
@ -108,7 +108,7 @@ public:
|
|||||||
/// @return An opaque handle
|
/// @return An opaque handle
|
||||||
///
|
///
|
||||||
Meta_handle meta_get_handle(void) const {
|
Meta_handle meta_get_handle(void) const {
|
||||||
return ((Meta_handle)meta_type_id() << 16) | (uintptr_t)this;
|
return ((Meta_handle)meta_type_id() << 16) | (uintptr_t) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Validates an AP_Meta_class handle.
|
/// Validates an AP_Meta_class handle.
|
||||||
@ -123,8 +123,8 @@ public:
|
|||||||
/// @return The instance pointer if the handle is good,
|
/// @return The instance pointer if the handle is good,
|
||||||
/// or NULL if it is bad.
|
/// or NULL if it is bad.
|
||||||
///
|
///
|
||||||
static AP_Meta_class *meta_validate_handle(Meta_handle handle) {
|
static AP_Meta_class * meta_validate_handle(Meta_handle handle) {
|
||||||
AP_Meta_class *candidate = (AP_Meta_class *)(handle & 0xffff); // extract object pointer
|
AP_Meta_class * candidate = (AP_Meta_class *)(handle & 0xffff); // extract object pointer
|
||||||
uint16_t id = handle >> 16; // and claimed type
|
uint16_t id = handle >> 16; // and claimed type
|
||||||
|
|
||||||
// Sanity-check the pointer to ensure it lies within the device RAM, so that
|
// Sanity-check the pointer to ensure it lies within the device RAM, so that
|
||||||
@ -190,7 +190,7 @@ public:
|
|||||||
/// @return NULL if p is not of precisely type T, otherwise p cast to T.
|
/// @return NULL if p is not of precisely type T, otherwise p cast to T.
|
||||||
///
|
///
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static T *meta_cast(AP_Meta_class *p) {
|
static T * meta_cast(AP_Meta_class *p) {
|
||||||
T tmp;
|
T tmp;
|
||||||
if (meta_type_equivalent(p, &tmp)) {
|
if (meta_type_equivalent(p, &tmp)) {
|
||||||
return (T *)p;
|
return (T *)p;
|
||||||
@ -206,7 +206,7 @@ public:
|
|||||||
/// @return NULL if this is not of precisely type T, otherwise this cast to T.
|
/// @return NULL if this is not of precisely type T, otherwise this cast to T.
|
||||||
///
|
///
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T *meta_cast(void) {
|
T * meta_cast(void) {
|
||||||
T tmp;
|
T tmp;
|
||||||
if (meta_type_equivalent(this, &tmp)) {
|
if (meta_type_equivalent(this, &tmp)) {
|
||||||
return (T*)this;
|
return (T*)this;
|
||||||
|
Loading…
Reference in New Issue
Block a user