void initialize();System initialize method. Derived Galaxies should not redefine initialize; they should write a
setup()
method to do any class-specific startup.
virtual void preinitialize();Preinitialization of a Galaxy invokes preinitialization of all its member blocks. Preinitialization of the member blocks is done in two passes: the first pass preinits atomic blocks only, the second all blocks. This allows clean support of graphical recursion; for example, a HOFIfElseGr star can control a recursive reference to the current galaxy. The IfElse star is guaranteed to get control before the subgalaxy does, so it can delete the subgalaxy to stop the recursion. The second pass must preinit all blocks in case a non-atomic block adds a block to the current galaxy.
Galaxy::preinitialize
is called from Galaxy::initialize
. (It would be somewhat cleaner to have the various schedulers invoke preinitialize()
separately from initialize()
, but that would require many more pieces of the system to know about preinitialization.) Because of this decision, blocks in subgalaxies will see a preinitialize call during the outer galaxy's preinitialize pass and then another one when the subgalaxy is itself initialized. Thus, blocks must act safely if preinitialized multiple times. (HOF stars generally destroy themselves when preinitialized, so they can't see extra calls.)
void wrapup();System wrapup method. Recursively calls wrapup in subsystems
void addBlock(Block& b,const char* bname);Add block to the galaxy and set its name.
int removeBlock(Block& b);Remove the block
b
from the galaxy's list of blocks, if it is in the list. The block is not deleted. If the block was present, 1
is returned; otherwise 0
is returned.
virtual void initState();Initialize states.
int numberBlocks() const;Return the number of blocks in the galaxy.
StringList print(int verbose) const;Print a description of the galaxy.
int isItAtomic() const;Returns
FALSE
(galaxies are not atomic blocks).
Galaxy& asGalaxy();These return myself as a Galaxy, overriding
const Galaxy& asGalaxy() const;
Block::asGalaxy.
const char* domain() const;Return my domain.
void setDomain(const char* dom);Set the domain of the galaxy (this may become a protected member in the future).
Block* blockWithName(const char* name);Support blockWithName message to access internal block list.
void addBlock(Block& b)Add
b
to my list of blocks.
void connect(GenericPort& source, GenericPort& destination,Connect sub-blocks with a delay (default to zero delay).
int numberDelays = 0)
void alias(PortHole& galPort, PortHole& blockPort);Connect a Galaxy PortHole to a PortHole of a sub-block, or same for a MultiPortHole.
void alias(MultiPortHole& galPort, MultiPortHole& blockPort);
void initSubblocks();Former: initialize subblocks only. Latter: initialize states in subblocks only.
void initStateSubblocks();
void printNames(Galaxy& g,ostream& stream) {
GalStarIter nextStar(g);
Star* s;
while ((s = nextStar++) != 0)
stream << s->fullName() << "\back n";
}