#include <sxNetwork.h>
Classes | |
class | PrivateData |
Public Member Functions | |
virtual sxInPort * | CreateInputPort () const |
virtual sxOutPort * | CreateOutputPort () const |
virtual sxConnection * | CreateConnection () |
virtual sxComponent * | CreateComponent (const QString &lname, int type, bool loadMode) |
Allocate new component. | |
virtual void | ExecutionStarted () |
virtual void | ExecutionFinished () |
virtual bool | SaveCustom (QDomElement &root) |
virtual bool | LoadCustom (const QDomElement &root) |
virtual void | AddPacketLifeTime (const SXPacketLifeTime <ime) |
virtual void | DisplayMessage (const QString &msg, sx::MessageType type=sx::RegularMessage) |
sxNetwork (const QString &cap=QString()) | |
QString | ErrorMessages () const |
retrieve error message from component | |
QString | FileName () const |
Return filename. | |
void | SetFileName (const QString &fname) |
Set the file name of this network. | |
bool | HasComponent () const |
Return true if network contains at least one component. | |
void | AddComponent (sxComponent *comp) |
Add new component to this network. | |
int | ComponentCount () const |
Number of component inside network. | |
sxComponent * | ComponentAt (int idx) const |
Retrive component at givent position. | |
void | SetComponentLibraries (QList< sxComponentLibrary * > *libraries) |
assign component library lists | |
QList< sxComponentLibrary * > * | ComponentLibraries () const |
return pointer to component library list | |
void | SetRunMode (sx::RunMode mode) |
sx::RunMode | RunMode () const |
void | SetRunParam (unsigned long param) |
unsigned long | RunParam () const |
void | SetData (QVariant d) |
QVariant | Data () const |
bool | Load (const QString &fname=QString()) |
Load existing design file. | |
bool | Save (const QString &fname=QString()) |
Save design to file. | |
void | RemoveComponents () |
Remove all components inside this network. | |
void | RemoveComponent (sxComponent *comp) |
Remove specified component. | |
void | SortComponents () |
Sort components according to it's depth. | |
sxComponent * | FindComponent (const QString &lname, int type) const |
search component wich specific type and library name | |
QList< SXPacketLifeTime > | PacketsLifeTimeList () const |
void | RaiseError () |
void | RaiseError (const QString &errmsg) |
bool | IsError () const |
Return true if any error occurs otherwise return false. | |
bool | IsRunning () const |
bool | IsEvaluating () const |
bool | Start () |
Start the execution. | |
void | Pause () |
Pause the execution. | |
void | Resume () |
Resume paused network. | |
bool | Stop (unsigned long timeout=ULONG_MAX) |
Stop current execution. | |
bool | Evaluate () |
Evaluate all components inside the network. | |
void | WaitResumed () |
block thread until resumed. | |
bool | IsPaused () const |
Is paused. | |
bool | WaitFinished (unsigned long timeout=ULONG_MAX) |
Wait component finishing the job. | |
bool | Abort () |
Abort execution by deactivating sources and close all ports. | |
double | TimerToc () const |
qint64 | TimerBase () const |
void sxNetwork::AddComponent | ( | sxComponent * | comp | ) |
Add new component to this network.
New component runner will be associated to the component.
comp | component (must not NULL) |
References sxComponent::SetNetwork(), and sxComponent::SetRunner().
Referenced by Load().
sxComponent * sxNetwork::ComponentAt | ( | int | idx | ) | const |
Retrive component at givent position.
Given index must be valid (i.e. between 0 and component count)
idx | component position |
sxComponent * sxNetwork::CreateComponent | ( | const QString & | lname, | |
int | type, | |||
bool | loadMode | |||
) | [virtual] |
Allocate new component.
lname | library name which component belongs to | |
id | component type |
Reimplemented in sxUiDesign.
References sxComponentLibrary::Create(), sxComponent::IsMultipleInstanceAllowed(), sxComponentLibrary::Name(), and SXTR.
Referenced by Load().
bool sxNetwork::Load | ( | const QString & | fname = QString() |
) |
Load existing design file.
fname | name of design file to load |
References AddComponent(), CreateComponent(), FileName(), HasComponent(), sxComponent::Load(), sxConnection::Load(), sxPort::Load(), and SetFileName().
Referenced by sxUiDesign::LoadDesign().
void sxNetwork::RemoveComponent | ( | sxComponent * | comp | ) |
Remove specified component.
Associated component runner, port and connection will also be freed.
comp | component to be removed (must not NULL) |
References sxComponent::OnDestroy(), and sxComponent::Runner().
void sxNetwork::RemoveComponents | ( | ) |
Remove all components inside this network.
References sxComponent::OnDestroy(), and sxComponent::Runner().
Referenced by sxUiDesign::RemoveAllComponents().
bool sxNetwork::Save | ( | const QString & | fname = QString() |
) |
Save design to file.
Design file is an XML file which has structure:
<design> <components> ... </components> <ports> ... </ports> <connections> ... </connections> </design>
fname | name of design file where to save the components |
References sxPort::Connection(), FileName(), sxComponent::InputAt(), sxComponent::InputCount(), sxComponent::OutputAt(), sxComponent::OutputCount(), sxConnection::Save(), sxPort::Save(), and sxComponent::Save().
void sxNetwork::SetFileName | ( | const QString & | fname | ) |
void sxNetwork::SortComponents | ( | ) |
Sort components according to it's depth.
Depth is define as a distance from source component.
References sxComponent::DownstreamComponents(), sxComponent::IsSource(), sxObject::SetTag(), and sxObject::Tag().
Referenced by Evaluate().
bool sxNetwork::WaitFinished | ( | unsigned long | timeout = ULONG_MAX |
) |
Wait component finishing the job.
timeout | time to wait (ms) |
void sxNetwork::WaitResumed | ( | ) |
block thread until resumed.
This method assumed network is paused, if not the behaviour is undefined