From: Jesse L. <jl...@us...> - 2006-01-16 19:24:40
|
Update of /cvsroot/aaf/AAF/Utilities/AAFAnalyzer/BaseTestImpl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16845/BaseTestImpl Modified Files: AcyclicVisitor.cpp AcyclicVisitor.h Log Message: Updated the cycle check to output node names, etc. Index: AcyclicVisitor.h =================================================================== RCS file: /cvsroot/aaf/AAF/Utilities/AAFAnalyzer/BaseTestImpl/AcyclicVisitor.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AcyclicVisitor.h 18 Oct 2005 17:02:42 -0000 1.4 --- AcyclicVisitor.h 16 Jan 2006 19:24:29 -0000 1.5 *************** *** 41,45 **** public: ! typedef vector<Node::LID> Vector; AcyclicVisitor(wostream& os); --- 41,46 ---- public: ! //typedef vector<Node::LID> Vector; ! typedef vector<shared_ptr<Node> > Vector; AcyclicVisitor(wostream& os); Index: AcyclicVisitor.cpp =================================================================== RCS file: /cvsroot/aaf/AAF/Utilities/AAFAnalyzer/BaseTestImpl/AcyclicVisitor.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AcyclicVisitor.cpp 1 Dec 2005 19:18:19 -0000 1.7 --- AcyclicVisitor.cpp 16 Jan 2006 19:24:29 -0000 1.8 *************** *** 26,30 **** #include <DetailLevelTestResult.h> #include <TestRegistry.h> ! //Requirement files #include <Requirement.h> --- 26,30 ---- #include <DetailLevelTestResult.h> #include <TestRegistry.h> ! #include <AnalyzerException.h> //Requirement files #include <Requirement.h> *************** *** 33,36 **** --- 33,46 ---- #include <Node.h> + //AAF Analyzer Base files + #include <AAFObjNode.h> + + //Axlib files + #include <AxObject.h> + #include <AxMob.h> + #include <AxUtil.h> + #include <AxMobSlot.h> + #include <AxComponent.h> + //STL files #include <ostream> *************** *** 91,110 **** //add node into the vector since it was visited on this sub-branch's traversal ! _Vector.push_back(lid); this->RecordVisit( lid ); return true; } ! // a cycle was detected ! _spResult->SetExplanation(L"Cycle detected.!"); ! _spResult->SetResult(TestResult::FAIL); ! //TODO: Dump something more useful than the vector of LIDs. ! _os << "Nodes of the cycle:" << endl; for(unsigned int i = 0; i < _Vector.size(); i++) { ! _os << _Vector.at(i) << endl; } ! _os << lid << endl; return false; --- 101,155 ---- //add node into the vector since it was visited on this sub-branch's traversal ! _Vector.push_back(node.GetSharedPointerToNode()); this->RecordVisit( lid ); return true; } ! // a cycle was detected ! ! AxStringUtil au; ! wstring newl=wstring(L"\n"); ! wstring cycle=wstring(L"Nodes of the cycle:") + newl ; ! _Vector.push_back(node.GetSharedPointerToNode()); ! for(unsigned int i = 0; i < _Vector.size(); i++) { ! cycle+=wstring(L"Node: ") + wstring(au.int2Str(_Vector.at(i)->GetLID())) + wstring(L" Object - ") + wstring( _Vector.at(i)->GetName()) +newl; ! //_os <<"Node: "<< _Vector.at(i)->GetLID() <<" Object - "<< _Vector.at(i)->GetName()<<endl; ! AAFObjNode& a=static_cast<AAFObjNode&>(*(_Vector.at(i))); ! AxObject axObj( a.GetAAFObject() ); ! ! IAAFMobSP spMob; ! IAAFMobSlotSP spMobS; ! IAAFSourceReferenceSP spSR; ! ! if (AxIsA(axObj, spMobS)){ ! AxMobSlot axMobS(spMobS); ! cycle+= wstring(L" SlotID - ") + wstring(au.int2Str(axMobS.GetSlotID())) + newl; ! //_os<<" SlotID - "<<axMobS.GetSlotID()<<endl; ! } ! else if(AxIsA(axObj, spMob)){ ! AxMob axMob(spMob); ! cycle += wstring( L" Name - ") + wstring(axMob.GetName()) + newl; ! cycle +=wstring( L" MobID - " + au.mobid2Str(axMob.GetMobID())) + newl; ! //_os<<" Name - "<<axMob.GetName()<<endl; ! //_os<<" MobID - "<<au.mobid2Str(axMob.GetMobID())<<endl; ! } ! else if (AxIsA(axObj,spSR)){ ! AxSourceReference axSR(spSR); ! cycle+= wstring(L" SourceID - " + au.mobid2Str(axSR.GetSourceID())) +newl; ! //_os<<" SourceID - "<<au.mobid2Str(axSR.GetSourceID())<<endl; ! } ! } ! cycle+=newl; ! //_os<<endl; ! ! _spResult->SetExplanation(L"Cycle detected!" +newl +cycle); ! _spResult->SetResult(TestResult::FAIL); ! _Vector.pop_back(); ! ! throw AnalyzerException(L"Graph not acyclic."); return false; |