• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PyDecRef函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PyDecRef函数的典型用法代码示例。如果您正苦于以下问题:C++ PyDecRef函数的具体用法?C++ PyDecRef怎么用?C++ PyDecRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: item

void ItemAttributeMgr::_SendAttributeChange(Attr attr, PyRep *oldValue, PyRep *newValue) {
    if(GetNotify() == false)
        return;

    Client *c = m_factory.entity_list.FindCharacter( item().ownerID() );
    if(c != NULL)
    {
        Notify_OnModuleAttributeChange omac;
        omac.ownerID = m_item.ownerID();
        omac.itemKey = m_item.itemID();
        omac.attributeID = attr;
        omac.time = Win32TimeNow();
        omac.oldValue = oldValue;
        omac.newValue = newValue;

        PyTuple* tmp = omac.Encode();
        c->QueueDestinyEvent(&tmp);
    }
    else
    {
        // delete the reps
        PyDecRef( oldValue );
        PyDecRef( newValue );
    }
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:25,代码来源:EVEAttributeMgr.cpp


示例2: PySafeDecRef

bool PyCachedCall::Decode(PySubStream **in_ss)
{
    PySubStream *ss = *in_ss;    //consume
    *in_ss = NULL;

    PySafeDecRef( result );

    ss->DecodeData();
    if(ss->decoded() == NULL) {
        SysLog::Error("PyCachedCall","Unable to decode initial stream for PyCachedCall");
        PyDecRef( ss );
        return false;
    }

    if(!ss->decoded()->IsDict()) {
        SysLog::Error("PyCachedCall","Cached call substream does not contain a dict: %s", ss->decoded()->TypeString());
        PyDecRef( ss );
        return false;
    }
    PyDict *po = (PyDict *) ss->decoded();

    PyDict::const_iterator cur, end;
    cur = po->begin();
    end = po->end();
    for(; cur != end; cur++) {
        if(!cur->first->IsString())
            continue;
        PyString *key = (PyString *) cur->first;
        if( key->content() == "lret" )
            result = cur->second->Clone();
    }

    PyDecRef( ss );
    return(result != NULL);
}
开发者ID:comet0,项目名称:evemu_server,代码行数:35,代码来源:CachedObjectMgr.cpp


示例3: TestMarshal

void TestMarshal( const Seperator& cmd )
{
    const char* cmdName = cmd.arg( 0 ).c_str();

    DBRowDescriptor *header = new DBRowDescriptor;
    // Fill header:
    header->AddColumn( "historyDate", DBTYPE_FILETIME );
    header->AddColumn( "lowPrice", DBTYPE_CY );
    header->AddColumn( "highPrice", DBTYPE_CY );
    header->AddColumn( "avgPrice", DBTYPE_CY );
    header->AddColumn( "volume", DBTYPE_I8 );
    header->AddColumn( "orders", DBTYPE_I4 );

    CRowSet* rs = new CRowSet( &header );

    PyPackedRow* row = rs->NewRow();
    row->SetField( "historyDate", new PyLong( Win32TimeNow() ) );
    row->SetField( "lowPrice", new PyLong( 18000 ) );
    row->SetField( "highPrice", new PyLong( 19000 ) );
    row->SetField( "avgPrice", new PyLong( 18400 ) );
    row->SetField( "volume", new PyLong( 5463586 ) );
    row->SetField( "orders", new PyInt( 254 ) );

    sLog.Log( cmdName, "Marshaling..." );

    Buffer marshaled;
    bool res = MarshalDeflate( rs, marshaled );
    PyDecRef( rs );

    if( !res )
    {
        sLog.Error( cmdName, "Failed to marshal Python object." );
        return;
    }

    sLog.Log( cmdName, "Unmarshaling..." );

    PyRep* rep = InflateUnmarshal( marshaled );
    if( NULL == rep )
    {
        sLog.Error( cmdName, "Failed to unmarshal Python object." );
        return;
    }

    sLog.Success( cmdName, "Final:" );
    rep->Dump( stdout, "    " );

    PyDecRef( rep );
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:49,代码来源:Commands.cpp


示例4: switch

//in theory this could be written in therms of the more generic
//MulticastTarget function, but this is much more efficient.
void EntityList::Multicast( const char* notifyType, const char* idType, PyTuple** payload, NotificationDestination target, uint32 target_id, bool seq )
{
    PyTuple* p = *payload;
    *payload = NULL;

	std::list<Client*>::const_iterator cur, end;
	cur = m_clients.begin();
	end = m_clients.end();
	for(; cur != end; cur++)
    {
		switch( target )
        {
		case NOTIF_DEST__LOCATION:
			if( (*cur)->GetLocationID() != target_id )
				continue;
			break;
		case NOTIF_DEST__CORPORATION:
			if( (*cur)->GetCorporationID() != target_id )
				continue;
			break;
		}

		PyTuple* temp = new PyTuple( *p );
		(*cur)->SendNotification( notifyType, idType, &temp, seq );
	}

    PyDecRef( p );
}
开发者ID:Almamu,项目名称:evemu_incursion,代码行数:30,代码来源:EntityList.cpp


示例5: PyString

PySubStream* CachedObjectMgr::LoadCachedFile(const char *obj_name)
{
    PyString *oname_str = new PyString(obj_name);
    PySubStream* ret = LoadCachedFile(oname_str, obj_name);
    PyDecRef(oname_str);
    return ret;
}
开发者ID:Bes666,项目名称:Evemu,代码行数:7,代码来源:CachedObjectMgr.cpp


示例6: UnmarshalLogText

void UnmarshalLogText( const Seperator& cmd )
{
    const char* cmdName = cmd.arg( 0 ).c_str();

    if( 1 == cmd.argCount() )
    {
        sLog.Error( cmdName, "Usage: %s marshal-binary [marshal-binary] ...", cmdName );
        return;
    }

    for( size_t i = 1; i < cmd.argCount(); ++i )
    {
        const std::string& marshalBinaryStr = cmd.arg( i );

        Buffer marshalBinary;
        if( !PyDecodeEscape( marshalBinaryStr.c_str(), marshalBinary ) )
        {
            sLog.Error( cmdName, "Failed to decode string into binary." );
            continue;
        }

        PyRep* r = InflateUnmarshal( marshalBinary );
        if( NULL == r )
            sLog.Error( cmdName, "Failed to unmarshal binary." );
        else
        {
            sLog.Success( cmdName, "Result:" );
            r->Dump( stdout, "    " );

            PyDecRef( r );
        }
    }
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:33,代码来源:Commands.cpp


示例7: DBResultToIntIntlistDict

/**
 * this function isn't used.
 */
void DBResultToIntIntlistDict( DBQueryResult &result, std::map<int32, PyRep *> &into ) {
    /* this builds a map from the int in result[0], to a list of each result[1]
     * which is has the same result[0]. This function assumes the result is
     * ORDER BY result[0]
     */
    uint32 last_key = 0xFFFFFFFF;

    PyList *l = NULL;

    DBResultRow row;
    while( result.GetRow( row ) )
    {
        uint32 k = row.GetUInt(0);
        if( k != last_key )
        {
            //watch for overwrite, no guarantee we are dealing with a key.
            std::map<int32, PyRep *>::iterator res = into.find(k);
            if( res != into.end() )
                //log an error or warning?
                PyDecRef( res->second );

            into[k] = l = new PyList();
            last_key = k;
        }

        l->AddItemInt( row.GetInt( 1 ) );
    }
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:31,代码来源:EVEDBUtils.cpp


示例8: ColumnCount

uint32 DBRowDescriptor::FindColumn( const char* name ) const
{
	uint32 cc = ColumnCount();
    PyString* stringName = new PyString( name );
    
	for( uint32 i = 0; i < cc; i++ )
    {
		if( stringName->hash() == GetColumnName( i )->hash() )
        {
            PyDecRef( stringName );
			return i;
        }
    }

    PyDecRef( stringName );
	return cc;
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:17,代码来源:PyDatabase.cpp


示例9: command

PyPacket* EVEClientSession::_HandleCommand( PyRep* rep )
{
    //check if it actually is tuple
    if( !rep->IsTuple() )
    {
        sLog.Error("Network", "%s: Invalid packet during waiting for command (tuple expected).", GetAddress().c_str());
    }
    // decode
    else if( rep->AsTuple()->size() == 2 )
    {
        //QC = Queue Check
        NetCommand_QC cmd;
        if( !cmd.Decode( &rep ) )
        {
            sLog.Error("Network", "%s: Failed to decode 2-arg command.", GetAddress().c_str());
        }
        else
        {
            sLog.Debug("Network", "%s: Got Queue Check command.", GetAddress().c_str());

            //they return position in queue
            PyRep* rsp = new PyInt( _GetQueuePosition() );
            mNet->QueueRep( rsp );
            PyDecRef( rsp );

            //now reset connection
            Reset();
        }
    }
    else if( rep->AsTuple()->size() == 3 )
    {
        //this is sent when client is logging in
        NetCommand_VK cmd;
        if( !cmd.Decode( &rep ) )
        {
            sLog.Error("Network", "%s: Failed to decode 3-arg command.", GetAddress().c_str());
        }
        else
        {
            sLog.Debug("Network", "%s: Got VK command, vipKey=%s.", GetAddress().c_str(), cmd.vipKey.c_str());

            if( _VerifyVIPKey( cmd.vipKey ) )
                mPacketHandler = &EVEClientSession::_HandleCrypto;
        }
    }
    else
    {
        _log(NET__PRES_ERROR, "%s: Received invalid command packet:", GetAddress().c_str());
        rep->Dump(NET__PRES_ERROR, "  ");
    }

    // recurse
    return PopPacket();
}
开发者ID:Almamu,项目名称:evemu_crucible,代码行数:54,代码来源:EVESession.cpp


示例10: PyString

void ObjCacheService::PrimeCache()
{
    CacheKeysMapConstItr cur, end;
    cur = m_cacheKeys.begin();
    end = m_cacheKeys.end();
    for(; cur != end; cur++)
    {
        PyString* str = new PyString( cur->first );
        _LoadCachableObject( str );
        PyDecRef( str );
    }
}
开发者ID:ratboy2499,项目名称:evemu_incursion,代码行数:12,代码来源:ObjCacheService.cpp


示例11: PyDecRef

/*
 * EVEAdvancedAttributeMgr
 */
void EVEAdvancedAttributeMgr::EncodeAttributes(std::map<int32, PyRep *> &into) const {
    // integers first
    {
        std::map<Attr, int_t>::const_iterator cur, end;
        cur = m_ints.begin();
        end = m_ints.end();
        for(; cur != end; cur++) {
            if(into.find(cur->first) != into.end())
                PyDecRef( into[cur->first] );
            into[cur->first] = PyGet(cur->first);
        }
    }
    // then reals
    {
        std::map<Attr, real_t>::const_iterator cur, end;
        cur = m_reals.begin();
        end = m_reals.end();
        for(; cur != end; cur++) {
            if(into.find(cur->first) != into.end())
                PyDecRef( into[cur->first] );
            into[cur->first] = PyGet(cur->first);
        }
    }
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:27,代码来源:EVEAttributeMgr.cpp


示例12: _log

void CachedObjectMgr::UpdateCacheFromSS(const std::string &objectID, PySubStream **in_cached_data) {
    PyCachedObjectDecoder cache;
    if(!cache.Decode(in_cached_data)) {
        _log(SERVICE__ERROR, "Failed to decode cache stream");
        return;
    }

    PyString* str = new PyString( objectID );

    PyBuffer* buf = cache.cache->data();
    PyIncRef( buf );

    _UpdateCache(str, &buf);

    PyDecRef( str );
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:16,代码来源:CachedObjectMgr.cpp


示例13: DBRowDescriptor

PyDict *DBResultToPackedRowDict( DBQueryResult &result, uint32 key_index )
{
    DBRowDescriptor *header = new DBRowDescriptor( result );

    PyDict *res = new PyDict();

    DBResultRow row;
    for( uint32 i = 0; result.GetRow( row ); i++ )
    {
        res->SetItem( DBColumnToPyRep(row, key_index), CreatePackedRow( row, header ) );
        PyIncRef( header );
    }

    PyDecRef( header );
    return res;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:16,代码来源:EVEDBUtils.cpp


示例14: if

void EntityList::Multicast(const char *notifyType, const char *idType, PyTuple **in_payload, const MulticastTarget &mcset, bool seq)
{
	// consume payload
	PyTuple *payload = *in_payload;
	*in_payload = NULL;

	//cache all these locally to avoid calling empty all the time.
	const bool chars_empty = mcset.characters.empty();
	const bool locs_empty = mcset.locations.empty();
	const bool corps_empty = mcset.corporations.empty();

	if( !chars_empty || !locs_empty || !corps_empty )
	{
		std::list<Client *>::const_iterator cur, end;
		cur = m_clients.begin();
		end = m_clients.end();
		for(; cur != end; cur++)
		{
			if(	  !chars_empty
			     && mcset.characters.find((*cur)->GetCharacterID()) != mcset.characters.end() )
			{
				//found, carry on...
			}
			else if(   !locs_empty
					  && mcset.locations.find((*cur)->GetLocationID()) != mcset.locations.end() )
			{
				//found, carry on...
			}
			else if(   !corps_empty
					  && mcset.corporations.find((*cur)->GetCorporationID()) != mcset.corporations.end() )
			{
				//found, carry on...
			}
			else
			{
				//not found in any of the above sets.
				continue;
			}

			PyTuple *temp = new PyTuple( *payload );
			(*cur)->SendNotification( notifyType, idType, &temp, seq );
			
		}
	}

	PyDecRef( payload );
}
开发者ID:Almamu,项目名称:evemu_incursion,代码行数:47,代码来源:EntityList.cpp


示例15: SafeDelete

void EVEClientSession::FastQueuePacket( PyPacket** p )
{
    if(p == NULL || *p == NULL)
        return;

    PyRep* r = (*p)->Encode();
    // maybe change PyPacket to a object with a reference..
    SafeDelete( *p );
    if( r == NULL )
    {
        sLog.Error("Network", "%s: Failed to encode a Fast queue packet???", GetAddress().c_str());
        return;
    }

    mNet->QueueRep( r );
    PyDecRef( r );
}
开发者ID:Almamu,项目名称:evemu_crucible,代码行数:17,代码来源:EVESession.cpp


示例16: _GetVersion

void EVEClientSession::Reset()
{
    mPacketHandler = NULL;

    if( GetState() != TCPConnection::STATE_CONNECTED )
        // Connection has been lost, there's no point in reset
        return;

    VersionExchangeServer version;
    _GetVersion( version );

    PyRep* r = version.Encode();
    mNet->QueueRep( r );
    PyDecRef( r );

    mPacketHandler = &EVEClientSession::_HandleVersion;
}
开发者ID:Almamu,项目名称:evemu_crucible,代码行数:17,代码来源:EVESession.cpp


示例17: switch

void ObjCacheService::InsertCacheHints(hintSet hset, PyDict *into) {
    const char *const *objects = NULL;
    uint32 object_count = 0;
    switch(hset) {
    case hLoginCachables:
        objects = LoginCachableObjects;
        object_count = LoginCachableObjectCount;
        break;
    case hCharCreateCachables:
        objects = CharCreateCachableObjects;
        object_count = CharCreateCachableObjectCount;
        break;
    case hAppearanceCachables:
        objects = AppearanceCachableObjects;
        object_count = AppearanceCachableObjectCount;
        break;
    case hCharCreateNewExtraCachables:
        objects = CharCreateNewExtraCachableObjects;
        object_count = CharCreateNewExtraCachableObjectCount;
        break;
    }
    if(objects == NULL)
        return;
    uint32 r;
    std::map<std::string, std::string>::const_iterator res;
    for(r = 0; r < object_count; r++) {
        //find the dict key to use for this object
        res = m_cacheKeys.find(objects[r]);
        if(res == m_cacheKeys.end()) {
            _log(SERVICE__ERROR, "Unable to find cache key for object ID '%s', skipping.", objects[r]);
            continue;
        }

        //get the hint
        PyString* str = new PyString( objects[r] );
        PyRep *cache_hint = GetCacheHint( str );
        PyDecRef( str );

        if(cache_hint == NULL)
            continue;	//print already done.

        into->SetItemString(res->second.c_str(), cache_hint);
    }
}
开发者ID:ratboy2499,项目名称:evemu_incursion,代码行数:44,代码来源:ObjCacheService.cpp


示例18: PyTuple

void TargetManager::QueueTBDestinyUpdate( PyTuple** up_in ) const
{
    PyTuple* up = *up_in;
    *up_in = NULL;    //could optimize out one of the Clones in here...

    PyTuple* up_dup = NULL;

    std::map<SystemEntity*, TargetedByEntry*>::const_iterator cur, end;
    cur = m_targetedBy.begin();
    end = m_targetedBy.end();
    for(; cur != end; ++cur)
    {
        if( NULL == up_dup )
            up_dup = new PyTuple( *up );

        cur->first->QueueDestinyUpdate( &up_dup );
        //they may not have consumed it (NPCs for example), so dont re-dup it in that case.
    }

    PySafeDecRef( up_dup );
    PyDecRef( up );
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:22,代码来源:TargetManager.cpp


示例19: _GetValueTuple

void ClientSession::_Set( const char* name, PyRep* value )
{
    PyTuple* v = _GetValueTuple( name );
    if( v == NULL )
    {
        v = new PyTuple( 2 );
        v->SetItem( 0, new PyNone );
        v->SetItem( 1, new PyNone );
        mSession->SetItemString( name, v );
    }

    PyRep* current = v->GetItem( 1 );
    if( value->hash() != current->hash() )
    {
        v->SetItem( 1, value );

        mDirty = true;
    }
    else
    {
        PyDecRef( value );
    }
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:23,代码来源:ClientSession.cpp


示例20: PyTuple

//send a destiny event to everybody in the bubble.
//assume that static entities are also not interested in destiny updates.
void SystemBubble::BubblecastDestinyEvent( PyTuple** payload, const char* desc ) const
{
    PyTuple* up = *payload;
    *payload = NULL;	//could optimize out one of the Clones in here...

    PyTuple* up_dup = NULL;

    std::set<SystemEntity *>::const_iterator cur, end, tmp;
    cur = m_dynamicEntities.begin();
    end = m_dynamicEntities.end();
    for(; cur != end; ++cur)
    {
        if( NULL == up_dup )
            up_dup = new PyTuple( *up );

        _log( DESTINY__BUBBLE_TRACE, "Bubblecast %s event to %s (%u)", desc, (*cur)->GetName(), (*cur)->GetID() );
        (*cur)->QueueDestinyEvent( &up_dup );
        //they may not have consumed it (NPCs for example), so dont re-dup it in that case.
    }

    PySafeDecRef( up_dup );
    PyDecRef( up );
}
开发者ID:stschake,项目名称:evemu-incursion,代码行数:25,代码来源:SystemBubble.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PyDict_Check函数代码示例发布时间:2022-05-30
下一篇:
C++ PyComplex_FromCComplex函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap