1 #ifndef __fpa__Base__RegionGrow__hxx__
2 #define __fpa__Base__RegionGrow__hxx__
4 #include <fpa/Base/Functors/RegionGrow/Tautology.h>
6 // -------------------------------------------------------------------------
7 template< class _TSuperclass >
8 typename fpa::Base::RegionGrow< _TSuperclass >::
9 TGrowFunction* fpa::Base::RegionGrow< _TSuperclass >::
12 return( this->m_GrowFunction );
15 // -------------------------------------------------------------------------
16 template< class _TSuperclass >
17 const typename fpa::Base::RegionGrow< _TSuperclass >::
18 TGrowFunction* fpa::Base::RegionGrow< _TSuperclass >::
19 GetGrowFunction( ) const
21 return( this->m_GrowFunction );
24 // -------------------------------------------------------------------------
25 template< class _TSuperclass >
26 typename fpa::Base::RegionGrow< _TSuperclass >::
27 TOutput fpa::Base::RegionGrow< _TSuperclass >::
28 GetInsideValue( ) const
30 const TGrowFunction* f = this->GetGrowFunction( );
32 return( f->GetInsideValue( ) );
34 return( this->m_InitResult );
37 // -------------------------------------------------------------------------
38 template< class _TSuperclass >
39 typename fpa::Base::RegionGrow< _TSuperclass >::
40 TOutput fpa::Base::RegionGrow< _TSuperclass >::
41 GetOutsideValue( ) const
43 const TGrowFunction* f = this->GetGrowFunction( );
45 return( f->GetOutsideValue( ) );
47 return( this->m_InitResult );
50 // -------------------------------------------------------------------------
51 template< class _TSuperclass >
52 void fpa::Base::RegionGrow< _TSuperclass >::
53 SetGrowFunction( TGrowFunction* f )
55 TGrowFunction* old_f = this->GetGrowFunction( );
58 f->SetInsideValue( old_f->GetInsideValue( ) );
59 f->SetOutsideValue( old_f->GetOutsideValue( ) );
62 this->m_GrowFunction = f;
65 // -------------------------------------------------------------------------
66 template< class _TSuperclass >
67 void fpa::Base::RegionGrow< _TSuperclass >::
68 SetInsideValue( const TOutput& v )
70 TGrowFunction* f = this->GetGrowFunction( );
73 f->SetInsideValue( v );
79 // -------------------------------------------------------------------------
80 template< class _TSuperclass >
81 void fpa::Base::RegionGrow< _TSuperclass >::
82 SetOutsideValue( const TOutput& v )
84 TGrowFunction* f = this->GetGrowFunction( );
87 f->SetOutsideValue( v );
93 // -------------------------------------------------------------------------
94 template< class _TSuperclass >
95 fpa::Base::RegionGrow< _TSuperclass >::
99 typedef fpa::Base::Functors::RegionGrow::Tautology< TVertex, TOutput > _TFunc;
100 this->SetGrowFunction( _TFunc::New( ) );
101 this->m_InitResult = this->GetGrowFunction( )->GetOutsideValue( );
104 // -------------------------------------------------------------------------
105 template< class _TSuperclass >
106 fpa::Base::RegionGrow< _TSuperclass >::
111 // -------------------------------------------------------------------------
112 template< class _TSuperclass >
113 bool fpa::Base::RegionGrow< _TSuperclass >::
114 _UpdateValue( _TQueueNode& v, const _TQueueNode& p )
119 // -------------------------------------------------------------------------
120 template< class _TSuperclass >
121 typename fpa::Base::RegionGrow< _TSuperclass >::
122 TOutput fpa::Base::RegionGrow< _TSuperclass >::
123 _GetInputValue( const TVertex& v, const TVertex& p )
125 TOutput res = this->m_InitResult;
126 if( this->m_GrowFunction.IsNotNull( ) )
127 res = this->m_GrowFunction->Evaluate( v, p );
131 // -------------------------------------------------------------------------
132 template< class _TSuperclass >
133 bool fpa::Base::RegionGrow< _TSuperclass >::
134 _UpdateResult( _TQueueNode& n )
136 n.Result = this->_GetInputValue( n.Vertex, n.Parent );
137 this->Superclass::_UpdateResult( n );
138 return( n.Result == this->GetInsideValue( ) );
141 #endif // __fpa__Base__RegionGrow__hxx__