这篇教程C++ GetRef函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetRef函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRef函数的具体用法?C++ GetRef怎么用?C++ GetRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetRef函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: selectint SocketEngine::DispatchEvents(){ timeval tval; tval.tv_sec = 1; tval.tv_usec = 0; fd_set rfdset = ReadSet, wfdset = WriteSet, errfdset = ErrSet; int sresult = select(MaxFD + 1, &rfdset, &wfdset, &errfdset, &tval); ServerInstance->UpdateTime(); for (int i = 0, j = sresult; i <= MaxFD && j > 0; i++) { int has_read = FD_ISSET(i, &rfdset), has_write = FD_ISSET(i, &wfdset), has_error = FD_ISSET(i, &errfdset); if (!(has_read || has_write || has_error)) continue; --j; EventHandler* ev = GetRef(i); if (!ev) continue; if (has_error) { stats.ErrorEvents++; socklen_t codesize = sizeof(int); int errcode = 0; if (getsockopt(i, SOL_SOCKET, SO_ERROR, (char*)&errcode, &codesize) < 0) errcode = errno; ev->HandleEvent(EVENT_ERROR, errcode); continue; } if (has_read) { stats.ReadEvents++; ev->SetEventMask(ev->GetEventMask() & ~FD_READ_WILL_BLOCK); ev->HandleEvent(EVENT_READ); if (ev != GetRef(i)) continue; } if (has_write) { stats.WriteEvents++; int newmask = (ev->GetEventMask() & ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE)); SocketEngine::OnSetEvent(ev, ev->GetEventMask(), newmask); ev->SetEventMask(newmask); ev->HandleEvent(EVENT_WRITE); } } return sresult;}
开发者ID:CardboardAqueduct,项目名称:inspircd,代码行数:58,
示例2: keventint KQueueEngine::DispatchEvents(){ ts.tv_nsec = 0; ts.tv_sec = 1; int i = kevent(EngineHandle, NULL, 0, &ke_list[0], ke_list.size(), &ts); ServerInstance->UpdateTime(); if (i < 0) return i; TotalEvents += i; for (int j = 0; j < i; j++) { struct kevent& kev = ke_list[j]; EventHandler* eh = GetRef(kev.ident); if (!eh) continue; if (kev.flags & EV_EOF) { ErrorEvents++; eh->HandleEvent(EVENT_ERROR, kev.fflags); continue; } if (kev.filter == EVFILT_WRITE) { WriteEvents++; /* When mask is FD_WANT_FAST_WRITE or FD_WANT_SINGLE_WRITE, * we set a one-shot write, so we need to clear that bit * to detect when it set again. */ const int bits_to_clr = FD_WANT_SINGLE_WRITE | FD_WANT_FAST_WRITE | FD_WRITE_WILL_BLOCK; SetEventMask(eh, eh->GetEventMask() & ~bits_to_clr); eh->HandleEvent(EVENT_WRITE); if (eh != GetRef(kev.ident)) // whoops, deleted out from under us continue; } if (kev.filter == EVFILT_READ) { ReadEvents++; SetEventMask(eh, eh->GetEventMask() & ~FD_READ_WILL_BLOCK); eh->HandleEvent(EVENT_READ); } } return i;}
开发者ID:GeeksIRC,项目名称:inspircd,代码行数:52,
示例3: HoeFormatXGLint HoeFormatX(HOEFORMAT format){ switch (format) { case HOE_A8R8G8B8: case HOE_B8G8R8X8: case HOE_R8G8B8A8: return GetRef()->ext.ARB_texture_compression ? GL_COMPRESSED_RGBA:GL_RGBA8; case HOE_R8G8B8: return GetRef()->ext.ARB_texture_compression ? GL_COMPRESSED_RGB:GL_RGB8; default: Con_Print("warning: %s format not convert to Glformat",HoeFormatString(format)); return 0; } }
开发者ID:gejza,项目名称:Hoe3D,代码行数:14,
示例4: DrawOnScreenvoid CWCamera::DrawOnScreen() { char GlobalPosition[30]={0}; const Point3D& Pos=GetRef().GetAbsCoord(Point3D(0,0,0)); sprintf(GlobalPosition,"%5.2f %5.2f %5.2f",Pos.x(),Pos.y(),Pos.z()); Hgl::WriteText(GlobalPosition, Point2D(.30f,.75f)); //write global position}
开发者ID:lixiangalwh,项目名称:carworld-0.245.1-add-new-feature,代码行数:7,
示例5: GetRefValueMap S_info::Get(const void *s) const{ ValueMap m; for(int i = 0; i < column.GetCount(); i++) m.Add(column.GetKey(i), GetRef(s, i)); return m;}
开发者ID:ultimatepp,项目名称:mirror,代码行数:7,
示例6: GetRef/** * @function GetNeighbors * @brief Returns the IDs of the neighboring states of the input */std::vector<int> Dijkstra3D::GetNeighbors( int id ){ std::vector<int> neighbors; int idx = mV[id].x; int idy = mV[id].y; int idz = mV[id].z; int nx; int ny; int nz; for( int i = 0; i < 26; i++ ) { nx = idx + mNX[i]; ny = idy + mNY[i]; nz = idz + mNZ[i]; if( nx < 0 || nx > mDimX -1 || ny < 0 || ny > mDimY -1 || nz < 0 || nz > mDimZ -1 ) { continue; } int n_id = GetRef(nx,ny,nz); if( mV[ n_id ].color == 0 || mGrid->getCell(nx,ny,nz) == 1 || mV[ n_id ].color == 3 ) { continue; } else { neighbors.push_back( n_id ); } } return neighbors;}
开发者ID:ana-GT,项目名称:LJM2,代码行数:31,
示例7: LoadComponentfwRefContainer<ComponentData> ComponentLoader::LoadComponent(const char* componentName){ auto component = m_knownComponents[componentName]; if (!component.GetRef()) { FatalError("Unknown component %s.", componentName); } if (component->IsLoaded()) { return component; } // match and resolve dependencies auto dependencies = component->GetDepends(); for (auto& dependency : dependencies) { // find the first component to provide this bool match = false; for (auto& it : m_knownComponents) { auto matchProvides = it.second->GetProvides(); for (auto& provide : matchProvides) { if (dependency.IsMatchedBy(provide)) { trace("Resolving dependency for %s by %s (%s)./n", dependency.GetString().c_str(), it.second->GetName().c_str(), provide.GetString().c_str()); auto dependencyData = LoadComponent(it.second->GetName().c_str()); component->AddDependency(dependencyData); match = true; break; } } // break if matched if (match) { break; } } if (!match && dependency.GetCategory() != "vendor") { trace("Unable to resolve dependency for %s./n", dependency.GetString().c_str()); return nullptr; } } // load the component component->Load(); return component;}
开发者ID:ghost30812,项目名称:client,代码行数:60,
示例8: AlembicObject//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------AlembicCurves::AlembicCurves(SceneNodePtr eNode, AlembicWriteJob *in_Job, Abc::OObject oParent) : AlembicObject(eNode, in_Job, oParent){ MObject nRef = GetRef(); MFnNurbsCurve node(nRef); MStatus status; MObject abcCurveId = node.attribute("abcCurveId", &status); if (status == MStatus::kSuccess) { const int cId = MPlug(nRef, abcCurveId).asInt(); if (cId != 0) { this->accumRef = AlembicCurveAccumulator::GetAccumulator(cId, nRef, eNode, in_Job, oParent); return; } } const bool animTS = (GetJob()->GetAnimatedTs() > 0); mObject = AbcG::OCurves(GetMyParent(), eNode->name, animTS); mSchema = mObject.getSchema(); // create all properties Abc::OCompoundProperty comp = mSchema.getArbGeomParams(); mRadiusProperty = Abc::OFloatArrayProperty(comp, ".radius", mSchema.getMetaData(), animTS); mColorProperty = Abc::OC4fArrayProperty(comp, ".color", mSchema.getMetaData(), animTS); mFaceIndexProperty = Abc::OInt32ArrayProperty(comp, ".face_index", mSchema.getMetaData(), animTS); mVertexIndexProperty = Abc::OInt32ArrayProperty( comp, ".vertex_index", mSchema.getMetaData(), animTS); mKnotVectorProperty = Abc::OFloatArrayProperty(comp, ".knot_vector", mSchema.getMetaData(), animTS);}
开发者ID:BlackGinger,项目名称:ExocortexCrate,代码行数:35,
示例9: GetRefbool TFxSprite::Init(str particleSystem, TFxSpriteAnimTask * task, bool reset ){ TFxSpriteRef s = GetRef(); if (reset) { mDrawnOnce = false; s->GetLPS()->NewScript(); } if (particleSystem.has_data()) { s->GetLPS()->RegisterDataSource("dLocus",&s->mEmitterLocus); s->GetLPS()->RegisterDataSource("dUp",&s->mEmitterUp); if( !s->GetLPS()->Load(particleSystem) ) { return false; } s->mName = particleSystem ; if (!task) { task = ((TFxSpriteAnimTask*)GetAnimTask()); } task->mSpriteList.insert( s ); } return true;}
开发者ID:janvanderkamp,项目名称:balloon_storm,代码行数:28,
示例10: PopReftBool PopRef(int *aRef,tForthHeaderType match1, tForthHeaderType match2){ tBool matched=GetRef(aRef,match1,match2); if(matched) gRefSP++; // then pop as well. return matched;}
开发者ID:andrewhannay,项目名称:FIGnition,代码行数:7,
示例11: CALLEDstatus_tBFileInterface::HandleMessage(int32 message, const void *data, size_t size){ CALLED(); status_t rv; switch(message) { case FILEINTERFACE_SET_REF: { const fileinterface_set_ref_request *request = (const fileinterface_set_ref_request*) data; fileinterface_set_ref_reply reply; entry_ref ref(request->device, request->directory, request->name); reply.duration = request->duration; rv = SetRef(ref, request->create, &reply.duration); request->SendReply(rv, &reply, sizeof(reply)); return B_OK; } case FILEINTERFACE_GET_REF: { const fileinterface_get_ref_request *request = (const fileinterface_get_ref_request*) data; fileinterface_get_ref_reply reply; entry_ref resultRef; rv = GetRef(&resultRef, reply.mimetype); if (rv == B_OK) { reply.device = resultRef.device; reply.directory = resultRef.directory; strcpy(reply.name, resultRef.name); } request->SendReply(rv, &reply, sizeof(reply)); return B_OK; } case FILEINTERFACE_SNIFF_REF: { const fileinterface_sniff_ref_request *request = (const fileinterface_sniff_ref_request*) data; fileinterface_sniff_ref_reply reply; entry_ref ref(request->device, request->directory, request->name); rv = SniffRef(ref, reply.mimetype, &reply.capability); request->SendReply(rv, &reply, sizeof(reply)); return B_OK; } default: return B_ERROR; } return B_ERROR;}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:58,
示例12: FOutvoid TGgSchBs::SaveXml(const TStr& FNm){ TFOut FOut(FNm); FILE* fOut=FOut.GetFileId(); fprintf(fOut, "<GgSchBs>/n"); for (int RefN=0; RefN<GetRefs(); RefN++){ PGgSchRef Ref=GetRef(RefN); Ref->SaveXml(fOut, 1+RefN); } fprintf(fOut, "</GgSchBs>");}
开发者ID:Accio,项目名称:snap,代码行数:9,
示例13: TO_UTF8void SCH_REFERENCE::Annotate(){ if( m_NumRef < 0 ) m_Ref += '?'; else { // To avoid a risk of duplicate, for power components // the ref number is 0nnn instead of nnn. // Just because sometimes only power components are annotated if( GetLibPart() && GetLibPart()->IsPower() ) m_Ref = TO_UTF8( GetRef() << "0" << m_NumRef ); else m_Ref = TO_UTF8( GetRef() << m_NumRef ); } m_RootCmp->SetRef( &m_SheetPath, FROM_UTF8( m_Ref.c_str() ) ); m_RootCmp->SetUnit( m_Unit ); m_RootCmp->SetUnitSelection( &m_SheetPath, m_Unit );}
开发者ID:cpavlina,项目名称:kicad,代码行数:19,
示例14: Insertvoid MUIDRefCache::Insert(const MUID& uid, void* pRef){#ifdef _DEBUG if (GetRef(uid)) { _ASSERT(0); OutputDebugString("MUIDRefCache DUPLICATED Data. /n"); }#endif insert(value_type(uid, pRef));}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:10,
示例15: wxCharvoid SCH_REFERENCE::Annotate(){ if( m_NumRef < 0 ) m_Ref += wxChar( '?' ); else m_Ref = TO_UTF8( GetRef() << m_NumRef ); m_RootCmp->SetRef( &m_SheetPath, FROM_UTF8( m_Ref.c_str() ) ); m_RootCmp->SetUnit( m_Unit ); m_RootCmp->SetUnitSelection( &m_SheetPath, m_Unit );}
开发者ID:barrem,项目名称:kicad-source-mirror,代码行数:11,
示例16: CreateManualInstancefwRefContainer<Component> ComponentData::CreateInstance(const std::string& userData){ auto instance = CreateManualInstance(); if (instance.GetRef() && !instance->Initialize(userData)) { instance = nullptr; } return instance;}
开发者ID:ghost30812,项目名称:client,代码行数:11,
示例17: Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerJNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env, jobject obj){ const std::vector<u32>& buffer = GetRef(env, obj)->GetBannerImage().buffer; const jsize size = static_cast<jsize>(buffer.size()); const jintArray out_array = env->NewIntArray(size); if (!out_array) return nullptr; env->SetIntArrayRegion(out_array, 0, size, reinterpret_cast<const jint*>(buffer.data())); return out_array;}
开发者ID:AdmiralCurtiss,项目名称:dolphin,代码行数:11,
示例18: GetPathbool FolderPanel :: GetPath( BPath * path ){ entry_ref ref ; if( !GetRef( &ref ) ) return false ; BEntry ent( &ref ) ; path->SetTo( &ent ) ; return ( path->InitCheck() == B_OK ) ;}
开发者ID:HaikuArchives,项目名称:TraX,代码行数:12,
示例19: switch//--------------------------------------------------------------------------------------------------static void DelCmdHandler( le_atServer_CmdRef_t commandRef, le_atServer_Type_t type, uint32_t parametersNumber, void* contextPtr){ AtSession_t *atSessionPtr = (AtSession_t *)contextPtr; le_atServer_FinalRsp_t finalRsp = LE_ATSERVER_OK; le_atServer_CmdRef_t cmdRef; char param[LE_ATDEFS_PARAMETER_MAX_BYTES]; int i = 0; switch (type) { case LE_ATSERVER_TYPE_PARA: for (i = 0; i < parametersNumber && parametersNumber <= PARAM_MAX; i++) { memset(param,0,LE_ATDEFS_PARAMETER_MAX_BYTES); // get the command to delete LE_ASSERT_OK(le_atServer_GetParameter(commandRef, i, param, LE_ATDEFS_PARAMETER_MAX_BYTES)); // get its refrence cmdRef = GetRef(atSessionPtr->atCmds, atSessionPtr->cmdsCount, param); LE_DEBUG("Deleting %p => %s", cmdRef, param); // delete the command LE_ASSERT_OK(le_atServer_Delete(cmdRef)); } // send an OK final response finalRsp = LE_ATSERVER_OK; break; // this command doesn't support test and read send an ERROR final // reponse case LE_ATSERVER_TYPE_TEST: case LE_ATSERVER_TYPE_READ: finalRsp = LE_ATSERVER_ERROR; break; // an action command type to verify that AT+DEL command does exist // send an OK final response case LE_ATSERVER_TYPE_ACT: finalRsp = LE_ATSERVER_OK; break; default: LE_ASSERT(0); break; } // send final response LE_ASSERT_OK(le_atServer_SendFinalResultCode(commandRef, finalRsp, "", 0));}
开发者ID:legatoproject,项目名称:legato-af,代码行数:54,
示例20: TO_UTF8void SCH_REFERENCE::Annotate(){ if( m_NumRef < 0 ) m_Ref += '?'; else { m_Ref = TO_UTF8( GetRef() << GetRefNumber() ); } m_RootCmp->SetRef( &m_SheetPath, FROM_UTF8( m_Ref.c_str() ) ); m_RootCmp->SetUnit( m_Unit ); m_RootCmp->SetUnitSelection( &m_SheetPath, m_Unit );}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:13,
示例21: QTSS_SetValueQTSS_Error HTTPSessionInterface::RegDevSession(const char* serial, UInt32 serailLen){ if((::strlen(serial) == 0) || (serailLen == 0)) return QTSS_ValueNotFound; fSessionType = qtssDeviceSession; QTSS_SetValue(this, qtssEasySesSerial, 0, serial, serailLen); fDevSerialPtr.Set( fSerial, serailLen); fDevRef.Set( fDevSerialPtr, this); OS_Error theErr = QTSServerInterface::GetServer()->GetRecordSessionMap()->Register(GetRef()); //printf("[line:%d]HTTPSessionInterface::RegDevSession theErr = %d/n",__LINE__, theErr); if(theErr == OS_NoErr) fAuthenticated = true; return theErr;}
开发者ID:iavstream,项目名称:EasyRMS,代码行数:15,
示例22: PrintParseTree/* Recursively print a parse tree as code */void PrintParseTree(VyParseTree* tree){ int treeType = tree->type; /* If it is a list, then print a parenthesized list */ if(treeType == TREE_LIST){ PrintListGeneric(tree, '(', ')'); } /* Print a reference separated by a colon */ else if(treeType == TREE_REF){ PrintParseTree(GetObj(tree)); /* Delete the previous space before adding the colon */ printf("/b:"); PrintParseTree(GetRef(tree)); } /* If it is a number or identifier, just print the string */ else if(treeType == TREE_IDENT) { printf("%s ", GetStrData(tree)); } else if(treeType == TREE_NUM){ PrintNumber(GetNumberData(tree)); /* Print a space so that the backspace doesn't delete part of the number */ printf(" "); } /* Print strings enclosed in quotes */ else if(treeType == TREE_STR){ printf("/""); printf("%s", GetStrData(tree)); printf("/""); printf("/""); } /* If it is an error, print the error */ else if(treeType == TREE_ERROR){ printf("/n---------------------------------/n"); printf("Error: %s", tree->data->error.message); printf("/n---------------------------------/n"); } else{ printf("/n/n/nWarning: Incorrect parse tree node type: %d! /n/n/n", treeType); }}
开发者ID:BillyBuggy,项目名称:experiments,代码行数:47,
示例23: whilebool Config::CheckTexture(dword &width,dword &height,HOEFORMAT &format){#ifdef _HOE_OPENGL_ if (format == HOE_X8R8G8B8) format = HOE_R8G8B8; // resize to 2*n dword w1=1,h1=1; while (w1 < width) w1 <<= 1; while (h1 < height) h1 <<= 1; width = w1; height = h1;#endif#ifdef _HOE_D3D_ switch (format) { case HOE_A8R8G8B8: case HOE_R8G8B8A8: format = HOE_B8G8R8A8; break; case HOE_X8R8G8B8: case HOE_R8G8B8: format = HOE_B8G8R8X8; break; case HOE_L8A8: if (GetRef()->IsTextureFormatOk(HOE_L8A8)) format = HOE_L8A8; else format = HOE_B8G8R8X8; break; // povolene formaty case HOE_DXT1: case HOE_DXT2: case HOE_DXT3: case HOE_DXT4: case HOE_DXT5: case HOE_U8V8: break; default: assert(!"warning: check format"); };#endif return false;}
开发者ID:gejza,项目名称:Hoe3D,代码行数:42,
示例24: GetRefvoid SocketEngine::DispatchTrialWrites(){ std::vector<int> working_list; working_list.reserve(trials.size()); working_list.assign(trials.begin(), trials.end()); trials.clear(); for(unsigned int i=0; i < working_list.size(); i++) { int fd = working_list[i]; EventHandler* eh = GetRef(fd); if (!eh) continue; int mask = eh->event_mask; eh->event_mask &= ~(FD_ADD_TRIAL_READ | FD_ADD_TRIAL_WRITE); if ((mask & (FD_ADD_TRIAL_READ | FD_READ_WILL_BLOCK)) == FD_ADD_TRIAL_READ) eh->HandleEvent(EVENT_READ, 0); if ((mask & (FD_ADD_TRIAL_WRITE | FD_WRITE_WILL_BLOCK)) == FD_ADD_TRIAL_WRITE) eh->HandleEvent(EVENT_WRITE, 0); }}
开发者ID:GeeksIRC,项目名称:inspircd,代码行数:20,
示例25: ParseDSNCDbConn CDbLib::Connect(char *dsn){ char *uid, *pwd, *etc; ParseDSN(dsn, dsn, uid, pwd, etc); qObjTSRef ts = GetRef(); if (myHENV) { TRACE("sql: spawning connection/n"); SQLHDBC hdbc; SQLRETURN nResult; if ((nResult = SQLAllocHandle(SQL_HANDLE_DBC, myHENV, &hdbc) != SQL_SUCCESS)) { return CDbConn(this, (SQLHDBC)NULL); } if (etc && *etc) { CStr connIn; connIn = CStr("DSN=")<<dsn<<";UID="<<uid<<";PWD="<<pwd<<';'<<etc; CStr connOut(1024); short totLen; nResult = SQLDriverConnect(hdbc, NULL, (LPSQLC) connIn.SafeP(), connIn.Length(), (LPSQLC) connOut.SafeP(), connOut.Length(), &totLen, SQL_DRIVER_NOPROMPT); } else { nResult = SQLConnect(hdbc, (LPSQLC) dsn, SQL_NTS, (LPSQLC) uid, SQL_NTS, (LPSQLC) pwd, SQL_NTS); } // if failed to connect, free the allocated hdbc before return if (!SQL_SUCCEEDED(nResult)) { CDbConn conn(this, hdbc); conn.SetError(nResult); return conn; } return CDbConn(this, hdbc); } else { return CDbConn(this, (SQLHDBC)NULL); }}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:40,
示例26: CheckAndPrintErrors/* Check and print errors */int CheckAndPrintErrors(VyParseTree* tree){ int treeType = tree->type; int error = 0; if(treeType == TREE_LIST){ /* Check each element recursively */ int i; for(i = 0; i < ListTreeSize(tree); i++){ VyParseTree* next = GetListData(tree,i); /* Check the sub nodes for errors */ int listError = CheckAndPrintErrors(next); if(listError) error = 1; } } /* Check each piece of the ref */ else if(treeType == TREE_REF){ int objError = CheckAndPrintErrors(GetObj(tree)); int refError = CheckAndPrintErrors(GetRef(tree)); if(objError || refError) error = 1; } /* If it is an error, print the error */ else if(treeType == TREE_ERROR){ printf("/n/n"); printf("------- Parsing Error -------/n"); printf("Position: "); PrintPosition(tree->pos); printf("/n"); printf(tree->data->error.message); printf("/n-----------------------------"); error = 1; } return error; }
开发者ID:BillyBuggy,项目名称:experiments,代码行数:41,
注:本文中的GetRef函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetRegion函数代码示例 C++ GetRect函数代码示例 |