From ea9c7859f8b27fe6f921819b82844647f2f38584 Mon Sep 17 00:00:00 2001 From: DrZiplok Date: Mon, 3 Jan 2011 02:26:18 +0000 Subject: [PATCH] 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 --- libraries/AP_Common/AP_MetaClass.cpp | 26 ++++++++++++++++++++++++++ libraries/AP_Common/AP_MetaClass.h | 8 +++++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 libraries/AP_Common/AP_MetaClass.cpp diff --git a/libraries/AP_Common/AP_MetaClass.cpp b/libraries/AP_Common/AP_MetaClass.cpp new file mode 100644 index 0000000000..3fa231e620 --- /dev/null +++ b/libraries/AP_Common/AP_MetaClass.cpp @@ -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; +} diff --git a/libraries/AP_Common/AP_MetaClass.h b/libraries/AP_Common/AP_MetaClass.h index 11fab417bd..7e5b62951b 100644 --- a/libraries/AP_Common/AP_MetaClass.h +++ b/libraries/AP_Common/AP_MetaClass.h @@ -14,8 +14,11 @@ #ifndef AP_METACLASS_H #define AP_METACLASS_H +#include // for size_t #include +#include // for RAMEND + /// Basic meta-class from which other AP_* classes can derive. /// /// Functions that form the public API to the metaclass are prefixed meta_. @@ -130,7 +133,6 @@ public: return (T *)p; return NULL; } -//#define meta_cast(_p, _typename) { _typename _obj; AP_MetaClass::meta_type_equivalent(_p, &_obj) ? (_typename *)_p : NULL; } /// Serialise the class. /// @@ -146,7 +148,7 @@ public: /// have overflowed the buffer. If the return value is zero, /// 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. /// @@ -165,7 +167,7 @@ public: /// value is zero the class does not support unserialisation or /// 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