本文整理汇总了C++中IAAFRoot::GetImplRep方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFRoot::GetImplRep方法的具体用法?C++ IAAFRoot::GetImplRep怎么用?C++ IAAFRoot::GetImplRep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFRoot
的用法示例。
在下文中一共展示了IAAFRoot::GetImplRep方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateImpl
// Creates and returns an Impl object based on the given class ID.
// Will create the appropriate kind of API class and attach it.
//
// Implementation note: This function does the following:
// 1) Create the API class. (The API class will create the Impl class
// and attach it.)
// 2) Ask the newly created API class for its contained Impl class.
// 3) Return that Impl class.
//
ImplAAFRoot * CreateImpl (const aafClassID_t & rClassID)
{
IAAFRoot *pIAAFRoot;
ImplAAFRoot *implRoot;
HRESULT hr;
CLSID classID;
// Cast (by bitwise copy) from aafClassID_t to CLSID.
//
memcpy(&classID, &rClassID, sizeof(CLSID));
// The reference implementation must be "self-contained". We do
// not want any user supplied classes to be created and used
// instead on one our built-in classes.
//
// The simplest change is to just simulate a call to
// CoCreateInstance:
//
// This code is invoked within the current module so we
// should just be able to call the DllGetClassObject entry point
// instead of calling CoCreateInstance and searching the
// registry.
IClassFactory *pFactory = NULL;
hr = DllGetClassObject(classID, IID_IClassFactory, (void **)&pFactory);
if (SUCCEEDED(hr))
{
hr = pFactory->CreateInstance(NULL, IID_IAAFRoot, (void **)&pIAAFRoot);
pFactory->Release();
}
if (SUCCEEDED(hr))
pIAAFRoot->GetImplRep((void **)&implRoot);
else
implRoot = NULL;
return (implRoot);
}
示例2: GetRepObject
HRESULT STDMETHODCALLTYPE
CAAFTypeDefObjectRef::SetObject (IAAFPropertyValue * pPropVal,
IUnknown * pObject)
{
HRESULT hr;
ImplAAFTypeDefObjectRef * ptr;
ImplAAFRoot * pO;
pO = GetRepObject ();
assert (pO);
ptr = static_cast<ImplAAFTypeDefObjectRef*> (pO);
assert (ptr);
//
// set up for pPropVal
//
ImplAAFPropertyValue * internalpPropVal = NULL;
if (pPropVal)
{
HRESULT hStat;
IAAFRoot * iObj;
ImplAAFRoot *arg;
hStat = pPropVal->QueryInterface (IID_IAAFRoot, (void **)&iObj);
assert (SUCCEEDED (hStat));
assert (iObj);
hStat = iObj->GetImplRep((void **)&arg);
assert (SUCCEEDED (hStat));
iObj->Release(); // we are through with this interface pointer.
internalpPropVal = static_cast<ImplAAFPropertyValue*>(arg);
assert (internalpPropVal);
}
//
// set up for pObject
//
ImplAAFRoot * internalpObject = NULL;
if (pObject)
{
HRESULT hStat;
IAAFRoot * iObj;
ImplAAFRoot *arg;
hStat = pObject->QueryInterface (IID_IAAFRoot, (void **)&iObj);
if (FAILED(hStat))
{
// If input IUnknown argument MUST supprt our private IAAFRoot interface.
// If it does not than the argument is not one of our implementation objects!
assert(E_NOINTERFACE == hStat);
if (E_NOINTERFACE == hStat)
return AAFRESULT_INVALID_PARAM;
else
return hStat;
}
assert (iObj);
hStat = iObj->GetImplRep((void **)&arg);
assert (SUCCEEDED (hStat));
iObj->Release(); // we are through with this interface pointer.
internalpObject = static_cast<ImplAAFRoot*>(arg);
assert (internalpObject);
}
try
{
hr = ptr->SetObject
(internalpPropVal,
internalpObject);
}
catch (OMException& e)
{
// OMExceptions should be handled by the impl code. However, if an
// unhandled OMException occurs, control reaches here. We must not
// allow the unhandled exception to reach the client code, so we
// turn it into a failure status code.
//
// If the OMException contains an HRESULT, it is returned to the
// client, if not, AAFRESULT_UHANDLED_EXCEPTION is returned.
//
hr = OMExceptionToResult(e, AAFRESULT_UNHANDLED_EXCEPTION);
}
catch (OMAssertionViolation &)
{
// Control reaches here if there is a programming error in the
// impl code that was detected by an assertion violation.
// We must not allow the assertion to reach the client code so
// here we turn it into a failure status code.
//
hr = AAFRESULT_ASSERTION_VIOLATION;
}
catch (...)
{
// We CANNOT throw an exception out of a COM interface method!
// Return a reasonable exception code.
//
hr = AAFRESULT_UNEXPECTED_EXCEPTION;
}
//
// no cleanup necessary for pPropVal
//
//
// no cleanup necessary for pObject
//
//.........这里部分代码省略.........
示例3: GetRepObject
HRESULT STDMETHODCALLTYPE
CAAFSelector::RemoveAlternateSegment (IAAFSegment * pSegment)
{
HRESULT hr;
ImplAAFSelector * ptr;
ImplAAFRoot * pO;
pO = GetRepObject ();
assert (pO);
ptr = static_cast<ImplAAFSelector*> (pO);
assert (ptr);
//
// set up for pSegment
//
ImplAAFSegment * internalpSegment = NULL;
if (pSegment)
{
HRESULT hStat;
IAAFRoot * iObj;
ImplAAFRoot *arg;
hStat = pSegment->QueryInterface (IID_IAAFRoot, (void **)&iObj);
assert (SUCCEEDED (hStat));
assert (iObj);
hStat = iObj->GetImplRep((void **)&arg);
assert (SUCCEEDED (hStat));
iObj->Release(); // we are through with this interface pointer.
internalpSegment = static_cast<ImplAAFSegment*>(arg);
assert (internalpSegment);
}
try
{
hr = ptr->RemoveAlternateSegment
(internalpSegment);
}
catch (OMException& e)
{
// OMExceptions should be handled by the impl code. However, if an
// unhandled OMException occurs, control reaches here. We must not
// allow the unhandled exception to reach the client code, so we
// turn it into a failure status code.
//
// If the OMException contains an HRESULT, it is returned to the
// client, if not, AAFRESULT_UHANDLED_EXCEPTION is returned.
//
hr = OMExceptionToResult(e, AAFRESULT_UNHANDLED_EXCEPTION);
}
catch (OMAssertionViolation &)
{
// Control reaches here if there is a programming error in the
// impl code that was detected by an assertion violation.
// We must not allow the assertion to reach the client code so
// here we turn it into a failure status code.
//
hr = AAFRESULT_ASSERTION_VIOLATION;
}
catch (...)
{
// We CANNOT throw an exception out of a COM interface method!
// Return a reasonable exception code.
//
hr = AAFRESULT_UNEXPECTED_EXCEPTION;
}
//
// no cleanup necessary for pSegment
//
return hr;
}
示例4: GetRepObject
HRESULT STDMETHODCALLTYPE
CAAFTypeDefRecord::Initialize (aafUID_constref id,
IAAFTypeDef ** ppMemberTypes,
aafString_t * pMemberNames,
aafUInt32 numMembers,
aafCharacter_constptr pTypeName)
{
HRESULT hr;
ImplAAFTypeDefRecord * ptr;
ImplAAFRoot * pO;
pO = GetRepObject ();
assert (pO);
ptr = static_cast<ImplAAFTypeDefRecord*> (pO);
assert (ptr);
//
// set up for ppMemberTypes
//
ImplAAFTypeDef ** internalppMemberTypes = NULL;
if (ppMemberTypes)
{
aafUInt32 localIdx;
assert (numMembers >= 0);
internalppMemberTypes = new ImplAAFTypeDef*[numMembers];
assert (internalppMemberTypes);
for (localIdx = 0; localIdx < numMembers; localIdx++)
{
HRESULT hStat;
IAAFRoot * iObj;
ImplAAFRoot *arg;
hStat = ppMemberTypes[localIdx]->QueryInterface (IID_IAAFRoot, (void **)&iObj);
assert (SUCCEEDED (hStat));
assert (iObj);
hStat = iObj->GetImplRep((void **)&arg);
assert (SUCCEEDED (hStat));
iObj->Release(); // we are through with this interface pointer.
internalppMemberTypes[localIdx] = static_cast<ImplAAFTypeDef*>(arg);
assert (internalppMemberTypes[localIdx]);
}
}
try
{
hr = ptr->Initialize
(id,
internalppMemberTypes,
const_cast<aafCharacter_constptr*>(pMemberNames),
numMembers,
pTypeName);
}
catch (OMException& e)
{
// OMExceptions should be handled by the impl code. However, if an
// unhandled OMException occurs, control reaches here. We must not
// allow the unhandled exception to reach the client code, so we
// turn it into a failure status code.
//
// If the OMException contains an HRESULT, it is returned to the
// client, if not, AAFRESULT_UHANDLED_EXCEPTION is returned.
//
hr = OMExceptionToResult(e, AAFRESULT_UNHANDLED_EXCEPTION);
}
catch (OMAssertionViolation &)
{
// Control reaches here if there is a programming error in the
// impl code that was detected by an assertion violation.
// We must not allow the assertion to reach the client code so
// here we turn it into a failure status code.
//
hr = AAFRESULT_ASSERTION_VIOLATION;
}
catch (...)
{
// We CANNOT throw an exception out of a COM interface method!
// Return a reasonable exception code.
//
hr = AAFRESULT_UNEXPECTED_EXCEPTION;
}
//
// cleanup for ppMemberTypes
//
if (internalppMemberTypes)
{
delete[] internalppMemberTypes;
internalppMemberTypes = 0;
}
return hr;
}
示例5: GetRepObject
HRESULT STDMETHODCALLTYPE
CAAFClassDef::RegisterNewPropertyDef (aafUID_constref id,
aafCharacter_constptr pName,
IAAFTypeDef * pTypeDef,
aafBoolean_t isOptional,
aafBoolean_t isUniqueIdentifier,
IAAFPropertyDef ** ppPropDef)
{
HRESULT hr;
ImplAAFClassDef * ptr;
ImplAAFRoot * pO;
pO = GetRepObject ();
assert (pO);
ptr = static_cast<ImplAAFClassDef*> (pO);
assert (ptr);
//
// set up for pTypeDef
//
ImplAAFTypeDef * internalpTypeDef = NULL;
if (pTypeDef)
{
HRESULT hStat;
IAAFRoot * iObj;
ImplAAFRoot *arg;
hStat = pTypeDef->QueryInterface (IID_IAAFRoot, (void **)&iObj);
assert (SUCCEEDED (hStat));
assert (iObj);
hStat = iObj->GetImplRep((void **)&arg);
assert (SUCCEEDED (hStat));
iObj->Release(); // we are through with this interface pointer.
internalpTypeDef = static_cast<ImplAAFTypeDef*>(arg);
assert (internalpTypeDef);
}
//
// set up for isOptional
//
if (! Is_aafBoolean_t_Valid(isOptional))
return AAFRESULT_INVALID_ENUM_VALUE;
//
// set up for isUniqueIdentifier
//
if (! Is_aafBoolean_t_Valid(isUniqueIdentifier))
return AAFRESULT_INVALID_ENUM_VALUE;
//
// set up for ppPropDef
//
ImplAAFPropertyDef * internalppPropDef = NULL;
ImplAAFPropertyDef ** pinternalppPropDef = NULL;
if (ppPropDef)
{
pinternalppPropDef = &internalppPropDef;
}
try
{
hr = ptr->RegisterNewPropertyDef
(id,
pName,
internalpTypeDef,
isOptional,
isUniqueIdentifier,
pinternalppPropDef);
}
catch (OMException& e)
{
// OMExceptions should be handled by the impl code. However, if an
// unhandled OMException occurs, control reaches here. We must not
// allow the unhandled exception to reach the client code, so we
// turn it into a failure status code.
//
// If the OMException contains an HRESULT, it is returned to the
// client, if not, AAFRESULT_UHANDLED_EXCEPTION is returned.
//
hr = OMExceptionToResult(e, AAFRESULT_UNHANDLED_EXCEPTION);
}
catch (OMAssertionViolation &)
{
// Control reaches here if there is a programming error in the
// impl code that was detected by an assertion violation.
// We must not allow the assertion to reach the client code so
// here we turn it into a failure status code.
//
hr = AAFRESULT_ASSERTION_VIOLATION;
}
catch (...)
{
// We CANNOT throw an exception out of a COM interface method!
// Return a reasonable exception code.
//
hr = AAFRESULT_UNEXPECTED_EXCEPTION;
}
//
// no cleanup necessary for pTypeDef
//
//
// cleanup for ppPropDef
//
//.........这里部分代码省略.........