recSchema Class Reference

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

#include <recSchema.h>

Inherits schema.

Collaboration diagram for recSchema:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void place (double ox, double oy, int orientation)
 The two subschema are placed centered vertically, s2 on top of s1.
virtual void draw (device &dev)
 Draw the two subschema s1 and s2 as well as the feedback connections between s1 and s2, and the feedfrom connections beetween s2 and s1.
virtual point inputPoint (unsigned int i) const
 The input points s1 ~ s2.
virtual point outputPoint (unsigned int i) const
 The output points s1 ~ s2.

Friends

schemamakeRecSchema (schema *s1, schema *s2)
 Creates a new recursive schema (s1 ~ s2).

Detailed Description

place and connect two diagrams in recursive composition

Definition at line 33 of file recSchema.h.


Member Function Documentation

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

The two subschema are placed centered vertically, s2 on top of s1.

The input and output points are computed.

Implements schema.

Definition at line 71 of file recSchema.cpp.

00072 {
00073     beginPlace(ox, oy, orientation);
00074 
00075     double dx1 = (width() - fSchema1->width())/2;
00076     double dx2 = (width() - fSchema2->width())/2;
00077 
00078     // place the two sub diagrams
00079     if (orientation == kLeftRight) {
00080         fSchema2->place(ox+dx2, oy, kRightLeft);
00081         fSchema1->place(ox+dx1, oy+fSchema2->height(), kLeftRight);
00082     } else {
00083         fSchema1->place(ox+dx1, oy, kRightLeft);
00084         fSchema2->place(ox+dx2, oy+fSchema1->height(), kLeftRight);
00085     }
00086 
00087 
00088     // adjust delta space to orientation
00089     if (orientation == kRightLeft) { dx1 = -dx1; }
00090 
00091     // place input points
00092     for (unsigned int i=0; i<inputs(); i++) {
00093         point p = fSchema1->inputPoint(i+fSchema2->outputs());
00094         fInputPoint[i] = point(p.x-dx1, p.y);
00095     }
00096 
00097     // place output points
00098     for (unsigned int i=0; i<outputs(); i++) {
00099         point p = fSchema1->outputPoint(i);
00100         fOutputPoint[i] = point(p.x+dx1, p.y);
00101     }
00102 
00103     endPlace();
00104 }


Friends And Related Function Documentation

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

Creates a new recursive schema (s1 ~ s2).

The smallest component is enlarged to the width of the other. The left and right horizontal margins are computed according to the number of internal connections.

Definition at line 34 of file recSchema.cpp.

00035 {
00036     schema* a = makeEnlargedSchema(s1, s2->width());
00037     schema* b = makeEnlargedSchema(s2, s1->width());
00038     double  m = dWire * max(b->inputs(), b->outputs());
00039     double  w = a->width() + 2*m;
00040 
00041     return new recSchema(a,b,w);
00042 }


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208