]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/ProcessObject.hxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.hxx
1 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
2 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
3
4 // -------------------------------------------------------------------------
5 template< class T >
6 T* cpPlugins::Interface::ProcessObject::
7 GetInput( unsigned int idx )
8 {
9   if( idx < this->m_Inputs.size( ) )
10     return( dynamic_cast< T* >( this->m_Inputs[ idx ].GetPointer( ) ) );
11   else
12     return( NULL );
13 }
14
15 // -------------------------------------------------------------------------
16 template< class T >
17 const T* cpPlugins::Interface::ProcessObject::
18 GetInput( unsigned int idx ) const
19 {
20   if( idx < this->m_Inputs.size( ) )
21     return(
22       dynamic_cast< const T* >( this->m_Inputs[ idx ].GetPointer( ) )
23       );
24   else
25     return( NULL );
26 }
27
28 // -------------------------------------------------------------------------
29 template< class T >
30 T* cpPlugins::Interface::ProcessObject::
31 GetOutput( unsigned int idx )
32 {
33   if( idx < this->m_Outputs.size( ) )
34     return( dynamic_cast< T* >( this->m_Outputs[ idx ].GetPointer( ) ) );
35   else
36     return( NULL );
37 }
38
39 // -------------------------------------------------------------------------
40 template< class T >
41 const T* cpPlugins::Interface::ProcessObject::
42 GetOutput( unsigned int idx ) const
43 {
44   if( idx < this->m_Outputs.size( ) )
45     return(
46       dynamic_cast< const T* >( this->m_Outputs[ idx ].GetPointer( ) )
47       );
48   else
49     return( NULL );
50 }
51
52 // -------------------------------------------------------------------------
53 template< class O >
54 void cpPlugins::Interface::ProcessObject::
55 _MakeOutput( unsigned int idx )
56 {
57   if( idx >= this->m_Outputs.size( ) )
58     return;
59   this->m_Outputs[ idx ] = O::New( );
60   this->m_Outputs[ idx ]->SetSource( this );
61 }
62
63 #endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
64
65 // eof - $RCSfile$