-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
572 additions
and
546 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
namespace fintamath { | ||
|
||
struct Config final { | ||
Config(); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "fintamath/config/Config.hpp" | ||
|
||
#include "ParserConfig.hpp" | ||
#include "PrecisionConfig.hpp" | ||
#include "fintamath/config/ConverterConfig.hpp" | ||
#include "fintamath/config/ExpressionConfig.hpp" | ||
|
||
namespace fintamath { | ||
|
||
Config::Config() { | ||
static const PrecisionConfig precisionConfig; | ||
static const ParserConfig parserConfig; | ||
static const ConverterConfig converterConfig; | ||
static const ExpressionConfig expressionConfig; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,47 @@ | ||
#include "fintamath/core/Converter.hpp" | ||
#include "fintamath/config/ConverterConfig.hpp" | ||
|
||
#include "fintamath/core/Converter.hpp" | ||
#include "fintamath/numbers/Complex.hpp" | ||
#include "fintamath/numbers/Integer.hpp" | ||
#include "fintamath/numbers/Rational.hpp" | ||
#include "fintamath/numbers/Real.hpp" | ||
|
||
namespace fintamath { | ||
|
||
MultiMethod<std::unique_ptr<IMathObject>(const IMathObject &, const IMathObject &)> &Converter::getConverter() { | ||
static MultiMethod<std::unique_ptr<IMathObject>(const IMathObject &, const IMathObject &)> converter; | ||
return converter; | ||
} | ||
|
||
ConverterConfig::ConverterConfig() { | ||
Converter::add<Integer, Integer>([](const Integer & /*type*/, const Integer &value) { | ||
return Integer(value).clone(); | ||
}); | ||
|
||
Converter::add<Rational, Rational>([](const Rational & /*type*/, const Rational &value) { | ||
return Rational(value).clone(); | ||
}); | ||
Converter::add<Rational, Integer>([](const Rational & /*type*/, const Integer &value) { | ||
return Rational(value).clone(); | ||
}); | ||
|
||
Converter::add<Real, Real>([](const Real & /*type*/, const Real &value) { | ||
return Real(value).clone(); | ||
}); | ||
Converter::add<Real, Integer>([](const Real & /*type*/, const Integer &value) { | ||
return Real(value).clone(); | ||
}); | ||
Converter::add<Real, Rational>([](const Real & /*type*/, const Rational &value) { | ||
return Real(value).clone(); | ||
}); | ||
|
||
Converter::add<Complex, Complex>([](const Complex & /*type*/, const Complex &value) { | ||
return std::make_unique<Complex>(value); | ||
}); | ||
Converter::add<Complex, Integer>([](const Complex & /*type*/, const Integer &value) { | ||
return std::make_unique<Complex>(value); | ||
}); | ||
Converter::add<Complex, Rational>([](const Complex & /*type*/, const Rational &value) { | ||
return std::make_unique<Complex>(value); | ||
}); | ||
Converter::add<Complex, Real>([](const Complex & /*type*/, const Real &value) { | ||
return std::make_unique<Complex>(value); | ||
}); | ||
} | ||
|
||
using namespace fintamath; | ||
|
||
namespace { | ||
|
||
struct ConverterConfig final { | ||
ConverterConfig() { | ||
Converter::add<Integer, Integer>([](const Integer & /*type*/, const Integer &value) { | ||
return Integer(value).clone(); | ||
}); | ||
|
||
Converter::add<Rational, Rational>([](const Rational & /*type*/, const Rational &value) { | ||
return Rational(value).clone(); | ||
}); | ||
Converter::add<Rational, Integer>([](const Rational & /*type*/, const Integer &value) { | ||
return Rational(value).clone(); | ||
}); | ||
|
||
Converter::add<Real, Real>([](const Real & /*type*/, const Real &value) { | ||
return Real(value).clone(); | ||
}); | ||
Converter::add<Real, Integer>([](const Real & /*type*/, const Integer &value) { | ||
return Real(value).clone(); | ||
}); | ||
Converter::add<Real, Rational>([](const Real & /*type*/, const Rational &value) { | ||
return Real(value).clone(); | ||
}); | ||
|
||
Converter::add<Complex, Complex>([](const Complex & /*type*/, const Complex &value) { | ||
return std::make_unique<Complex>(value); | ||
}); | ||
Converter::add<Complex, Integer>([](const Complex & /*type*/, const Integer &value) { | ||
return std::make_unique<Complex>(value); | ||
}); | ||
Converter::add<Complex, Rational>([](const Complex & /*type*/, const Rational &value) { | ||
return std::make_unique<Complex>(value); | ||
}); | ||
Converter::add<Complex, Real>([](const Complex & /*type*/, const Real &value) { | ||
return std::make_unique<Complex>(value); | ||
}); | ||
} | ||
}; | ||
|
||
const ConverterConfig config; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
namespace fintamath { | ||
|
||
struct ConverterConfig final { | ||
ConverterConfig(); | ||
}; | ||
|
||
} |
Oops, something went wrong.