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.
Diff: handle/dataLocation.h
- Revision:
- 6:f0248eb6714d
- Parent:
- 5:eef5ea6a9916
diff -r eef5ea6a9916 -r f0248eb6714d handle/dataLocation.h
--- a/handle/dataLocation.h Thu Apr 03 15:56:05 2014 +0000
+++ b/handle/dataLocation.h Thu Apr 03 16:27:23 2014 +0000
@@ -9,12 +9,14 @@
private:
// Current value of lat lon and alt
double lat,lon,alt;
+ double timestamp;
public:
- DataLocation(double latA,double lonA,double altA):lat(latA),lon(lonA),alt(altA){}
+ DataLocation(){}
+ DataLocation(double latA,double lonA,double altA,double t=0):lat(latA),lon(lonA),alt(altA),timestamp(t){}
double& getLat(){return lat;}
double& getLon(){return lon;}
double& getAlt(){return alt;}
-}
+};
/// \brief Location holder type
enum LHType{
@@ -33,18 +35,19 @@
class LocHolder{
private:
// Actual Locations (absolute)
- static DataLocation locs[MAXNUMLOCS];
+ DataLocation locs[MAXNUMLOCS];
// Target Locations (relative to base station -> base station is at 0,0,0)
- static DataLocation targ[MAXNUMLOCS];
+ DataLocation targ[MAXNUMLOCS];
// Base Station Locations (absolute)
- static DataLocation base[MAXNUMLOCS];
+ DataLocation base[MAXNUMLOCS];
// Index of the head of the circular buffers
- static unsigned int headLocs,headTarg,headBase;
+ unsigned int headLocs,headTarg,headBase;
// Number of locations
- static unsigned int sizeLocs,sizeTarg,sizeBase;
+ unsigned int sizeLocs,sizeTarg,sizeBase;
+ LocHolder():headLocs(0),headTarg(0),headBase(0),sizeLocs(0),sizeTarg(0),sizeBase(0){}
public:
/// \brief Get locations type
- static DataLocation* get(LHType type);
+ DataLocation* get(LHType type);
/// \brief Get Current value
DataLocation& getC(LHType type,int offset=0);
@@ -52,15 +55,11 @@
/// \brief Get Index
unsigned int& getI(LHType type,LHIType indexType=LHIType_head);
- /// \brief Increment index
- void inc(LHType type,int amount=1);
+ /// \brief Fix an index that might be out of bounds;
+ unsigned int getRealIndex(LHType type,int index,int offset=0,bool useSize=true);
- /// \brief Add data
- void addLocs(DataLocation newLoc);
- void addTarg(DataLocation newLoc);
- void addBase(DataLocation newLoc);
+ /// \brief Increment index
+ void inc(LHType type,int amount=1,bool abs=false);
- void incLocs(int amount=1);
- void incLocs(int amount=1);
- void incLocs(int amount=1);
+ void add(LHType type,DataLocation newLoc);
};
\ No newline at end of file
