CLAM::Network Class Reference

#include <Network.hxx>

List of all members.

Classes

struct  Geometry

Public Types

typedef std::list< std::string > NamesList
typedef std::map< std::string,
Processing * > 
ProcessingsMap
typedef std::list< InPortBase * > InPortsList
typedef std::vector< Processing * > Processings
typedef std::vector
< ControlSource * > 
ControlSources
typedef std::vector
< ControlSink * > 
ControlSinks
typedef std::vector
< InformationText * > 
InformationTexts
typedef std::map< std::string,
Geometry
ProcessingsGeometriesMap
typedef std::set< std::string > NamesSet
typedef std::pair< bool,
std::string > 
ConnectionState
 Has true if ports have the old name AudioIn or AudioOut and which connections are broken.

Public Member Functions

 Network ()
virtual ~Network ()
virtual const char * GetClassName () const
 Return the class name.
bool IsStopped () const
bool IsPlaying () const
bool IsPaused () const
bool IsRealTime () const
void Start ()
void Stop ()
void Pause ()
void Do ()
void AddFlowControl (FlowControl *)
 Gets the ownership of the FlowControl passed.
void Clear ()
void SetPlayer (NetworkPlayer *player)
 Set the object in charge of managing the processing thread.
unsigned BackendBufferSize ()
unsigned BackendSampleRate ()
virtual void StoreOn (Storage &storage) const
 Stores component's subitems on the given Storage.
virtual void LoadFrom (Storage &storage)
 Loads component's subitems from the given Storage.
bool SetProcessingsGeometries (const ProcessingsGeometriesMap &processingsGeometries)
 Sets canvas related geometries (positions/sizes) using a map of names geometries.
const ProcessingsGeometriesMap GetAndClearGeometries ()
 Returns a map of processing names to positions/sizes in the canvas and clears them.
const GeometrygetProcessingGeometry (const std::string &processingName) const
 Returns the geometry in the network of the named processing.
const Processings getOrderedProcessings (const std::string &type, bool horizontalOrder) const
 Retrieves a list of processings of the given type by position order.
const Processings getOrderedProcessingsByAttribute (const std::string &attribute, bool horizontalOrder=false) const
 Retrieves a list of processings whose type have defined the attribute in the metadata.This is used to retrieve, for example, processings with the 'port_source_type' or 'control_source_type' attribute.
const ControlSinks getOrderedControlSinks () const
const ControlSources getOrderedControlSources () const
bool ConnectPorts (const std::string &, const std::string &)
 methods related to connect/disconnect interface
bool ConnectControls (const std::string &, const std::string &)
bool DisconnectPorts (const std::string &, const std::string &)
bool DisconnectControls (const std::string &, const std::string &)
ProcessingGetProcessing (const std::string &name) const
 Retrieves a processing by its name.
void AddProcessing (const std::string &name, Processing *processing, const ProcessingConfig *config=0)
 Adds a processing to the network with the given name, and optionally providing a configuration.
ProcessingAddProcessing (const std::string &name, const std::string &type)
 Creates and adds a processing to the network of the given type.
std::string AddProcessing (const std::string &type)
 Creates and adds a processing to the network of the given type, using a name derived from the type itself which is returned.
std::string GetUnusedName (const std::string &prefix, const bool cutOnLastSeparator=false, const std::string separator="_") const
 Generates an unused name derived from the provided prefix.
void RemoveProcessing (const std::string &name)
 Removes the named processing.
bool HasProcessing (const std::string &name) const
 Returns true if the network has a processing with the given name.
bool ConfigureProcessing (const std::string &, const ProcessingConfig &)
 Configures the processing with the given processing id and config object and notifies this to the network.
void ReconfigureAllProcessings ()
 Calls Configure() for each processing with its current configuration.
bool RenameProcessing (const std::string &oldName, const std::string &newName)
 Renames a processing.
const std::string & GetNetworkId (const Processing *proc) const
 Returns the id of the given processing.
ProcessingsMap::iterator BeginProcessings ()
ProcessingsMap::iterator EndProcessings ()
ProcessingsMap::const_iterator BeginProcessings () const
ProcessingsMap::const_iterator EndProcessings () const
void addInformationText (InformationText *informationText)
void removeInformationText (InformationText *informationText)
InformationTexts::iterator BeginInformationTexts ()
InformationTexts::iterator EndInformationTexts ()
InformationTexts::const_iterator BeginInformationTexts () const
InformationTexts::const_iterator EndInformationTexts () const
InPortBaseGetInPortByCompleteName (const std::string &) const
OutPortBaseGetOutPortByCompleteName (const std::string &) const
InControlBaseGetInControlByCompleteName (const std::string &) const
OutControlBaseGetOutControlByCompleteName (const std::string &) const
NamesList GetInPortsConnectedTo (const std::string &) const
NamesList GetInControlsConnectedTo (const std::string &) const
InPortsList GetInPortsConnectedTo (OutPortBase &) const
std::string GetConnectorIdentifier (const std::string &) const
std::string GetProcessingIdentifier (const std::string &) const
bool IsReady () const
 Tells whether the network is ready to rock.
bool IsEmpty () const
 Returns true when it has no processings.
bool HasMisconfiguredProcessings () const
 Returns true when some processing is misconfigured.
bool HasUnconnectedInPorts () const
 Returns true when a processing has an inport that is not connected.
bool HasSyncSource () const
 Tell whether the network contains any processing which limits the cpu usage such as file or device interfaces.
bool SupportsVariableAudioSize () const
 This method reports whether the network supports dynamic buffer-size host.
std::string GetConfigurationErrors () const
 Returns an string containing configuration errors.
std::string GetUnconnectedInPorts () const
 Returns an string the full name of the unconnected inports.
ConnectionState GetConnectionReport () const
void ResetConnectionReport ()

const std::string & GetName () const
 Network attributes.
void SetName (const std::string &name)
const TextGetDescription () const
 Returns the network description.
void SetDescription (const Text &description)
 Set the network description.
CopyAndPaste Methods related to copy&paste processings from canvas

bool UpdateSelections (const NamesList &processingsNamesList)
 Marks as selected the processings whose name is in the list.
void setPasteMode ()
 Sets or unsets the paste mode.

Static Protected Member Functions

static std::size_t PositionOfLastIdentifier (const std::string &str)
static std::size_t PositionOfProcessingIdentifier (const std::string &str)
static char NamesIdentifiersSeparator ()

Detailed Description

Definition at line 54 of file Network.hxx.


Member Typedef Documentation

typedef std::pair<bool, std::string> CLAM::Network::ConnectionState

Has true if ports have the old name AudioIn or AudioOut and which connections are broken.

Definition at line 305 of file Network.hxx.

Definition at line 65 of file Network.hxx.

Definition at line 64 of file Network.hxx.

Definition at line 67 of file Network.hxx.

typedef std::list<InPortBase *> CLAM::Network::InPortsList

Definition at line 61 of file Network.hxx.

typedef std::list<std::string> CLAM::Network::NamesList

Definition at line 59 of file Network.hxx.

typedef std::set<std::string> CLAM::Network::NamesSet

Definition at line 73 of file Network.hxx.

typedef std::vector<Processing*> CLAM::Network::Processings

Definition at line 63 of file Network.hxx.

typedef std::map<std::string, Geometry> CLAM::Network::ProcessingsGeometriesMap

Definition at line 70 of file Network.hxx.

typedef std::map<std::string, Processing* > CLAM::Network::ProcessingsMap

Definition at line 60 of file Network.hxx.


Constructor & Destructor Documentation

CLAM::Network::Network (  ) 

Definition at line 31 of file Network.cxx.

CLAM::Network::~Network (  )  [virtual]

Definition at line 38 of file Network.cxx.


Member Function Documentation

void CLAM::Network::AddFlowControl ( FlowControl flowControl  ) 

Gets the ownership of the FlowControl passed.

So it will be deleted by the destructor

Definition at line 412 of file Network.cxx.

void CLAM::Network::addInformationText ( InformationText informationText  ) 

Definition at line 751 of file Network.cxx.

std::string CLAM::Network::AddProcessing ( const std::string &  type  ) 

Creates and adds a processing to the network of the given type, using a name derived from the type itself which is returned.

Definition at line 464 of file Network.cxx.

References CLAM_ASSERT, CLAM::Processing::Configure(), CLAM::Processing::GetConfig(), IsStopped(), CLAM::Processing::SetNetworkBackLink(), and Stop().

Processing & CLAM::Network::AddProcessing ( const std::string &  name,
const std::string &  type 
)

Creates and adds a processing to the network of the given type.

Returns:
A reference to the created processing.
Precondition:
the name does not exist already (use HasProcessing)
Exceptions:
ErrFactory when the type does not exist

Definition at line 457 of file Network.cxx.

void CLAM::Network::AddProcessing ( const std::string &  name,
Processing processing,
const ProcessingConfig config = 0 
)

Adds a processing to the network with the given name, and optionally providing a configuration.

The network adquires responsability to delete the processing when it is done, and it should be created by new.

Definition at line 446 of file Network.cxx.

unsigned CLAM::Network::BackendBufferSize (  ) 

Definition at line 425 of file Network.cxx.

unsigned CLAM::Network::BackendSampleRate (  ) 

Definition at line 430 of file Network.cxx.

References CLAM::FlowControl::AttachToNetwork().

Network::InformationTexts::const_iterator CLAM::Network::BeginInformationTexts (  )  const

Definition at line 776 of file Network.cxx.

Network::InformationTexts::iterator CLAM::Network::BeginInformationTexts (  ) 

Definition at line 766 of file Network.cxx.

Network::ProcessingsMap::const_iterator CLAM::Network::BeginProcessings (  )  const

Definition at line 739 of file Network.cxx.

Network::ProcessingsMap::iterator CLAM::Network::BeginProcessings (  ) 

Definition at line 730 of file Network.cxx.

References IsStopped(), and Stop().

Referenced by Clear(), and HasSyncSource().

void CLAM::Network::Clear (  ) 

Definition at line 714 of file Network.cxx.

References BeginProcessings(), EndProcessings(), and CLAM::NetworkPlayer::Stop().

bool CLAM::Network::ConfigureProcessing ( const std::string &  name,
const ProcessingConfig newConfig 
)

Configures the processing with the given processing id and config object and notifies this to the network.

So use this method instead of getting the processing with GetProcessing and calling Configure on it.

Definition at line 519 of file Network.cxx.

bool CLAM::Network::ConnectControls ( const std::string &  producer,
const std::string &  consumer 
)

Definition at line 562 of file Network.cxx.

bool CLAM::Network::ConnectPorts ( const std::string &  producer,
const std::string &  consumer 
)

methods related to connect/disconnect interface

Definition at line 540 of file Network.cxx.

bool CLAM::Network::DisconnectControls ( const std::string &  producer,
const std::string &  consumer 
)
bool CLAM::Network::DisconnectPorts ( const std::string &  producer,
const std::string &  consumer 
)
void CLAM::Network::Do ( void   ) 
Network::InformationTexts::const_iterator CLAM::Network::EndInformationTexts (  )  const

Definition at line 781 of file Network.cxx.

Network::InformationTexts::iterator CLAM::Network::EndInformationTexts (  ) 

Definition at line 771 of file Network.cxx.

Network::ProcessingsMap::const_iterator CLAM::Network::EndProcessings (  )  const

Definition at line 744 of file Network.cxx.

Network::ProcessingsMap::iterator CLAM::Network::EndProcessings (  ) 

Definition at line 735 of file Network.cxx.

References RemoveProcessing().

Referenced by Clear(), and HasSyncSource().

const Network::ProcessingsGeometriesMap CLAM::Network::GetAndClearGeometries (  ) 

Returns a map of processing names to positions/sizes in the canvas and clears them.

That means that they can only be retrieved once. Canvas positions are significant to determine both, the execution order and the order in which exported ports (horizontally) and and exported controls (vertically) are exposed.

Todo:
clarify that interface, it is not obvious

Definition at line 391 of file Network.cxx.

References CLAM_ASSERT.

virtual const char* CLAM::Network::GetClassName (  )  const [inline, virtual]

Return the class name.

Implements CLAM::Component.

Definition at line 97 of file Network.hxx.

std::string CLAM::Network::GetConfigurationErrors (  )  const

Returns an string containing configuration errors.

Don't rely on the format because is subject to change.

Definition at line 929 of file Network.cxx.

Network::ConnectionState CLAM::Network::GetConnectionReport (  )  const

Definition at line 962 of file Network.cxx.

std::string CLAM::Network::GetConnectorIdentifier ( const std::string &  str  )  const

Definition at line 610 of file Network.cxx.

Referenced by GetOutControlByCompleteName(), and IsStopped().

const Text& CLAM::Network::GetDescription (  )  const [inline]

Returns the network description.

The network description is an html fragment or plain text that describes the network to someone using it.

See also:
SetDescription

Definition at line 90 of file Network.hxx.

InControlBase & CLAM::Network::GetInControlByCompleteName ( const std::string &  name  )  const

Definition at line 633 of file Network.cxx.

References PositionOfLastIdentifier(), and PositionOfProcessingIdentifier().

Referenced by DisconnectPorts().

Network::NamesList CLAM::Network::GetInControlsConnectedTo ( const std::string &  producer  )  const

Definition at line 806 of file Network.cxx.

InPortBase & CLAM::Network::GetInPortByCompleteName ( const std::string &  name  )  const

Definition at line 621 of file Network.cxx.

Referenced by DisconnectControls().

Network::InPortsList CLAM::Network::GetInPortsConnectedTo ( OutPortBase producer  )  const
Network::NamesList CLAM::Network::GetInPortsConnectedTo ( const std::string &  producer  )  const

Definition at line 787 of file Network.cxx.

const std::string& CLAM::Network::GetName (  )  const [inline]

Network attributes.

Definition at line 81 of file Network.hxx.

const std::string & CLAM::Network::GetNetworkId ( const Processing proc  )  const

Returns the id of the given processing.

Precondition:
the processing belongs to the network.

Definition at line 833 of file Network.cxx.

Referenced by CLAM::NetworkPlayer::CacheSourcesAndSinks().

const Network::ControlSinks CLAM::Network::getOrderedControlSinks (  )  const
Deprecated:
use getOrderedProcessings or getOrderedProcessingsByAttribute instead

Definition at line 332 of file Network.cxx.

Referenced by CLAM::NetworkPlayer::CacheSourcesAndSinks().

const Network::ControlSources CLAM::Network::getOrderedControlSources (  )  const
Deprecated:
should use getOrderedProcessings or getOrderedProcessingsByAttribute instead

Definition at line 357 of file Network.cxx.

Referenced by CLAM::NetworkPlayer::CacheSourcesAndSinks().

const Network::Processings CLAM::Network::getOrderedProcessings ( const std::string &  type,
bool  horizontalOrder 
) const

Retrieves a list of processings of the given type by position order.

  • horizontalOrder if true, ordered left to right; if not, top to bottom

Definition at line 284 of file Network.cxx.

const Network::Processings CLAM::Network::getOrderedProcessingsByAttribute ( const std::string &  attribute,
bool  horizontalOrder = false 
) const

Retrieves a list of processings whose type have defined the attribute in the metadata.This is used to retrieve, for example, processings with the 'port_source_type' or 'control_source_type' attribute.

  • horizontalOrder if true, ordered left to right; if not, top to bottom

Definition at line 308 of file Network.cxx.

OutControlBase & CLAM::Network::GetOutControlByCompleteName ( const std::string &  name  )  const
OutPortBase & CLAM::Network::GetOutPortByCompleteName ( const std::string &  name  )  const

Definition at line 627 of file Network.cxx.

References PositionOfLastIdentifier().

Referenced by DisconnectControls().

Processing & CLAM::Network::GetProcessing ( const std::string &  name  )  const

Retrieves a processing by its name.

Precondition:
there is a processing with such a name
See also:
HasProcessing

Definition at line 437 of file Network.cxx.

Referenced by GetOutControlByCompleteName(), and IsStopped().

const Network::Geometry & CLAM::Network::getProcessingGeometry ( const std::string &  processingName  )  const

Returns the geometry in the network of the named processing.

Precondition:
The processing should exist in the network

Definition at line 274 of file Network.cxx.

std::string CLAM::Network::GetProcessingIdentifier ( const std::string &  str  )  const

Definition at line 615 of file Network.cxx.

Referenced by GetOutControlByCompleteName(), and IsStopped().

std::string CLAM::Network::GetUnconnectedInPorts (  )  const

Returns an string the full name of the unconnected inports.

Don't rely on the format because is subject to change.

Definition at line 893 of file Network.cxx.

std::string CLAM::Network::GetUnusedName ( const std::string &  prefix,
const bool  cutOnLastSeparator = false,
const std::string  separator = "_" 
) const

Generates an unused name derived from the provided prefix.

Definition at line 471 of file Network.cxx.

bool CLAM::Network::HasMisconfiguredProcessings (  )  const

Returns true when some processing is misconfigured.

Definition at line 869 of file Network.cxx.

bool CLAM::Network::HasProcessing ( const std::string &  name  )  const

Returns true if the network has a processing with the given name.

Definition at line 513 of file Network.cxx.

bool CLAM::Network::HasSyncSource (  )  const

Tell whether the network contains any processing which limits the cpu usage such as file or device interfaces.

This is needed when executing a network in a real time process.

Definition at line 910 of file Network.cxx.

References BeginProcessings(), EndProcessings(), and CLAM::Processing::GetNInPorts().

bool CLAM::Network::HasUnconnectedInPorts (  )  const

Returns true when a processing has an inport that is not connected.

Definition at line 878 of file Network.cxx.

bool CLAM::Network::IsEmpty (  )  const

Returns true when it has no processings.

Definition at line 864 of file Network.cxx.

bool CLAM::Network::IsPaused (  )  const

Definition at line 659 of file Network.cxx.

bool CLAM::Network::IsPlaying (  )  const

Definition at line 652 of file Network.cxx.

bool CLAM::Network::IsReady (  )  const

Tells whether the network is ready to rock.

A network is ready when:

  • it contains any processing,
  • all processings are properly configured, and
  • all in ports are connected,

Definition at line 856 of file Network.cxx.

bool CLAM::Network::IsRealTime (  )  const

Definition at line 666 of file Network.cxx.

bool CLAM::Network::IsStopped (  )  const
void CLAM::Network::LoadFrom ( Storage storage  )  [virtual]

Loads component's subitems from the given Storage.

Parameters:
storage The given storage where the subitem will be loaded from
See also:
Storage

Implements CLAM::Component.

Definition at line 157 of file Network.cxx.

static char CLAM::Network::NamesIdentifiersSeparator (  )  [inline, static, protected]

Definition at line 347 of file Network.hxx.

Referenced by PositionOfLastIdentifier(), and PositionOfProcessingIdentifier().

void CLAM::Network::Pause (  ) 

Definition at line 704 of file Network.cxx.

static std::size_t CLAM::Network::PositionOfLastIdentifier ( const std::string &  str  )  [inline, static, protected]
static std::size_t CLAM::Network::PositionOfProcessingIdentifier ( const std::string &  str  )  [inline, static, protected]

Definition at line 341 of file Network.hxx.

References NamesIdentifiersSeparator(), and PositionOfLastIdentifier().

Referenced by GetInControlByCompleteName().

void CLAM::Network::ReconfigureAllProcessings (  ) 

Calls Configure() for each processing with its current configuration.

Definition at line 530 of file Network.cxx.

void CLAM::Network::removeInformationText ( InformationText informationText  ) 

Definition at line 756 of file Network.cxx.

void CLAM::Network::RemoveProcessing ( const std::string &  name  ) 

Removes the named processing.

Precondition:
should exist

Definition at line 493 of file Network.cxx.

Referenced by EndProcessings().

bool CLAM::Network::RenameProcessing ( const std::string &  oldName,
const std::string &  newName 
)

Renames a processing.

Returns true if successfull. Returns false if oldName does not exist in the network or when the given name is invalid.

Definition at line 844 of file Network.cxx.

void CLAM::Network::ResetConnectionReport (  ) 

Definition at line 971 of file Network.cxx.

void CLAM::Network::SetDescription ( const Text description  )  [inline]

Set the network description.

See also:
GetDescription

Definition at line 95 of file Network.hxx.

void CLAM::Network::SetName ( const std::string &  name  )  [inline]

Definition at line 82 of file Network.hxx.

void CLAM::Network::setPasteMode (  )  [inline]

Sets or unsets the paste mode.

If the paste mode is on, when Loading an xml existing processings are not removed and new processings allocate new names if their name already exist.

Definition at line 134 of file Network.hxx.

void CLAM::Network::SetPlayer ( NetworkPlayer player  ) 

Set the object in charge of managing the processing thread.

Receives property of the player.

Definition at line 418 of file Network.cxx.

bool CLAM::Network::SetProcessingsGeometries ( const ProcessingsGeometriesMap processingsGeometries  ) 

Sets canvas related geometries (positions/sizes) using a map of names geometries.

See also:
SetProcessingsGeometries

Definition at line 382 of file Network.cxx.

void CLAM::Network::Start (  ) 

Definition at line 673 of file Network.cxx.

void CLAM::Network::Stop (  ) 

Definition at line 696 of file Network.cxx.

Referenced by AddProcessing(), BeginProcessings(), DisconnectControls(), and DisconnectPorts().

void CLAM::Network::StoreOn ( Storage storage  )  const [virtual]

Stores component's subitems on the given Storage.

Parameters:
storage The given storage where the subitem will be stored
See also:
Storage

Implements CLAM::Component.

Definition at line 46 of file Network.cxx.

bool CLAM::Network::SupportsVariableAudioSize (  )  const

This method reports whether the network supports dynamic buffer-size host.

Definition at line 919 of file Network.cxx.

bool CLAM::Network::UpdateSelections ( const NamesList processingsNamesList  ) 

The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3