From 020b87301105fa3fd08ecf4a61b55394c9282210 Mon Sep 17 00:00:00 2001 From: SMFSW Date: Tue, 21 Nov 2017 21:22:16 +0100 Subject: [PATCH] v1.4: const for function parameters --- Doxyfile | 2 +- Release Notes.txt | 3 +++ library.properties | 2 +- src/cppQueue.cpp | 8 ++++---- src/cppQueue.h | 18 +++++++++--------- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Doxyfile b/Doxyfile index 5cedb46..e03c7df 100755 --- a/Doxyfile +++ b/Doxyfile @@ -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 diff --git a/Release Notes.txt b/Release Notes.txt index 9c9fbff..c4723d8 100755 --- a/Release Notes.txt +++ b/Release Notes.txt @@ -10,6 +10,9 @@ Feel free to share your thoughts @ xgarmanboziax@gmail.com 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) diff --git a/library.properties b/library.properties index 317b227..610c159 100755 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Queue -version=1.3 +version=1.4 author=SMFSW maintainer=SMFSW sentence=Queue handling library (designed on Arduino) diff --git a/src/cppQueue.cpp b/src/cppQueue.cpp index 259ccbe..aba8053 100755 --- a/src/cppQueue.cpp +++ b/src/cppQueue.cpp @@ -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) @@ -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; @@ -52,7 +52,7 @@ void Queue::clean(void) } -bool Queue::push(void * record) +bool Queue::push(const void * record) { if ((!ovw) && isFull()) { return false; } diff --git a/src/cppQueue.h b/src/cppQueue.h index 466d438..e66a34b 100755 --- a/src/cppQueue.h +++ b/src/cppQueue.h @@ -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) @@ -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 @@ -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 **/ @@ -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; } @@ -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; } @@ -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 @@ -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); }