Colin Stearns / Mbed 2 deprecated dgps

Dependencies:   mbed

handle/dataLocation.cpp

Committer:
dylanembed123
Date:
2014-04-01
Revision:
4:c75d5e5e6bfc
Child:
5:eef5ea6a9916

File content as of revision 4:c75d5e5e6bfc:



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)];
}