Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 4.6
  • 5.x
  • 6.x
  • aux_vars_fix
  • julia
  • llvm-15
  • master
  • python-codegen
  • rework_pac
  • uop
  • julia-6.2.0
  • julia-6.3.0
  • julia-6.4.0
  • julia-7.0.0
14 results

Target

Select target project
  • normann/preprocessor
  • Dynare/preprocessor
  • FerhatMihoubi/preprocessor
  • MichelJuillard/preprocessor
  • sebastien/preprocessor
  • lnsongxf/preprocessor
  • albop/preprocessor
  • DoraK/preprocessor
  • amg/preprocessor
  • wmutschl/preprocessor
  • JohannesPfeifer/preprocessor
11 results
Select Git revision
  • 4.6
  • aux_vars_fix
  • master
  • occbin
  • pac_composite_target_mce
  • ramsey_k_order
  • rework_pac
  • uop
  • created_preprocessor_repo
9 results
Show changes
Showing
with 7999 additions and 5004 deletions
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
* along with Dynare. If not, see <https://www.gnu.org/licenses/>. * along with Dynare. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _EQUATION_TAGS_HH #ifndef EQUATION_TAGS_HH
#define _EQUATION_TAGS_HH #define EQUATION_TAGS_HH
#include <map> #include <map>
#include <optional>
#include <set> #include <set>
#include <string> #include <string>
#include <optional>
using namespace std; using namespace std;
...@@ -31,6 +31,7 @@ class EquationTags ...@@ -31,6 +31,7 @@ class EquationTags
{ {
private: private:
map<int, map<string, string>> eqn_tags; map<int, map<string, string>> eqn_tags;
public: public:
// Add multiple equation tags for the given equation // Add multiple equation tags for the given equation
void void
...@@ -62,7 +63,7 @@ public: ...@@ -62,7 +63,7 @@ public:
//! Various functions to get info from equation tags //! Various functions to get info from equation tags
//! Get equation tags for a given equation //! Get equation tags for a given equation
map<string, string> [[nodiscard]] map<string, string>
getTagsByEqn(int eqn) const getTagsByEqn(int eqn) const
{ {
if (auto it = eqn_tags.find(eqn); it != eqn_tags.end()) if (auto it = eqn_tags.find(eqn); it != eqn_tags.end())
...@@ -71,16 +72,19 @@ public: ...@@ -71,16 +72,19 @@ public:
} }
//! Get equations that have the given key //! Get equations that have the given key
set<int> getEqnsByKey(const string &key) const; [[nodiscard]] set<int> getEqnsByKey(const string& key) const;
//! Get equations that have the given key and value //! Get equations that have the given key and value
set<int> getEqnsByTag(const string &key, const string &value) const; [[nodiscard]] set<int> getEqnsByTag(const string& key, const string& value) const;
//! Get the first equation that has the given key and value //! Get the first equation that has the given key and value
optional<int> getEqnByTag(const string &key, const string &value) const; [[nodiscard]] optional<int> getEqnByTag(const string& key, const string& value) const;
// Get equations that have all the given keys and values (seen as a conjunction)
[[nodiscard]] set<int> getEqnsByTags(const map<string, string>& tags_selected) const;
//! Get the tag value given the equation number and key //! Get the tag value given the equation number and key
optional<string> [[nodiscard]] optional<string>
getTagValueByEqnAndKey(int eqn, const string& key) const getTagValueByEqnAndKey(int eqn, const string& key) const
{ {
if (auto it = eqn_tags.find(eqn); it != eqn_tags.end()) if (auto it = eqn_tags.find(eqn); it != eqn_tags.end())
...@@ -90,21 +94,21 @@ public: ...@@ -90,21 +94,21 @@ public:
} }
//! Get the equations marked dynamic //! Get the equations marked dynamic
set<int> [[nodiscard]] set<int>
getDynamicEqns() const getDynamicEqns() const
{ {
return getEqnsByTag("dynamic", ""); return getEqnsByTag("dynamic", "");
} }
//! Returns true if equation tag with key and value exists //! Returns true if equation tag with key and value exists
bool [[nodiscard]] bool
exists(const string& key, const string& value) const exists(const string& key, const string& value) const
{ {
return getEqnByTag(key, value).has_value(); return getEqnByTag(key, value).has_value();
} }
//! Returns true if equation tag with key exists for a given equation //! Returns true if equation tag with key exists for a given equation
bool [[nodiscard]] bool
exists(int eqn, const string& key) const exists(int eqn, const string& key) const
{ {
auto it = eqn_tags.find(eqn); auto it = eqn_tags.find(eqn);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.