这篇教程C++ uNew函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uNew函数的典型用法代码示例。如果您正苦于以下问题:C++ uNew函数的具体用法?C++ uNew怎么用?C++ uNew使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uNew函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: U_ASSERTuArray* uArray::New(uType* type, int length, const void* optionalData){ U_ASSERT(type && type->Type == uTypeTypeArray); uArrayType* arrayType = (uArrayType*)type; uType* elementType = arrayType->ElementType; size_t elementSize = elementType->ValueSize; uArray* array = (uArray*)uNew(type, sizeof(uArray) + elementSize * length); array->_ptr = (uint8_t*)array + sizeof(uArray); array->_length = length; if (optionalData) { memcpy(array->Ptr(), optionalData, elementSize * length); if (U_IS_OBJECT(elementType)) for (int i = 0; i < length; i++) uRetain(((uObject**)array->Ptr())[i]); else if (elementType->Flags & uTypeFlagsRetainStruct) for (int i = 0; i < length; i++) uRetainStruct(elementType, (uint8_t*)array->Ptr() + elementType->ValueSize * i); } return array;}
开发者ID:brapastor,项目名称:Fuse_Pract,代码行数:25,
示例2: uNewTypestatic uType* uNewType(uint32_t type, const char* name, const uTypeOptions& options, bool isDefinition = true){ bool isType = strcmp(name, "Uno.Type") == 0; uType* result = (uType*)uNew( isType ? _ObjectTypePtr : ::g::Uno::Type_typeof(), options.TypeSize + options.GenericCount * sizeof(uType*) + options.MethodTypeCount * sizeof(uType*) + options.PrecalcCount * sizeof(uType*) + options.FieldCount * sizeof(uFieldInfo) + options.InterfaceCount * sizeof(uInterfaceInfo)); uint8_t* ptr = (uint8_t*)result + options.TypeSize; if (isType) result->__type = result; result->Type = type; result->FullName = name; result->Definition = result; result->ObjectSize = options.ObjectSize; result->ValueSize = options.ValueSize; result->TypeSize = options.TypeSize; result->InterfaceCount = options.InterfaceCount; result->Interfaces = (uInterfaceInfo*)ptr; ptr += options.InterfaceCount * sizeof(uInterfaceInfo); result->FieldCount = options.FieldCount; result->Fields = (uFieldInfo*)ptr; ptr += options.FieldCount * sizeof(uFieldInfo); result->GenericCount = options.GenericCount; result->Generics = (uType**)ptr; ptr += options.GenericCount * sizeof(uType*); result->MethodTypeCount = options.MethodTypeCount; result->MethodTypes = (uType**)ptr; ptr += options.MethodTypeCount * sizeof(uType*); result->PrecalcCount = options.PrecalcCount; result->PrecalcTypes = (uType**)ptr; ptr += options.PrecalcCount * sizeof(uType*); if (isDefinition) { for (size_t i = 0; i < result->GenericCount; i++) result->Generics[i] = uGetGenericType(i); for (size_t i = 0; i < result->MethodTypeCount; i++) result->MethodTypes[i] = uNewMethodType(result, i); } result->ObjCDefaultObjectSize = 0; result->ObjCNativeClass = NULL; result->ObjCProxyClass = NULL; return result;}
开发者ID:brapastor,项目名称:Fuse_Pract,代码行数:59,
示例3: sizeofuDelegate* uDelegate::Copy(){ uDelegate* delegate = (uDelegate*)uNew(__type, sizeof(uDelegate)); delegate->_this = _this; delegate->_func = _func; delegate->_object = _object; delegate->_generic = _generic; return delegate;}
开发者ID:brapastor,项目名称:Fuse_Pract,代码行数:9,
示例4: uPrevarma::mat Methods::implicitJacobi(double time) { /* method implicit Jacobi */ arma::mat uPrev(n,n, arma::fill::zeros); //empty matrix for previous values arma::mat uNew(n,n, arma::fill::zeros); //empty matrix for new values arma::mat temp(n,n, arma::fill::zeros); //empty matrix for temporary values of uPrev double threshold = 0.000001; //convergance threshold double diff = threshold + 1; //difference of uPrev and temp //set initial value for(int j=0; j<n ;j++) { for(int i=0; i<n ;i++) { uPrev(i,j) = (1-j*h)*std::exp(i*h); //steady-state } //end j } //end i temp = uPrev; //set intial guess as previous value while(diff > threshold) { /* calculate new values */ for(int i=1; i<n-1 ;i++) { for(int j=1; j<n-1 ;j++) { uNew(i,j) = (1./(1+4*alpha))*(uPrev(i,j) + alpha*(temp(i+1,j)+temp(i-1,j)+temp(i,j+1)+temp(i,j-1))); } //end j } //end i for(int k=0; k<n ;k++) { /* set boundary conditions (assume x=y=[0,1]) */ double kn = float(k)/n; uNew(0,k) = (1-kn)*std::exp(time); uNew(n-1,k) = (1-kn)*std::exp(1+time); uNew(k,0) = std::exp(kn+time); uNew(k,n-1) = 0; } //end k diff = 0; //reset diff for(int i=0; i<n ;i++) { /* calculate difference */ for(int j=0; j<n ;j++) { diff += std::abs(temp(i,j) - uNew(i,j)); } //end i } //end j diff /= n*n; //assuming our matrix is square temp = uPrev; uPrev = uNew; //keep temp } //end while return uNew;} //end function implicitJacobi
开发者ID:moncar,项目名称:FYS3150-1,代码行数:51,
示例5: uNewvoid Leapforg::solver(){ std::vector<double> uNew(M_+1), uMid(M_+1), uOld(M_+1); init(uNew, uMid); prePrint(); double currentT = 0; bool stop = false; for (int n = 1; stop != true; ++n) { uOld = uNew; currentT = n * stepT_; scheme(n, uOld, uMid, uNew); if(isNeedPrint(currentT)) { print(currentT, uNew); } stop = isNeedStop(currentT); } postPrint();}
开发者ID:lrtfm,项目名称:math,代码行数:21,
示例6: uBoxPtruObject* uBoxPtr(uType* type, const void* src, void* stack, bool ref){ switch (type->Type) { case uTypeTypeEnum: case uTypeTypeStruct: { uObject* object; void* ptr; if (stack) { object = (uObject*)stack; ptr = (uint8_t*)stack + sizeof(uObject); memset(stack, 0, sizeof(uObject)); object->__type = type; } else { object = uNew(type, sizeof(uObject) + type->ValueSize); ptr = (uint8_t*)object + sizeof(uObject); if (type->Flags & uTypeFlagsRetainStruct) uRetainStruct(type, const_cast<void*>(src)); } INLINE_MEMCPY(ptr, src, type->ValueSize); return object; } case uTypeTypeVoid: return NULL; default: return ref ? *(uObject**)src : (uObject*)src; }}
开发者ID:brapastor,项目名称:Fuse_Pract,代码行数:37,
示例7: // public SocketException New(string message) [static] :703SocketException* SocketException::New4(uString* message){ SocketException* obj1 = (SocketException*)uNew(SocketException_typeof()); obj1->ctor_3(message); return obj1;}
开发者ID:Florestamx,项目名称:floresta,代码行数:7,
示例8: // public ReadClosure New(string filename) [static] :101ApplicationDir__ReadClosure* ApplicationDir__ReadClosure::New1(uString* filename){ ApplicationDir__ReadClosure* obj1 = (ApplicationDir__ReadClosure*)uNew(ApplicationDir__ReadClosure_typeof()); obj1->ctor_(filename); return obj1;}
开发者ID:SuperManfred,项目名称:FUSE1stAPP,代码行数:7,
示例9: // public BoolChangedArgs New(bool value, object origin) [static] :134BoolChangedArgs* BoolChangedArgs::New3(bool value, uObject* origin){ BoolChangedArgs* obj1 = (BoolChangedArgs*)uNew(BoolChangedArgs_typeof()); obj1->ctor_2(value, origin); return obj1;}
开发者ID:blyk,项目名称:BlackCode-Fuse,代码行数:7,
示例10: assertvoid HeatPDE::fdSolve( int M, int N, std::vector<double>* u, Updater* up, bool isAmerican, bool xReversed, int dM, int dN ){ assert(u->size() == (unsigned int)(N+1)); d_earlyExerciseBoundary.resize(0); bool doPrint = false; if ( dM>0 && dN>0 ) { doPrint = true; } // grid parameters double dt = (d_tf-d_ti)/M; double dx = (d_xr-d_xl)/N; double c = dt/(dx*dx); up->config(c,N); std::vector<double> uNew(N+1,0); // initial condition for (int n=0; n<N+1; n++) { double x = d_xl + n*dx; if (xReversed) { x = d_xr - n*dx; std::reverse(std::begin(*u), std::end(*u)); } // initialize if functional terminal condition is given if (d_functionalTerminal) { (*u)[n] = (*d_f)(x); } // print x-coordinates if (doPrint && n%dN == 0) { std::cout << "," << x; } } // Hack!!! Set u at boundaries to zero, only for double barrier test //(*u)[0]=0; //(*u)[N]=0; // End of Hack!! //std::cout << "==============" << std::endl; //std::cout << "u initial: " << std::endl; //for (int i=0; i<(*u).size(); i++) { std::cout << std::setprecision(3) << (*u)[i] << ", "; } //std::cout << std::endl; //std::cout << "--------------" << std::endl; d_earlyExerciseBoundary.push_back(0); if (doPrint) { std::cout << std::endl; print(0, *u, dN); } for (int m=0; m<M; m++) { // boundary conditions at the next time step double t = d_ti + (m+1)*dt; uNew[0] = (*d_gl)(t); // set to zero if want to hack uNew[N] = (*d_gr)(t); // set to zero if want to hack // Some methods like Backward Euler by LU. // works in reversed x-coordinates if (xReversed) { uNew[N] = 0; // (*d_gl)(t); uNew[0] = 0; // (*d_gr)(t); } // early exercise boundary at the current time step std::vector<double> prem; if (isAmerican) { prem = earlyExercisePremiumAtGivemTime(N, t, xReversed); } // time evolution up->update((*u), &uNew, prem); // store the solution at T-dt if ( m == M-1 ) { d_uOld = (*u); } // write back to output for (int n=0; n<=N; n++) { (*u)[n] = uNew[n]; } if (isAmerican) { int nb = earlyExerciseBoundaryAtGivenTime((*u), prem, xReversed); if (!xReversed) { d_earlyExerciseBoundary.push_back(d_xl+nb*dx); } else { d_earlyExerciseBoundary.push_back(d_xr-nb*dx); } } if ( doPrint && m%dM == 0 ) { print(t, *u, dN); } } if (xReversed) { std::reverse(std::begin(*u), std::end(*u)); } //std::cout << "u final: " << std::endl; //for (int i=0; i<(*u).size(); i++) { std::cout << std::setprecision(3) << (*u)[i] << ", "; } //std::cout << std::endl; //std::cout << "=============" << std::endl;}
开发者ID:ShengQuanZhou,项目名称:baruch-mfe-lab,代码行数:100,
示例11: // public TimeAnimator New() [static] :2264TimeAnimator* TimeAnimator::New7(){ TimeAnimator* obj2 = (TimeAnimator*)uNew(TimeAnimator_typeof()); obj2->ctor_8(); return obj2;}
开发者ID:blyk,项目名称:BlackCode-Fuse,代码行数:7,
示例12: // public ConeRenderer New() [static] :1792ConeRenderer* ConeRenderer::New2(){ ConeRenderer* obj1 = (ConeRenderer*)uNew(ConeRenderer_typeof()); obj1->ctor_2(); return obj1;}
开发者ID:sauvikatinnofied,项目名称:ExploringFuse,代码行数:7,
示例13: // public generated Vibrate New() [static] :46Vibrate* Vibrate::New1(){ Vibrate* obj1 = (Vibrate*)uNew(Vibrate_typeof()); obj1->ctor_1(); return obj1;}
开发者ID:Florestamx,项目名称:floresta,代码行数:7,
示例14: // public JWrapper New(Android.Base.Primitives.ujobject obj, Uno.Type typePtr, bool typeHasFallbackClass, bool resolveType, bool stackArg) [static] :2578JWrapper* JWrapper::New2(jobject obj, uType* typePtr, bool typeHasFallbackClass, bool resolveType, bool stackArg){ JWrapper* obj2 = (JWrapper*)uNew(JWrapper_typeof()); obj2->ctor_1(obj, typePtr, typeHasFallbackClass, resolveType, stackArg); return obj2;}
开发者ID:blyk,项目名称:BlackCode-Fuse,代码行数:7,
示例15: // public outsideTheBox_FuseScaling_float_Factor_Property New(Fuse.Scaling obj) [static] :55outsideTheBox_FuseScaling_float_Factor_Property* outsideTheBox_FuseScaling_float_Factor_Property::New1(::g::Fuse::Scaling* obj){ outsideTheBox_FuseScaling_float_Factor_Property* obj1 = (outsideTheBox_FuseScaling_float_Factor_Property*)uNew(outsideTheBox_FuseScaling_float_Factor_Property_typeof()); obj1->ctor_1(obj); return obj1;}
开发者ID:deliloka,项目名称:bethebox,代码行数:7,
示例16: // public Template New(HamburgerIcon parent) [static] :6HamburgerIcon__Template* HamburgerIcon__Template::New1(::g::HamburgerIcon* parent){ HamburgerIcon__Template* obj1 = (HamburgerIcon__Template*)uNew(HamburgerIcon__Template_typeof()); obj1->ctor_1(parent); return obj1;}
开发者ID:ie-ModelingAndDesign,项目名称:2015-B,代码行数:7,
示例17: // public BigCog New() [static] :6BigCog* BigCog::New3(){ BigCog* obj1 = (BigCog*)uNew(BigCog_typeof()); obj1->ctor_5(); return obj1;}
开发者ID:hhalse,项目名称:PullToPunish,代码行数:7,
示例18: // public Template New(MainView parent) [static] :34MainView__Template* MainView__Template::New1(::g::MainView* parent){ MainView__Template* obj1 = (MainView__Template*)uNew(MainView__Template_typeof()); obj1->ctor_1(parent); return obj1;}
开发者ID:blyk,项目名称:BlackCode-Fuse,代码行数:7,
示例19: // public generated VerySimpleEventQueue New() [static] :44VerySimpleEventQueue* VerySimpleEventQueue::New1(){ VerySimpleEventQueue* obj1 = (VerySimpleEventQueue*)uNew(VerySimpleEventQueue_typeof()); obj1->ctor_(); return obj1;}
开发者ID:blyk,项目名称:BlackCode-Fuse,代码行数:7,
示例20: // public generated FileCache New() [static] :155FileCache* FileCache::New1(){ FileCache* obj1 = (FileCache*)uNew(FileCache_typeof()); obj1->ctor_(); return obj1;}
开发者ID:blyk,项目名称:BlackCode-Fuse,代码行数:7,
示例21: // public ByteFileSource New(string path, byte[] bytes) [static] :131ByteFileSource* ByteFileSource::New1(uString* path, uArray* bytes){ ByteFileSource* obj1 = (ByteFileSource*)uNew(ByteFileSource_typeof()); obj1->ctor_1(path, bytes); return obj1;}
开发者ID:brapastor,项目名称:Fuse_Pract,代码行数:7,
示例22: // public generated InvokedFromNativeCodeAttribute New() [static] :6InvokedFromNativeCodeAttribute* InvokedFromNativeCodeAttribute::New1(){ InvokedFromNativeCodeAttribute* obj1 = (InvokedFromNativeCodeAttribute*)uNew(InvokedFromNativeCodeAttribute_typeof()); obj1->ctor_1(); return obj1;}
开发者ID:blyk,项目名称:BlackCode-Fuse,代码行数:7,
示例23: // public UxFactory New(Uno.Func<object> create) [static] :13UxFactory* UxFactory::New2(uDelegate* create){ UxFactory* obj1 = (UxFactory*)uNew(UxFactory_typeof()); obj1->ctor_(create); return obj1;}
开发者ID:blyk,项目名称:BlackCode-Fuse,代码行数:7,
注:本文中的uNew函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uPtr函数代码示例 C++ uL函数代码示例 |