|
| 1 | +/* |
| 2 | + Copyright (C) 2023 Quaternion Risk Management Ltd |
| 3 | + All rights reserved. |
| 4 | +
|
| 5 | + This file is part of ORE, a free-software/open-source library |
| 6 | + for transparent pricing and risk analysis - http://opensourcerisk.org |
| 7 | +
|
| 8 | + ORE is free software: you can redistribute it and/or modify it |
| 9 | + under the terms of the Modified BSD License. You should have received a |
| 10 | + copy of the license along with this program. |
| 11 | + The license is also available online at <http://opensourcerisk.org> |
| 12 | +
|
| 13 | + This program is distributed on the basis that it will form a useful |
| 14 | + contribution to risk analytics and model standardisation, but WITHOUT |
| 15 | + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 16 | + FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. |
| 17 | +*/ |
| 18 | + |
| 19 | +/*! \file orea/app/initbuilders.hpp |
| 20 | + \brief add builders to factories |
| 21 | +*/ |
| 22 | + |
| 23 | +#pragma once |
| 24 | + |
| 25 | +#define ORE_REGISTER_LEG_DATA(NAME, CLASS, OVERWRITE) \ |
| 26 | + ore::data::LegDataFactory::instance().addBuilder(NAME, &ore::data::createLegData<CLASS>, OVERWRITE); |
| 27 | + |
| 28 | +#define ORE_REGISTER_CALIBRATION_INSTRUMENT(NAME, CLASS, OVERWRITE) \ |
| 29 | + ore::data::CalibrationInstrumentFactory::instance().addBuilder( \ |
| 30 | + NAME, &ore::data::createCalibrationInstrument<CLASS>, OVERWRITE); |
| 31 | + |
| 32 | +#define ORE_REGISTER_REFERENCE_DATUM(NAME, CLASS, OVERWRITE) \ |
| 33 | + ore::data::ReferenceDatumFactory::instance().addBuilder( \ |
| 34 | + NAME, &ore::data::createReferenceDatumBuilder<ore::data::ReferenceDatumBuilder<CLASS>>, OVERWRITE); |
| 35 | + |
| 36 | +#define ORE_REGISTER_BOND_BUILDER(NAME, CLASS, OVERWRITE) \ |
| 37 | + ore::data::BondFactory::instance().addBuilder(NAME, boost::make_shared<CLASS>(), OVERWRITE); |
| 38 | + |
| 39 | +#define ORE_REGISTER_TRADE_BUILDER(NAME, CLASS, OVERWRITE) \ |
| 40 | + ore::data::TradeFactory::instance().addBuilder(NAME, boost::make_shared<ore::data::TradeBuilder<CLASS>>(), \ |
| 41 | + OVERWRITE); |
| 42 | + |
| 43 | +#define ORE_REGISTER_LEGBUILDER(NAME, CLASS, OVERWRITE) \ |
| 44 | + ore::data::EngineBuilderFactory::instance().addLegBuilder([]() { return boost::make_shared<CLASS>(); }, OVERWRITE); |
| 45 | + |
| 46 | +#define ORE_REGISTER_AMC_ENGINE_BUILDER(CLASS, OVERWRITE) \ |
| 47 | + ore::data::EngineBuilderFactory::instance().addAmcEngineBuilder( \ |
| 48 | + [](const boost::shared_ptr<QuantExt::CrossAssetModel>& cam, const std::vector<ore::data::Date>& grid) { \ |
| 49 | + return boost::make_shared<CLASS>(cam, grid); \ |
| 50 | + }, \ |
| 51 | + OVERWRITE); |
| 52 | + |
| 53 | +#define ORE_REGISTER_ENGINE_BUILDER(CLASS, OVERWRITE) \ |
| 54 | + ore::data::EngineBuilderFactory::instance().addEngineBuilder([]() { return boost::make_shared<CLASS>(); }, \ |
| 55 | + OVERWRITE); |
| 56 | + |
| 57 | +#define ORE_REGISTER_TRS_UNDERLYING_BUILDER(NAME, CLASS, OVERWRITE) \ |
| 58 | + oreplus::data::TrsUnderlyingBuilderFactory::instance().addBuilder(NAME, boost::make_shared<CLASS>(), OVERWRITE); |
| 59 | + |
| 60 | +namespace ore::data { |
| 61 | + |
| 62 | +void initBuilders(); |
| 63 | + |
| 64 | +} // namespace ore::data |
0 commit comments