HRESULT STDMETHODCALLTYPE CAAFGPITrigger::SetActiveState (aafBoolean_t ActiveState) { HRESULT hr; ImplAAFGPITrigger * ptr; ImplAAFRoot * pO; pO = GetRepObject (); assert (pO); ptr = static_cast<ImplAAFGPITrigger*> (pO); assert (ptr); // // set up for ActiveState // if (! Is_aafBoolean_t_Valid(ActiveState)) return AAFRESULT_INVALID_ENUM_VALUE; try { hr = ptr->SetActiveState (ActiveState); } 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; }
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 // 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; }