当前位置: 首页>>代码示例>>C++>>正文


C++ OH_FAIL函数代码示例

本文整理汇总了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());
        }
    }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:33,代码来源:serialization.cpp

示例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 + "'");
 }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:25,代码来源:vo_volatilities.cpp

示例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 + "'");
 }
开发者ID:minikie,项目名称:test,代码行数:29,代码来源:vo_termstructures.cpp

示例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());
        }
    }
开发者ID:jojogh,项目名称:QuantPlus,代码行数:25,代码来源:settings.cpp

示例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");
 }
开发者ID:AAthresh,项目名称:quantlib,代码行数:7,代码来源:repositoryxl.cpp

示例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());
        }
    }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:31,代码来源:serialization.cpp

示例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 + "'");
 }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:27,代码来源:vo_assetswap.cpp

示例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());
        }
    }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:26,代码来源:serialization.cpp

示例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 + "'");
 }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:31,代码来源:vo_schedule.cpp

示例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);
    }
}
开发者ID:derekcameron,项目名称:quantlibcl,代码行数:25,代码来源:manual.cpp

示例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());
        }
    }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:60,代码来源:credit.cpp

示例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 + "'");
 }
开发者ID:minikie,项目名称:test,代码行数:25,代码来源:vo_overnightindexedswap.cpp

示例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());
        }
    }
开发者ID:jojogh,项目名称:QuantPlus,代码行数:59,代码来源:capfloor.cpp

示例14: convert2

 value_t convert2(const container_t& c, const std::string &parameterName) {
     try {
         return convert2<value_t, container_t>(c);
     }
     catch(const std::exception& e) {
         OH_FAIL("Error converting parameter '" << parameterName << "' : '" << e.what());
     }
 }
开发者ID:rdaluiso,项目名称:quantlib,代码行数:8,代码来源:convert2.hpp

示例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());
        }
    }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:57,代码来源:credit.cpp


注:本文中的OH_FAIL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。