FAUST compiler  0.9.9.6b8
Public Member Functions | Private Attributes | List of all members
enlargedSchema Class Reference

An enlarged schema. More...

#include <enlargedSchema.h>

Inheritance diagram for enlargedSchema:
Inheritance graph
[legend]
Collaboration diagram for enlargedSchema:
Collaboration graph
[legend]

Public Member Functions

 enlargedSchema (schema *s, double width)
 Put additional space left and right of a schema so that the result has a certain width. More...
 
virtual void place (double x, double y, int orientation)
 Define the graphic position of the schema. More...
 
virtual void draw (device &dev)
 Draw the enlarged schema. More...
 
virtual point inputPoint (unsigned int i) const
 Returns an input point. More...
 
virtual point outputPoint (unsigned int i) const
 Returns an output point. More...
 
virtual void collectTraits (collector &c)
 Draw the enlarged schema. More...
 
- Public Member Functions inherited from schema
 schema (unsigned int inputs, unsigned int outputs, double width, double height)
 
virtual ~schema ()
 
double width () const
 
double height () const
 
unsigned int inputs () const
 
unsigned int outputs () const
 
void beginPlace (double x, double y, int orientation)
 
void endPlace ()
 
bool placed () const
 
double x () const
 
double y () const
 
int orientation () const
 

Private Attributes

schemafSchema
 
vector< pointfInputPoint
 
vector< pointfOutputPoint
 

Detailed Description

An enlarged schema.

Definition at line 35 of file enlargedSchema.h.

Constructor & Destructor Documentation

enlargedSchema::enlargedSchema ( schema s,
double  width 
)

Put additional space left and right of a schema so that the result has a certain width.

The wires are prolonged accordingly.

Definition at line 45 of file enlargedSchema.cpp.

References fInputPoint, fOutputPoint, schema::inputs(), and schema::outputs().

46  : schema(s->inputs(), s->outputs(), width, s->height()),
47  fSchema(s)
48 {
49  for (unsigned int i=0; i<inputs(); i++) fInputPoint.push_back(point(0,0));
50  for (unsigned int i=0; i<outputs(); i++) fOutputPoint.push_back(point(0,0));
51 }
unsigned int outputs() const
Definition: schema.h:129
unsigned int inputs() const
Definition: schema.h:128
double width() const
Definition: schema.h:126
vector< point > fInputPoint
schema(unsigned int inputs, unsigned int outputs, double width, double height)
Definition: schema.h:113
schema * fSchema
Definition: schema.h:40
double height() const
Definition: schema.h:127
vector< point > fOutputPoint

Here is the call graph for this function:

Member Function Documentation

void enlargedSchema::collectTraits ( collector c)
virtual

Draw the enlarged schema.

This methos can only be called after the block have been placed

Implements schema.

Definition at line 133 of file enlargedSchema.cpp.

References collector::addTrait(), schema::collectTraits(), fSchema, inputPoint(), schema::inputPoint(), schema::inputs(), outputPoint(), schema::outputPoint(), schema::outputs(), and schema::placed().

134 {
135  assert(placed());
136 
138 
139  // draw enlarge input wires
140  for (unsigned int i=0; i<inputs(); i++) {
141  point p = inputPoint(i);
142  point q = fSchema->inputPoint(i);
143  c.addTrait(trait(p,q)); // in->out direction
144  }
145 
146  // draw enlarge output wires
147  for (unsigned int i=0; i<outputs(); i++) {
148  point q = fSchema->outputPoint(i);
149  point p = outputPoint(i);
150  c.addTrait(trait(q,p)); // in->out direction
151  }
152 }
void addTrait(const trait &t)
Definition: schema.h:84
Definition: schema.h:56
unsigned int outputs() const
Definition: schema.h:129
virtual point outputPoint(unsigned int i) const
Returns an output point.
virtual point inputPoint(unsigned int i) const =0
virtual void collectTraits(collector &c)=0
unsigned int inputs() const
Definition: schema.h:128
bool placed() const
Definition: schema.h:137
schema * fSchema
Definition: schema.h:40
virtual point outputPoint(unsigned int i) const =0
virtual point inputPoint(unsigned int i) const
Returns an input point.

Here is the call graph for this function:

void enlargedSchema::draw ( device dev)
virtual

Draw the enlarged schema.

This methos can only be called after the block have been placed

Implements schema.

Definition at line 107 of file enlargedSchema.cpp.

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

108 {
109  assert(placed());
110 
111  fSchema->draw(dev);
112 #if 0
113  // draw enlarge input wires
114  for (unsigned int i=0; i<inputs(); i++) {
115  point p = inputPoint(i);
116  point q = fSchema->inputPoint(i);
117  if ( (p.z>=0) && (q.z>=0) ) dev.trait(p.x, p.y, q.x, q.y);
118  }
119 
120  // draw enlarge output wires
121  for (unsigned int i=0; i<outputs(); i++) {
122  point p = outputPoint(i);
123  point q = fSchema->outputPoint(i);
124  if ( (p.z>=0) && (q.z>=0) ) dev.trait(p.x, p.y, q.x, q.y);
125  }
126 #endif
127 }
unsigned int outputs() const
Definition: schema.h:129
virtual point outputPoint(unsigned int i) const
Returns an output point.
virtual point inputPoint(unsigned int i) const =0
virtual void draw(device &dev)=0
unsigned int inputs() const
Definition: schema.h:128
double y
Definition: schema.h:43
bool placed() const
Definition: schema.h:137
schema * fSchema
double x
Definition: schema.h:42
Definition: schema.h:40
virtual point outputPoint(unsigned int i) const =0
virtual void trait(double x1, double y1, double x2, double y2)=0
virtual point inputPoint(unsigned int i) const
Returns an input point.

Here is the call graph for this function:

point enlargedSchema::inputPoint ( unsigned int  i) const
virtual

Returns an input point.

Implements schema.

Definition at line 86 of file enlargedSchema.cpp.

References fInputPoint, schema::inputs(), and schema::placed().

Referenced by collectTraits(), and draw().

87 {
88  assert (placed());
89  assert (i < inputs());
90  return fInputPoint[i];
91 }
unsigned int inputs() const
Definition: schema.h:128
bool placed() const
Definition: schema.h:137
vector< point > fInputPoint

Here is the call graph for this function:

Here is the caller graph for this function:

point enlargedSchema::outputPoint ( unsigned int  i) const
virtual

Returns an output point.

Implements schema.

Definition at line 96 of file enlargedSchema.cpp.

References fOutputPoint, schema::outputs(), and schema::placed().

Referenced by collectTraits(), and draw().

97 {
98  assert (placed());
99  assert (i < outputs());
100  return fOutputPoint[i];
101 }
unsigned int outputs() const
Definition: schema.h:129
bool placed() const
Definition: schema.h:137
vector< point > fOutputPoint

Here is the call graph for this function:

Here is the caller graph for this function:

void enlargedSchema::place ( double  ox,
double  oy,
int  orientation 
)
virtual

Define the graphic position of the schema.

Computes the graphic position of all the elements, in particular the inputs and outputs. This method must be called before draw(), otherwise draw is not allowed

Implements schema.

Definition at line 59 of file enlargedSchema.cpp.

References schema::beginPlace(), schema::endPlace(), fInputPoint, fOutputPoint, fSchema, schema::inputPoint(), schema::inputs(), kRightLeft, schema::outputPoint(), schema::outputs(), schema::place(), schema::width(), point::x, and point::y.

60 {
61  beginPlace(ox, oy, orientation);
62 
63  double dx = (width() - fSchema->width())/2;
64  fSchema->place(ox+dx, oy, orientation);
65 
66  if (orientation == kRightLeft) {
67  dx = -dx;
68  }
69 
70  for (unsigned int i=0; i < inputs(); i++) {
71  point p = fSchema->inputPoint(i);
72  fInputPoint[i] = point(p.x-dx, p.y); //, p.z);
73  }
74 
75  for (unsigned int i=0; i < outputs(); i++) {
76  point p = fSchema->outputPoint(i);
77  fOutputPoint[i] = point(p.x+dx, p.y); //, p.z);
78  }
79 
80  endPlace();
81 }
void endPlace()
Definition: schema.h:134
unsigned int outputs() const
Definition: schema.h:129
virtual point inputPoint(unsigned int i) const =0
void beginPlace(double x, double y, int orientation)
Definition: schema.h:132
unsigned int inputs() const
Definition: schema.h:128
double width() const
Definition: schema.h:126
double y
Definition: schema.h:43
vector< point > fInputPoint
int orientation() const
Definition: schema.h:140
virtual void place(double x, double y, int orientation)=0
schema * fSchema
double x
Definition: schema.h:42
Definition: schema.h:40
virtual point outputPoint(unsigned int i) const =0
vector< point > fOutputPoint

Here is the call graph for this function:

Member Data Documentation

vector<point> enlargedSchema::fInputPoint
private

Definition at line 38 of file enlargedSchema.h.

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

vector<point> enlargedSchema::fOutputPoint
private

Definition at line 39 of file enlargedSchema.h.

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

schema* enlargedSchema::fSchema
private

Definition at line 37 of file enlargedSchema.h.

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


The documentation for this class was generated from the following files: