22 #ifndef __OutPort_hxx__
23 #define __OutPort_hxx__
55 virtual void SetSize(
int newSize)=0;
57 virtual void SetHop(
int newHop)=0;
64 virtual const std::type_info &
GetTypeId()
const = 0;
73 template<
typename Token>
106 return typeid(Token);
120 template<
class Token>
126 template<
class Token>
129 InPortsList::iterator it = mVisuallyConnectedPorts.begin();
130 for( it=BeginVisuallyConnectedInPorts(); it!=EndVisuallyConnectedInPorts(); it++ )
132 (*it)->UnAttachRegion();
134 mVisuallyConnectedPorts.clear();
137 template<
class Token>
144 template<
class Token>
150 mVisuallyConnectedPorts.push_back( &in );
153 (*it)->AttachRegionToOutPort(
this, mRegion );
160 template<
class Token>
164 "OutPort<Token>::connectToIn coudn't connect to inPort "
165 "because was not templatized by the same Token type as outPort" );
167 ConnectToPublisher( static_cast<ProperInPortPublisher&>(in) );
169 ConnectToConcreteIn( static_cast<ProperInPort&>(in) );
172 template<
class Token>
176 "already connected to another out port" );
177 CLAM_ASSERT( !IsVisuallyConnectedTo(in),
"OutPort<Token>::ConnectToConcreteIn - Trying to connect an in port "
178 "already connected to this out port" );
179 mVisuallyConnectedPorts.push_back(&in);
183 template<
class Token>
187 "OutPort<Token>::DisconnectFromIn coudn't discconnect from inPort "
188 "because was not templatized by the same Token type as outPort" );
191 TryDisconnectFromPublisher( in );
193 TryDisconnectFromConcreteIn( in );
196 template<
class Token>
199 CLAM_ASSERT( IsConnectableTo(in),
"TryDisconnectFromConcreteIn: expect the same token template");
202 DisconnectFromConcreteIn( *concreteIn );
206 template<
class Token>
209 CLAM_ASSERT( IsConnectableTo(in),
"TryDisconnectFromPublisher: expect the same token template");
213 mVisuallyConnectedPorts.remove( &in );
217 if( (*it)->GetVisuallyConnectedOutPort())
223 template<
class Token>
226 CLAM_ASSERT( IsVisuallyConnectedTo(in) || IsPhysicallyConnectedToIn(in),
227 "OutPort::DisconnectFromConcreteIn() in port is not directly neither physically connected" );
228 if (IsVisuallyConnectedTo(in) )
231 mVisuallyConnectedPorts.remove(&in);
242 template<
class Token>
245 return mRegion[offset];
248 template<
class Token>
251 mRegion.Size( newSize );
254 template<
class Token>
257 return mRegion.Size();
260 template<
class Token>
263 return mRegion.Hop();
266 template<
class Token>
272 template<
class Token>
278 template<
class Token>
281 return mRegion.CanProduce();
284 template<
class Token>
290 template<
class Token>
293 if (IsVisuallyConnectedTo(in))
296 return ( 0!=GetPublisherContaining(in) );
300 template<
class Token>
304 InPortsList::iterator it;
305 for( it=mVisuallyConnectedPorts.begin(); it!=mVisuallyConnectedPorts.end(); it++ )
306 if ( (*it)->IsPublisherOf(in) )
313 template<
class Token>
316 InPortsList::iterator it;
317 for( it=mVisuallyConnectedPorts.begin(); it!=mVisuallyConnectedPorts.end(); it++ )
318 if(*it == &in)
return true;
322 template<
class Token>
325 mRegion.CenterEvenRegions();
328 template<
class Token>
331 CLAM_DEBUG_ASSERT( 0 <= offset,
"OutPort<Token>::GetLastWrittenData - Index under bounds" );
332 CLAM_DEBUG_ASSERT( offset <= GetSize(),
"OutPort<Token>::GetLastWrittenData - Index over bounds" );
333 return mRegion.GetLastWrittenData( offset );
338 #endif // __OutPort_hxx__