本文整理汇总了C++中OH_GET_REFERENCE函数的典型用法代码示例。如果您正苦于以下问题:C++ OH_GET_REFERENCE函数的具体用法?C++ OH_GET_REFERENCE怎么用?C++ OH_GET_REFERENCE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OH_GET_REFERENCE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SEQSEQ
SEQSEQ(ANY) SAL_CALL CalcAddins_impl::qlRangeAccrualFloatersCouponSetPricer(
const ANY &ObjectId,
const ANY &RangeAccrualPricer,
const ANY &Trigger) throw(RuntimeException) {
try {
// convert input datatypes to C++ datatypes
std::string ObjectIdCpp;
calcToScalar(ObjectIdCpp, ObjectId);
std::string RangeAccrualPricerCpp;
calcToScalar(RangeAccrualPricerCpp, RangeAccrualPricer);
// convert object IDs into library objects
OH_GET_REFERENCE(ObjectIdLibObjPtr, ObjectIdCpp,
QuantLibAddin::RangeAccrualFloatersCoupon, QuantLib::RangeAccrualFloatersCoupon)
OH_GET_REFERENCE(RangeAccrualPricerLibObjPtr, RangeAccrualPricerCpp,
QuantLibAddin::RangeAccrualPricer, QuantLib::RangeAccrualPricer)
// invoke the member function
static bool returnValue = true;
ObjectIdLibObjPtr->setPricer(
RangeAccrualPricerLibObjPtr);
// convert and return the return value
SEQSEQ(ANY) retAnyArray;
retAnyArray.realloc(1);
SEQ(ANY) retAnyVector(1);
STRING s = STRFROMASCII( std::string("VOID").c_str() );
retAnyVector[0] = CSS::uno::makeAny( s );
retAnyArray[0] = retAnyVector;
return retAnyArray;
} catch (const std::exception &e) {
do {
std::ostringstream errorMsg;
errorMsg << "ERROR: qlRangeAccrualFloatersCouponSetPricer: " << e.what();
OH_LOG_MESSAGE(errorMsg.str());
SEQSEQ(ANY) retAnyArray;
retAnyArray.realloc(1);
SEQ(ANY) retAnyVector(1);
STRING s = STRFROMASCII( errorMsg.str().c_str() );
retAnyVector[0] = CSS::uno::makeAny( s );
retAnyArray[0] = retAnyVector;
return retAnyArray;
} while (false);
}
}
示例2: CALVanillaOption
std::string CALVanillaOption(
const std::string &ObjectId,
const std::string &Payoff,
const std::string &Exercise,
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 object IDs into library objects
OH_GET_REFERENCE(PayoffLibObjPtr, Payoff,
QuantLibAddin::StrikedTypePayoff, QuantLib::StrikedTypePayoff)
OH_GET_REFERENCE(ExerciseLibObjPtr, Exercise,
QuantLibAddin::Exercise, QuantLib::Exercise)
// Construct the Value Object
boost::shared_ptr<ObjectHandler::ValueObject> valueObject(
new QuantLibAddin::ValueObjects::CALVanillaOption(
ObjectId,
Payoff,
Exercise,
PermanentCpp));
// Construct the Object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::VanillaOption(
valueObject,
PayoffLibObjPtr,
ExerciseLibObjPtr,
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 CALVanillaOption : " << e.what());
}
}
示例3: OH_GET_REFERENCE
XLL_DEC bool *qlRangeAccrualFloatersCouponSetPricer(
char *ObjectId,
char *RangeAccrualPricer,
OPER *Trigger) {
// declare a shared pointer to the Function Call object
boost::shared_ptr<ObjectHandler::FunctionCall> functionCall;
try {
// instantiate the Function Call object
functionCall = boost::shared_ptr<ObjectHandler::FunctionCall>(
new ObjectHandler::FunctionCall("qlRangeAccrualFloatersCouponSetPricer"));
ObjectHandler::validateRange(Trigger, "Trigger");
// initialize the session ID (if enabled)
SET_SESSION_ID
// convert object IDs into library objects
OH_GET_REFERENCE(ObjectIdLibObjPtr, ObjectId,
QuantLibAddin::RangeAccrualFloatersCoupon, QuantLib::RangeAccrualFloatersCoupon)
OH_GET_REFERENCE(RangeAccrualPricerLibObjPtr, RangeAccrualPricer,
QuantLibAddin::RangeAccrualPricer, QuantLib::RangeAccrualPricer)
// invoke the member function
static bool returnValue = true;
ObjectIdLibObjPtr->setPricer(
RangeAccrualPricerLibObjPtr);
// convert and return the return value
return &returnValue;
} catch (const std::exception &e) {
ObjectHandler::RepositoryXL::instance().logError(e.what(), functionCall);
return 0;
} catch (...) {
ObjectHandler::RepositoryXL::instance().logError("unkown error type", functionCall);
return 0;
}
}
示例4: create_qlFwdToCotSwapAdapter
boost::shared_ptr<ObjectHandler::Object> create_qlFwdToCotSwapAdapter(
const boost::shared_ptr<ObjectHandler::ValueObject> &valueObject) {
// convert input datatypes to C++ datatypes
std::string ForwardModel =
ObjectHandler::convert2<std::string>(valueObject->getProperty("ForwardModel"));
bool Permanent =
ObjectHandler::convert2<bool>(valueObject->getProperty("Permanent"));
// convert object IDs into library objects
OH_GET_REFERENCE(ForwardModelLibObjPtr, ForwardModel,
QuantLibAddin::MarketModel, QuantLib::MarketModel)
// update value object precedent IDs (if any)
valueObject->processPrecedentID(ForwardModel);
// construct and return the object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::FwdToCotSwapAdapter(
valueObject,
ForwardModelLibObjPtr,
Permanent));
return object;
}
示例5: create_qlPseudoRootFacade
boost::shared_ptr<ObjectHandler::Object> create_qlPseudoRootFacade(
const boost::shared_ptr<ObjectHandler::ValueObject> &valueObject) {
// convert input datatypes to C++ datatypes
std::string Calibrator =
ObjectHandler::convert2<std::string>(valueObject->getProperty("Calibrator"));
bool Permanent =
ObjectHandler::convert2<bool>(valueObject->getProperty("Permanent"));
// convert object IDs into library objects
OH_GET_REFERENCE(CalibratorLibObjPtr, Calibrator,
QuantLibAddin::CTSMMCapletCalibration, QuantLib::CTSMMCapletCalibration)
// update value object precedent IDs (if any)
valueObject->processPrecedentID(Calibrator);
// construct and return the object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::PseudoRootFacade(
valueObject,
CalibratorLibObjPtr,
Permanent));
return object;
}
示例6: create_qlVanillaSwapFromSwapRateHelper
boost::shared_ptr<ObjectHandler::Object> create_qlVanillaSwapFromSwapRateHelper(
const boost::shared_ptr<ObjectHandler::ValueObject> &valueObject) {
// convert input datatypes to C++ datatypes
std::string SwapRateHelper =
ObjectHandler::convert2<std::string>(valueObject->getProperty("SwapRateHelper"));
bool Permanent =
ObjectHandler::convert2<bool>(valueObject->getProperty("Permanent"));
// convert object IDs into library objects
OH_GET_REFERENCE(SwapRateHelperLibObjPtr, SwapRateHelper,
QuantLibAddin::SwapRateHelper, QuantLib::SwapRateHelper)
// update value object precedent IDs (if any)
valueObject->processPrecedentID(SwapRateHelper);
// construct and return the object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::VanillaSwap(
valueObject,
SwapRateHelperLibObjPtr,
Permanent));
return object;
}
示例7: create_qlGaussianDefaultProbLM
boost::shared_ptr<ObjectHandler::Object> create_qlGaussianDefaultProbLM(
const boost::shared_ptr<ObjectHandler::ValueObject> &valueObject) {
// convert input datatypes to C++ datatypes
std::string Basket =
ObjectHandler::convert2<std::string>(valueObject->getProperty("Basket"));
std::vector<std::vector<double> > Factors =
ObjectHandler::matrix::convert2<double>(valueObject->getProperty("Factors"), "Factors");
bool Permanent =
ObjectHandler::convert2<bool>(valueObject->getProperty("Permanent"));
// convert object IDs into library objects
OH_GET_REFERENCE(BasketLibObjPtr, Basket,
QuantLibAddin::Basket, QuantLib::Basket)
// update value object precedent IDs (if any)
valueObject->processPrecedentID(Basket);
// construct and return the object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::GaussianDefProbLM(
valueObject,
BasketLibObjPtr,
Factors,
Permanent));
return object;
}
示例8: OH_GET_REFERENCE
XLL_DEC OPER *qlAbcdCalibrationK(
char *ObjectId,
OPER *Times,
OPER *BlackVols,
OPER *Trigger) {
// declare a shared pointer to the Function Call object
boost::shared_ptr<ObjectHandler::FunctionCall> functionCall;
try {
// instantiate the Function Call object
functionCall = boost::shared_ptr<ObjectHandler::FunctionCall>(
new ObjectHandler::FunctionCall("qlAbcdCalibrationK"));
ObjectHandler::validateRange(Trigger, "Trigger");
// initialize the session ID (if enabled)
SET_SESSION_ID
// convert input datatypes to C++ datatypes
std::vector<double> TimesCpp =
ObjectHandler::operToVector<double>(*Times, "Times");
std::vector<double> BlackVolsCpp =
ObjectHandler::operToVector<double>(*BlackVols, "BlackVols");
// convert object IDs into library objects
OH_GET_REFERENCE(ObjectIdLibObjPtr, ObjectId,
QuantLibAddin::AbcdCalibration, QuantLib::AbcdCalibration)
// invoke the member function
std::vector<double> returnValue = ObjectIdLibObjPtr->k(
TimesCpp,
BlackVolsCpp);
// convert and return the return value
static OPER xRet;
ObjectHandler::vectorToOper(returnValue, xRet);
return &xRet;
} catch (const std::exception &e) {
ObjectHandler::RepositoryXL::instance().logError(e.what(), functionCall);
return 0;
} catch (...) {
ObjectHandler::RepositoryXL::instance().logError("unkown error type", functionCall);
return 0;
}
}
示例9: 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());
}
}
示例10: qlScheduleTruncated
std::string qlScheduleTruncated(
const std::string &ObjectId,
const std::string &OriginalSchedule,
const ObjectHandler::property_t &TruncationDate,
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::Date TruncationDateLib = ObjectHandler::convert2<QuantLib::Date>(
TruncationDate, "TruncationDate");
// convert object IDs into library objects
OH_GET_REFERENCE(OriginalScheduleLibObjPtr, OriginalSchedule,
QuantLibAddin::Schedule, QuantLib::Schedule)
// Construct the Value Object
boost::shared_ptr<ObjectHandler::ValueObject> valueObject(
new QuantLibAddin::ValueObjects::qlScheduleTruncated(
ObjectId,
OriginalSchedule,
TruncationDate,
PermanentCpp));
// Construct the Object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::Schedule(
valueObject,
OriginalScheduleLibObjPtr,
TruncationDateLib,
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 qlScheduleTruncated : " << e.what());
}
}
示例11: qlVanillaSwapFromSwapIndex
std::string qlVanillaSwapFromSwapIndex(
const std::string &ObjectId,
const std::string &SwapIndex,
const ObjectHandler::property_t &FixingDate,
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::Date FixingDateLib = ObjectHandler::convert2<QuantLib::Date>(
FixingDate, "FixingDate");
// convert object IDs into library objects
OH_GET_REFERENCE(SwapIndexLibObjPtr, SwapIndex,
QuantLibAddin::SwapIndex, QuantLib::SwapIndex)
// Construct the Value Object
boost::shared_ptr<ObjectHandler::ValueObject> valueObject(
new QuantLibAddin::ValueObjects::qlVanillaSwapFromSwapIndex(
ObjectId,
SwapIndex,
FixingDate,
PermanentCpp));
// Construct the Object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::VanillaSwap(
valueObject,
SwapIndexLibObjPtr,
FixingDateLib,
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 qlVanillaSwapFromSwapIndex : " << e.what());
}
}
示例12: create_qlFlatVol
boost::shared_ptr<ObjectHandler::Object> create_qlFlatVol(
const boost::shared_ptr<ObjectHandler::ValueObject> &valueObject) {
// convert input datatypes to C++ datatypes
std::vector<double> Volatilities =
ObjectHandler::vector::convert2<double>(valueObject->getProperty("Volatilities"), "Volatilities");
std::string Correlations =
ObjectHandler::convert2<std::string>(valueObject->getProperty("Correlations"));
std::string EvolutionDescription =
ObjectHandler::convert2<std::string>(valueObject->getProperty("EvolutionDescription"));
long Factors =
ObjectHandler::convert2<long>(valueObject->getProperty("Factors"));
std::vector<double> InitialRates =
ObjectHandler::vector::convert2<double>(valueObject->getProperty("InitialRates"), "InitialRates");
std::vector<double> Displacements =
ObjectHandler::vector::convert2<double>(valueObject->getProperty("Displacements"), "Displacements");
bool Permanent =
ObjectHandler::convert2<bool>(valueObject->getProperty("Permanent"));
// convert object IDs into library objects
OH_GET_REFERENCE(CorrelationsLibObjPtr, Correlations,
QuantLibAddin::PiecewiseConstantCorrelation, QuantLib::PiecewiseConstantCorrelation)
OH_GET_UNDERLYING(EvolutionDescriptionLibObj, EvolutionDescription,
QuantLibAddin::EvolutionDescription, QuantLib::EvolutionDescription)
// update value object precedent IDs (if any)
valueObject->processPrecedentID(Correlations);
valueObject->processPrecedentID(EvolutionDescription);
// construct and return the object
boost::shared_ptr<ObjectHandler::Object> object(
new QuantLibAddin::FlatVol(
valueObject,
Volatilities,
CorrelationsLibObjPtr,
EvolutionDescriptionLibObj,
Factors,
InitialRates,
Displacements,
Permanent));
return object;
}
示例13: SEQSEQ
SEQSEQ(ANY) SAL_CALL CalcAddins_impl::qlIndexName(
const ANY &ObjectId,
const ANY &Trigger) throw(RuntimeException) {
try {
// convert input datatypes to C++ datatypes
std::string ObjectIdCpp;
calcToScalar(ObjectIdCpp, ObjectId);
// convert object IDs into library objects
OH_GET_REFERENCE(ObjectIdLibObjPtr, ObjectIdCpp,
QuantLibAddin::Index, QuantLib::Index)
// invoke the member function
std::string returnValue = ObjectIdLibObjPtr->name();
// convert and return the return value
ANY returnValueCalc;
scalarToCalc(returnValueCalc, returnValue);
SEQSEQ(ANY) retAnyArray;
retAnyArray.realloc(1);
SEQ(ANY) retAnyVector(1);
retAnyVector[0] = returnValueCalc;
retAnyArray[0] = retAnyVector;
return retAnyArray;
} catch (const std::exception &e) {
do {
std::ostringstream errorMsg;
errorMsg << "ERROR: qlIndexName: " << e.what();
OH_LOG_MESSAGE(errorMsg.str());
SEQSEQ(ANY) retAnyArray;
retAnyArray.realloc(1);
SEQ(ANY) retAnyVector(1);
STRING s = STRFROMASCII( errorMsg.str().c_str() );
retAnyVector[0] = CSS::uno::makeAny( s );
retAnyArray[0] = retAnyVector;
return retAnyArray;
} while (false);
}
}
示例14: OH_GET_REFERENCE
XLL_DEC OPER *qlEvolutionDescriptionFirstAliveRate(
char *ObjectId,
OPER *Trigger) {
// declare a shared pointer to the Function Call object
boost::shared_ptr<ObjectHandler::FunctionCall> functionCall;
try {
// instantiate the Function Call object
functionCall = boost::shared_ptr<ObjectHandler::FunctionCall>(
new ObjectHandler::FunctionCall("qlEvolutionDescriptionFirstAliveRate"));
ObjectHandler::validateRange(Trigger, "Trigger");
// initialize the session ID (if enabled)
SET_SESSION_ID
// convert object IDs into library objects
OH_GET_REFERENCE(ObjectIdLibObjPtr, ObjectId,
QuantLibAddin::EvolutionDescription, QuantLib::EvolutionDescription)
// invoke the member function
std::vector<QuantLib::Size> returnValue = ObjectIdLibObjPtr->firstAliveRate();
// convert and return the return value
std::vector<long> returnValVec =
QuantLibAddin::convertVector<QuantLib::Size, long>(returnValue);
static OPER xRet;
ObjectHandler::vectorToOper(returnValVec, xRet);
return &xRet;
} catch (const std::exception &e) {
ObjectHandler::RepositoryXL::instance().logError(e.what(), functionCall);
return 0;
} catch (...) {
ObjectHandler::RepositoryXL::instance().logError("unkown error type", functionCall);
return 0;
}
}
示例15: OH_GET_REFERENCE
XLL_DEC char *qlSwaptionType(
char *ObjectId,
OPER *Trigger) {
// declare a shared pointer to the Function Call object
boost::shared_ptr<ObjectHandler::FunctionCall> functionCall;
try {
// instantiate the Function Call object
functionCall = boost::shared_ptr<ObjectHandler::FunctionCall>(
new ObjectHandler::FunctionCall("qlSwaptionType"));
ObjectHandler::validateRange(Trigger, "Trigger");
// initialize the session ID (if enabled)
SET_SESSION_ID
// convert object IDs into library objects
OH_GET_REFERENCE(ObjectIdLibObjPtr, ObjectId,
QuantLibAddin::Swaption, QuantLib::Swaption)
// invoke the member function
QuantLib::VanillaSwap::Type returnValue = ObjectIdLibObjPtr->type();
// convert and return the return value
std::ostringstream os;
os << returnValue;
static char ret[XL_MAX_STR_LEN];
ObjectHandler::stringToChar(os.str(), ret);
return ret;
} catch (const std::exception &e) {
ObjectHandler::RepositoryXL::instance().logError(e.what(), functionCall);
return 0;
} catch (...) {
ObjectHandler::RepositoryXL::instance().logError("unkown error type", functionCall);
return 0;
}
}