The
type()
and typePort()
functions belong to GenericPort, not PortHole, because multiportholes have a declared type and can be type-equivalenced to other portholes. However, type resolution is strictly a PortHole notion. Multiportholes need no resolved type because they do not themselves transport particles, and indeed the concept would be ambiguous since the member ports of a multiporthole might have different resolved types. The declared type of a multiporthole is automatically assigned to its children, and its children are automatically brought into any type equivalence set the multiporthole is made part of. Thereafter, type resolution considers only the member portholes and not the multiporthole itself.
virtual int isItInput () const;Each of the above functions returns
virtual int isItOutput () const;
virtual int isItMulti () const;
TRUE
(1) or FALSE
(0).
StringList print (int verbose = 0) const;Print human-readable information on the GenericPort.
DataType type () const;Return my DataType. This may be one of the DataType values associated with Particle classes, or the special type `
ANYTYPE
', which indicates that the type must be resolved during setup. Note that type()
returns the port's declared type, as supplied to setPort()
. This is not necessarily the datatype that will be chosen to pass through the port at runtime. That type is available from the PortHole::resolvedType()
function.
GenericPort* alias() const;Return my alias, or a null pointer if I have no alias. Generally, Galaxy portholes have aliases and Star portholes do not, but this is not a strict requirement.
GenericPort* aliasFrom() const;Return the porthole that I am the alias for (a null pointer if none). It is guaranteed that if gp is a pointer to GenericPort and if
gp->alias()
is non-null, then the boolean expression gp->alias()->aliasFrom() == gp
bitWord attributes() const;Return my attributes. Attributes are a series of bits.
GenericPort& realPort();Return the real port after resolving any aliases. If I have no alias, then a reference to myself is returned.
const GenericPort& realPort() const;
GenericPort* typePort() const;Return another generic port that is constrained to have the same type as me (0 if none). If a non-null value is called, successive calls will form a circular linked list that always returns to its starting point; that is, the loop
void printLoop(GenericPort& g) {is guaranteed to terminate and not to dereference a null pointer.
if (g->typePort()) {
GenericPort* gp = g;
while (gp->typePort() != g) {
cout << gp->fullName() << "\back n";
gp = gp->typePort();
}
}
}
inline int hidden(const GenericPort& p)IMPORTANT:
hidden
is not a member function of GenericPort, but is a "plain function". It returns TRUE
if the port in question has the HIDDEN
attribute.
virtual PortHole& newConnection();Return a reference to a porthole to be used for new connections. Class PortHole uses this one unchanged; MultiPortHole has to create a new member PortHole.
GenericPort& setPort(const char* portName, Block* blk, DataType typ=FLOAT);Set the basic PortHole parameters: the name, parent, and data type.
void inheritTypeFrom(GenericPort& p);Link to another port for determining the type of `
ANYTYPE
' connections. The "inheritance" relationship is actually a completely symmetric constraint, and so this function would have been better named sameTypeAs()
. Any number of portholes can be tied together by inheritTypeFrom()
calls. Internally this is represented by chaining all the members of such a type equivalence set into a circular loop, which can be walked via typePort()
calls. If a multiporthole is made part of a type equivalence set, all its current and future children become part of the set automatically.
virtual void connect(GenericPort& destination,int numberDelays,Connect me with the indicated peer.
const char* initDelayValues = 0);
bitWord setAttributes(const Attribute& attr);Set my attributes (some bits are turned on and others are turned off).
void setAlias (GenericPort& gp);Set gp to be my alias. The aliasFrom pointer of gp is set to point to me.
GenericPort* translateAliases();The above is a protected function. If this function is called on a port with no alias, the address of the port itself is returned; otherwise,
alias()->translateAliases()
is returned.