Example #1
0
AAFRESULT STDMETHODCALLTYPE
    ImplAAFPluginDef::GetLocatorAt (
	  aafUInt32 index,
      ImplAAFLocator ** ppLocator)
{
	if(ppLocator == NULL)
		return(AAFRESULT_NULL_PARAM);

	aafUInt32 count;
	AAFRESULT hr;
	hr = CountLocators (&count);
	if (AAFRESULT_FAILED (hr)) return hr;

	if (index >= count)
	  return AAFRESULT_BADINDEX;

	ImplAAFLocator *pLocator;
	_locators.getValueAt(pLocator,index);

	ASSERTU(pLocator);
	pLocator->AcquireReference();
	(*ppLocator)=pLocator;

	return AAFRESULT_SUCCESS;
}
Example #2
0
HRESULT STDMETHODCALLTYPE
    CAAFLocator::GetPath (aafCharacter *  pPath,
        aafUInt32  bufSize)
{
  HRESULT hr;

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


  try
    {
      hr = ptr->GetPath
       (pPath,
        bufSize);
    }
  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;
    }

  return hr;
}
Example #3
0
ImplAAFEssenceDescriptor::~ImplAAFEssenceDescriptor ()
{
	// Release all of the locator pointers.
	aafUInt32 count = _locators.count();
	for (aafUInt32  i = 0; i < count; i++)
	{
		ImplAAFLocator *pLocator = _locators.clearValueAt(i);
		if (pLocator)
		{
		  pLocator->ReleaseReference();
		  pLocator = 0;
		}
	}
}
Example #4
0
// Internal to the toolkit functions
AAFRESULT
    ImplAAFPluginDef::GetNthLocator (aafInt32 index, ImplAAFLocator **ppLocator)
{
	if(ppLocator == NULL)
		return(AAFRESULT_NULL_PARAM);

	ImplAAFLocator	*obj = NULL;
	_locators.getValueAt(obj, index);
	*ppLocator = obj;
	if (obj)
		obj->AcquireReference();
	else
		return AAFRESULT_NO_MORE_OBJECTS; // AAFRESULT_BADINDEX ???

	return AAFRESULT_SUCCESS;
}
Example #5
0
AAFRESULT STDMETHODCALLTYPE
    ImplAAFEssenceDescriptor::RemoveLocatorAt (aafUInt32 index)
{
	if (index >= _locators.count())
	  return AAFRESULT_BADINDEX;
	
	ImplAAFLocator *pLocator = _locators.removeAt(index);
  if (pLocator)
  {
    // We have removed an element from a "stong reference container" so we must
    // decrement the objects reference count. This will not delete the object
    // since the caller must have alread acquired a reference. (transdel 2000-MAR-10)
    pLocator->ReleaseReference ();
  }
	return AAFRESULT_SUCCESS;
}
Example #6
0
AAFRESULT STDMETHODCALLTYPE
    ImplAAFPluginDef::RemoveLocatorAt (
	  aafUInt32 index)
{
	aafUInt32 count;
	AAFRESULT hr;
	ImplAAFLocator	*pLoc;
	
	hr = CountLocators (&count);
	if (AAFRESULT_FAILED (hr)) return hr;

	if (index >= count)
	  return AAFRESULT_BADINDEX;

	pLoc = _locators.removeAt(index);
	if(pLoc)
		pLoc->ReleaseReference();

	return AAFRESULT_SUCCESS;
}
Example #7
0
ImplAAFPluginDef::~ImplAAFPluginDef ()
{
	// Release the manufacturer locator
	ImplAAFNetworkLocator *pNetLocator = _manufacturerURL.clearValue();
	if (pNetLocator)
	{
	  pNetLocator->ReleaseReference();
	  pNetLocator = 0;
	}

	// Release all of the other locator pointers.
	OMUInt32 count = _locators.count();
	for (OMUInt32 i = 0; i < count; i++)
	{
		ImplAAFLocator *pLocator = _locators.clearValueAt(i);
		if (pLocator)
		{
		  pLocator->ReleaseReference();
		  pLocator = 0;
		}
	}
}
Example #8
0
HRESULT STDMETHODCALLTYPE
    CAAFEssenceDescriptor::GetLocatorAt (aafUInt32  index,
        IAAFLocator ** ppLocator)
{
  HRESULT hr;

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

  //
  // set up for ppLocator
  //
  ImplAAFLocator * internalppLocator = NULL;
  ImplAAFLocator ** pinternalppLocator = NULL;
  if (ppLocator)
    {
      pinternalppLocator = &internalppLocator;
    }

  try
    {
      hr = ptr->GetLocatorAt
       (index,
        pinternalppLocator);
    }
  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 ppLocator
  //
  if (SUCCEEDED(hr))
    {
      IUnknown *pUnknown;
      HRESULT hStat;

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