コード例 #1
0
ファイル: CAAFOperationGroup.cpp プロジェクト: mcanthony/aaf
HRESULT STDMETHODCALLTYPE
    CAAFOperationGroup::AddParameter (IAAFParameter * pParameter)
{
  HRESULT hr;

  ImplAAFOperationGroup * ptr;
  ImplAAFRoot * pO;
  pO = GetRepObject ();
  assert (pO);
  ptr = static_cast<ImplAAFOperationGroup*> (pO);
  assert (ptr);

  //
  // set up for pParameter
  //
  ImplAAFParameter * internalpParameter = NULL;
  if (pParameter)
    {
      HRESULT hStat;
      IAAFRoot * iObj;
      ImplAAFRoot *arg;
      hStat = pParameter->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.
      internalpParameter = static_cast<ImplAAFParameter*>(arg);
      assert (internalpParameter);
    }

  try
    {
      hr = ptr->AddParameter
       (internalpParameter);
    }
  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 pParameter
  //
  return hr;
}
コード例 #2
0
ファイル: CEnumAAFTypeDefs.cpp プロジェクト: mcanthony/aaf
HRESULT STDMETHODCALLTYPE
    CEnumAAFTypeDefs::Next (aafUInt32  count,
        IAAFTypeDef ** ppTypeDefs,
        aafUInt32 *  pNumFetched)
{
  HRESULT hr;

  ImplEnumAAFTypeDefs * ptr;
  ImplAAFRoot * pO;
  pO = GetRepObject ();
  assert (pO);
  ptr = static_cast<ImplEnumAAFTypeDefs*> (pO);
  assert (ptr);

  //
  // set up for ppTypeDefs
  //
  ImplAAFTypeDef ** internalppTypeDefs = NULL;
  assert (count >= 0);
  internalppTypeDefs = new ImplAAFTypeDef*[count];
  assert (internalppTypeDefs);

  ImplAAFTypeDef ** pinternalppTypeDefs = NULL;
  if (ppTypeDefs)
    {
      pinternalppTypeDefs = internalppTypeDefs;
    }

  try
    {
      hr = ptr->Next
       (count,
        pinternalppTypeDefs,
        pNumFetched);
    }
  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 ppTypeDefs
  //
  if (SUCCEEDED(hr)||hr==AAFRESULT_NO_MORE_OBJECTS)
    {
      IUnknown *pUnknown;
      HRESULT hStat;
      aafUInt32 localIdx;
	  assert (count >= 0);
	  for (localIdx = 0; localIdx < *pNumFetched; localIdx++)
		{
		  pUnknown = static_cast<IUnknown *> (internalppTypeDefs[localIdx]->GetContainer());
		  hStat = pUnknown->QueryInterface(IID_IAAFTypeDef, (void **)(ppTypeDefs+localIdx));
		  assert (SUCCEEDED (hStat));
		  //pUnknown->Release();
		  internalppTypeDefs[localIdx]->ReleaseReference(); // We are through with this pointer.
		}
    }
  delete[] internalppTypeDefs;
  internalppTypeDefs = 0;
  return hr;
}
コード例 #3
0
ファイル: CAAFOperationGroup.cpp プロジェクト: mcanthony/aaf
HRESULT STDMETHODCALLTYPE
    CAAFOperationGroup::GetRender (IAAFSourceReference ** ppSourceRef)
{
  HRESULT hr;

  ImplAAFOperationGroup * ptr;
  ImplAAFRoot * pO;
  pO = GetRepObject ();
  assert (pO);
  ptr = static_cast<ImplAAFOperationGroup*> (pO);
  assert (ptr);

  //
  // set up for ppSourceRef
  //
  ImplAAFSourceReference * internalppSourceRef = NULL;
  ImplAAFSourceReference ** pinternalppSourceRef = NULL;
  if (ppSourceRef)
    {
      pinternalppSourceRef = &internalppSourceRef;
    }

  try
    {
      hr = ptr->GetRender
       (pinternalppSourceRef);
    }
  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 ppSourceRef
  //
  if (SUCCEEDED(hr))
    {
      IUnknown *pUnknown;
      HRESULT hStat;

      if (internalppSourceRef)
        {
          pUnknown = static_cast<IUnknown *> (internalppSourceRef->GetContainer());
          hStat = pUnknown->QueryInterface(IID_IAAFSourceReference, (void **)ppSourceRef);
          assert (SUCCEEDED (hStat));
          //pUnknown->Release();
          internalppSourceRef->ReleaseReference(); // We are through with this pointer.
        }
    }
  return hr;
}
コード例 #4
0
ファイル: CAAFClassDef.cpp プロジェクト: UIKit0/aaf
HRESULT STDMETHODCALLTYPE
    CAAFClassDef::RegisterOptionalPropertyDef (aafUID_constref  id,
        aafCharacter_constptr  pName,
        IAAFTypeDef * pTypeDef,
        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 ppPropDef
  //
  ImplAAFPropertyDef * internalppPropDef = NULL;
  ImplAAFPropertyDef ** pinternalppPropDef = NULL;
  if (ppPropDef)
    {
      pinternalppPropDef = &internalppPropDef;
    }

  try
    {
      hr = ptr->RegisterOptionalPropertyDef
       (id,
        pName,
        internalpTypeDef,
        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
  //
  if (SUCCEEDED(hr))
    {
      IUnknown *pUnknown;
      HRESULT hStat;

      if (internalppPropDef)
        {
          pUnknown = static_cast<IUnknown *> (internalppPropDef->GetContainer());
          hStat = pUnknown->QueryInterface(IID_IAAFPropertyDef, (void **)ppPropDef);
          assert (SUCCEEDED (hStat));
          //pUnknown->Release();
          internalppPropDef->ReleaseReference(); // We are through with this pointer.
        }
    }
  return hr;
}