本文整理汇总了C++中Wrapper类的典型用法代码示例。如果您正苦于以下问题:C++ Wrapper类的具体用法?C++ Wrapper怎么用?C++ Wrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Wrapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void Wrapper<Overkiz::UniversalUniqueIdentifier>::deserialize(Message::ConstIterator& iterator, Overkiz::UniversalUniqueIdentifier& val) const
{
std::string string;
Wrapper<std::string> wstring;
wstring.deserialize(iterator, string);
val.build(string);
}
开发者ID:Overkiz,项目名称:libbus,代码行数:7,代码来源:Type.cpp
示例2: String
void *Thread::ThreadCall(void *myWrapper)
{
Wrapper *wrapper = reinterpret_cast<Wrapper*>(myWrapper);
wrapper->thread->mRunning = true;
#ifdef PTW32_STATIC_LIB
pthread_win32_thread_attach_np();
#endif
try {
wrapper->call();
}
catch(const std::exception &e)
{
LogWarn("Thread::ThreadCall", String("Unhandled exception in thread: ") + e.what());
}
catch(...)
{
LogWarn("Thread::ThreadCall", String("Unhandled unknown exception in thread"));
}
delete wrapper;
wrapper->thread->mRunning = false;
#ifdef PTW32_STATIC_LIB
pthread_win32_thread_detach_np();
#endif
pthread_exit(NULL);
return NULL;
}
开发者ID:orinocoz,项目名称:Teapotnet,代码行数:30,代码来源:thread.cpp
示例3: qmlbind_value_get_backref
qmlbind_backref qmlbind_value_get_backref(qmlbind_value self)
{
Wrapper *obj = dynamic_cast<Wrapper *>(self->toQObject());
if (!obj) {
return 0;
}
return obj->backref().backref();
}
开发者ID:tpickett66,项目名称:libqmlbind,代码行数:8,代码来源:api_value.cpp
示例4: CallBS
double CallBS(const Wrapper<Parameter>& r, const Wrapper<Parameter>& sig, double Expiry,double Spot, double Strike)
{
double d1,d2;
d1=1./(sig->Mean(1,2)*sqrt(Expiry)) * ( log(Spot/Strike) + (r->Mean(1,2) + .5 * sig->Mean(1,2) * sig->Mean(1,2) ) * Expiry);
d2=1./(sig->Mean(1,2)*sqrt(Expiry)) * ( log(Spot/Strike) + (r->Mean(1,2) - .5 * sig->Mean(1,2) * sig->Mean(1,2) ) * Expiry);
double ans = CumulativeNormal(d1) * Spot - CumulativeNormal(d2) * Strike * exp(-r->Mean(1,2) * Expiry);
return ans;
}
开发者ID:Ruairih,项目名称:LMM,代码行数:10,代码来源:BlackScholes.hpp
示例5: JS_UNLIKELY
js::UnwrapOneChecked(JSObject *obj, bool stopAtOuter)
{
if (!obj->isWrapper() ||
JS_UNLIKELY(!!obj->getClass()->ext.innerObject && stopAtOuter))
{
return obj;
}
Wrapper *handler = Wrapper::wrapperHandler(obj);
return handler->isSafeToUnwrap() ? Wrapper::wrappedObject(obj) : NULL;
}
开发者ID:RickEyre,项目名称:mozilla-central,代码行数:11,代码来源:jswrapper.cpp
示例6: JS_UNLIKELY
js::UnwrapOneChecked(RawObject obj)
{
// Checked unwraps should never unwrap outer windows.
if (!obj->isWrapper() ||
JS_UNLIKELY(!!obj->getClass()->ext.innerObject))
{
return obj;
}
Wrapper *handler = Wrapper::wrapperHandler(obj);
return handler->isSafeToUnwrap() ? Wrapper::wrappedObject(obj) : NULL;
}
开发者ID:IcepOwer,项目名称:Spidermonkey,代码行数:12,代码来源:jswrapper.cpp
示例7: main
int main()
{
int x = 7, y = 4;
Wrapper<int> w = x;
std::cout << x << " " << y << std::endl;
w.t = 2;
std::cout << x << " " << y << std::endl;
w.rebind(y);
std::cout << x << " " << y << std::endl;
w.t = 14;
std::cout << x << " " << y << std::endl;
}
开发者ID:CCJY,项目名称:coliru,代码行数:12,代码来源:main.cpp
示例8: ptr
Ref<Object> Frame::unwrap(Frame * frame) {
Object * function;
frame->extract()(function, "function");
Wrapper * wrapper = ptr(function).as<Wrapper>();
if (wrapper) {
return wrapper->value();
} else {
return new(frame) Unwrapper(Cell::create(frame)(frame->sym("value"))(function));
}
}
开发者ID:ioquatix,项目名称:kai,代码行数:13,代码来源:Frame.cpp
示例9: main
int main()
{
Wrapper<Foo> wrap;
{
std::cout << "before foo" << std::endl;
wrap->foo();
std::cout << "after foo" << std::endl;
}
{
std::cout << "before cfoo" << std::endl;
wrap->cfoo();
std::cout << "after cfoo" << std::endl;
}
}
开发者ID:CCJY,项目名称:coliru,代码行数:14,代码来源:main.cpp
示例10: assert
void Context::put(Control *control) {
auto iter = std::find_if(m_controls.begin(), m_controls.end(),
[control](Wrapper *w) { return w->control() == control; });
assert(iter != m_controls.end());
Wrapper *w = *iter;
w->unref();
if (w->refCount() == 0) {
m_controls.remove(w);
m_plugin->hal()->put(w->control());
delete w;
}
}
开发者ID:crowdos,项目名称:hwhal,代码行数:15,代码来源:context.cpp
示例11: while
js::UnwrapObjectChecked(JSContext *cx, JSObject *obj)
{
while (obj->isWrapper() &&
!JS_UNLIKELY(!!obj->getClass()->ext.innerObject)) {
JSObject *wrapper = obj;
Wrapper *handler = Wrapper::wrapperHandler(obj);
bool rvOnFailure;
if (!handler->enter(cx, wrapper, JSID_VOID,
Wrapper::PUNCTURE, &rvOnFailure))
return rvOnFailure ? obj : NULL;
obj = Wrapper::wrappedObject(obj);
JS_ASSERT(obj);
}
return obj;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:15,代码来源:jswrapper.cpp
示例12: Times
ExoticBSEngine::ExoticBSEngine(const Wrapper<PathDependent>& TheProduct_,
const Parameters& R_,
const Parameters& D_,
const Parameters& Vol_,
const Wrapper<RandomBase>& TheGenerator_,
double Spot_)
:
ExoticEngine(TheProduct_,R_),
TheGenerator(TheGenerator_)
{
MJArray Times(TheProduct_->GetLookAtTimes());
NumberOfTimes = Times.size();
TheGenerator->ResetDimensionality(NumberOfTimes);
// Here is the place for change of models for different products
Drifts.resize(NumberOfTimes);
StandardDeviations.resize(NumberOfTimes);
double Variance = Vol_.IntegralSquare(0,Times[0]);
Drifts[0] = R_.Integral(0.0,Times[0]) - D_.Integral(0.0,Times[0]) - 0.5 * Variance;
StandardDeviations[0] = sqrt(Variance);
// here calculates the r*dt sigma*dw
for (unsigned long j=1; j < NumberOfTimes; ++j)
{
double thisVariance = Vol_.IntegralSquare(Times[j-1],Times[j]);
Drifts[j] = R_.Integral(Times[j-1],Times[j]) - D_.Integral(Times[j-1],Times[j])
- 0.5 * thisVariance;
StandardDeviations[j] = sqrt(thisVariance);
}
LogSpot = log(Spot_);
Variates.resize(NumberOfTimes);
}
开发者ID:karentycoon,项目名称:Computational_finance,代码行数:34,代码来源:ExoticBSEngine.cpp
示例13: scoped_attributes_t
scoped_attributes_t(
Wrapper& wrapper,
attribute::set_t attributes,
typename std::enable_if<
!std::is_base_of<logger_base_t, Wrapper>::value
>::type* = 0
) :
scoped_attributes_concept_t(wrapper.log()),
m_guard_attributes(std::move(attributes))
{}
开发者ID:bioothod,项目名称:blackhole,代码行数:10,代码来源:scoped_attributes.hpp
示例14: main
DT main(DT argc, char *argv[]) {
//x.setRecalcFunc();
//y.setRecalcFunc(&recalcY);
//z.setRecalcFunc(&recalcZ);
/* a = 0
* b = 0
* a + b -> sum
*/
cout << "Init 1" << endl;
Wrapper<DT> a = 0;
Wrapper<DT> b = 0;
DT sum = 0;
cout << "Init 2" << endl;
ptrA = &a;
ptrB = &b;
ptrSum = ∑
cout << "Init 3" << endl;
a.onChange(&aChanged);
b.onChange(&bChanged);
cout << "Init 4" << endl;
a = 7;
b = 14;
/*
Wrapper<DT> x = a + b;
Wrapper<DT> y = c - d;
DT z = x * y;
*/
// 462
// 336
cout << "Init 5" << endl;
cout << sum << endl;
// gettimeofday(&startTime, 0);
/*seconds = endTime.tv_sec - startTime.tv_sec;
useconds = endTime.tv_usec - startTime.tv_usec;
mtimeMT = ((seconds) * 1000 + useconds/1000.0) + 0.5;*/
}
开发者ID:blitzprog,项目名称:data-flow-tests,代码行数:43,代码来源:dynamic-data-flow.cpp
示例15:
void _3dsLoader::readObjectMaterial(Chunk ¤tChunk, Wrapper &model, Mesh *mesh) const
{
ASSERT(currentChunk.getID()==OBJECT_MATERIAL, "Expected chunk ID OBJECT_MATERIAL");
char materialName[255] = {0};
currentChunk.getString(materialName);
mesh->material = model.getMaterial(materialName);
// We don't care about shared vertices, so skip the rest
}
开发者ID:foxostro,项目名称:arbarlith2,代码行数:11,代码来源:3dsLoader.cpp
示例16: sqrt
ExoticBSEngineBB::ExoticBSEngineBB(const Wrapper<PathDependent>& TheProduct_,
const Parameters& R_,
const Parameters& D_,
const Parameters& Vol_,
const Wrapper<RandomBase>& TheGenerator_,
double Spot_,
bool speed_up_)
:
ExoticEngine(TheProduct_, R_, speed_up_),
TheGenerator(TheGenerator_)
{
NumberOfTimes = TheProduct_->GetLookAtTimes().size();
if (speed_up == true)
NumberOfTimes -= 1;
times.resize(NumberOfTimes);
out.resize(NumberOfTimes);
for (unsigned long i(0); i < NumberOfTimes;++i)
times[i] = TheProduct_->GetLookAtTimes()[i];
TheGenerator->ResetDimensionality(NumberOfTimes);
Drifts.resize(NumberOfTimes);
StandardDeviations.resize(NumberOfTimes);
Drifts[0] = R_.Integral(0.0,times[0]) - D_.Integral(0.0,times[0]) - 0.5 * Vol_.IntegralSquare(0.0,times[0]);
StandardDeviations[0] = sqrt(Vol_.IntegralSquare(0.0, times[0]));
for (unsigned long j=1; j < NumberOfTimes; ++j)
{
Drifts[j] = R_.Integral(times[j-1],times[j]) - D_.Integral(times[j-1],times[j])
- 0.5 * Vol_.IntegralSquare(times[j-1],times[j]);
StandardDeviations[j] = sqrt(Vol_.IntegralSquare(times[j - 1], times[j]));
}
LogSpot = std::log(Spot_);
Variates.resize(NumberOfTimes);
method_ = logscale;
}
开发者ID:calvin456,项目名称:intro_derivative_pricing,代码行数:41,代码来源:ExoticBSEngineBB.cpp
示例17: JS_UNLIKELY
js::UnwrapOneChecked(JSContext *cx, JSObject *obj)
{
// Checked unwraps should never unwrap outer windows.
if (!obj->isWrapper() ||
JS_UNLIKELY(!!obj->getClass()->ext.innerObject))
{
return obj;
}
Wrapper *handler = Wrapper::wrapperHandler(obj);
bool rvOnFailure;
if (!handler->enter(cx, obj, JSID_VOID,
Wrapper::PUNCTURE, &rvOnFailure))
{
return rvOnFailure ? obj : NULL;
}
obj = Wrapper::wrappedObject(obj);
JS_ASSERT(obj);
return obj;
}
开发者ID:CrtronicsStudio,项目名称:spidermonkey,代码行数:21,代码来源:jswrapper.cpp
示例18: open
File* open(CStrRef uri, CStrRef mode, CArrRef options) {
const char *uri_string = uri.data();
Wrapper *wrapper = NULL;
/* Special case for PHP4 Backward Compatability */
if (!strncasecmp(uri_string, "zlib:", sizeof("zlib:") - 1)) {
wrapper = getWrapper("compress.zlib");
} else {
const char *colon = strstr(uri_string, "://");
if (colon) {
wrapper = getWrapper(String(uri_string, colon - uri_string, CopyString));
}
}
if (wrapper == NULL) {
wrapper = getWrapper("file");
}
assert(wrapper);
return wrapper->open(uri, mode, options);
}
开发者ID:gitlisted,项目名称:hiphop-php,代码行数:21,代码来源:stream_wrapper_registry.cpp
示例19: factorial
void WrapperArray::optimize()
{
if(reserved.empty() == true)
return;
FactorialGenerator factorial(reserved.size());
shared_ptr<WrapperArray> minWrapperArray = nullptr;
mutex mtx;
//#pragma omp parallel for
for (int i = 0; i < factorial.size(); i++)
{
shared_ptr<WrapperArray> wrapperArray(new WrapperArray(this->sample));
vector<size_t> &row = factorial[i];
for (size_t j = 0; j < row.size(); j++)
{
Product *product = this->reserved[row[j]];
if (wrapperArray->empty() == true ||
wrapperArray->at(wrapperArray->size() - 1)->tryInsert(product) == false)
{
Wrapper *wrapper = new Wrapper(*this->sample);
wrapper->tryInsert(product);
wrapperArray->emplace_back(wrapper);
}
}
//unique_lock<mutex> uk(mtx);
if (minWrapperArray == nullptr ||
wrapperArray->size() < minWrapperArray->size())
{
minWrapperArray = wrapperArray;
}
}
assign(minWrapperArray->begin(), minWrapperArray->end());
}
开发者ID:hajunho,项目名称:framework,代码行数:40,代码来源:WrapperArray.cpp
示例20: main
int main(int /*argc*/, const char ** /*argv*/)
//*************************************************************************************************************
{
int result=0;
AsyncProcessorEventHandler ThreadProcessorCallback;
MyProcessor Processor;
ProxyProcessor Proxy(Processor, "MyProxy");
Wrapper MyWrapper;
MyWrapper.Start("Wrapper"); // Start the listener thread
ThreadProcessorCallback.SetExecuteFunction(ProxyProcessor::Execute_CBFromProcessor, (void *)&Proxy);
ThreadProcessorCallback.SetNotifFunction (Wrapper::SignalEvt , (void *)&MyWrapper);
const unsigned int StackSize=1024;
result=Proxy.Construct(PROTH_PRIORITY_NORMAL, StackSize, 50, sizeof(MyMsg), 50, sizeof(MyMsg), ThreadProcessorCallback);
if(result != S_OK)
{
return(result);
}
// Processor.init(2, MyPorts, /*&myEventHandler, NULL*/ &Proxy, false /* is Invalid */);
for (size_t nbWait=50; nbWait>0; --nbWait)
{
switch(global_state)
{
case OMX_StateIdle:
Proxy.SetState(OMX_StateExecuting);
break;
case OMX_StateExecuting:
Proxy.SetState(OMX_StateIdle);
break;
case State_WaitForResponse:
case OMX_StateInvalid:
default:
break;
}
printf("\nmain %04d", nbWait);
SleepMillisecond(100);
}
return(result);
}
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:40,代码来源:wom_nonregr.cpp
注:本文中的Wrapper类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论