Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
handle/dataLocation.h@6:f0248eb6714d, 2014-04-03 (annotated)
- Committer:
- dylanembed123
- Date:
- Thu Apr 03 16:27:23 2014 +0000
- Revision:
- 6:f0248eb6714d
- Parent:
- 5:eef5ea6a9916
Fix compile errors;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dylanembed123 | 5:eef5ea6a9916 | 1 | /** |
dylanembed123 | 5:eef5ea6a9916 | 2 | * \brief Camera interface |
dylanembed123 | 5:eef5ea6a9916 | 3 | **/ |
dylanembed123 | 5:eef5ea6a9916 | 4 | |
dylanembed123 | 4:c75d5e5e6bfc | 5 | #define MAXNUMLOCS 256 |
dylanembed123 | 4:c75d5e5e6bfc | 6 | |
dylanembed123 | 4:c75d5e5e6bfc | 7 | // Storage of data location |
dylanembed123 | 4:c75d5e5e6bfc | 8 | class DataLocation{ |
dylanembed123 | 4:c75d5e5e6bfc | 9 | private: |
dylanembed123 | 4:c75d5e5e6bfc | 10 | // Current value of lat lon and alt |
dylanembed123 | 4:c75d5e5e6bfc | 11 | double lat,lon,alt; |
dylanembed123 | 6:f0248eb6714d | 12 | double timestamp; |
dylanembed123 | 4:c75d5e5e6bfc | 13 | public: |
dylanembed123 | 6:f0248eb6714d | 14 | DataLocation(){} |
dylanembed123 | 6:f0248eb6714d | 15 | DataLocation(double latA,double lonA,double altA,double t=0):lat(latA),lon(lonA),alt(altA),timestamp(t){} |
dylanembed123 | 4:c75d5e5e6bfc | 16 | double& getLat(){return lat;} |
dylanembed123 | 4:c75d5e5e6bfc | 17 | double& getLon(){return lon;} |
dylanembed123 | 4:c75d5e5e6bfc | 18 | double& getAlt(){return alt;} |
dylanembed123 | 6:f0248eb6714d | 19 | }; |
dylanembed123 | 4:c75d5e5e6bfc | 20 | |
dylanembed123 | 5:eef5ea6a9916 | 21 | /// \brief Location holder type |
dylanembed123 | 5:eef5ea6a9916 | 22 | enum LHType{ |
dylanembed123 | 5:eef5ea6a9916 | 23 | LHType_locs=0, |
dylanembed123 | 5:eef5ea6a9916 | 24 | LHType_targ, |
dylanembed123 | 5:eef5ea6a9916 | 25 | LHType_base |
dylanembed123 | 5:eef5ea6a9916 | 26 | }; |
dylanembed123 | 5:eef5ea6a9916 | 27 | |
dylanembed123 | 5:eef5ea6a9916 | 28 | /// \brief Location holder index type |
dylanembed123 | 5:eef5ea6a9916 | 29 | enum LHIType{ |
dylanembed123 | 5:eef5ea6a9916 | 30 | LHIType_head=0, |
dylanembed123 | 5:eef5ea6a9916 | 31 | LHIType_size |
dylanembed123 | 5:eef5ea6a9916 | 32 | }; |
dylanembed123 | 5:eef5ea6a9916 | 33 | |
dylanembed123 | 4:c75d5e5e6bfc | 34 | // Singleton location holder |
dylanembed123 | 4:c75d5e5e6bfc | 35 | class LocHolder{ |
dylanembed123 | 4:c75d5e5e6bfc | 36 | private: |
dylanembed123 | 4:c75d5e5e6bfc | 37 | // Actual Locations (absolute) |
dylanembed123 | 6:f0248eb6714d | 38 | DataLocation locs[MAXNUMLOCS]; |
dylanembed123 | 4:c75d5e5e6bfc | 39 | // Target Locations (relative to base station -> base station is at 0,0,0) |
dylanembed123 | 6:f0248eb6714d | 40 | DataLocation targ[MAXNUMLOCS]; |
dylanembed123 | 4:c75d5e5e6bfc | 41 | // Base Station Locations (absolute) |
dylanembed123 | 6:f0248eb6714d | 42 | DataLocation base[MAXNUMLOCS]; |
dylanembed123 | 4:c75d5e5e6bfc | 43 | // Index of the head of the circular buffers |
dylanembed123 | 6:f0248eb6714d | 44 | unsigned int headLocs,headTarg,headBase; |
dylanembed123 | 5:eef5ea6a9916 | 45 | // Number of locations |
dylanembed123 | 6:f0248eb6714d | 46 | unsigned int sizeLocs,sizeTarg,sizeBase; |
dylanembed123 | 6:f0248eb6714d | 47 | LocHolder():headLocs(0),headTarg(0),headBase(0),sizeLocs(0),sizeTarg(0),sizeBase(0){} |
dylanembed123 | 4:c75d5e5e6bfc | 48 | public: |
dylanembed123 | 5:eef5ea6a9916 | 49 | /// \brief Get locations type |
dylanembed123 | 6:f0248eb6714d | 50 | DataLocation* get(LHType type); |
dylanembed123 | 5:eef5ea6a9916 | 51 | |
dylanembed123 | 5:eef5ea6a9916 | 52 | /// \brief Get Current value |
dylanembed123 | 5:eef5ea6a9916 | 53 | DataLocation& getC(LHType type,int offset=0); |
dylanembed123 | 5:eef5ea6a9916 | 54 | |
dylanembed123 | 5:eef5ea6a9916 | 55 | /// \brief Get Index |
dylanembed123 | 5:eef5ea6a9916 | 56 | unsigned int& getI(LHType type,LHIType indexType=LHIType_head); |
dylanembed123 | 4:c75d5e5e6bfc | 57 | |
dylanembed123 | 6:f0248eb6714d | 58 | /// \brief Fix an index that might be out of bounds; |
dylanembed123 | 6:f0248eb6714d | 59 | unsigned int getRealIndex(LHType type,int index,int offset=0,bool useSize=true); |
dylanembed123 | 4:c75d5e5e6bfc | 60 | |
dylanembed123 | 6:f0248eb6714d | 61 | /// \brief Increment index |
dylanembed123 | 6:f0248eb6714d | 62 | void inc(LHType type,int amount=1,bool abs=false); |
dylanembed123 | 4:c75d5e5e6bfc | 63 | |
dylanembed123 | 6:f0248eb6714d | 64 | void add(LHType type,DataLocation newLoc); |
dylanembed123 | 4:c75d5e5e6bfc | 65 | }; |