本文整理汇总了C++中OH_FAIL函数的典型用法代码示例。如果您正苦于以下问题:C++ OH_FAIL函数的具体用法?C++ OH_FAIL怎么用?C++ OH_FAIL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OH_FAIL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ohObjectSave
long ohObjectSave(
const std::vector<std::string>& ObjectList,
const std::string &Filename,
const ObjectHandler::property_t &Overwrite,
const ObjectHandler::property_t &IncludeGroups,
const ObjectHandler::property_t &Trigger) {
try {
// convert input datatypes to C++ datatypes
bool OverwriteCpp = ObjectHandler::convert2<bool>(
Overwrite, "Overwrite", false);
bool IncludeGroupsCpp = ObjectHandler::convert2<bool>(
IncludeGroups, "IncludeGroups", true);
// invoke the utility function
long returnValue = ObjectHandler::SerializationFactory::instance().saveObject(
ObjectList,
Filename,
OverwriteCpp,
IncludeGroupsCpp);
// convert and return the return value
return returnValue;
} catch (const std::exception &e) {
OH_FAIL("Error in function ohObjectSave : " << e.what());
}
}
示例2: if
void qlAbcdAtmVolCurve::setSystemProperty(const std::string& name, const ObjectHandler::property_t& value) {
std::string nameUpper = boost::algorithm::to_upper_copy(name);
if(strcmp(nameUpper.c_str(), "OBJECTID")==0)
objectId_ = boost::get<std::string>(value);
else if(strcmp(nameUpper.c_str(), "CLASSNAME")==0)
className_ = boost::get<std::string>(value);
else if(strcmp(nameUpper.c_str(), "SETTLEMENTDAYS")==0)
SettlementDays_ = ObjectHandler::convert2<long>(value);
else if(strcmp(nameUpper.c_str(), "CALENDAR")==0)
Calendar_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "OPTIONTENORS")==0)
OptionTenors_ = ObjectHandler::vector::convert2<ObjectHandler::property_t>(value, nameUpper);
else if(strcmp(nameUpper.c_str(), "VOLATILITIESQUOTES")==0)
VolatilitiesQuotes_ = ObjectHandler::vector::convert2<ObjectHandler::property_t>(value, nameUpper);
else if(strcmp(nameUpper.c_str(), "INCLUSIONININTERPOLATION")==0)
InclusionInInterpolation_ = ObjectHandler::vector::convert2<bool>(value, nameUpper);
else if(strcmp(nameUpper.c_str(), "CONVENTION")==0)
Convention_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "DAYCOUNTER")==0)
DayCounter_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "PERMANENT")==0)
Permanent_ = ObjectHandler::convert2<bool>(value);
else
OH_FAIL("Error: attempt to set non-existent Property: '" + name + "'");
}
示例3: if
ObjectHandler::property_t qlInterpolatedYieldCurve::getSystemProperty(const std::string& name) const {
std::string nameUpper = boost::algorithm::to_upper_copy(name);
if(strcmp(nameUpper.c_str(), "OBJECTID")==0)
return objectId_;
else if(strcmp(nameUpper.c_str(), "CLASSNAME")==0)
return className_;
else if(strcmp(nameUpper.c_str(), "REFDATE")==0)
return RefDate_;
else if(strcmp(nameUpper.c_str(), "DATES")==0)
return Dates_;
else if(strcmp(nameUpper.c_str(), "DATA")==0)
return Data_;
else if(strcmp(nameUpper.c_str(), "CALENDAR")==0)
return Calendar_;
else if(strcmp(nameUpper.c_str(), "DAYCOUNTER")==0)
return DayCounter_;
else if(strcmp(nameUpper.c_str(), "JUMPS")==0)
return Jumps_;
else if(strcmp(nameUpper.c_str(), "JUMPDATES")==0)
return JumpDates_;
else if(strcmp(nameUpper.c_str(), "TRAITSID")==0)
return TraitsID_;
else if(strcmp(nameUpper.c_str(), "INTERPOLATORID")==0)
return InterpolatorID_;
else if(strcmp(nameUpper.c_str(), "PERMANENT")==0)
return Permanent_;
else
OH_FAIL("Error: attempt to retrieve non-existent Property: '" + name + "'");
}
示例4: CALSettingsSetEvaluationDate
bool CALSettingsSetEvaluationDate(
const ObjectHandler::property_t &EvalDate,
const ObjectHandler::property_t &Trigger) {
try {
// convert input datatypes to QuantLib datatypes
QuantLib::Date EvalDateLib = ObjectHandler::convert2<QuantLib::Date>(
EvalDate, "EvalDate", QuantLib::Date());
// invoke the utility function
static bool returnValue = true;
QuantLibAddin::qlSettingsSetEvaluationDate(
EvalDateLib);
// convert and return the return value
return returnValue;
} catch (const std::exception &e) {
OH_FAIL("Error in function CALSettingsSetEvaluationDate : " << e.what());
}
}
示例5: OH_FAIL
RepositoryXL &RepositoryXL::instance() {
if (instance_) {
RepositoryXL *ret = dynamic_cast<RepositoryXL*>(instance_);
if (ret) return *ret;
}
OH_FAIL("Attempt to reference uninitialized RepositoryXL object");
}
示例6: ohObjectSaveString
std::string ohObjectSaveString(
const std::vector<std::string>& ObjectList,
const ObjectHandler::property_t &Overwrite,
const ObjectHandler::property_t &Trigger) {
try {
// convert input datatypes to C++ datatypes
bool OverwriteCpp = ObjectHandler::convert2<bool>(
Overwrite, "Overwrite", false);
// convert input datatypes to Object references
std::vector<boost::shared_ptr<ObjectHandler::Object> > ObjectListObjPtr =
ObjectHandler::getObjectVector<ObjectHandler::Object>(ObjectList);
// invoke the utility function
std::string returnValue = ObjectHandler::SerializationFactory::instance().saveObjectString(
ObjectListObjPtr,
OverwriteCpp);
// convert and return the return value
return returnValue;
} catch (const std::exception &e) {
OH_FAIL("Error in function ohObjectSaveString : " << e.what());
}
}
示例7: if
void qlAssetSwap::setSystemProperty(const std::string& name, const ObjectHandler::property_t& value) {
std::string nameUpper = boost::algorithm::to_upper_copy(name);
if(strcmp(nameUpper.c_str(), "OBJECTID")==0)
objectId_ = boost::get<std::string>(value);
else if(strcmp(nameUpper.c_str(), "CLASSNAME")==0)
className_ = boost::get<std::string>(value);
else if(strcmp(nameUpper.c_str(), "PAYBONDCOUPON")==0)
PayBondCoupon_ = ObjectHandler::convert2<bool>(value);
else if(strcmp(nameUpper.c_str(), "BOND")==0)
Bond_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "CLEANPRICE")==0)
CleanPrice_ = ObjectHandler::convert2<double>(value);
else if(strcmp(nameUpper.c_str(), "IBORINDEX")==0)
IborIndex_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "SPREAD")==0)
Spread_ = ObjectHandler::convert2<double>(value);
else if(strcmp(nameUpper.c_str(), "FLOATINGLEGSCHEDULE")==0)
FloatingLegSchedule_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "FLOATINGLEGDAYCOUNTER")==0)
FloatingLegDayCounter_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "PARASSETSWAP")==0)
ParAssetSwap_ = ObjectHandler::convert2<bool>(value);
else if(strcmp(nameUpper.c_str(), "PERMANENT")==0)
Permanent_ = ObjectHandler::convert2<bool>(value);
else
OH_FAIL("Error: attempt to set non-existent Property: '" + name + "'");
}
示例8: ohObjectLoadString
std::vector<std::string> ohObjectLoadString(
const std::string &Xml,
const ObjectHandler::property_t &Overwrite,
const ObjectHandler::property_t &Trigger) {
try {
// convert input datatypes to C++ datatypes
bool OverwriteCpp = ObjectHandler::convert2<bool>(
Overwrite, "Overwrite", false);
// invoke the utility function
std::vector<std::string> returnValue = ObjectHandler::SerializationFactory::instance().loadObjectString(
Xml,
OverwriteCpp);
// convert and return the return value
return returnValue;
} catch (const std::exception &e) {
OH_FAIL("Error in function ohObjectLoadString : " << e.what());
}
}
示例9: if
void qlSchedule::setSystemProperty(const std::string& name, const ObjectHandler::property_t& value) {
std::string nameUpper = boost::algorithm::to_upper_copy(name);
if(strcmp(nameUpper.c_str(), "OBJECTID")==0)
objectId_ = boost::get<std::string>(value);
else if(strcmp(nameUpper.c_str(), "CLASSNAME")==0)
className_ = boost::get<std::string>(value);
else if(strcmp(nameUpper.c_str(), "EFFECTIVEDATE")==0)
EffectiveDate_ = value;
else if(strcmp(nameUpper.c_str(), "TERMINATIONDATE")==0)
TerminationDate_ = value;
else if(strcmp(nameUpper.c_str(), "TENOR")==0)
Tenor_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "CALENDAR")==0)
Calendar_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "CONVENTION")==0)
Convention_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "TERMDATECONV")==0)
TermDateConv_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "GENRULE")==0)
GenRule_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "ENDOFMONTH")==0)
EndOfMonth_ = ObjectHandler::convert2<bool>(value);
else if(strcmp(nameUpper.c_str(), "FIRSTDATE")==0)
FirstDate_ = value;
else if(strcmp(nameUpper.c_str(), "NEXTTOLASTDATE")==0)
NextToLastDate_ = value;
else if(strcmp(nameUpper.c_str(), "PERMANENT")==0)
Permanent_ = ObjectHandler::convert2<bool>(value);
else
OH_FAIL("Error: attempt to set non-existent Property: '" + name + "'");
}
示例10: operToOper
void operToOper(OPER *xTarget, const OPER *xSource) {
if (xSource->xltype == xltypeNum) {
xTarget->xltype = xltypeNum;
xTarget->val.num = xSource->val.num;
return;
} else if (xSource->xltype == xltypeStr) {
// Must use type unsigned char (BYTE) to process the 0th byte of Excel byte-counted string
unsigned char len = xSource->val.str[0];
xTarget->val.str = new char[ len + 1 ];
xTarget->xltype = xltypeStr | xlbitDLLFree;
xTarget->val.str[0] = len;
if (len)
strncpy(xTarget->val.str + 1, xSource->val.str + 1, len);
return;
} else if (xSource->xltype == xltypeErr) {
xTarget->xltype = xltypeErr;
xTarget->val.err = xSource->val.err;
return;
} else if (xSource->xltype == xltypeNil) {
xTarget->xltype = xltypeNil;
return;
} else {
OH_FAIL("operToOper: unexpected OPER type: " << xSource->xltype);
}
}
示例11: qlIntegralNtdEngine
std::string qlIntegralNtdEngine(
const std::string &ObjectId,
const std::string &IntegrationStep,
const std::string &YieldCurve,
const ObjectHandler::property_t &Permanent,
const ObjectHandler::property_t &Trigger,
const bool &Overwrite) {
try {
// convert input datatypes to C++ datatypes
bool PermanentCpp = ObjectHandler::convert2<bool>(
Permanent, "Permanent", false);
// convert input datatypes to QuantLib datatypes
QuantLib::Period IntegrationStepLib;
QuantLibAddin::cppToLibrary(IntegrationStep, IntegrationStepLib);
// convert object IDs into library objects
OH_GET_OBJECT(YieldCurveCoerce, YieldCurve, ObjectHandler::Object)
QuantLib::Handle<QuantLib::YieldTermStructure> YieldCurveLibObj =
QuantLibAddin::CoerceHandle<
QuantLibAddin::YieldTermStructure,
QuantLib::YieldTermStructure>()(
YieldCurveCoerce);
// Construct the Value Object
boost::shared_ptr<ObjectHandler::ValueObject> valueObject(
new QuantLibAddin::ValueObjects::qlIntegralNtdEngine(
ObjectId,
IntegrationStep,
YieldCurve,
PermanentCpp));
// Construct the Object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::IntegralNtdEngine(
valueObject,
IntegrationStepLib,
YieldCurveLibObj,
PermanentCpp));
// Store the Object in the Repository
std::string returnValue =
ObjectHandler::Repository::instance().storeObject(ObjectId, object, Overwrite, valueObject);
// Convert and return the return value
return returnValue;
} catch (const std::exception &e) {
OH_FAIL("Error in function qlIntegralNtdEngine : " << e.what());
}
}
示例12: if
void qlOvernightIndexedSwap::setSystemProperty(const std::string& name, const ObjectHandler::property_t& value) {
std::string nameUpper = boost::algorithm::to_upper_copy(name);
if(strcmp(nameUpper.c_str(), "OBJECTID")==0)
objectId_ = boost::get<std::string>(value);
else if(strcmp(nameUpper.c_str(), "CLASSNAME")==0)
className_ = boost::get<std::string>(value);
else if(strcmp(nameUpper.c_str(), "PAYERRECEIVER")==0)
PayerReceiver_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "NOMINAL")==0)
Nominal_ = ObjectHandler::vector::convert2<double>(value, nameUpper);
else if(strcmp(nameUpper.c_str(), "SCHEDULE")==0)
Schedule_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "FIXEDRATE")==0)
FixedRate_ = ObjectHandler::convert2<double>(value);
else if(strcmp(nameUpper.c_str(), "FIXDAYCOUNTER")==0)
FixDayCounter_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "OVERNIGHTINDEX")==0)
OvernightIndex_ = ObjectHandler::convert2<std::string>(value);
else if(strcmp(nameUpper.c_str(), "SPREAD")==0)
Spread_ = ObjectHandler::convert2<double>(value);
else if(strcmp(nameUpper.c_str(), "PERMANENT")==0)
Permanent_ = ObjectHandler::convert2<bool>(value);
else
OH_FAIL("Error: attempt to set non-existent Property: '" + name + "'");
}
示例13: CALCapFloor
std::string CALCapFloor(
const std::string &ObjectId,
const std::string &OptionType,
const std::string &LegID,
const std::vector<double>& Strikes,
const ObjectHandler::property_t &Permanent,
const ObjectHandler::property_t &Trigger,
const bool &Overwrite) {
try {
// convert input datatypes to C++ datatypes
bool PermanentCpp = ObjectHandler::convert2<bool>(
Permanent, "Permanent", false);
// convert input datatypes to QuantLib enumerated datatypes
QuantLib::CapFloor::Type OptionTypeEnum =
ObjectHandler::Create<QuantLib::CapFloor::Type>()(OptionType);
// convert object IDs into library objects
OH_GET_UNDERLYING(LegIDLibObj, LegID,
QuantLibAddin::Leg, QuantLib::Leg)
// Construct the Value Object
boost::shared_ptr<ObjectHandler::ValueObject> valueObject(
new QuantLibAddin::ValueObjects::CALCapFloor(
ObjectId,
OptionType,
LegID,
Strikes,
PermanentCpp));
// Construct the Object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::CapFloor(
valueObject,
OptionTypeEnum,
LegIDLibObj,
Strikes,
PermanentCpp));
// Store the Object in the Repository
std::string returnValue =
ObjectHandler::Repository::instance().storeObject(ObjectId, object, Overwrite);
// Convert and return the return value
return returnValue;
} catch (const std::exception &e) {
OH_FAIL("Error in function CALCapFloor : " << e.what());
}
}
示例14: convert2
value_t convert2(const container_t& c, const std::string ¶meterName) {
try {
return convert2<value_t, container_t>(c);
}
catch(const std::exception& e) {
OH_FAIL("Error converting parameter '" << parameterName << "' : '" << e.what());
}
}
示例15: qlIssuer
std::string qlIssuer(
const std::string &ObjectId,
const ObjectHandler::property_t &DefaultCurves,
const std::string &DefaultEvents,
const ObjectHandler::property_t &Permanent,
const ObjectHandler::property_t &Trigger,
const bool &Overwrite) {
try {
// convert input datatypes to C++ datatypes
std::string DefaultCurvesCpp = ObjectHandler::convert2<std::string>(
DefaultCurves, "DefaultCurves", "");
bool PermanentCpp = ObjectHandler::convert2<bool>(
Permanent, "Permanent", false);
// convert object IDs into library objects
OH_GET_REFERENCE_DEFAULT(DefaultCurvesLibObjPtr, DefaultCurvesCpp,
QuantLibAddin::DefaultProbabilityTermStructure, QuantLib::DefaultProbabilityTermStructure)
OH_GET_REFERENCE(DefaultEventsLibObjPtr, DefaultEvents,
QuantLibAddin::DefaultEventSet, QuantLib::DefaultEventSet)
// Construct the Value Object
boost::shared_ptr<ObjectHandler::ValueObject> valueObject(
new QuantLibAddin::ValueObjects::qlIssuer(
ObjectId,
DefaultCurvesCpp,
DefaultEvents,
PermanentCpp));
// Construct the Object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::Issuer(
valueObject,
DefaultCurvesLibObjPtr,
DefaultEventsLibObjPtr,
PermanentCpp));
// Store the Object in the Repository
std::string returnValue =
ObjectHandler::Repository::instance().storeObject(ObjectId, object, Overwrite, valueObject);
// Convert and return the return value
return returnValue;
} catch (const std::exception &e) {
OH_FAIL("Error in function qlIssuer : " << e.what());
}
}