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


C++ ReleaseRefCountable函数代码示例

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


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

示例1: clonedMap

VError VJSONObject::CloneProperties( VJSONCloner& inCloner, VJSONObject *inDestination) const
{
	VError err = VE_OK;
	if (inDestination != NULL)
	{
		MapType clonedMap( fMap);

		for( MapType::iterator i = clonedMap.begin() ; (i != clonedMap.end()) && (err == VE_OK) ; ++i)
		{
			if (i->second.first.IsObject())
			{
				VJSONObject *theOriginalObject = RetainRefCountable( i->second.first.GetObject());
				err = inCloner.CloneObject( theOriginalObject, i->second.first);
				VJSONGraph::Connect( &inDestination->fGraph, i->second.first);
				ReleaseRefCountable( &theOriginalObject);
			}
			else if (i->second.first.IsArray())
			{
				VJSONArray *theOriginalArray = RetainRefCountable( i->second.first.GetArray());
				err = theOriginalArray->Clone( i->second.first, inCloner);
				VJSONGraph::Connect( &inDestination->fGraph, i->second.first);
				ReleaseRefCountable( &theOriginalArray);
			}
		}
		
		if (err == VE_OK)
			inDestination->fMap.swap( clonedMap);
	}
	return err;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:30,代码来源:VJSONValue.cpp

示例2: testMySQLConnectorCreateSessionWithInCorrectPassword

void testMySQLConnectorCreateSessionWithInCorrectPassword()
{
    CSQLConnector* connector = (CSQLConnector*) ( VComponentManager::RetainComponent ( 'MYSQ', 'SQL ' ) );

    VJSONObject* params = new VJSONObject();

    params->SetProperty ( "hostname",	MYSQL_HOST );

    params->SetProperty ( "user",		MYSQL_USER );

    params->SetProperty ( "password",	MYSQL_CORRECT_PASSWORD );

    params->SetProperty ( "database",	MYSQL_DATABASE );

    params->SetProperty ( "port",		MYSQL_PORT );

    params->SetProperty ( "ssl",		MYSQL_SSL_FALSE );

    ISQLSession* session = connector->CreateSession ( params );

    if ( session != NULL )
    {
        printf ( "connection to mysql server was successful ..\n" );

        ReleaseRefCountable ( &session );
    }
    else
    {
        printf ( "connection to mysql server failed ..\n" );
    }

    ReleaseRefCountable ( &params );

    ReleaseRefCountable ( &connector );
}
开发者ID:StephaneH,项目名称:core-Wakanda,代码行数:35,代码来源:testMySQLConnector.cpp

示例3: RetainFolder

VFile *VProcess::RetainFile( EFolderKind inPrimarySelector, const VString& inFileName, EFolderKind inSecondarySelector) const
{
	VFile *file = NULL;

	VFolder *parent = RetainFolder( inPrimarySelector);
	if (testAssert( parent != NULL))
	{
		file = new VFile( *parent, inFileName);
		if ( (file != NULL) && !file->Exists())
			ReleaseRefCountable( &file);
	}
	ReleaseRefCountable( &parent);

	if ( (file == NULL) && (inSecondarySelector != 0) )
	{
		parent = RetainFolder( inSecondarySelector);
		if ( (parent != NULL) && parent->Exists())
		{
			file = new VFile( *parent, inFileName);
			if ( (file != NULL) && !file->Exists())
				ReleaseRefCountable( &file);
		}
		ReleaseRefCountable( &parent);
	}
	
	return file;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:27,代码来源:VProcess.cpp

示例4: Send

WAKDebuggerServerMessage* VRemoteDebugPilot::WaitFrom(OpaqueDebuggerContext inContext)
{
	WAKDebuggerServerMessage*	res = NULL;
	RemoteDebugPilotMsg_t		msg;
	VChromeDbgHdlPage*			page = NULL;	

	msg.type = WAIT_FROM_MSG;
	msg.ctx = inContext;
	msg.outpage = &page;

	VError	err = Send(msg);

	if (!err && page)
	{
		fPendingContextsNumberSem.Unlock();
		res = page->WaitFrom();
		fLock.Lock();
		if (res->fType == WAKDebuggerServerMessage::SRV_CONNEXION_INTERRUPTED)
		{
			std::map< OpaqueDebuggerContext, VContextDescriptor* >::iterator	ctxIt = fContextArray.find(inContext);
			if (ctxIt != fContextArray.end())
			{
				ReleaseRefCountable(&(*ctxIt).second->fPage);
			}
		}
		ReleaseRefCountable(&page);
		fLock.Unlock();
		fPendingContextsNumberSem.Lock();
	}
	else
	{
		//int a=1;
	}
	return res;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:35,代码来源:VRemoteDebugPilot.cpp

示例5: ReleaseRefCountable

bool VProjectItemFolder::ConformsTo( const XBOX::VString& inFileKindID) const
{
	bool result = false;

	if (fOwner != NULL)
	{
		VString extension;
		fOwner->GetExtension( extension);

		VFileKind *itemKind = VFileKindManager::Get()->RetainFirstFileKindMatchingWithExtension( extension);
		if (itemKind == NULL)
			itemKind = VFileKindManager::Get()->RetainFileKind( L"public.folder");
		
		if (itemKind != NULL)
		{
			VFileKind *refKind = VFileKindManager::Get()->RetainFileKind( inFileKindID);
			if (refKind != NULL)
			{
				result = itemKind->ConformsTo( *refKind);
				ReleaseRefCountable( &refKind);
			}
			ReleaseRefCountable( &itemKind);
		}
	}

	return result;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:27,代码来源:VProjectItemBehaviour.cpp

示例6: xbox_assert

VRPCService::~VRPCService()
{
	xbox_assert(fMethodsRequestHandler == NULL);
	xbox_assert(fProxyRequestHandler == NULL);

	ReleaseRefCountable( &fMethodsRequestHandler);
	ReleaseRefCountable( &fProxyRequestHandler);
}
开发者ID:StephaneH,项目名称:core-Wakanda,代码行数:8,代码来源:VRPCService.cpp

示例7: buffer

VError XMacFileSystemNotification::StartWatchingForChanges( const VFolder &inFolder, VFileSystemNotifier::EventKind inKindFilter, VFileSystemNotifier::IEventHandler *inHandler, sLONG inLatency )
{
	// We need to get the folder's path into an array for us to pass along to the OS call.
	VString posixPathString;
	inFolder.GetPath( posixPathString, FPS_POSIX);

	VStringConvertBuffer buffer( posixPathString, VTC_UTF_8);
	std::string posixPath( buffer.GetCPointer());

	CFStringRef pathRef = posixPathString.MAC_RetainCFStringCopy();
	CFArrayRef pathArray = CFArrayCreate( NULL, (const void **)&pathRef, 1, NULL );
	
	FSEventStreamContext context = { 0 };
	
	// The latency the user passed us is expressed in milliseconds, but the OS call requires the latency to be
	// expressed in seconds.
	CFTimeInterval latency = (inLatency / 1000.0);
	
	// Now we can make our change data object
	XMacChangeData *data = new XMacChangeData( inFolder.GetPath(), posixPath, inKindFilter, VTask::GetCurrent(), inHandler, this);
	context.info = data;
	data->fStreamRef = FSEventStreamCreate( NULL, &FSEventCallback, &context, pathArray, kFSEventStreamEventIdSinceNow, latency, kFSEventStreamCreateFlagNone );
	if (data->fStreamRef == NULL)
	{
		CFRelease( pathArray );
		CFRelease( pathRef );
		ReleaseRefCountable( &data);
		return MAKE_NATIVE_VERROR( errno );
	}
	
	// We also need to take an initial snapshot of the directory for us to compare again
	CreateDirectorySnapshot( posixPath, data->fSnapshot, true );
	
	// Now we can add the data object we just made to our list
	fOwner->PushChangeData( data);

	// Next, we can schedule this to run on the main event loop
	FSEventStreamScheduleWithRunLoop( data->fStreamRef, CFRunLoopGetMain(), kCFRunLoopDefaultMode );

	CFRelease( pathArray );
	CFRelease( pathRef );

	// Now that we've scheduled the stream to run on a helper thread, all that is left is to
	// start executing the stream
	VError err;
	if (FSEventStreamStart( data->fStreamRef ))
	{
		err = VE_OK;
	}
	else
	{
		err = MAKE_NATIVE_VERROR( errno );
	}
	ReleaseRefCountable( &data);
	
	return err;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:57,代码来源:XMacFileSystemNotification.cpp

示例8: testMySQLConnectorBench

void testMySQLConnectorBench()
{
    CSQLConnector* connector = (CSQLConnector*) ( VComponentManager::RetainComponent ( 'MYSQ', 'SQL ' ) );

    VJSONObject* params = new VJSONObject();

    params->SetProperty ( "hostname",	MYSQL_HOST );

    params->SetProperty ( "user",		MYSQL_USER );

    params->SetProperty ( "password",	MYSQL_CORRECT_PASSWORD );

    params->SetProperty ( "database",	MYSQL_DATABASE );

    params->SetProperty ( "port",		MYSQL_PORT );

    params->SetProperty ( "ssl",			MYSQL_SSL_FALSE );

    ISQLSession* session = connector->CreateSession ( params );

    if ( session != NULL )
    {
        VString query ( "SELECT * FROM people" );

        clock_t startClock = clock();

        VError error = session->ExecuteQuery ( query );

        clock_t endClock = clock();

        sLONG Dt = 1000 * ( endClock - startClock ) / CLOCKS_PER_SEC;

        printf ( "fetching all rows takes %d milliseconds\n", Dt );
        fflush ( stderr );

        startClock = clock();

        ReleaseRefCountable ( &session );

        endClock = clock();

        Dt = 1000 * ( endClock - startClock ) / CLOCKS_PER_SEC;

        printf ( "releasing all rows takes %d milliseconds\n", Dt );
        fflush ( stderr );
    }

    ReleaseRefCountable ( &params );

    ReleaseRefCountable ( &connector );
}
开发者ID:StephaneH,项目名称:core-Wakanda,代码行数:51,代码来源:testMySQLConnector.cpp

示例9: ReleaseRefCountable

void VRemoteDebugPilot::RemoveContext(std::map< OpaqueDebuggerContext, VContextDescriptor* >::iterator& inCtxIt)
{
	XBOX::VError			err;
	XBOX::VString			resp;

	if (fState != STOPPED_STATE)
	{
		// ctx could already have been removed by ABORT
		if (inCtxIt != fContextArray.end())
		{
			if ((*inCtxIt).second->fPage)
			{
				ReleaseRefCountable(&(*inCtxIt).second->fPage);
			}

			if (fState == CONNECTED_STATE)
			{
				resp = CVSTR("{\"method\":\"removeContext\",\"contextId\":\"");
				resp.AppendLong8((sLONG8)((*inCtxIt).first));
				resp += CVSTR("\",\"id\":\"");
				resp += fClientId;
				resp += CVSTR("\"}");
				err = SendToBrowser( resp );
				if (err)
				{
					fWS->Close();
					fState = DISCONNECTING_STATE;
				}
			}
			inCtxIt->second->Release();
			fContextArray.erase(inCtxIt);
		}
	}
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:34,代码来源:VRemoteDebugPilot.cpp

示例10: ContextUpdated

XBOX::VError VRemoteDebugPilot::BreakpointReached(
											OpaqueDebuggerContext		inContext,
											int							inLineNumber,
											RemoteDebuggerPauseReason	inDebugReason,
											XBOX::VString&				inException,
											XBOX::VString&				inSourceUrl,
											XBOX::VectorOfVString&		inSourceData)
{

	VError	err = VE_INVALID_PARAMETER;

	XBOX::VSemaphore*	sem = NULL;
	VContextDebugInfos	debugInfos;
	
	debugInfos.fFileName = inSourceUrl;

	VURL::Decode( debugInfos.fFileName );
	VIndex				idx = debugInfos.fFileName.FindUniChar( L'/', debugInfos.fFileName.GetLength(), true );
	if (idx  > 1)
	{
		VString			tmpStr;
		debugInfos.fFileName.GetSubString(idx+1,debugInfos.fFileName.GetLength()-idx,tmpStr);
		debugInfos.fFileName = tmpStr;
	}

	debugInfos.fLineNb = inLineNumber+1;
	debugInfos.fReason = ( inDebugReason == EXCEPTION_RSN ? "exception" : (inDebugReason == BREAKPOINT_RSN ? "breakpoint" : "dbg statement" ) );
	debugInfos.fComment = "To Be Completed";
	debugInfos.fSourceLine = ( inLineNumber < inSourceData.size() ? inSourceData[inLineNumber] : " NO SOURCE AVAILABLE  " );
	err = ContextUpdated(inContext,debugInfos,&sem);

	if (err == VE_OK)
	{
		fPendingContextsNumberSem.Unlock();
		// if sem not NULL then wait for a browser page granted for debug
		if (sem)
		{
			sem->Lock();
			ReleaseRefCountable(&sem);
		}

		RemoteDebugPilotMsg_t	msg;
		msg.type = BREAKPOINT_REACHED_MSG;
		msg.ctx = inContext;
		msg.linenb = inLineNumber;
		msg.datavectstr = inSourceData;
		msg.datastr = inException;
		msg.urlstr = inSourceUrl;
		err = Send( msg );
		//testAssert(err == VE_OK);
		fPendingContextsNumberSem.Lock();
	}
	VString trace = VString("VRemoteDebugPilot::BreakpointReached ctx activation pb for ctxid=");
	trace.AppendLong8((unsigned long long)inContext);
	trace += " ,ok=";
	trace += (!err ? "1" : "0" );
	sPrivateLogHandler->Put( (err ? WAKDBG_ERROR_LEVEL : WAKDBG_INFO_LEVEL),trace);

	return err;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:60,代码来源:VRemoteDebugPilot.cpp

示例11: switch

void VJSONValue::_Dispose()
{
	switch( fType)
	{
		case JSON_string:	fString.Dispose(); break;
		case JSON_array:	ReleaseRefCountable( &fArray); break;
		case JSON_object:	ReleaseRefCountable( &fObject); break;
		case JSON_number:
		case JSON_null:
		case JSON_true:
		case JSON_false:
		case JSON_undefined:
		case JSON_date:
			break;
	}
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:16,代码来源:VJSONValue.cpp

示例12: VRIAServerSolution

VRIAServerSolution* VRIAServerSolution::OpenSolution( VError& outError, VSolutionStartupParameters *inStartupParameters)
{
	outError = VE_OK;
	VRIAServerSolution *solution = NULL;

	VSolution *designSolution = VSolutionManager::Get()->OpenSolution( inStartupParameters);
	if (designSolution != NULL)
	{
		solution = new VRIAServerSolution();
		if (solution != NULL)
		{
			VRIAServerSolutionOpeningParameters *openingParams = new VRIAServerSolutionOpeningParameters( inStartupParameters);
			outError = solution->_Open( designSolution, openingParams);
			ReleaseRefCountable( &openingParams);
		}
		else
		{
			VSolutionManager::Get()->CloseSolution( designSolution);
			
			delete designSolution;
			designSolution = NULL;

			outError = ThrowError( VE_MEMORY_FULL);
		}
	}
	else
	{
		outError = VE_UNKNOWN_ERROR;
	}

	return solution;
}
开发者ID:rajeshpillai,项目名称:core-Wakanda,代码行数:32,代码来源:VRIAServerSolution.cpp

示例13: vThrowError

void VJSGlobalClass::do_ProgressIndicator(VJSParms_callStaticFunction& ioParms, VJSGlobalObject *inContext)
{
	VString sessiontile;
	VString windowtile, userinfo;
	bool caninterrupt = false;
	Real maxvalue = -1;
	VError err = VE_OK;
	
	if (ioParms.IsNumberParam(1))
		ioParms.GetRealParam(1, &maxvalue);
	else
		err = vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");

	if (err == VE_OK )
	{
		if (ioParms.IsStringParam(2))
			ioParms.GetStringParam(2, sessiontile);
		else
			err = vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "2");
	}

	caninterrupt = ioParms.GetBoolParam( 3, L"Can Interrupt", "Cannot Interrupt");

		
	//VProgressIndicator* progress = inContext->GetRuntimeDelegate()->CreateProgressIndicator( windowtile);

	if (err == VE_OK)
	{
		VProgressIndicator* progress = new VProgressIndicator();
		if (progress != NULL)
		{
			if (ioParms.CountParams() >= 4)
			{
				if (ioParms.IsStringParam(4))
				{
					ioParms.GetStringParam(4, windowtile);
					progress->SetTitle(windowtile);
				}
				else
					vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "4");
			}
			if (ioParms.CountParams() >= 5)
			{
				if (ioParms.IsStringParam(5))
				{
					ioParms.GetStringParam(5, userinfo);
					progress->SetUserInfo(userinfo);
				}
				else
					vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "5");
			}
			progress->BeginSession((sLONG8)maxvalue, sessiontile, caninterrupt);
		}
		ioParms.ReturnValue(VJSProgressIndicator::CreateInstance(ioParms.GetContextRef(), progress));
		
		ReleaseRefCountable( &progress);
	}
	else
		ioParms.ReturnNullValue();	
}	
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:60,代码来源:VJSGlobalClass.cpp

示例14: ReleaseRefCountable

VProcess::~VProcess()
{
#if WITH_RESOURCE_FILE
	ReleaseRefCountable( &fProcessResFile);
#endif

	sLONG val = 0;
	GetCommandLineArgumentAsLong( "-memDebugLeaks", &val);
	if (val != 0)
	{
		VObject::GetAllocator()->DumpLeaks();
	#if WITH_VMemoryMgr
		VMemory::GetManager()->DumpLeaks();
	#endif
	}
	else
	{
		#if VERSIONDEBUG
		#if DUMP_LEAKS
			VObject::GetAllocator()->DumpLeaks();
			VMemory::DumpLeaks();
		#endif
		#endif
	}
	if (fInitCalled)
		_DeInit();
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:27,代码来源:VProcess.cpp

示例15: VFileStream

void VJSStream::do_BinaryStream(VJSParms_callStaticFunction& ioParms)
{
	VFile* file = ioParms.RetainFileParam( 1);
	bool forwrite = ioParms.GetBoolParam( 2, L"Write", L"Read");
	if (file != NULL)
	{
		VError err = VE_OK;
		if (forwrite)
		{
			if (!file->Exists())
				err = file->Create();
		}
		VFileStream* stream = new VFileStream(file);
		if (err == VE_OK)
		{
			if (forwrite)
				err = stream->OpenWriting();
			else
				err = stream->OpenReading();
		}
		
		if (err == VE_OK)
		{
			ioParms.ReturnValue(VJSStream::CreateInstance(ioParms.GetContextRef(), stream));
		}
		else
		{
			delete stream;
		}
	}
	else
		vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
	ReleaseRefCountable( &file);
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:34,代码来源:VJSRuntime_stream.cpp


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