FAUST compiler  0.9.9.6b8
Public Member Functions | Private Member Functions | Private Attributes | Friends
topSchema Class Reference

A topSchema is a schema surrounded by a dashed rectangle with a label on the top left. More...

#include <topSchema.h>

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

List of all members.

Public Member Functions

virtual void place (double ox, double oy, int orientation)
 Define the graphic position of the schema.
virtual void draw (device &dev)
 Draw the enlarged schema.
virtual point inputPoint (unsigned int i) const
 Top schema has no input.
virtual point outputPoint (unsigned int i) const
 Top schema has no output.
virtual void collectTraits (collector &c)
 Draw the enlarged schema.

Private Member Functions

 topSchema (schema *s1, double margin, const string &text, const string &link)
 A topSchema is a schema surrounded by a dashed rectangle with a label on the top left.

Private Attributes

schemafSchema
double fMargin
string fText
string fLink
vector< pointfInputPoint
vector< pointfOutputPoint

Friends

schemamakeTopSchema (schema *s1, double margin, const string &text, const string &link)
 Creates a new top schema.

Detailed Description

A topSchema is a schema surrounded by a dashed rectangle with a label on the top left.

The rectangle is placed at half the margin parameter. Arrows are added to all the outputs

Definition at line 34 of file topSchema.h.


Constructor & Destructor Documentation

topSchema::topSchema ( schema s,
double  margin,
const string &  text,
const string &  link 
) [private]

A topSchema is a schema surrounded by a dashed rectangle with a label on the top left.

The rectangle is placed at half the margin parameter. Arrows are added to the outputs. The constructor is made private to enforce the usage of makeTopSchema.

Definition at line 45 of file topSchema.cpp.

    :   schema(0, 0, s->width()+2*margin, s->height()+2*margin),
        fSchema(s),
        fMargin(margin),
        fText(text),
        fLink(link)
{
}

Member Function Documentation

void topSchema::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 115 of file topSchema.cpp.

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

{
    assert(placed());
    fSchema->collectTraits(c);

    // draw arrows at output points of schema
    for (unsigned int i=0; i<fSchema->inputs(); i++) {
        point p = fSchema->inputPoint(i);
        c.addOutput(p);;
    }

    // draw arrows at output points of schema
    for (unsigned int i=0; i<fSchema->outputs(); i++) {
        point p = fSchema->outputPoint(i);
        c.addInput(p);;
    }


}

Here is the call graph for this function:

void topSchema::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 92 of file topSchema.cpp.

References schema::draw(), device::fleche(), fLink, fMargin, fSchema, fText, schema::height(), device::label(), schema::orientation(), schema::outputPoint(), schema::outputs(), schema::placed(), device::rect(), schema::width(), point::x, schema::x(), point::y, and schema::y().

{
    assert(placed());

    // draw a background white rectangle
    dev.rect(x(), y(), width()-1, height()-1, "#ffffff", fLink.c_str());

    // draw the label
    dev.label(x()+fMargin, y()+fMargin/2, fText.c_str());

    fSchema->draw(dev);

    // draw arrows at output points of schema
    for (unsigned int i=0; i<fSchema->outputs(); i++) {
        point p = fSchema->outputPoint(i);
        dev.fleche(p.x, p.y, 0, orientation());
    }
}

Here is the call graph for this function:

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

Top schema has no input.

Implements schema.

Definition at line 71 of file topSchema.cpp.

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

{
    assert (placed());
    assert (i < inputs());
    exit(1);
}

Here is the call graph for this function:

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

Top schema has no output.

Implements schema.

Definition at line 81 of file topSchema.cpp.

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

{
    assert (placed());
    assert (i < outputs());
    exit(1);
}

Here is the call graph for this function:

void topSchema::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 60 of file topSchema.cpp.

References schema::beginPlace(), schema::endPlace(), fMargin, fSchema, and schema::place().

Here is the call graph for this function:


Friends And Related Function Documentation

schema* makeTopSchema ( schema s1,
double  margin,
const string &  text,
const string &  link 
) [friend]

Creates a new top schema.

Definition at line 33 of file topSchema.cpp.

{
    return new topSchema (makeDecorateSchema(s, margin/2, text), margin/2, "", link);
}

Member Data Documentation

vector<point> topSchema::fInputPoint [private]

Definition at line 40 of file topSchema.h.

string topSchema::fLink [private]

Definition at line 39 of file topSchema.h.

Referenced by draw().

double topSchema::fMargin [private]

Definition at line 37 of file topSchema.h.

Referenced by draw(), and place().

vector<point> topSchema::fOutputPoint [private]

Definition at line 41 of file topSchema.h.

Definition at line 36 of file topSchema.h.

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

string topSchema::fText [private]

Definition at line 38 of file topSchema.h.

Referenced by draw().


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