[Sofaswitch-svn] [commit] r311 - in sofaswitch/trunk/callflow: docs docs/current src
Author: derek Date: Tue Jun 12 19:35:06 2007 New Revision: 311 Removed: sofaswitch/trunk/callflow/docs/current/faultyjoinexample.png Modified: sofaswitch/trunk/callflow/docs/callflow.xml sofaswitch/trunk/callflow/docs/chap2.sgml sofaswitch/trunk/callflow/docs/chap3.sgml sofaswitch/trunk/callflow/src/canvas.cpp sofaswitch/trunk/callflow/src/dnd.cpp sofaswitch/trunk/callflow/src/dnd.h sofaswitch/trunk/callflow/src/shapelist.cpp Log: Modify docs to get them closer to correct. Add test, so that on compiling, do not accept graphs that have multiple structures connected to one output box. Modified: sofaswitch/trunk/callflow/docs/callflow.xml ============================================================================== --- sofaswitch/trunk/callflow/docs/callflow.xml (original) +++ sofaswitch/trunk/callflow/docs/callflow.xml Tue Jun 12 19:35:06 2007 @@ -55,3 +55,12 @@ </book> + + > current/faultyjoinexample.png + > current/MakeCall.png + > current/startflow.png + > current/validjoinexample.png + > deathexample.png + > exchildgraph.png + > exloadnewgraph.png + > faultyendprocessing.png Modified: sofaswitch/trunk/callflow/docs/chap2.sgml ============================================================================== --- sofaswitch/trunk/callflow/docs/chap2.sgml (original) +++ sofaswitch/trunk/callflow/docs/chap2.sgml Tue Jun 12 19:35:06 2007 @@ -20,7 +20,8 @@ <title>Hello World example</title> <para> Perhaps the simplest example of a graph you can create is the standard "Hello -World" example, shown here, in figure <xref xrefstyle="select: labelnumber" linkend="helloworldexample"/>. +World" example, shown here, in figure <xref xrefstyle="select: labelnumber" +linkend="helloworldexample"/>. <figure id="helloworldexample"> <title>The standard "Hello World" example</title> <mediaobject><imageobject> @@ -56,6 +57,40 @@ </para> <para> +The output connection of a control element should be connected to the input +connection of one other control element. Joining the output connector of a +control element to two other places is ambiguous, and is an error. Thus, the +left graph depicted in figure <xref xrefstyle="select: labelnumber" +linkend="ambiguousconnection"/> is wrong. Further, you will note that the filled circles +indicating a join are drawn +<figure id="ambiguousconnection"> +<title>Joining of control elements</title> +<informaltable frame="all"> +<tgroup cols="2"> +<tbody><row><entry> +<mediaobject><imageobject> +<imagedata fileref="diagrams/faultyjoinexample.png" align="center" format="PNG"></imagedata> +</imageobject></mediaobject> +</entry> +<entry> +<mediaobject><imageobject> +<imagedata fileref="diagrams/GoodJoin.png" align="center" format="PNG"></imagedata> +</imageobject></mediaobject> +</entry> +</row> +<row><entry><para> +Faulty graph +</para></entry> +<entry><para> +Correct graph +</para></entry></row> +</tbody> +</tgroup> +</informaltable> +</figure> + + +<para> When Python code generated from the above graph is run, several messages to and from the server. First, there is a message to the server saying that a new entity has been created, but without a specific &sofaswitch; identity. The Modified: sofaswitch/trunk/callflow/docs/chap3.sgml ============================================================================== --- sofaswitch/trunk/callflow/docs/chap3.sgml (original) +++ sofaswitch/trunk/callflow/docs/chap3.sgml Tue Jun 12 19:35:06 2007 @@ -702,7 +702,9 @@ item. There is no ambiguity over where the flow of execution should go. However, connecting the output of one control item to multiple other control items is incorrect, as the correct direction for execution is not -determinable. +determinable. Thus, the left image in figure +<xref xrefstyle="select: labelnumber" linkend="ambiguousconection"/> is +invalid, but the right image is correct. </para> Modified: sofaswitch/trunk/callflow/src/canvas.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/canvas.cpp (original) +++ sofaswitch/trunk/callflow/src/canvas.cpp Tue Jun 12 19:35:06 2007 @@ -154,7 +154,7 @@ } /* Left button down, no current "Kind" selected. we are therefore going to - * move an object from the cureent position, or mark additional buttons.. */ + * move an object from the current position, or mark additional buttons.. */ if (!event.ShiftDown ()) { selectingRegion.SetSelected (false); selectingRegion.SetPosition (lastMousePoint); Modified: sofaswitch/trunk/callflow/src/dnd.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/dnd.cpp (original) +++ sofaswitch/trunk/callflow/src/dnd.cpp Tue Jun 12 19:35:06 2007 @@ -90,7 +90,7 @@ otherNodeLabel = wxString(""); otherNodeIndex = -1; otherNodeKind = DndShape::None; -} + countLinks = 0;} LabelledPoint::LabelledPoint(int x, int y) { @@ -98,6 +98,7 @@ otherNodeLabel = wxString(""); otherNodeIndex = -1; otherNodeKind = DndShape::None; + countLinks = 0; } LabelledPoint::LabelledPoint(int x, int y, const wxString & newLabel) @@ -106,6 +107,7 @@ otherNodeLabel = wxString(newLabel); otherNodeIndex = -1; otherNodeKind = DndShape::None; + countLinks = 1; } LabelledPoint::LabelledPoint(wxPoint &srcData) @@ -114,6 +116,7 @@ otherNodeLabel = wxString(""); otherNodeIndex = -1; otherNodeKind = DndShape::None; + countLinks = 0; } LabelledPoint::LabelledPoint(wxPoint &srcData, const wxString & srcString) @@ -122,16 +125,24 @@ otherNodeLabel = wxString(srcString); otherNodeIndex = -1; otherNodeKind = DndShape::None; + countLinks = 1; } LabelledPoint::~LabelledPoint() { } +void LabelledPoint::SetOtherNodeLabel(const wxString & otherNode) +{ + otherNodeLabel = otherNode; + countLinks++; +} + void LabelledPoint::PrintMe() { wxString f = GetFullLabel(); - printf(" Labelled Point %s %d %d\n", f.c_str(), thisPoint.x, thisPoint.y); + std::cerr << " Labelled Point " << f << " " <<thisPoint.x + << " " << thisPoint.y << " links#" << countLinks << std::endl; } wxString LabelledPoint::GetFullLabel() const @@ -161,14 +172,15 @@ void LabelledPoint::ClearData() { - otherNodeKind = -1; - otherNodeIndex = -1; - if (otherNodeLabel.IsNull()) - printf("not null\n"); - otherNodeLabel = wxString(""); - if (otherNodeLabel.IsNull()) - printf("not null second time.\n"); - + countLinks = 0; + otherNodeKind = -1; + otherNodeIndex = -1; + if (otherNodeLabel.IsNull()) + printf("not null\n"); + otherNodeLabel = wxString(""); + if (otherNodeLabel.IsNull()) + printf("not null second time.\n"); + } bool LabelledPoint::LinksToShape() @@ -182,6 +194,11 @@ return true; } +bool LabelledPoint::MultipleLinks() +{ + return countLinks > 1; +} + int LabelledPoint::DistanceBetween(wxPoint & suppliedPoint) { int deltaX = suppliedPoint.x - thisPoint.x; @@ -328,6 +345,24 @@ return true; } +bool MyListPoints::OneToMany() +{ + wxNode *node = (wxNode *)GetFirst(); + + while (node != NULL) { + LabelledPoint *thisLabel = (LabelledPoint *)node->GetData(); + + if (thisLabel->MultipleLinks()) + return true; + + node = node->GetNext(); + } + + return false; +} + + + bool MyListPoints::PointLinked(int index) { wxNode *node = (wxNode *)GetFirst(); @@ -368,6 +403,11 @@ return outputPoints.AllLinked(); } +bool DndShape::OutputOneToMany() +{ + return outputPoints.OneToMany(); +} + bool DndShape::TestInternalVariables() { ClearCompileError(); @@ -843,6 +883,7 @@ printf("\n\n"); } + void DndShape::MarkMatchingPoints(MyListPoints &setInput) { if (setInput.GetCount() == 0) { Modified: sofaswitch/trunk/callflow/src/dnd.h ============================================================================== --- sofaswitch/trunk/callflow/src/dnd.h (original) +++ sofaswitch/trunk/callflow/src/dnd.h Tue Jun 12 19:35:06 2007 @@ -106,8 +106,7 @@ /**Set the label, which describes the id of the node associated with this point */ - void SetOtherNodeLabel(const wxString & otherNode) - { otherNodeLabel = otherNode; } + void SetOtherNodeLabel(const wxString & otherNode); /**Set the other node index, which describes the index of the point from the otherNodes list of points. With this information, we @@ -133,6 +132,9 @@ the list of type "MyExtendedShapes"*/ bool LinksToShape(); + /**Report TRUE if this point is linked to two other shapes */ + bool MultipleLinks(); + /**Report the distance from the supplied point to this point */ int DistanceBetween(wxPoint & supppliedPoint); @@ -151,6 +153,13 @@ /**The DndShap::Kind enum, which describes the type of the othe rnode */ int otherNodeKind; + + /**The count of the number of links made by this point to another point. + This value can be 0 (not linked), 1 (linked to another node). If it is 2, + then it implies this point is connected to two other points. A value of 2 + is fine if this is an input node. If this is an output node, 2 is an + error.*/ + int countLinks; }; @@ -243,6 +252,10 @@ rounding is done, false is returned. */ bool GravityPoint(wxPoint & srcPoint); + /**Go through this list of points. report TRUE if any of them is linked + twice. This method is used to test for when an output pint is linked + to two other nodes */ + bool OneToMany(); protected: /**the key of the owner of this list. This key is the unique Id @@ -420,6 +433,12 @@ somewhere. Return False if there is a dangling output point */ virtual bool CheckOutputPointsLinked(); + /**Check that none of the output points is linked to two different + places. Thus, we want to find an output point that is connected to two + (or more) different places. Such a linking pattern is ambiguous, and + an error. This error is discovered at compile time */ + virtual bool OutputOneToMany(); + /**Report the key which labels this unique shape */ wxString GetKey() const { return uniqueKey; } Modified: sofaswitch/trunk/callflow/src/shapelist.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/shapelist.cpp (original) +++ sofaswitch/trunk/callflow/src/shapelist.cpp Tue Jun 12 19:35:06 2007 @@ -251,6 +251,10 @@ it = begin(); while (it != end()) { DndShape *thisShape = it->second; + bool multipleOnOutput = thisShape->OutputOneToMany(); + if (multipleOnOutput) + thisShape->SetCompileError("Ambiguous - output goes to two places"); + bool thisLinked = thisShape->CheckOutputPointsLinked(); if (!thisLinked) thisShape->SetCompileError("Not all output points are linked");
participants (1)
-
SofaSWITCH SVN