File tree Expand file tree Collapse file tree 14 files changed +145
-13
lines changed Expand file tree Collapse file tree 14 files changed +145
-13
lines changed Original file line number Diff line number Diff line change 1616 "maintainer" : true
1717 }
1818 ],
19- "version" : " 1.3.9 " ,
19+ "version" : " 1.4.0 " ,
2020 "license" : " MIT" ,
2121 "frameworks" : " arduino" ,
2222 "platforms" : " *"
Original file line number Diff line number Diff line change 11name =qlibs
2- version =1.3.9
2+ version =1.4.0
33license =MIT
44author =J. Camilo Gomez C. <
[email protected] >
55maintainer =J. Camilo Gomez C. <
[email protected] >
Original file line number Diff line number Diff line change 11cmake_minimum_required ( VERSION 3.2 )
22project ( qlibs-cpp
3- VERSION 1.3.9
3+ VERSION 1.4.0
44 DESCRIPTION "A collection of useful C++ libraries for embedded systems"
55 LANGUAGES CXX )
66
Original file line number Diff line number Diff line change @@ -213,6 +213,22 @@ namespace qlibs {
213213 */
214214 void * dump ( void * const dst,
215215 const size_t n ) noexcept ;
216+
217+ /* *
218+ * @brief Check if the bit-field instance has been initialized.
219+ * @return @c true if instance has been initialized
220+ */
221+ bool isInitialized ( void ) const {
222+ return ( nullptr != field );
223+ }
224+
225+ /* *
226+ * @brief Check if the bit-field instance has been initialized.
227+ * @return @c true if instance has been initialized
228+ */
229+ explicit operator bool () const noexcept {
230+ return isInitialized ();
231+ }
216232 };
217233
218234 /* * @}*/
Original file line number Diff line number Diff line change @@ -814,6 +814,22 @@ namespace qlibs {
814814 */
815815 bool setRuleWeights ( real_t *rWeights ) noexcept ;
816816
817+ /* *
818+ * @brief Check if the FIS instance has been initialized.
819+ * @return @c true if instance has been initialized
820+ */
821+ bool isInitialized ( void ) const {
822+ return ( nullptr != xInput );
823+ }
824+
825+ /* *
826+ * @brief Check if the FIS instance has been initialized.
827+ * @return @c true if instance has been initialized
828+ */
829+ explicit operator bool () const noexcept {
830+ return isInitialized ();
831+ }
832+
817833 /* *
818834 * @brief Get the number of points used on Mamdani to perform the
819835 * de-fuzzification proccess
@@ -1207,6 +1223,23 @@ namespace qlibs {
12071223 }
12081224 return *this ;
12091225 }
1226+
1227+ /* *
1228+ * @brief Check if the FIS system has been initialized.
1229+ * @return @c true if instance has been initialized
1230+ */
1231+ bool isInitialized ( void ) const {
1232+ return sys.isInitialized ();
1233+ }
1234+
1235+ /* *
1236+ * @brief Check if the FIS system has been initialized.
1237+ * @return @c true if instance has been initialized
1238+ */
1239+ explicit operator bool () const noexcept {
1240+ return sys.isInitialized ();
1241+ }
1242+
12101243 };
12111244 /* * @}*/
12121245 }
Original file line number Diff line number Diff line change @@ -373,6 +373,16 @@ namespace qlibs {
373373 */
374374 virtual bool isInitialized ( void ) const = 0;
375375
376+
377+ /* *
378+ * @brief Check if the LTI system is initialized.
379+ * @return @c true if the system has been initialized, otherwise
380+ * return @c false.
381+ */
382+ explicit operator bool () const noexcept {
383+ return isInitialized ();
384+ }
385+
376386 /* *
377387 * @brief Set the initial states for the given system
378388 * @pre System should be previously initialized by using the @c setup() method
@@ -577,6 +587,15 @@ namespace qlibs {
577587 return ( nullptr != xd ) && ( LTISYS_TYPE_DISCRETE == type );
578588 }
579589
590+ /* *
591+ * @brief Check if the LTI discrete system is initialized.
592+ * @return @c true if the system has been initialized, otherwise
593+ * return @c false.
594+ */
595+ explicit operator bool () const noexcept {
596+ return isInitialized ();
597+ }
598+
580599 /* *
581600 * @brief Set the initial states for the discrete system
582601 * @pre System should be previously initialized by using the
Original file line number Diff line number Diff line change @@ -258,6 +258,12 @@ namespace qlibs {
258258 * @note This should be called at intervals equal to the time step provided in the constructor.
259259 */
260260 real_t operator ()( const real_t xDot );
261+
262+ /* *
263+ * @brief Retrieve the current value of the integration
264+ * @return The current value of the integral.
265+ */
266+ real_t operator ()() const ;
261267 };
262268
263269 /* *
Original file line number Diff line number Diff line change @@ -449,6 +449,15 @@ namespace qlibs {
449449 {
450450 return { Kc, Ki, Kd };
451451 }
452+
453+ /* *
454+ * @brief Check if the PID instance has been initialized using setup().
455+ * @return @c true if the PID instance has been initialized, otherwise
456+ * return @c false.
457+ */
458+ explicit operator bool () const noexcept {
459+ return isInitialized;
460+ }
452461 };
453462
454463 /* * @}*/
Original file line number Diff line number Diff line change @@ -68,6 +68,15 @@ namespace qlibs {
6868 return setup ( win, windowSize );
6969 }
7070
71+ /* *
72+ * @brief Check if the RMS instance has been initialized using setup().
73+ * @return @c true if the RMS instance has been initialized, otherwise
74+ * return @c false.
75+ */
76+ explicit operator bool () const noexcept {
77+ return smootherLPF1::isInitialized (); // controls truthiness
78+ }
79+
7180 /* *
7281 * @brief Change the recursive parameters for the moving RMS estimator.
7382 * @param[in] l Exponential weighting factor, specified as a positive
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ namespace qlibs {
2828 protected:
2929 /* ! @cond */
3030 bool init{ true };
31+ bool isSetup{ false };
3132 static void windowSet ( real_t *w,
3233 const size_t wsize,
3334 const real_t x );
@@ -36,11 +37,24 @@ namespace qlibs {
3637 virtual ~smoother () {}
3738
3839 /* *
39- * @brief Check if the smoother filter is initialized.
40+ * @brief Check if the smoother filter has been initialized using setup() .
4041 * @return @c true if the smoother has been initialized, otherwise
4142 * return @c false.
4243 */
43- bool isInitialized ( void ) const ;
44+ bool isInitialized ( void ) const
45+ {
46+ return isSetup;
47+ }
48+
49+ /* *
50+ * @brief Check if the smoother filter has been initialized using setup().
51+ * @return @c true if the smoother has been initialized, otherwise
52+ * return @c false.
53+ */
54+ explicit operator bool () const noexcept
55+ {
56+ return isInitialized ();
57+ }
4458
4559 /* *
4660 * @brief Perform the smooth operation recursively for the input signal @a x.
You can’t perform that action at this time.
0 commit comments