Commit Graph

9 Commits

Author SHA1 Message Date
Andrew Tridgell 00d52a8bd7 ap_common: use intptr_t for pointer casts
this allows building on systems with pointers that aren't 16 bits long
2011-10-09 22:08:59 +11:00
DrZiplok@gmail.com 2f263229f9 Rename AP_Meta_class::AP_Type_id to AP_Meta_class::Type_id in keeping with the coding standard.
Add a non-static version of AP_Meta_class::meta_cast that can be used against any subclass object directly.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1539 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 23:46:58 +00:00
DrZiplok@gmail.com de71731994 Add a templated version of AP_Meta_class::meta_type_id so that you can get a type ID for any named type without having to have an instance of the type lying around. Update the comments about caching type IDs to reflect its availability.
Fix the comments around AP_Meta_class::meta_cast; they were leftovers from an earlier implementation and entirely not helpful.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1530 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 06:44:07 +00:00
DrZiplok@gmail.com 30d9a92c4e Implement a pure data serialisation load/save model for AP_Var.
The format is a simple TLV format; a tag identifying the variable, a length for the variable, and then the actual data.  This format could ultimately be extended to include waypoint/commands as well.

This allows us to load and save groups of variables to EEPROM without having to have a static EEPROM map.

Still needs unit tests and (probably) bugfixing.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1522 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-22 08:37:52 +00:00
DrZiplok@gmail.com 96d2dc33fe Formatting and naming changes for conformance with the ArduPilot Coding Conventions.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1502 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-16 09:14:21 +00:00
DrZiplok@gmail.com 6366cdc094 Add more documentation for AP_MetaClass.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1465 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:43:41 +00:00
DrZiplok@gmail.com d2bd744244 Metaclass improvements:
- Add a default ctor/dtor pair.  The dtor ensures that all dtors are virtual, and guarantees that there is something in the dtor vtable slot for classes that don't implement their own.
 - serialize must not alter the class, mark it const
 - Improve documentation
 - Fix handle validation to prevent trying to read 2 bytes beyond the end of memory


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1416 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-04 08:46:01 +00:00
DrZiplok ea9c7859f8 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
2011-01-03 02:26:18 +00:00
DrZiplok a3a9fe59e3 Following discussions with James, a complete rewrite of AP_Var.
The overriding principle here is to keep the use of AP_Vars as simple as possible, whilst letting the implementation do useful things behind the scenes.  To that end, we define AP_Float, AP_Int8, AP_Int16 and AP_Int32.  These are strongly typed, so that there is no ambiguity about what a variable "really" is.

The classes behave like the variables they are storing; you can use an AP_Float in most places you would use a regular float; you can add to it, multiply by it, etc.  If it has been given an address in EEPROM you can load and save it.

Variables can be given names, and if they are named then they can be looked up.  This allows e.g. a GCS or a test tool to find and traffic in variables that it may not explicitly know about.

AP_Var does not attempt to solve the problem of EEPROM address space management.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1399 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-02 22:14:36 +00:00