本文整理汇总了C++中ComPointer类的典型用法代码示例。如果您正苦于以下问题:C++ ComPointer类的具体用法?C++ ComPointer怎么用?C++ ComPointer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ComPointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateInstance
ErrorCode ComProxyStatelessServiceFactory::CreateInstance(
wstring const & serviceType,
wstring const & serviceName,
vector<byte> const & initializationData,
Guid const & partitionId,
const FABRIC_INSTANCE_ID instanceId,
__out IStatelessServiceInstancePtr & )
{
HRESULT hr;
ComPointer<IFabricStatelessServiceInstance> comService;
hr = comImpl_->CreateInstance(
serviceType.c_str(),
serviceName.c_str(),
(ULONG)initializationData.size(),
initializationData.data(),
partitionId.AsGUID(),
instanceId,
comService.InitializationAddress());
if(SUCCEEDED(hr))
{
ASSERT_IFNOT(comService, "Instance create returned a null service.");
// TODO: create proxy for the stateless service
// service = make_unique<ComProxyStatelessService>(comService);
//
}
return ErrorCode::FromHResult(hr);
}
示例2: FabricCreateWinFabStoreLayoutSpecification
HRESULT ComWinFabStoreLayoutSpecification::FabricCreateWinFabStoreLayoutSpecification(
/* [in] */ REFIID riid,
/* [retval][out] */ void **fabricLayoutSpecification)
{
ComPointer<ComWinFabStoreLayoutSpecification> comWinFabStoreLayoutSpecificationCPtr = make_com<ComWinFabStoreLayoutSpecification>();
return comWinFabStoreLayoutSpecificationCPtr->QueryInterface(riid, (LPVOID*)fabricLayoutSpecification);
}
示例3: WAIT_FOR_SIGNAL_RESET
HRESULT STDMETHODCALLTYPE ComTestStoreService::BeginUpdateEpoch(
/* [in] */ FABRIC_EPOCH const * epoch,
/* [in] */ FABRIC_SEQUENCE_NUMBER previousEpochLastSequenceNumber,
/* [in] */ IFabricAsyncOperationCallback *callback,
/* [retval][out] */ IFabricAsyncOperationContext **context)
{
if (epoch == NULL || callback == NULL || context == NULL) { return E_POINTER; }
WAIT_FOR_SIGNAL_RESET(StateProviderBeginUpdateEpochBlock)
CheckForReportFaultsAndDelays(testStoreService_.GetPartition(), ApiFaultHelper::Provider, L"BeginUpdateEpoch");
if (testStoreService_.ShouldFailOn(ApiFaultHelper::Provider, L"BeginUpdateEpoch")) return E_FAIL;
HRESULT hr;
if (testStoreService_.ShouldFailOn(ApiFaultHelper::Provider, L"EndUpdateEpoch"))
{
hr = E_FAIL;
}
else
{
hr = testStoreService_.UpdateEpoch(epoch, previousEpochLastSequenceNumber);
}
ComPointer<ComCompletedAsyncOperationContext> operation = make_com<ComCompletedAsyncOperationContext>();
hr = operation->Initialize(hr, root_, callback);
TestSession::FailTestIf(FAILED(hr), "operation->Initialize should not fail");
return ComAsyncOperationContext::StartAndDetach<ComCompletedAsyncOperationContext>(std::move(operation), context);
}
示例4: repaintCurrentFrame
void VideoRendererEVR::repaintCurrentFrame(QWidget *target, const QRect &rect)
{
// repaint the video
ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl);
// All failed results can be safely ignored
filterControl->RepaintVideo();
}
示例5: AcceptVisitor
void EngineService::AcceptVisitor( JobFiber& /*fiber*/, const ConfigurationBroadcastVisitor ) {
enum : UINT32 {
XAudio2CreateFlags = (ETIsDebugModeEnabled() ? XAUDIO2_DEBUG_ENGINE : 0)
};
ComPointer<IXAudio2> audio;
_log( MessageSeverity::Message, "Creating XAudio2 instance." ET_UTF8_NEWLINE_LITERAL );
if( FAILED( XAudio2Create( audio.GetInterfacePointer(), XAudio2CreateFlags, XAUDIO2_DEFAULT_PROCESSOR ) ) ) {
_log( MessageSeverity::Error, "Unable to create XAudio2 instance!" ET_UTF8_NEWLINE_LITERAL );
return;
}
if( FAILED( audio->RegisterForCallbacks( this ) ) ) {
_log( MessageSeverity::Error, "Unable to register XAudio2 device callbacks!" ET_UTF8_NEWLINE_LITERAL );
return;
}
if( FAILED( audio->StartEngine() ) ) {
_log( MessageSeverity::Error, "Unable to start XAudio2 engine!" ET_UTF8_NEWLINE_LITERAL );
return;
}
_log( MessageSeverity::Message, "Created XAudio2 instance." ET_UTF8_NEWLINE_LITERAL );
// Commit changes to the service.
_audio = eastl::move( audio );
}
示例6: CheckForReportFaultsAndDelays
HRESULT ComTestStoreService::BeginClose(
/* [in] */ IFabricAsyncOperationCallback *callback,
/* [retval][out] */ IFabricAsyncOperationContext **context)
{
if (context == NULL) { return E_POINTER; }
CheckForReportFaultsAndDelays(testStoreService_.GetPartition(), ApiFaultHelper::Service, L"BeginClose");
HRESULT beginResult = testStoreService_.ShouldFailOn(ApiFaultHelper::Service, L"BeginClose") ? E_FAIL : S_OK;
HRESULT endResult = testStoreService_.ShouldFailOn(ApiFaultHelper::Service, L"EndClose") ? E_FAIL : S_OK;
if(!isClosedCalled_)
{
isClosedCalled_ = true;
ErrorCode error = testStoreService_.OnClose();
TestSession::FailTestIfNot(error.IsSuccess(), "testStoreService_.OnClose failed with error {0}", error);
}
if(FAILED(beginResult)) return E_FAIL;
ComPointer<ComCompletedAsyncOperationContext> operation = make_com<ComCompletedAsyncOperationContext>();
HRESULT hr = operation->Initialize(endResult, root_, callback);
TestSession::FailTestIf(FAILED(hr), "operation->Initialize should not fail");
return ComAsyncOperationContext::StartAndDetach<ComCompletedAsyncOperationContext>(std::move(operation), context);
}
示例7: Create
ErrorCode ComProxyXmlLiteWriter::Create(
__in std::wstring const & outputName,
__out ComProxyXmlLiteWriterUPtr & xmlLiteWriter,
bool writeByteOrderMark,
bool indent)
{
#if !defined(PLATFORM_UNIX)
ComPointer<IStream> xmlFileStream;
auto error = ComXmlFileStream::Open(outputName, true, xmlFileStream);
if (!error.IsSuccess()) { return error; }
ComPointer<IUnknown> comPointer;
HRESULT hr = xmlFileStream->QueryInterface(IID_IUnknown, reinterpret_cast<void**>(comPointer.InitializationAddress()));
if (!SUCCEEDED(hr)) { return ErrorCode::FromHResult(hr); }
error = ComProxyXmlLiteWriter::Create(comPointer, xmlLiteWriter, writeByteOrderMark, indent);
if (!error.IsSuccess()) { return error; }
#else
ComPointer<IXmlWriter> writer;
auto hr = ::CreateXmlWriter(
::IID_IXmlWriter,
outputName.c_str(),
writer.VoidInitializationAddress(),
NULL);
auto error = ToErrorCode(hr, L"CreateXmlWriter", L"", true, false);
if (!error.IsSuccess()) { return error; }
xmlLiteWriter = move(make_unique<ComProxyXmlLiteWriter>(writer));
#endif
return ErrorCode(ErrorCodeValue::Success);
}
示例8: End
static HRESULT End(__in IFabricAsyncOperationContext * context, __out IFabricInfrastructureTaskQueryResult ** result)
{
if ((context == NULL) || (result == NULL))
{
return E_POINTER;
}
ComPointer<ComQueryInfrastructureTaskAsyncOperation> thisCPtr(context, CLSID_ComQueryInfrastructureTaskAsyncOperation);
auto hr = thisCPtr->Result;
if (SUCCEEDED(hr))
{
vector<InfrastructureTaskQueryResult> resultList;
auto error = thisCPtr->nativeResult_.MoveList(resultList);
if (error.IsSuccess())
{
ComPointer<IFabricInfrastructureTaskQueryResult> cPtr = make_com<ComQueryResult, IFabricInfrastructureTaskQueryResult>(move(resultList));
hr = cPtr->QueryInterface(IID_IFabricInfrastructureTaskQueryResult, reinterpret_cast<void**>(result));
}
else
{
hr = error.ToHResult();
}
}
return hr;
}
示例9: videoSize
QSize VideoRendererEVR::videoSize() const
{
SIZE nativeSize;
SIZE aspectRatioSize;
ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl);
filterControl->GetNativeVideoSize(&nativeSize, &aspectRatioSize);
return QSize(nativeSize.cx, nativeSize.cy);
}
示例10: getService
template <typename T> ComPointer<T> getService(const Filter &filter, REFGUID guidService, REFIID riid)
{
//normally we should use IID_IMFGetService but this introduces another dependency
//so here we simply define our own IId with the same value
ComPointer<T> ret;
ComPointer<IMFGetService> getService(filter, IID_IMFGetService);
if (getService) {
getService->GetService(guidService, riid, reinterpret_cast<void**>(ret.pparam()));
}
return ret;
}
示例11: m_target
VideoRendererEVR::VideoRendererEVR(QWidget *target) : m_target(target)
{
m_filter = Filter(CLSID_EnhancedVideoRenderer, IID_IBaseFilter);
if (!m_filter) {
return;
}
ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl);
filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId()));
filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size
}
示例12: _new
ComPointer<IFabricStateProvider2Factory> TestComStateProvider2Factory::Create(
__in Data::StateManager::IStateProvider2Factory & factory,
__in KAllocator & allocator)
{
TestComStateProvider2Factory * pointer = _new(TEST_COM_STATE_PROVIDER_FACTORY_TAG, allocator) TestComStateProvider2Factory(factory);
ASSERT_IF(pointer == nullptr, "OOM while allocating TestComStateProvider2Factory");
ASSERT_IFNOT(NT_SUCCESS(pointer->Status()), "Unsuccessful initialization while allocating TestComStateProvider2Factory {0}", pointer->Status());
ComPointer<IFabricStateProvider2Factory> result;
result.SetAndAddRef(pointer);
return result;
}
示例13: HandleOneWay
ErrorCode ComProxyFabricTransportCallbackMessageHandler::HandleOneWay(
wstring const & ,
MessageUPtr && message)
{
ComPointer<IFabricTransportMessage> msgCPointer = make_com<ComFabricTransportMessage,
IFabricTransportMessage>(move(message));
auto hr = comImpl_->HandleOneWay(
msgCPointer.GetRawPointer());
return ErrorCode::FromHResult(hr);
}
示例14: Compare
HRESULT STDMETHODCALLTYPE ComServiceEndpointsVersion::Compare(
__in /* [in] */ IFabricServiceEndpointsVersion * other,
__out /* [out, retval] */ LONG * result)
{
if (other == NULL || result == NULL) { return E_POINTER; }
ComPointer<ComServiceEndpointsVersion> comPtr;
auto hr = other->QueryInterface(CLSID_ComServiceEndpointsVersion, comPtr.VoidInitializationAddress());
if (FAILED(hr)) { return hr; }
*result = impl_->Compare(*(comPtr->get_Impl().get()));
return S_OK;
}
示例15: asyncOperation
HRESULT ComReplicator::OpenOperation::End(
__in IFabricAsyncOperationContext * context,
__out IFabricStringResult **replicationEndpoint)
{
if (replicationEndpoint == NULL) { return E_POINTER; }
*replicationEndpoint = NULL;
ComPointer<ComReplicator::OpenOperation> asyncOperation(
context, CLSID_ComReplicator_OpenOperation);
HRESULT hr = asyncOperation->ComReplicator::BaseOperation::End();
if (FAILED(hr)) { return hr; }
ComPointer<IFabricStringResult> stringResult = make_com<ComStringResult, IFabricStringResult>(asyncOperation->replicationEndpoint_);
*replicationEndpoint = stringResult.DetachNoRelease();
return S_OK;
}