当前位置: 首页>>代码示例>>C++>>正文


C++ HashMap::End方法代码示例

本文整理汇总了C++中HashMap::End方法的典型用法代码示例。如果您正苦于以下问题:C++ HashMap::End方法的具体用法?C++ HashMap::End怎么用?C++ HashMap::End使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HashMap的用法示例。


在下文中一共展示了HashMap::End方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetContext

Context* GetContext(lua_State* L)
{
    HashMap<void*, Context*>::ConstIterator i = contextMapping.Find(L);
    if (i == contextMapping.End())
    {
        lua_State* L1 = lua_getmainthread(L);
        return (L == L1) ? 0 : GetContext(L1);
    }

    return i->second_;
}
开发者ID:Hevedy,项目名称:Urho3D,代码行数:11,代码来源:ToluaUtils.cpp

示例2: if

ECode CWifiP2pDnsSdServiceResponse::ReadDnsName(
    /* [in] */ IDataInput* idi,
    /* [out] */ String* dnsName)
{
    VALIDATE_NOT_NULL(dnsName);
    *dnsName = String(NULL);

    StringBuilder sb;

    // copy virtual memory packet.
    HashMap<Int32, String> vmpack;
    HashMap<Int32, String>::Iterator it;

    if (!mDnsQueryName.IsNull()) {
        vmpack[0x27] = mDnsQueryName;
    }

    // try {
    Int32 i, temp;
    while (TRUE) {
        FAIL_RETURN(idi->ReadUnsignedByte(&i));
        if (i == 0x00) {
            *dnsName = sb.ToString();
            return NOERROR;
        }
        else if (i == 0xc0) {
            // refer to pointer.
            FAIL_RETURN(idi->ReadUnsignedByte(&temp));
            it = vmpack.Find(temp);
            if (it == vmpack.End()) {
                //invalid.
                return NOERROR;
            }

            sb += it->mSecond;
            *dnsName = sb.ToString();
            return NOERROR;
        }
        else {
            AutoPtr<ArrayOf<Byte> > data = ArrayOf<Byte>::Alloc(i);
            if (data == NULL) return E_OUT_OF_MEMORY;

            FAIL_RETURN(idi->ReadFully((ArrayOf<Byte>*)data));
            sb += String((const char *)data->GetPayload());
            sb += ".";
        }
    }
    // catch (IOException e) {
    //     e.printStackTrace();
    // }

    return NOERROR;
}
开发者ID:XilongPei,项目名称:Elastos5,代码行数:53,代码来源:CWifiP2pDnsSdServiceResponse.cpp

示例3: RemoveNamedAttribute

void RemoveNamedAttribute(HashMap<StringHash, Vector<AttributeInfo> >& attributes, StringHash objectType, const char* name)
{
    HashMap<StringHash, Vector<AttributeInfo> >::Iterator i = attributes.Find(objectType);
    if (i == attributes.End())
        return;

    Vector<AttributeInfo>& infos = i->second_;

    for (Vector<AttributeInfo>::Iterator j = infos.Begin(); j != infos.End(); ++j)
    {
        if (!j->name_.Compare(name, true))
        {
            infos.Erase(j);
            break;
        }
    }

    // If the vector became empty, erase the object type from the map
    if (infos.Empty())
        attributes.Erase(i);
}
开发者ID:janfrost,项目名称:Urho3D,代码行数:21,代码来源:Context.cpp

示例4: LoadMesh


//.........这里部分代码省略.........

                        // Require skinning weight to be sufficiently large before vertex contributes to bone hitbox
                        if (assign.weight_ > 0.33f)
                        {
                            // Check distance of vertex from bone to get bone max. radius information
                            Vector3 bonePos = bones_[bone].derivedPosition_;
                            Vector3 vertexPos = vBuf->vertices_[vertex].position_;
                            float distance = (bonePos - vertexPos).Length();
                            if (distance > bones_[bone].radius_)
                            {
                                bones_[bone].collisionMask_ |= 1;
                                bones_[bone].radius_ = distance;
                            }
                            // Build the hitbox for the bone
                            bones_[bone].boundingBox_.Merge(bones_[bone].inverseWorldTransform_ * (vertexPos));
                            bones_[bone].collisionMask_ |= 2;
                        }
                    }
                    boneAssignment = boneAssignment.GetNext("vertexboneassignment");
                }
            }

            if ((subGeometryLodLevel.boneWeights_.Size()) && bones_.Size())
            {
                vBuf->elementMask_ |= MASK_BLENDWEIGHTS | MASK_BLENDINDICES;
                bool sorted = false;

                // If amount of bones is larger than supported by HW skinning, must remap per submesh
                if (bones_.Size() > maxBones_)
                {
                    HashMap<unsigned, unsigned> usedBoneMap;
                    unsigned remapIndex = 0;
                    for (HashMap<unsigned, PODVector<BoneWeightAssignment> >::Iterator i =
                                subGeometryLodLevel.boneWeights_.Begin(); i != subGeometryLodLevel.boneWeights_.End(); ++i)
                    {
                        // Sort the bone assigns by weight
                        Sort(i->second_.Begin(), i->second_.End(), CompareWeights);

                        // Use only the first 4 weights
                        for (unsigned j = 0; j < i->second_.Size() && j < 4; ++j)
                        {
                            unsigned originalIndex = i->second_[j].boneIndex_;
                            if (!usedBoneMap.Contains(originalIndex))
                            {
                                usedBoneMap[originalIndex] = remapIndex;
                                remapIndex++;
                            }
                            i->second_[j].boneIndex_ = usedBoneMap[originalIndex];
                        }
                    }

                    // If still too many bones in one subgeometry, error
                    if (usedBoneMap.Size() > maxBones_)
                        ErrorExit("Too many bones (limit " + String(maxBones_) + ") in submesh " + String(subMeshIndex + 1));

                    // Write mapping of vertex buffer bone indices to original bone indices
                    subGeometryLodLevel.boneMapping_.Resize(usedBoneMap.Size());
                    for (HashMap<unsigned, unsigned>::Iterator j = usedBoneMap.Begin(); j != usedBoneMap.End(); ++j)
                        subGeometryLodLevel.boneMapping_[j->second_] = j->first_;

                    sorted = true;
                }

                for (HashMap<unsigned, PODVector<BoneWeightAssignment> >::Iterator i = subGeometryLodLevel.boneWeights_.Begin();
                        i != subGeometryLodLevel.boneWeights_.End(); ++i)
                {
开发者ID:ElishaMcNutt,项目名称:Clockwork,代码行数:67,代码来源:OgreImporter.cpp

示例5: SaveEx

ECode CGestureStore::SaveEx(
    /* [in] */ IOutputStream * stream,
    /* [in] */ Boolean closeStream)
{
    VALIDATE_NOT_NULL(stream);
    /*
	AutoPtr<IBufferedOutputStream> outs;
	if (FAILED(CBufferedOutputStream::New(stream,
			                               GestureConstants::IO_BUFFER_SIZE,
			                               (IBufferedOutputStream **) &outs)))
	{
		return E_RUNTIME_EXCEPTION;
	}
	*/

    AutoPtr<IDataOutputStream> out;
    if (FAILED(CDataOutputStream::New(stream,(IDataOutputStream **) &out)))
    {
        return E_RUNTIME_EXCEPTION;
    }

    Int64 start;
    if (PROFILE_LOADING_SAVING) {
        start = SystemClock::GetElapsedRealtime();
    }

    HashMap<String, List<IGesture*> *> *maps = mNamedGestures;

    IDataOutput *dout=IDataOutput::Probe(out);
    // Write version number
    dout->WriteInt16(FILE_FORMAT_VERSION);
    // Write number of entries
    dout->WriteInt32(maps->GetSize());

    HashMap<String, List<IGesture*> *>::Iterator iter = maps->Begin();
    for (Int32 i=0; iter!=maps->End(); ++iter, ++i) {
        String key= iter->mFirst;
        List<IGesture*> *examples= iter->mSecond;
        Int32 count = examples->GetSize();

        // Write entry name
        ArrayOf<Byte>* utf = StringToByteArray(key);
        dout->WriteBytes(*utf); //??no WriteUTF api
        ArrayOf<Byte>::Free(utf);

        // Write number of examples for this entry
        dout->WriteInt32(count);

        for (Int32 j = 0; j < count; j++) {
            ((IGesture*)((*examples)[i]))->Serialize(out);
        }
    }
    stream->Flush(); //no Flush api

    if (PROFILE_LOADING_SAVING) {
        Int64 end = SystemClock::GetElapsedRealtime();
        Int64 diff= end - start;
        String tmp = String::FromInt64(diff);
        String log = String("Saving gestures library = ") + tmp + String(" ms");
        Logger::D(LOG_TAG,log.string());
    }

    mChanged = FALSE;
    if (closeStream) {
        CGestureUtils::CloseStream((ICloseable *)stream);
    }

    return NOERROR;

}
开发者ID:xianjimli,项目名称:Elastos,代码行数:70,代码来源:CGestureStore.cpp

示例6: DumpJavascriptObjects

void JSVM::DumpJavascriptObjects()
{
    ATOMIC_LOGINFOF("--- JS Objects ---");
    ATOMIC_LOGINFOF("Stash Count: %u, Total Stash: %u, Total Unstash: %u", stashCount_, totalStashCount_, totalUnstashCount_);

    HashMap<StringHash, String> strLookup;
    HashMap<StringHash, unsigned> totalClassCount;
    HashMap<StringHash, unsigned> stashedClassCount;
    HashMap<StringHash, int> maxRefCount;

    StringHash refCountedTypeHash("RefCounted");
    strLookup[refCountedTypeHash] = "RefCounted";

    duk_push_global_stash(ctx_);
    duk_get_prop_index(ctx_, -1, JS_GLOBALSTASH_INDEX_REFCOUNTED_REGISTRY);

    HashMap<void*, RefCounted*>::ConstIterator itr = heapToObject_.Begin();
    while (itr != heapToObject_.End())
    {
        void* heapPtr = itr->first_;
        RefCounted* refCounted = itr->second_;

        // TODO: need a lookup for refcounted classid to typename
        const String& className = refCounted->IsObject() ? ((Object*)refCounted)->GetTypeName() : "RefCounted";
        StringHash typeHash = refCounted->IsObject() ? ((Object*)refCounted)->GetType() : refCountedTypeHash;

        strLookup.InsertNew(typeHash, className);

        totalClassCount.InsertNew(typeHash, 0);
        totalClassCount[typeHash]++;

        maxRefCount.InsertNew(typeHash, 0);
        if (refCounted->Refs() > maxRefCount[typeHash])
            maxRefCount[typeHash] = refCounted->Refs();

        duk_push_pointer(ctx_, refCounted);
        duk_get_prop(ctx_, -2);

        if (!duk_is_undefined(ctx_, -1))
        {
            stashedClassCount.InsertNew(typeHash, 0);
            stashedClassCount[typeHash]++;
        }

        duk_pop(ctx_);

        itr++;

    }

    HashMap<StringHash, String>::ConstIterator itr2 = strLookup.Begin();
    while (itr2 != strLookup.End())
    {
        StringHash typeHash = itr2->first_;
        const String& className = itr2->second_;
        unsigned totalCount = totalClassCount[typeHash];
        unsigned stashedCount = stashedClassCount[typeHash];
        int _maxRefCount = maxRefCount[typeHash];

        ATOMIC_LOGINFOF("Classname: %s, Total: %u, Stashed: %u, Max Refs: %i", className.CString(), totalCount, stashedCount, _maxRefCount);

        itr2++;
    }

    duk_pop_2(ctx_);

}
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:67,代码来源:JSVM.cpp


注:本文中的HashMap::End方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。