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


C++ PyDecRef函数代码示例

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


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


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