// // WriteTo // AAFRESULT STDMETHODCALLTYPE ImplAAFWeakRefValue::WriteTo( OMProperty* pOmProp) { ASSERTU (isInitialized()); if (!isInitialized()) return AAFRESULT_NOT_INITIALIZED; AAFRESULT result = ImplAAFRefValue::WriteTo(pOmProp); if (AAFRESULT_SUCCEEDED(result)) { // If there is a referenceProperty then the SetObject method has already // written the object reference to the property. if (NULL == referenceProperty()) { OMReferenceProperty* refProperty = dynamic_cast<OMReferenceProperty *>(pOmProp); ASSERTU(refProperty); if (NULL == refProperty) return AAFRESULT_INVALID_OBJ; // ??? // Use an "indirect access" method of saving a strong object reference. // The local object reference must exist! NOTE: GetLocalObject() does NOT increment // the reference count of the returned object! result = SetNewObjectReference(refProperty, GetLocalObject()); if (AAFRESULT_SUCCEEDED(result)) { // Install the property direct access and cleanup the local reference. SetProperty(pOmProp); SetLocalObject(NULL); } } } return result; }
static void initialize() { commentOnlyObjectName(); commentOnlyObjectText(); version(); header(); commentOnlyLine(); contentAndCommentLine(); group(); includeFile(); removeObject(); line(); memoProperty(); noteProperty(); objectNoFields(); objectAndFields(); uniqueProperty(); requiredObjectProperty(); obsoleteProperty(); hasurlProperty(); extensibleProperty(); formatProperty(); minFieldsProperty(); maxFieldsProperty(); field(); closingField(); lastField(); name(); nameProperty(); requiredFieldProperty(); autosizableProperty(); autocalculatableProperty(); retaincaseProperty(); unitsProperty(); ipUnitsProperty(); minExclusiveProperty(); minInclusiveProperty(); maxExclusiveProperty(); maxInclusiveProperty(); deprecatedProperty(); defaultProperty(); automaticDefault(); typeProperty(); keyProperty(); objectListProperty(); externalListProperty(); referenceProperty(); beginExtensible(); beginExtensibleProperty(); metaDataComment(); versionObjectName(); }
AAFRESULT STDMETHODCALLTYPE ImplAAFWeakRefValue::SetObject(ImplAAFStorable *pObject) { AAFRESULT result = AAFRESULT_SUCCESS; if (NULL == pObject) return AAFRESULT_NULL_PARAM; ASSERTU (isInitialized()); if (!isInitialized()) return AAFRESULT_NOT_INITIALIZED; if (!pObject->attached()) { return AAFRESULT_OBJECT_NOT_ATTACHED; } if (NULL != referenceProperty()) { // Save the reference in the OMReferenceProperty result = SetNewObjectReference(referenceProperty(), pObject); } else { // Use an "indirect access" method of saving a weak object reference. // // If there was not associated reference property then we MUST // set the local object pointer for this instance. // // This weak reference should be an element of a weak reference set or // weak reference array. SetLocalObject(pObject); } return result; }
AAFRESULT STDMETHODCALLTYPE ImplAAFWeakRefValue::GetObject(ImplAAFStorable **ppObject) const { AAFRESULT result = AAFRESULT_SUCCESS; ImplAAFStorable *pObject = NULL; if (NULL == ppObject) return AAFRESULT_NULL_PARAM; *ppObject = NULL; ASSERTU (isInitialized()); if (!isInitialized()) return AAFRESULT_NOT_INITIALIZED; OMReferenceProperty* pProperty = referenceProperty(); if (NULL != pProperty) { if (! pProperty->isOptional() || pProperty->isPresent ()) { OMObject *object = pProperty->getObject(); if (NULL == object) return AAFRESULT_NULLOBJECT; pObject = ConvertOMObjectToRoot(object); ASSERTU (NULL != pObject); if (NULL == pObject) return AAFRESULT_INVALID_OBJ; // ??? } else { return AAFRESULT_PROP_NOT_PRESENT; } } else { // Use an "indirect access" method of retrieving a strong object reference. // // If there was not associated reference property then there MUST // be a local object pointer assigned to this instance. pObject = GetLocalObject(); ASSERTU (NULL != pObject); } *ppObject = pObject; (*ppObject)->AcquireReference(); return result; }