diff options
author | 2019-11-08 23:52:14 +0100 | |
---|---|---|
committer | 2019-11-08 23:52:14 +0100 | |
commit | 88f702b416ba9eb930e6c1e932124d5f24b1a24c (patch) | |
tree | 955f3047b79156d7b2bbab55fcbd4fbc94661f1d /src/lib/netlist/plib/pfunction.h | |
parent | 731c4fe52073a7a7561bf04559e9f0b3b791388d (diff) |
netlist: code maintenance and bug fixes. (nw)
- comment style migration continues.
- Fixed a two bugs in the truthtable ignore inputs code
- refactored the truthtable code a bit for better readability.
- updated netlist specific gitignore.
Diffstat (limited to 'src/lib/netlist/plib/pfunction.h')
-rw-r--r-- | src/lib/netlist/plib/pfunction.h | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/src/lib/netlist/plib/pfunction.h b/src/lib/netlist/plib/pfunction.h index d62d79cc00d..643a8b1ae26 100644 --- a/src/lib/netlist/plib/pfunction.h +++ b/src/lib/netlist/plib/pfunction.h @@ -1,13 +1,13 @@ // license:GPL-2.0+ // copyright-holders:Couriersud -/* - * pfunction.h - * - */ #ifndef PFUNCTION_H_ #define PFUNCTION_H_ +/// +/// \file pfunction.h +/// + #include "pmath.h" #include "pstate.h" #include "pstring.h" @@ -21,10 +21,10 @@ namespace plib { // function evaluation //============================================================ - /*! Class providing support for evaluating expressions - * - * @tparam NT Number type, should be float or double - */ + /// \brief Class providing support for evaluating expressions + /// + /// \tparam NT Number type, should be float or double + /// template <typename NT> class pfunction { @@ -37,7 +37,7 @@ namespace plib { POW, SIN, COS, - RAND, /* random number between 0 and 1 */ + RAND, /// random number between 0 and 1 TRUNC, PUSH_CONST, PUSH_INPUT @@ -49,52 +49,54 @@ namespace plib { NT m_param; }; public: - /*! Constructor with state saving support - * - * @param name Name of this object - * @param owner Owner of this object - * @param state_manager State manager to handle saving object state - * - */ + + /// \brief Constructor with state saving support + /// + /// \param name Name of this object + /// \param owner Owner of this object + /// \param state_manager State manager to handle saving object state + /// + /// pfunction(const pstring &name, const void *owner, state_manager_t &state_manager) : m_lfsr(0xACE1u) { state_manager.save_item(owner, m_lfsr, name + ".lfsr"); } - /*! Constructor without state saving support - * - */ + /// \brief Constructor without state saving support + /// pfunction() : m_lfsr(0xACE1u) { } - /*! Compile an expression - * - * @param inputs Vector of input variables, e.g. {"A","B"} - * @param expr infix or postfix expression. default is infix, postrix - * to be prefixed with rpn, e.g. "rpn:A B + 1.3 /" - */ + /// \brief Compile an expression + /// + /// \param inputs Vector of input variables, e.g. {"A","B"} + /// \param expr infix or postfix expression. default is infix, postrix + /// to be prefixed with rpn, e.g. "rpn:A B + 1.3 /" + /// void compile(const std::vector<pstring> &inputs, const pstring &expr); - /*! Compile a rpn expression - * - * @param inputs Vector of input variables, e.g. {"A","B"} - * @param expr Reverse polish notation expression, e.g. "A B + 1.3 /" - */ + /// \brief Compile a rpn expression + /// + /// \param inputs Vector of input variables, e.g. {"A","B"} + /// \param expr Reverse polish notation expression, e.g. "A B + 1.3 /" + /// void compile_postfix(const std::vector<pstring> &inputs, const pstring &expr); - /*! Compile an infix expression - * - * @param inputs Vector of input variables, e.g. {"A","B"} - * @param expr Infix expression, e.g. "(A+B)/1.3" - */ + + /// \brief Compile an infix expression + /// + /// \param inputs Vector of input variables, e.g. {"A","B"} + /// \param expr Infix expression, e.g. "(A+B)/1.3" + /// void compile_infix(const std::vector<pstring> &inputs, const pstring &expr); - /*! Evaluate the expression - * - * @param values for input variables, e.g. {1.1, 2.2} - * @return value of expression - */ + + /// \brief Evaluate the expression + /// + /// \param values for input variables, e.g. {1.1, 2.2} + /// \return value of expression + /// NT evaluate(const std::vector<NT> &values) noexcept; private: @@ -124,4 +126,4 @@ namespace plib { #endif } // namespace plib -#endif /* PEXCEPTION_H_ */ +#endif // PEXCEPTION_H_ |