本文整理汇总了C++中GetRef函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRef函数的具体用法?C++ GetRef怎么用?C++ GetRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetRef函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: select
int 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,代码来源:socketengine_select.cpp
示例2: kevent
int 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,代码来源:socketengine_kqueue.cpp
示例3: HoeFormatX
GLint 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,代码来源:hoe_format.cpp
示例4: DrawOnScreen
void 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,代码来源:CWCamera.cpp
示例5: GetRef
ValueMap 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,代码来源:S_info.cpp
示例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,代码来源:Dijkstra.cpp
示例7: LoadComponent
fwRefContainer<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,代码来源:ComponentLoader.cpp
示例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,代码来源:AlembicCurves.cpp
示例9: GetRef
bool 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,代码来源:fxsprite.cpp
示例10: PopRef
tBool 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,代码来源:FFC.c
示例11: CALLED
status_t
BFileInterface::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,代码来源:FileInterface.cpp
示例12: FOut
void 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,代码来源:google.cpp
示例13: TO_UTF8
void 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,代码来源:component_references_lister.cpp
示例14: Insert
void 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,代码来源:MUID.cpp
示例15: wxChar
void 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,代码来源:component_references_lister.cpp
示例16: CreateManualInstance
fwRefContainer<Component> ComponentData::CreateInstance(const std::string& userData)
{
auto instance = CreateManualInstance();
if (instance.GetRef() && !instance->Initialize(userData))
{
instance = nullptr;
}
return instance;
}
开发者ID:ghost30812,项目名称:client,代码行数:11,代码来源:ComponentLoader.cpp
示例17: Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner
JNIEXPORT 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,代码来源:GameFile.cpp
示例18: GetPath
bool 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,代码来源:FolderPanel.cpp
示例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,代码来源:server.c
示例20: TO_UTF8
void 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,代码来源:component_references_lister.cpp
注:本文中的GetRef函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论