Skip to content

Commit fafba44

Browse files
Adding default value
1 parent 75496fe commit fafba44

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/taskr/service.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Service
5959
* @param[in] fc Specifies the TaskR-formatted function to use
6060
* @param[in] interval The minimum interval in ms between two executions of the service. Specify 0 for no minimum interval.
6161
*/
62-
Service(serviceFc_t fc, const size_t interval) : _fc(fc), _interval(interval) { }
62+
Service(serviceFc_t fc, const size_t interval = 0) : _fc(fc), _interval(interval) { }
6363

6464
/**
6565
* This function indicates whether the minimum interval has passed between the last execution.
@@ -86,6 +86,8 @@ class Service
8686
_lastExecutionTime = std::chrono::high_resolution_clock::now();
8787
}
8888

89+
__INLINE__ const size_t getInterval() const { return _interval; }
90+
__INLINE__ void setInterval(const size_t interval) { _interval = interval; }
8991

9092
private:
9193

@@ -102,7 +104,7 @@ class Service
102104
/**
103105
* The interval between consecutive executions
104106
*/
105-
const size_t _interval;
107+
size_t _interval;
106108

107109
/**
108110
* Time point storing the last time this service was executed

0 commit comments

Comments
 (0)