]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/ProcessObject.cxx
Base objects migration
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.cxx
1 #include <cpPlugins/Interface/ProcessObject.h>
2
3 // -------------------------------------------------------------------------
4 cpPlugins::Interface::ProcessObject::
5 ProcessObject( )
6   : Superclass( )
7 {
8 }
9
10 // -------------------------------------------------------------------------
11 cpPlugins::Interface::ProcessObject::
12 ~ProcessObject( )
13 {
14 }
15
16 // -------------------------------------------------------------------------
17 std::string cpPlugins::Interface::ProcessObject::
18 GetClassName( ) const
19 {
20   return( "cpPlugins::Interface::ProcessObject" );
21 }
22
23 // -------------------------------------------------------------------------
24 const cpPlugins::Interface::ProcessObject::
25 TParameters& cpPlugins::Interface::ProcessObject::
26 GetDefaultParameters( ) const
27 {
28   return( this->m_DefaultParameters );
29 }
30
31 // -------------------------------------------------------------------------
32 void cpPlugins::Interface::ProcessObject::
33 SetParameters( const TParameters& params )
34 {
35   this->m_Parameters = params;
36 }
37
38 // -------------------------------------------------------------------------
39 unsigned int cpPlugins::Interface::ProcessObject::
40 GetNumberOfInputs( ) const
41 {
42   return( this->m_Inputs.size( ) );
43 }
44
45 // -------------------------------------------------------------------------
46 unsigned int cpPlugins::Interface::ProcessObject::
47 GetNumberOfOutputs( ) const
48 {
49   return( this->m_Outputs.size( ) );
50 }
51
52 // -------------------------------------------------------------------------
53 void cpPlugins::Interface::ProcessObject::
54 SetInput(
55   unsigned int idx, const cpPlugins::Interface::DataObject* dobj
56   )
57 {
58   if( idx < this->m_Inputs.size( ) )
59     this->m_Inputs[ idx ] = dobj;
60 }
61
62 // -------------------------------------------------------------------------
63 cpPlugins::Interface::DataObject* cpPlugins::Interface::ProcessObject::
64 GetOutput( unsigned int idx ) const
65 {
66   if( idx < this->m_Outputs.size( ) )
67     return( this->m_Outputs[ idx ] );
68   else
69     return( NULL );
70 }
71
72 // -------------------------------------------------------------------------
73 std::string cpPlugins::Interface::ProcessObject::
74 Update( )
75 {
76   // Force upstream updates
77   for( unsigned int idx = 0; idx < this->m_Inputs.size( ); ++idx )
78     this->m_Inputs->GetSource( )->Update( );
79
80   // Current update
81   std::string ret = this->_GenerateData( );
82
83   // Sync outputs
84   for( unsigned int odx = 0; odx < this->m_Outputs.size( ); ++odx )
85     this->m_Outputs->SetSource( this );
86
87   return( ret );
88 }
89
90
91 // eof - $RCSfile$