FlattenedNetwork.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _FlattenedNetwork_hxx_
00025 #define _FlattenedNetwork_hxx_
00026
00027 #include "Processing.hxx"
00028 #include "InPort.hxx"
00029 #include "OutPort.hxx"
00030 #include "InControl.hxx"
00031 #include "OutControl.hxx"
00032 #include <string>
00033 #include <list>
00034 #include <map>
00035 #include <set>
00036
00037
00038
00039 #include "BaseNetwork.hxx"
00040
00041 namespace CLAM
00042 {
00043 class NetworkPlayer;
00044 class FlowControl;
00045
00046 class FlattenedNetwork : public BaseNetwork
00047 {
00048
00049 public:
00050
00051 FlattenedNetwork();
00052 virtual ~FlattenedNetwork();
00053
00054
00055 const std::string& GetName() const { return _name; }
00056 void SetName( const std::string& name ) { _name=name; }
00057 virtual const char * GetClassName() const
00058 {
00059 return "FlattenedNetwork";
00060 }
00061
00062
00063 bool IsStopped() const;
00064 void Start();
00065 void Stop();
00066 void Do();
00068 void AddFlowControl( FlowControl* );
00069 void Clear();
00071 void SetPlayer( NetworkPlayer* player);
00072 unsigned BackendBufferSize();
00073 unsigned BackendSampleRate();
00074
00075
00077 virtual void StoreOn( Storage & storage) const;
00078 virtual void LoadFrom( Storage & storage);
00079
00081 bool UpdateSelections (const NamesList & processingsNamesList);
00082 void setPasteMode() { _setPasteMode=true; }
00083
00085 bool SetProcessingsGeometries (const ProcessingsGeometriesMap & processingsGeometries);
00086 const ProcessingsGeometriesMap GetAndClearGeometries();
00087
00088
00089
00091 bool ConnectPorts( const std::string &, const std::string & );
00092 bool ConnectControls( const std::string &, const std::string & );
00093 bool DisconnectPorts( const std::string &, const std::string & );
00094 bool DisconnectControls( const std::string &, const std::string & );
00095
00097 Processing& GetProcessing( const std::string & name ) const;
00099 void AddProcessing( const std::string &, Processing* );
00101 void AddProcessing( const std::string & name, const std::string & key );
00102 std::string AddProcessing( const std::string& key );
00103 std::string GetUnusedName( const std::string& prefix ) const;
00104 void RemoveProcessing ( const std::string & );
00105 bool HasProcessing( const std::string & name ) const;
00109 bool ConfigureProcessing( const std::string &, const ProcessingConfig & );
00111 void ReconfigureAllProcessings();
00112 bool RenameProcessing( const std::string & oldName, const std::string & newName );
00113
00114 const std::string & GetNetworkId(const Processing * proc) const;
00115
00116
00117 ProcessingsMap::iterator BeginProcessings();
00118 ProcessingsMap::iterator EndProcessings();
00119 ProcessingsMap::const_iterator BeginProcessings() const;
00120 ProcessingsMap::const_iterator EndProcessings() const;
00121
00122 InPortBase & GetInPortByCompleteName( const std::string& ) const;
00123 OutPortBase & GetOutPortByCompleteName( const std::string& ) const;
00124 InControl & GetInControlByCompleteName( const std::string& ) const;
00125 OutControl & GetOutControlByCompleteName( const std::string& ) const;
00126
00127 NamesList GetInPortsConnectedTo( const std::string & ) const;
00128 NamesList GetInControlsConnectedTo( const std::string & ) const;
00129 InPortsList GetInPortsConnectedTo( OutPortBase & ) const;
00130
00131 std::string GetConnectorIdentifier( const std::string& ) const;
00132 std::string GetProcessingIdentifier( const std::string& ) const;
00133
00139 bool IsReady() const;
00140
00142 bool IsEmpty() const;
00143
00145 bool HasMisconfiguredProcessings() const;
00146
00148 bool HasUnconnectedInPorts() const;
00149
00154 bool HasSyncSource() const;
00155
00160 std::string GetConfigurationErrors() const;
00165 std::string GetUnconnectedInPorts() const;
00166
00167 private:
00168
00169 std::string _name;
00170 ProcessingsMap _processings;
00171 FlowControl* _flowControl;
00172 NetworkPlayer* _player;
00173
00174
00175 mutable NamesSet _selectedProcessings;
00176 bool _setPasteMode;
00177
00178 bool HasSelectionAndContains(const std::string & name) const;
00179
00180
00181 mutable ProcessingsGeometriesMap _processingsGeometries;
00182 void StringPairToInts(const std::string & geometryInString, int & a, int & b);
00183 const std::string IntsToString (const int & a, const int & b) const;
00184
00185 };
00186
00187 }
00188 #endif
00189