Some AAF v1.0 class definitions (in this example
the 'TapeDescriptor' class definition) are not returned by
the dictionary when the 'GetClassDefs' method is used.
However, the class definition is present in the file
because it can be found when using
the 'LookupClassDef' method.
The attached file contains an example program which
demonstrates this behaviour, using axLib.
Phil
Source code example showing this bug
Logged In: YES
user_id=239292
630436.A.out.txt is the output of the attached program.
The class list are all those present in the dictionary of the aaf
file in AAFGetClassDefsBug.zip. (Note, this aaf file is created
by example2/axExample).
As described, the TapeDescriptor is not present but the uid
lookup succeeds.
Logged In: YES
user_id=239292
Re: 630436.B.out.txt
The test program was modified to iterate over the class
definitions a second time after the TapeDescriptor uid lookup.
I expected to see TapeDescriptor in the dictionary. Indeed it
exists in the dictionary the second time around, but the
iterator now fails to iterate over the entire list, and an
assertion fails at the point indicated in the source code at the
end of 630436.B.out.txt. Perhaps, indicating another error.
Logged In: YES
user_id=239292
Disregard the previous note about 630436.B.out.txt. In fact, a
call to ImplAAFDictionary::LookupClassDef
(AUID_TapeDescriptor) results in the class being present the
next time one iterates over the set of class definitions in the
dictionary - as one might expect.
The key to resolving this, I beleive, lies in making all class
definitiona axiomatic. Initializing them, as such, in
AAFObjectModel::InitializeAxiomaticDefinitions(void) is one
(the only?) way to accomplish that.
Logged In: YES
user_id=239292
I modified AAFObjectModel::InitializeAxiomaticDefinitions()
so that all class definitions are made axiomatic.
ImplAAFDictionary::GetClassDefs() now returns the full set of
class definitions - 84 of them at the moment - rather than just
those classes present in a file, and the few that formerly were
made axiomatic in
AAFObjectModel::InitializeAxiomaticDefinitions().
This change was introduced at revision 1.13 of
AAFObjectModel.cpp.
Logged In: YES
user_id=239292
Reopened.
The previous solution was a tad too brute.
Logged In: YES
user_id=239292
More comments:
1) The documentation in AAF.h states that
IAAFDictionary::GetClassDefs() returns the class definition of
all classes. "All" must be clarified. Does it mean:
1.1) All registered class definitions.
1.2) All known class definitions.
"Registered" class definitions are those in the
ImplAAFMetaDictionary::_classDefinitions set. (Axiomatic
class definitions end up in this set during initialization.) Take
a peak at ImplAAFMetaDictionary::
{RegisterClassDef,PvtRegisterClassDef}().
2) LookupClassDef() checks if the requested class is
axiomitic, exists in the dictionary, or is builtin. In all cases
the requested class is registered - i.e., added to
_classDefinitions if it was not already there.
3) Because LookupClassDef() registers all classes that it
exectues a look up on, subsequent calls to GetClassDefs()
will include class definitions that were registered by
LookupClassDef(). Hence, GetClassDef() will not always
return the same set of class definitions.
In light of point 3, 1.1 strikes me as odd behavior.
Hence, I'd say that 1.2 is correct.... which means
GetClassDefs() is currently wrong.
If GetClassDefs() should return all known class definitions,
then I think that all class definitions will have to be
registered. Registering the built in class definitions at
initialization time would resolve this. (IMO, of course).
This bug will stay open until the behavior of GetClassDef()
is verified.
Logged In: YES
user_id=239292
More comments:
1) The documentation in AAF.h states that
IAAFDictionary::GetClassDefs() returns the class definition of
all classes. "All" must be clarified. Does it mean:
1.1) All registered class definitions.
1.2) All known class definitions.
"Registered" class definitions are those in the
ImplAAFMetaDictionary::_classDefinitions set. (Axiomatic
class definitions end up in this set during initialization.) Take
a peak at ImplAAFMetaDictionary::
{RegisterClassDef,PvtRegisterClassDef}().
2) LookupClassDef() checks if the requested class is
axiomitic, exists in the dictionary, or is builtin. In all cases
the requested class is registered - i.e., added to
_classDefinitions if it was not already there.
3) Because LookupClassDef() registers all classes that it
exectues a look up on, subsequent calls to GetClassDefs()
will include class definitions that were registered by
LookupClassDef(). Hence, GetClassDef() will not always
return the same set of class definitions.
In light of point 3, 1.1 strikes me as odd behavior.
Hence, I'd say that 1.2 is correct.... which means
GetClassDefs() is currently wrong.
If GetClassDefs() should return all known class definitions,
then I think that all class definitions will have to be
registered. Registering the built in class definitions at
initialization time would resolve this. (IMO, of course).
This bug will stay open until the behavior of GetClassDef()
is verified.