Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add const qualifiers for getter methods #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/TaskScheduler.h
Original file line number Diff line number Diff line change
@@ -390,10 +390,10 @@ void StatusRequest::setWaiting(unsigned int aCount) {
#endif // #ifdef _TASK_TIMEOUT
}

bool StatusRequest::pending() { return (iCount != 0); }
bool StatusRequest::completed() { return (iCount == 0); }
int StatusRequest::getStatus() { return iStatus; }
int StatusRequest::getCount() { return iCount; }
bool StatusRequest::pending() const { return (iCount != 0); }
bool StatusRequest::completed() const { return (iCount == 0); }
int StatusRequest::getStatus() const { return iStatus; }
int StatusRequest::getCount() const { return iCount; }
StatusRequest* Task::getStatusRequest() { return iStatusRequest; }
StatusRequest* Task::getInternalStatusRequest() { return &iMyStatusRequest; }

@@ -481,13 +481,13 @@ long StatusRequest::untilTimeout() {
#endif // _TASK_TIMEOUT
#endif // _TASK_STATUS_REQUEST

bool Task::isEnabled() { return iStatus.enabled; }
bool Task::isEnabled() const { return iStatus.enabled; }

unsigned long Task::getInterval() { return iInterval; }
unsigned long Task::getInterval() const { return iInterval; }

long Task::getIterations() { return iIterations; }
long Task::getIterations() const { return iIterations; }

unsigned long Task::getRunCounter() { return iRunCounter; }
unsigned long Task::getRunCounter() const { return iRunCounter; }

#ifdef _TASK_OO_CALLBACKS

@@ -784,18 +784,18 @@ void Task::resetTimeout() {
#endif // _TASK_THREAD_SAFE
}

unsigned long Task::getTimeout() {
unsigned long Task::getTimeout() const {
return iTimeout;
}

long Task::untilTimeout() {
long Task::untilTimeout() const {
if ( iTimeout ) {
return ( (long) (iStarttime + iTimeout) - (long) _TASK_TIME_FUNCTION() );
}
return -1;
}

bool Task::timedOut() {
bool Task::timedOut() const {
return iStatus.timeout;
}

@@ -940,7 +940,7 @@ void Task::cancel() {
disable();
}

bool Task::canceled() {
bool Task::canceled() const {
return iStatus.canceled;
}

@@ -961,31 +961,31 @@ bool Task::restartDelayed(unsigned long aDelay) {
return enableDelayed(aDelay);
}

bool Task::isFirstIteration() { return (iRunCounter <= 1); }
bool Task::isFirstIteration() const { return (iRunCounter <= 1); }

bool Task::isLastIteration() { return (iIterations == 0); }
bool Task::isLastIteration() const { return (iIterations == 0); }

#ifdef _TASK_TIMECRITICAL

long Task::getOverrun() { return iOverrun; }
long Task::getStartDelay() { return iStartDelay; }
long Task::getOverrun() const { return iOverrun; }
long Task::getStartDelay() const { return iStartDelay; }

#endif // _TASK_TIMECRITICAL


#ifdef _TASK_WDT_IDS

void Task::setId(unsigned int aID) { iTaskID = aID; }
unsigned int Task::getId() { return iTaskID; }
unsigned int Task::getId() const { return iTaskID; }
void Task::setControlPoint(unsigned int aPoint) { iControlPoint = aPoint; }
unsigned int Task::getControlPoint() { return iControlPoint; }
unsigned int Task::getControlPoint() const { return iControlPoint; }

#endif // _TASK_WDT_IDS

#ifdef _TASK_LTS_POINTER

void Task::setLtsPointer(void *aPtr) { iLTS = aPtr; }
void* Task::getLtsPointer() { return iLTS; }
void* Task::getLtsPointer() const { return iLTS; }

#endif // _TASK_LTS_POINTER

@@ -1240,7 +1240,7 @@ void* Scheduler::currentLts() { return iCurrent->iLTS; }
#endif // _TASK_LTS_POINTER

#ifdef _TASK_TIMECRITICAL
bool Scheduler::isOverrun() { return (iCurrent->iOverrun < 0); }
bool Scheduler::isOverrun() const { return (iCurrent->iOverrun < 0); }

void Scheduler::cpuLoadReset() {
iCPUStart = micros();
@@ -1249,7 +1249,7 @@ void Scheduler::cpuLoadReset() {
}


unsigned long Scheduler::getCpuLoadTotal() {
unsigned long Scheduler::getCpuLoadTotal() const {
return (micros() - iCPUStart);
}
#endif // _TASK_TIMECRITICAL
50 changes: 25 additions & 25 deletions src/TaskSchedulerDeclarations.h
Original file line number Diff line number Diff line change
@@ -99,10 +99,10 @@ class StatusRequest {
INLINE void setWaiting(unsigned int aCount = 1);
INLINE bool signal(int aStatus = 0);
INLINE void signalComplete(int aStatus = 0);
INLINE bool pending();
INLINE bool completed();
INLINE int getStatus();
INLINE int getCount();
INLINE bool pending() const;
INLINE bool completed() const;
INLINE int getStatus() const;
INLINE int getCount() const;

#ifdef _TASK_TIMEOUT
INLINE void setTimeout(unsigned long aTimeout) { iTimeout = aTimeout; };
@@ -195,9 +195,9 @@ class Task {
#ifdef _TASK_TIMEOUT
INLINE void setTimeout(unsigned long aTimeout, bool aReset=false);
INLINE void resetTimeout();
INLINE unsigned long getTimeout();
INLINE long untilTimeout();
INLINE bool timedOut();
INLINE unsigned long getTimeout() const;
INLINE long untilTimeout() const;
INLINE bool timedOut() const;
#endif

INLINE bool enable();
@@ -212,11 +212,11 @@ class Task {
INLINE bool disable();
INLINE void abort();
INLINE void cancel();
INLINE bool isEnabled();
INLINE bool canceled();
INLINE bool isEnabled() const;
INLINE bool canceled() const;

#ifdef _TASK_SCHEDULING_OPTIONS
INLINE unsigned int getSchedulingOption() { return iOption; }
INLINE unsigned int getSchedulingOption() const { return iOption; }
INLINE void setSchedulingOption(unsigned int aOption) { iOption = aOption; }
#endif //_TASK_SCHEDULING_OPTIONS

@@ -226,14 +226,14 @@ class Task {
INLINE void set(unsigned long aInterval, long aIterations, TaskCallback aCallback,TaskOnEnable aOnEnable=NULL, TaskOnDisable aOnDisable=NULL);
#endif // _TASK_OO_CALLBACKS
INLINE void setInterval(unsigned long aInterval);
INLINE unsigned long getInterval();
INLINE unsigned long getInterval() const;
INLINE void setIterations(long aIterations);
INLINE long getIterations();
INLINE unsigned long getRunCounter();
INLINE long getIterations() const;
INLINE unsigned long getRunCounter() const;

#ifdef _TASK_SELF_DESTRUCT
INLINE void setSelfDestruct(bool aSelfDestruct=true) { iStatus.selfdestruct = aSelfDestruct; }
INLINE bool getSelfDestruct() { return iStatus.selfdestruct; }
INLINE bool getSelfDestruct() const { return iStatus.selfdestruct; }
#endif // #ifdef _TASK_SELF_DESTRUCT

#ifdef _TASK_OO_CALLBACKS
@@ -248,12 +248,12 @@ class Task {
INLINE void yieldOnce(TaskCallback aCallback);
#endif // _TASK_OO_CALLBACKS

INLINE bool isFirstIteration() ;
INLINE bool isLastIteration() ;
INLINE bool isFirstIteration() const;
INLINE bool isLastIteration() const;

#ifdef _TASK_TIMECRITICAL
INLINE long getOverrun() ;
INLINE long getStartDelay() ;
INLINE long getOverrun() const ;
INLINE long getStartDelay() const ;
#endif // _TASK_TIMECRITICAL

#ifdef _TASK_STATUS_REQUEST
@@ -265,14 +265,14 @@ class Task {

#ifdef _TASK_WDT_IDS
INLINE void setId(unsigned int aID) ;
INLINE unsigned int getId() ;
INLINE unsigned int getId() const;
INLINE void setControlPoint(unsigned int aPoint) ;
INLINE unsigned int getControlPoint() ;
INLINE unsigned int getControlPoint() const ;
#endif // _TASK_WDT_IDS

#ifdef _TASK_LTS_POINTER
INLINE void setLtsPointer(void *aPtr) ;
INLINE void* getLtsPointer() ;
INLINE void* getLtsPointer();
#endif // _TASK_LTS_POINTER

#ifdef _TASK_EXPOSE_CHAIN
@@ -372,11 +372,11 @@ class Scheduler {
#endif // _TASK_LTS_POINTER

#ifdef _TASK_TIMECRITICAL
INLINE bool isOverrun();
INLINE bool isOverrun() const;
INLINE void cpuLoadReset();
INLINE unsigned long getCpuLoadCycle(){ return iCPUCycle; };
INLINE unsigned long getCpuLoadIdle() { return iCPUIdle; };
INLINE unsigned long getCpuLoadTotal();
INLINE unsigned long getCpuLoadCycle() const { return iCPUCycle; };
INLINE unsigned long getCpuLoadIdle() const { return iCPUIdle; };
INLINE unsigned long getCpuLoadTotal() const;
#endif // _TASK_TIMECRITICAL

#ifdef _TASK_PRIORITY