sxNetwork Class Reference

network class More...

#include <sxNetwork.h>

Inheritance diagram for sxNetwork:

sxCaptionItem sxObject sxUiDesign

List of all members.

Classes

class  PrivateData

Public Member Functions

virtual sxInPortCreateInputPort () const
virtual sxOutPortCreateOutputPort () const
virtual sxConnectionCreateConnection ()
virtual sxComponentCreateComponent (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 &ltime)
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.
sxComponentComponentAt (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.
sxComponentFindComponent (const QString &lname, int type) const
 search component wich specific type and library name
QList< SXPacketLifeTimePacketsLifeTimeList () 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


Detailed Description

network class

Member Function Documentation

void sxNetwork::AddComponent ( sxComponent comp  ) 

Add new component to this network.

New component runner will be associated to the component.

Parameters:
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)

Parameters:
idx component position

sxComponent * sxNetwork::CreateComponent ( const QString &  lname,
int  type,
bool  loadMode 
) [virtual]

Allocate new component.

Parameters:
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.

Parameters:
fname name of design file to load
See also:
Save

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.

Parameters:
comp component to be removed (must not NULL)

References sxComponent::OnDestroy(), and sxComponent::Runner().

void sxNetwork::RemoveComponents (  ) 

Remove all components inside this network.

See also:
RemoveComponent()

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>
Parameter(s), settings(s), GUI properties are saved to design file.
Parameters:
fname name of design file where to save the components
See also:
Load()

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  ) 

Set the file name of this network.

Parameters:
fname valid filename

Referenced by Load().

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.

Parameters:
timeout time to wait (ms)

void sxNetwork::WaitResumed (  ) 

block thread until resumed.

This method assumed network is paused, if not the behaviour is undefined


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

Generated on Wed Dec 17 19:30:47 2008 for xBCI API by  doxygen 1.5.7.1