splitSchema Class Reference

place and connect two diagrams in split composition More...

#include <splitSchema.h>

Inherits schema.

Collaboration diagram for splitSchema:
[legend]

List of all members.

Public Member Functions

virtual void place (double ox, double oy, int orientation)
 Places the two subschema horizontaly, centered, with enough gap for the connections.
virtual void draw (device &dev)
 Draw the two sub schema and the connections between them.
virtual point inputPoint (unsigned int i) const
 The inputs of s1 <: s2 are the inputs of s1.
virtual point outputPoint (unsigned int i) const
 The outputs of s1 <: s2 are the outputs of s2.

Private Member Functions

 splitSchema (schema *s1, schema *s2, double hgap)
 Constructor for a split schema s1 <: s2 where the outputs of s1 are distributed to the inputs of s2.

Private Attributes

schemafSchema1
schemafSchema2
double fHorzGap

Friends

schemamakeSplitSchema (schema *s1, schema *s2)
 Creates a new split schema.

Detailed Description

place and connect two diagrams in split composition

Definition at line 33 of file splitSchema.h.


Constructor & Destructor Documentation

splitSchema::splitSchema ( schema s1,
schema s2,
double  hgap 
) [private]

Constructor for a split schema s1 <: s2 where the outputs of s1 are distributed to the inputs of s2.

The constructor is private in order to enforce the usage of makeSplitSchema

Definition at line 52 of file splitSchema.cpp.

00053     :   schema( s1->inputs(),
00054                 s2->outputs(),
00055                 s1->width() + s2->width() + hgap,
00056                 max(s1->height(), s2->height()) ),
00057         fSchema1(s1),
00058         fSchema2(s2),
00059         fHorzGap(hgap)
00060 {
00061 }


Member Function Documentation

void splitSchema::draw ( device dev  )  [virtual]

Draw the two sub schema and the connections between them.

Implements schema.

Definition at line 106 of file splitSchema.cpp.

References schema::draw(), fSchema1, fSchema2, schema::inputPoint(), schema::inputs(), schema::outputPoint(), schema::outputs(), schema::placed(), device::trait(), point::x, and point::y.

00107 {
00108     assert(placed());
00109 
00110     // draw the two subdiagrams
00111     fSchema1->draw(dev);
00112     fSchema2->draw(dev);
00113 
00114     unsigned int r = fSchema1->outputs();
00115     assert(r>0);
00116 
00117     // draw the connections between them
00118     for (unsigned int i=0; i<fSchema2->inputs(); i++) {
00119         point p = fSchema1->outputPoint(i%r);
00120         point q = fSchema2->inputPoint(i);
00121         dev.trait(p.x, p.y, q.x, q.y);
00122     }
00123 }

Here is the call graph for this function:

point splitSchema::inputPoint ( unsigned int  i  )  const [virtual]

The inputs of s1 <: s2 are the inputs of s1.

Implements schema.

Definition at line 88 of file splitSchema.cpp.

References fSchema1, and schema::inputPoint().

00089 {
00090     return fSchema1->inputPoint(i);
00091 }

Here is the call graph for this function:

point splitSchema::outputPoint ( unsigned int  i  )  const [virtual]

The outputs of s1 <: s2 are the outputs of s2.

Implements schema.

Definition at line 97 of file splitSchema.cpp.

References fSchema2, and schema::outputPoint().

00098 {
00099     return fSchema2->outputPoint(i);
00100 }

Here is the call graph for this function:

void splitSchema::place ( double  ox,
double  oy,
int  orientation 
) [virtual]

Places the two subschema horizontaly, centered, with enough gap for the connections.

Implements schema.

Definition at line 68 of file splitSchema.cpp.

References schema::beginPlace(), schema::endPlace(), fHorzGap, fSchema1, fSchema2, schema::height(), kLeftRight, max(), schema::place(), and schema::width().

00069 {
00070     beginPlace(ox, oy, orientation);
00071 
00072     double dy1 = max(0.0, fSchema2->height()-fSchema1->height()) / 2.0;
00073     double dy2 = max(0.0, fSchema1->height()-fSchema2->height()) / 2.0;
00074 
00075     if (orientation == kLeftRight) {
00076         fSchema1->place(ox, oy+dy1, orientation);
00077         fSchema2->place(ox+fSchema1->width()+fHorzGap, oy+dy2, orientation);
00078     } else {
00079         fSchema2->place(ox, oy+dy2, orientation);
00080         fSchema1->place(ox+fSchema2->width()+fHorzGap, oy+dy1, orientation);
00081     }
00082     endPlace();
00083 }

Here is the call graph for this function:


Friends And Related Function Documentation

schema* makeSplitSchema ( schema s1,
schema s2 
) [friend]

Creates a new split schema.

Cables are enlarged to dWire. The horizontal gap between the two subschema is such that the connections are not too slopy.

Definition at line 34 of file splitSchema.cpp.

00035 {
00036     // make sure a and b are at least dWire large
00037     schema * a = makeEnlargedSchema(s1, dWire);
00038     schema * b = makeEnlargedSchema(s2, dWire);
00039 
00040     // horizontal gap to avaoid too slopy connections
00041     double  hgap = (a->height()+b->height())/4;
00042 
00043     return new splitSchema(a,b,hgap);
00044 }


Member Data Documentation

double splitSchema::fHorzGap [private]

Definition at line 37 of file splitSchema.h.

Referenced by place().

Definition at line 35 of file splitSchema.h.

Referenced by draw(), inputPoint(), and place().

Definition at line 36 of file splitSchema.h.

Referenced by draw(), outputPoint(), and place().


The documentation for this class was generated from the following files:
Generated on Thu Jul 15 15:47:37 2010 for FAUST compiler by  doxygen 1.6.3