mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 15:53:56 -04:00
Don't allow the default serialize/unserialize to be inlined.
Fix some includes and remove an old implementation of meta_cast. git-svn-id: https://arducopter.googlecode.com/svn/trunk@1401 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
a02136236f
commit
ea9c7859f8
26
libraries/AP_Common/AP_MetaClass.cpp
Normal file
26
libraries/AP_Common/AP_MetaClass.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
|
||||||
|
//
|
||||||
|
// This is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 2.1 of the License, or (at
|
||||||
|
// your option) any later version.
|
||||||
|
//
|
||||||
|
|
||||||
|
/// @file AP_MetaClass.cpp
|
||||||
|
/// Abstract meta-class from which other AP classes may inherit.
|
||||||
|
/// Provides type introspection and some basic protocols that can
|
||||||
|
/// be implemented by subclasses.
|
||||||
|
|
||||||
|
#include "AP_MetaClass.h"
|
||||||
|
|
||||||
|
size_t
|
||||||
|
AP_MetaClass::serialize(void *buf, size_t bufSize)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
AP_MetaClass::unserialize(void *buf, size_t bufSize)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
@ -14,8 +14,11 @@
|
|||||||
#ifndef AP_METACLASS_H
|
#ifndef AP_METACLASS_H
|
||||||
#define AP_METACLASS_H
|
#define AP_METACLASS_H
|
||||||
|
|
||||||
|
#include <stddef.h> // for size_t
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include <avr/io.h> // for RAMEND
|
||||||
|
|
||||||
/// Basic meta-class from which other AP_* classes can derive.
|
/// Basic meta-class from which other AP_* classes can derive.
|
||||||
///
|
///
|
||||||
/// Functions that form the public API to the metaclass are prefixed meta_.
|
/// Functions that form the public API to the metaclass are prefixed meta_.
|
||||||
@ -130,7 +133,6 @@ public:
|
|||||||
return (T *)p;
|
return (T *)p;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
//#define meta_cast(_p, _typename) { _typename _obj; AP_MetaClass::meta_type_equivalent(_p, &_obj) ? (_typename *)_p : NULL; }
|
|
||||||
|
|
||||||
/// Serialise the class.
|
/// Serialise the class.
|
||||||
///
|
///
|
||||||
@ -146,7 +148,7 @@ public:
|
|||||||
/// have overflowed the buffer. If the return value is zero,
|
/// have overflowed the buffer. If the return value is zero,
|
||||||
/// the class does not support serialisation.
|
/// the class does not support serialisation.
|
||||||
///
|
///
|
||||||
virtual size_t serialize(void *buf, size_t bufSize) const { return 0; }
|
virtual size_t serialize(void *buf, size_t bufSize);
|
||||||
|
|
||||||
/// Unserialise the class.
|
/// Unserialise the class.
|
||||||
///
|
///
|
||||||
@ -165,7 +167,7 @@ public:
|
|||||||
/// value is zero the class does not support unserialisation or
|
/// value is zero the class does not support unserialisation or
|
||||||
/// the data in the buffer is invalid.
|
/// the data in the buffer is invalid.
|
||||||
///
|
///
|
||||||
virtual size_t unserialize(void *buf, size_t bufSize) { return false; }
|
virtual size_t unserialize(void *buf, size_t bufSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AP_METACLASS_H
|
#endif // AP_METACLASS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user