Skip to content

Commit

Permalink
v1.4: const for function parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
SMFSW committed Nov 21, 2017
1 parent 5f3b3d9 commit 020b873
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = Queue
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.3
PROJECT_NUMBER = 1.4

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
3 changes: 3 additions & 0 deletions Release Notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Feel free to share your thoughts @ [email protected] about:

** Actual:

v1.4 21 November 2017:
- Added const qualifier for function parameters

v1.3 12 July 2017:
- #2 fix for esp8266: reanamed cpp/h files : header name already used in compiler sys includes
- examples updated with new header file name (cppQueue.h)
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Queue
version=1.3
version=1.4
author=SMFSW <[email protected]>
maintainer=SMFSW <[email protected]>
sentence=Queue handling library (designed on Arduino)
Expand Down
8 changes: 4 additions & 4 deletions src/cppQueue.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!\file cppQueue.cpp
** \author SMFSW
** \version 1.3
** \date 2017/07/12
** \version 1.4
** \date 2017/11/21
** \copyright BSD 3-Clause License (c) 2017, SMFSW
** \brief Queue handling library (designed on Arduino)
** \details Queue handling library (designed on Arduino)
Expand All @@ -25,7 +25,7 @@ extern "C"
else { ctr = end-1; } //!< Decrements buffer index \b cnt rolling back to \b end when limit \b start is reached


Queue::Queue(uint16_t size_rec, uint16_t nb_recs, QueueType type, bool overwrite)
Queue::Queue(const uint16_t size_rec, const uint16_t nb_recs, const QueueType type, const bool overwrite)
{
rec_nb = nb_recs;
rec_sz = size_rec;
Expand All @@ -52,7 +52,7 @@ void Queue::clean(void)
}


bool Queue::push(void * record)
bool Queue::push(const void * record)
{
if ((!ovw) && isFull()) { return false; }

Expand Down
18 changes: 9 additions & 9 deletions src/cppQueue.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!\file cppQueue.h
** \author SMFSW
** \version 1.3
** \date 2017/07/12
** \version 1.4
** \date 2017/11/21
** \copyright BSD 3-Clause License (c) 2017, SMFSW
** \brief Queue handling library (designed on Arduino)
** \details Queue handling library (designed on Arduino)
Expand All @@ -20,7 +20,7 @@ typedef enum enumQueueType {
} QueueType;


/*! \class Queue Queue.h "Queue/Queue.h"
/*! \class Queue cppQueue.h
** \brief Class containing the required methods for handling the queue
**/
class Queue
Expand All @@ -44,7 +44,7 @@ class Queue
** \param [in] overwrite - Overwrite previous records when queue is full
** \return nothing
**/
Queue(uint16_t size_rec, uint16_t nb_recs=20, QueueType type=FIFO, bool overwrite=false);
Queue(const uint16_t size_rec, const uint16_t nb_recs=20, const QueueType type=FIFO, const bool overwrite=false);

/*! \brief Queue desructor: release dynamically allocated queue
**/
Expand All @@ -59,7 +59,7 @@ class Queue
** \retval true if queue is empty
** \retval false is not empty
**/
bool isEmpty(void) __attribute__((always_inline)) {
inline bool isEmpty(void) __attribute__((always_inline)) {
return (!cnt) ? true : false;
}

Expand All @@ -68,14 +68,14 @@ class Queue
** \retval true if queue is full
** \retval false is not full
**/
bool isFull(void) __attribute__((always_inline)) {
inline bool isFull(void) __attribute__((always_inline)) {
return (cnt == rec_nb) ? true : false;
}

/*! \brief get number of records in the queue
** \return Number of records left in the queue
**/
uint16_t nbRecs(void) __attribute__((always_inline)) {
inline uint16_t nbRecs(void) __attribute__((always_inline)) {
return cnt;
}

Expand All @@ -85,7 +85,7 @@ class Queue
** \retval true if succefully pushed into queue
** \retval false if queue is full
**/
bool push(void * record);
bool push(const void * record);

/*! \brief Pop record from queue
** \param [in,out] record - pointer to record to be popped from queue
Expand All @@ -102,7 +102,7 @@ class Queue
** \retval true if succefully pulled from queue
** \retval false if queue is empty
**/
bool pull(void * record)__attribute__((always_inline)) {
inline bool pull(void * record)__attribute__((always_inline)) {
return pop(record);
}

Expand Down

0 comments on commit 020b873

Please sign in to comment.