2008-01-11 14:42:14 +01:00
|
|
|
/*
|
2013-06-12 16:42:09 +02:00
|
|
|
* Copyright (C) 2003-2012 Dynare Team
|
2008-01-11 14:42:14 +01:00
|
|
|
*
|
|
|
|
* This file is part of Dynare.
|
|
|
|
*
|
|
|
|
* Dynare is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Dynare is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2006-11-05 00:31:17 +01:00
|
|
|
#ifndef _NUMERICALCONSTANTS_HH
|
|
|
|
#define _NUMERICALCONSTANTS_HH
|
2007-05-08 21:16:35 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2006-11-05 00:31:17 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2006-11-23 20:10:41 +01:00
|
|
|
#include <map>
|
2007-05-08 21:16:35 +02:00
|
|
|
|
2010-11-25 13:45:35 +01:00
|
|
|
//! Handles non-negative numerical constants
|
2006-11-05 00:31:17 +01:00
|
|
|
class NumericalConstants
|
|
|
|
{
|
2007-05-08 21:16:35 +02:00
|
|
|
private:
|
|
|
|
//! Vector of numerical constants
|
|
|
|
vector<string> mNumericalConstants;
|
2009-04-29 13:05:40 +02:00
|
|
|
//! Double values of these constants
|
|
|
|
vector<double> double_vals;
|
2006-11-23 20:10:41 +01:00
|
|
|
//! Map matching constants to their id
|
2007-05-08 21:16:35 +02:00
|
|
|
map<string, int> numConstantsIndex;
|
|
|
|
public:
|
2010-11-25 13:45:35 +01:00
|
|
|
//! Adds a non-negative constant (possibly Inf or NaN) and returns its ID
|
2012-07-12 12:46:22 +02:00
|
|
|
int AddNonNegativeConstant(const string &iConst);
|
2007-05-08 21:16:35 +02:00
|
|
|
//! Get a constant in string form
|
2009-04-29 13:05:40 +02:00
|
|
|
string get(int ID) const;
|
2007-05-08 21:16:35 +02:00
|
|
|
//! Get a constant in double form
|
2009-04-29 13:05:40 +02:00
|
|
|
double getDouble(int ID) const;
|
2006-11-05 00:31:17 +01:00
|
|
|
};
|
2007-05-08 21:16:35 +02:00
|
|
|
|
2006-11-05 00:31:17 +01:00
|
|
|
#endif
|