A chain of components. More...
|MIPComponentChain (const std::string &chainName)|
|Create a chain with a specific name. |
|Start the chain. |
|Stops the chain. |
|Clears the component chain. |
|bool||setChainStart (MIPComponent *pStartComponent)|
|Set the start of the chain. |
|bool||addConnection (MIPComponent *pPullComponent, MIPComponent *pPushCompontent, bool feedback=false, uint32_t allowedMessageTypes=MIPMESSAGE_TYPE_ALL, uint32_t allowedSubmessageTypes=MIPMESSAGE_TYPE_ALL)|
|Add a link between two components. |
|bool||deleteConnection (MIPComponent *pPullComponent, MIPComponent *pPushCompontent, bool feedback=false, uint32_t allowedMessageTypes=MIPMESSAGE_TYPE_ALL, uint32_t allowedSubmessageTypes=MIPMESSAGE_TYPE_ALL)|
|Removes a connection previously added by the addConnection function. |
|std::string||getName () const|
|Returns the name of the component chain. |
|Rebuilds a running chain. |
|virtual void||onThreadExit (bool error, const std::string &errorComponent, const std::string &errorDescription)|
|Function called when the background thread exits. |
This class describes a collection of links which exist between specific components. When the chain is started, messages will be passed over these links. The messages are described by classes derived from MIPMessage, components are implemented in classes derived from MIPComponent.
|bool MIPComponentChain::addConnection||(||MIPComponent *||pPullComponent,|
With this function, a link from pPullComponent to pPushCompontent is created. This means that at a certain point in the chain, messages will be extracted from pPullComponent using its implementation of MIPComponent::pull and will be fed to pPushComponent using its MIPComponent::push implementation.
Note that no copies are made of these components, the actual components specified by the MIPComponent pointers are used in the chain. For this reason, as long as the chain will be used, these MIPComponent objects must exist.
Messages can be filtered both on type and on subtype. By default, all messages are allowed over a link between components, but it is also possible to only allow specific kinds of messages to be passed over that link. Filtering can be done using the parameters allowedMessageTypes and allowedSubmessageTypes. For example, to only allow LPC compressed audio messages to be passed over a connection, allowedMessageTypes should be set to MIPMESSAGE_TYPE_AUDIO_ENCODED and allowedSubmessageTypes should be set to MIPENCODEDAUDIOMESSAGE_TYPE_LPC.
If the feedback flag is set to true, a MIPFeedback message will be passed over this link. This way, it is possible to provide feedback (about introduced delay for example) to components higher up in the chain.
Removes all components from the component chain.
|bool MIPComponentChain::deleteConnection||(||MIPComponent *||pPullComponent,|
|std::string MIPComponentChain::getName||(||)|| const
Returns the name of the component chain, as was specified in the constructor.
|virtual void MIPComponentChain::onThreadExit||(||bool||error,|
|const std::string &||errorComponent,|
|const std::string &||errorDescription|
This function is called when the background thread exits. This can happen if the MIPComponentChain::stop function is called, or when an error occured in the chain. The error flag indicates if the thread exited due to an error and if so, the errorComponent parameter contains the name of the component which caused the error. The errorDescription parameter then containts the error string obtained from that component's MIPComponent::getErrorString function.
|bool MIPComponentChain::setChainStart||(||MIPComponent *||pStartComponent||)|
Informs the chain to which component the initial message should be sent. It is this component which will determine the timing in the chain.
This function analyses the connections which were added previously and starts a background thread which will distribute the messages over the links in the chain. The chain itself sends a MIPSystemMessage with subtype MIPSYSTEMMESSAGE_WAITTIME to the component set by MIPComponentChain::setChainStart, instructing it to wait until it is time to process the rest of the chain. Therefore, it is the first component of the chain which performs the timing.
This function stops the background thread in which the messages are distributed.