QC Control software

Dependencies:   mbed

Fork of dgps by Colin Stearns

Revision:
7:c75d5e5e6bfc
Child:
9:da906eeac51e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/handle/dataLocation.cpp	Tue Apr 01 15:52:08 2014 +0000
@@ -0,0 +1,34 @@
+
+
+DataLocation* LocHolder::locs=NULL;
+DataLocation* LocHolder::targ=NULL;
+DataLocation* LocHolder::base=NULL;
+
+DataLocation* LocHolder::getLocs(){
+    if(locs==NULL)locs=new DataLocation[MAXNUMLOCS];
+    return locs;
+}
+
+DataLocation* LocHolder::getTarg(){
+    if(targ==NULL)targ=new DataLocation[MAXNUMLOCS];
+    return targ;
+}
+
+DataLocation* LocHolder::getBase(){
+    if(base==NULL)base=new DataLocation[MAXNUMLOCS];
+    return base;
+}
+
+unsigned int LocHolder::getRealIndex(int index,int offset=0){
+    return (index+offset)%MAXNUMLOCS;
+}
+
+DataLocation& LocHolder::getCurrentLocs(int offset=0){
+    return getLocs()[getRealIndex(headLocs,offset)];
+}
+DataLocation& LocHolder::getCurrentTarg(int offset=0){
+    return getTarg()[getRealIndex(headTarg,offset)];
+}
+DataLocation& LocHolder::getCurrentBase(int offset=0){
+    return getBase()[getRealIndex(headBase,offset)];
+}