]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/BaseObjects/Parameters.cxx
...
[cpPlugins.git] / lib / cpPlugins / BaseObjects / Parameters.cxx
1 #include <cpPlugins/BaseObjects/Parameters.h>
2 #include <cpExtensions/Utility.h>
3 #include <tinyxml2/tinyxml2.h>
4
5 // -------------------------------------------------------------------------
6 cpPlugins::BaseObjects::Parameters::
7 Parameters( )
8 {
9   this->Clear( );
10 }
11
12 // -------------------------------------------------------------------------
13 cpPlugins::BaseObjects::Parameters::
14 ~Parameters( )
15 {
16 }
17
18 // -------------------------------------------------------------------------
19 void cpPlugins::BaseObjects::Parameters::
20 Modified( ) const
21 {
22   this->m_TimeStamp.Modified( );
23 }
24
25 // -------------------------------------------------------------------------
26 itk::ModifiedTimeType cpPlugins::BaseObjects::Parameters::
27 GetMTime( ) const
28 {
29   return( this->m_TimeStamp.GetMTime( ) );
30 }
31
32 // -------------------------------------------------------------------------
33 void cpPlugins::BaseObjects::Parameters::
34 Clear( )
35 {
36   this->m_Parameters.clear( );
37   this->Modified( );
38 }
39
40 // -------------------------------------------------------------------------
41 void cpPlugins::BaseObjects::Parameters::
42 GetNames( std::vector< std::string >& container ) const
43 {
44   container.clear( );
45   TParameters::const_iterator i = this->m_Parameters.begin( );
46   for( ; i != this->m_Parameters.end( ); ++i )
47     container.push_back( i->first );
48 }
49
50 // -------------------------------------------------------------------------
51 cpPlugins::BaseObjects::Parameters::
52 Type cpPlugins::BaseObjects::Parameters::
53 GetType( const std::string& name ) const
54 {
55   auto i = this->m_Parameters.find( name );
56   if( i != this->m_Parameters.end( ) )
57     return( i->second.first );
58   else
59     return( Self::NoType );
60 }
61
62 // -------------------------------------------------------------------------
63 #define cpPlugins_BaseObjects_Parameters_TypeAsString( Y )      \
64   if( i->second.first == Self::Y )                              \
65     return( #Y )
66
67 std::string cpPlugins::BaseObjects::Parameters::
68 GetTypeAsString( const std::string& name ) const
69 {
70   auto i = this->m_Parameters.find( name );
71   cpPlugins_BaseObjects_Parameters_TypeAsString( String );
72   else cpPlugins_BaseObjects_Parameters_TypeAsString( Bool );
73   else cpPlugins_BaseObjects_Parameters_TypeAsString( Int );
74   else cpPlugins_BaseObjects_Parameters_TypeAsString( Uint );
75   else cpPlugins_BaseObjects_Parameters_TypeAsString( Real );
76   else cpPlugins_BaseObjects_Parameters_TypeAsString( OpenFileName );
77   else cpPlugins_BaseObjects_Parameters_TypeAsString( SaveFileName );
78   else cpPlugins_BaseObjects_Parameters_TypeAsString( PathName );
79   else cpPlugins_BaseObjects_Parameters_TypeAsString( StringList );
80   else cpPlugins_BaseObjects_Parameters_TypeAsString( BoolList );
81   else cpPlugins_BaseObjects_Parameters_TypeAsString( IntList );
82   else cpPlugins_BaseObjects_Parameters_TypeAsString( UintList );
83   else cpPlugins_BaseObjects_Parameters_TypeAsString( RealList );
84   else cpPlugins_BaseObjects_Parameters_TypeAsString( OpenFileNameList );
85   else cpPlugins_BaseObjects_Parameters_TypeAsString( SaveFileNameList );
86   else cpPlugins_BaseObjects_Parameters_TypeAsString( PathNameList );
87   else cpPlugins_BaseObjects_Parameters_TypeAsString( Choices );
88   else return( "NoType" );
89 }
90
91 // -------------------------------------------------------------------------
92 #define cpPlugins_BaseObjects_Parameters_TypeFromString( Y, str )   \
93   if( str == std::string( #Y ) )                                    \
94     return( Self::Y )
95
96 cpPlugins::BaseObjects::Parameters::
97 Type cpPlugins::BaseObjects::Parameters::
98 GetTypeFromString( const std::string& t )
99 {
100   cpPlugins_BaseObjects_Parameters_TypeFromString( String, t );
101   else cpPlugins_BaseObjects_Parameters_TypeFromString( Bool, t );
102   else cpPlugins_BaseObjects_Parameters_TypeFromString( Int, t );
103   else cpPlugins_BaseObjects_Parameters_TypeFromString( Uint, t );
104   else cpPlugins_BaseObjects_Parameters_TypeFromString( Real, t );
105   else cpPlugins_BaseObjects_Parameters_TypeFromString( OpenFileName, t );
106   else cpPlugins_BaseObjects_Parameters_TypeFromString( SaveFileName, t );
107   else cpPlugins_BaseObjects_Parameters_TypeFromString( PathName, t );
108   else cpPlugins_BaseObjects_Parameters_TypeFromString( StringList, t );
109   else cpPlugins_BaseObjects_Parameters_TypeFromString( BoolList, t );
110   else cpPlugins_BaseObjects_Parameters_TypeFromString( IntList, t );
111   else cpPlugins_BaseObjects_Parameters_TypeFromString( UintList, t );
112   else cpPlugins_BaseObjects_Parameters_TypeFromString( RealList, t );
113   else cpPlugins_BaseObjects_Parameters_TypeFromString( OpenFileNameList, t );
114   else cpPlugins_BaseObjects_Parameters_TypeFromString( SaveFileNameList, t );
115   else cpPlugins_BaseObjects_Parameters_TypeFromString( PathNameList, t );
116   else cpPlugins_BaseObjects_Parameters_TypeFromString( Choices, t );
117   else return( Self::NoType );
118 }
119
120 // -------------------------------------------------------------------------
121 std::string cpPlugins::BaseObjects::Parameters::
122 GetString( const std::string& name, bool force ) const
123 {
124   auto i = this->m_Parameters.find( name );
125   if( i != this->m_Parameters.end( ) )
126   {
127     if( i->second.first == Self::String || force )
128       return( i->second.second );
129     else
130       return( "" );
131   }
132   else
133     return( "" );
134 }
135
136 // -------------------------------------------------------------------------
137 void cpPlugins::BaseObjects::Parameters::
138 SetString( const std::string& name, const std::string& v, bool force )
139 {
140   auto i = this->m_Parameters.find( name );
141   if( i != this->m_Parameters.end( ) )
142   {
143     if( i->second.first == Self::String || force )
144     {
145       if( i->second.second != v )
146       {
147         i->second.second = v;
148         this->Modified( );
149
150       } // fi
151
152     } // fi
153
154   } // fi
155 }
156
157 // -------------------------------------------------------------------------
158 void cpPlugins::BaseObjects::Parameters::
159 ConfigureAsChoices(
160   const std::string& name, const std::vector< std::string >& choices
161   )
162 {
163   // It is invalid not to give choices when configuring
164   if( choices.size( ) == 0 )
165     return;
166
167   std::stringstream str_choices;
168   str_choices << choices[ 0 ];
169   for( unsigned int i = 1; i < choices.size( ); ++i )
170     str_choices << "#" << choices[ i ];
171   str_choices << "@";
172   this->m_Parameters[ name ] =
173     TParameter( Self::Choices, str_choices.str( ) );
174   this->Modified( );
175 }
176
177 // -------------------------------------------------------------------------
178 std::vector< std::string > cpPlugins::BaseObjects::Parameters::
179 GetChoices( const std::string& name ) const
180 {
181   std::vector< std::string > choices;
182
183   TParameters::const_iterator i = this->m_Parameters.find( name );
184   if( i != this->m_Parameters.end( ) )
185   {
186     if( i->second.first == Self::Choices )
187     {
188       std::istringstream str_choices( i->second.second );
189       std::string real_choices;
190       std::getline( str_choices, real_choices, '@' );
191       std::istringstream str( real_choices );
192       std::string token;
193       while( std::getline( str, token, '#' ) )
194         choices.push_back( token );
195
196     } // fi
197
198   } // fi
199   return( choices );
200 }
201
202 // -------------------------------------------------------------------------
203 std::string cpPlugins::BaseObjects::Parameters::
204 GetSelectedChoice( const std::string& name ) const
205 {
206   auto i = this->m_Parameters.find( name );
207   if( i != this->m_Parameters.end( ) )
208   {
209     if( i->second.first == Self::Choices )
210     {
211       std::istringstream str_choices( i->second.second );
212       std::string real_choice;
213       std::getline( str_choices, real_choice, '@' );
214       std::getline( str_choices, real_choice, '@' );
215       return( real_choice );
216     }
217     else
218       return( "" );
219   }
220   else
221     return( "" );
222 }
223
224 // -------------------------------------------------------------------------
225 bool cpPlugins::BaseObjects::Parameters::
226 SetSelectedChoice( const std::string& name, const std::string& choice )
227 {
228   auto i = this->m_Parameters.find( name );
229   if( i != this->m_Parameters.end( ) )
230   {
231     if( i->second.first == Self::Choices )
232     {
233       std::istringstream str_choices( i->second.second );
234       std::string choices;
235       std::getline( str_choices, choices, '@' );
236       if( choices.find( choice ) != std::string::npos )
237       {
238         std::stringstream new_choices;
239         new_choices << choices << "@" << choice;
240         i->second.second = new_choices.str( );
241         this->Modified( );
242         return( true );
243       }
244       else
245         return( false );
246     }
247     else
248       return( false );
249   }
250   else
251     return( false );
252 }
253
254 // -------------------------------------------------------------------------
255 std::string cpPlugins::BaseObjects::Parameters::
256 GetAcceptedFileExtensions( const std::string& name ) const
257 {
258   auto i = this->m_AcceptedFileExtensions.find( name );
259   if( i != this->m_AcceptedFileExtensions.end( ) )
260     return( i->second );
261   else
262     return( "" );
263 }
264
265 // -------------------------------------------------------------------------
266 void cpPlugins::BaseObjects::Parameters::
267 SetAcceptedFileExtensions(
268   const std::string& name, const std::string& extensions
269   )
270 {
271   auto i = this->m_Parameters.find( name );
272   if( i != this->m_Parameters.end( ) )
273   {
274     bool is_valid = ( i->second.first == Self::OpenFileName );
275     is_valid     |= ( i->second.first == Self::SaveFileName );
276     is_valid     |= ( i->second.first == Self::OpenFileNameList );
277     is_valid     |= ( i->second.first == Self::SaveFileNameList );
278     if( is_valid )
279       this->m_AcceptedFileExtensions[ name ] = extensions;
280
281   } // fi
282 }
283
284 // -------------------------------------------------------------------------
285 bool cpPlugins::BaseObjects::Parameters::
286 ToXML(
287   tinyxml2::XMLDocument* doc, tinyxml2::XMLElement* parent_elem
288   ) const
289 {
290   if( parent_elem == NULL )
291     return( false );
292
293   auto pIt = this->m_Parameters.begin( );
294   for( ; pIt != this->m_Parameters.end( ); ++pIt )
295   {
296     tinyxml2::XMLElement* p = doc->NewElement( "Parameter" );
297     p->SetAttribute( "Name", pIt->first.c_str( ) );
298     p->SetAttribute( "Value", pIt->second.second.c_str( ) );
299     p->SetAttribute( "Type", this->GetTypeAsString( pIt->first ).c_str( ) );
300     parent_elem->InsertEndChild( p );
301
302   } // rof
303   return( true );
304 }
305
306 // -------------------------------------------------------------------------
307 bool cpPlugins::BaseObjects::Parameters::
308 FromXML( const tinyxml2::XMLElement* filter_elem )
309 {
310   const tinyxml2::XMLElement* param =
311     filter_elem->FirstChildElement( "Parameter" );
312   bool ret = false;
313   while( param != NULL )
314   {
315     const char* param_name = param->Attribute( "Name" );
316     const char* param_type = param->Attribute( "Type" );
317     if( param_name != NULL && param_type != NULL )
318     {
319       TParameter value;
320       value.second = param->Attribute( "Value" );
321       value.first = Self::GetTypeFromString( param_type );
322       this->m_Parameters[ param_name ] = value;
323
324     } // fi
325     param = param->NextSiblingElement( "Parameter" );
326     ret = true;
327
328   } // elihw
329   this->Modified( );
330   return( ret );
331 }
332
333 // -------------------------------------------------------------------------
334 cpPlugins::BaseObjects::Parameters::
335 TParameters& cpPlugins::BaseObjects::Parameters::
336 GetRawParameters( )
337 {
338   return( this->m_Parameters );
339 }
340
341 // -------------------------------------------------------------------------
342 const cpPlugins::BaseObjects::Parameters::
343 TParameters& cpPlugins::BaseObjects::Parameters::
344 GetRawParameters( ) const
345 {
346   return( this->m_Parameters );
347 }
348
349 // -------------------------------------------------------------------------
350 #define cpPlugins_BaseObjects_Parameters_Configure_Code( Y )            \
351   void cpPlugins::BaseObjects::Parameters::                             \
352   ConfigureAs##Y( const std::string& name, const T##Y& init )           \
353   {                                                                     \
354     this->_Configure< Y >( name );                                      \
355     this->Set##Y( name, init );                                         \
356   }                                                                     \
357   bool cpPlugins::BaseObjects::Parameters::                             \
358   Has##Y( const std::string& name ) const                               \
359   { return( this->_Has< Y >( name ) ); }
360
361 // -------------------------------------------------------------------------
362 #define cpPlugins_BaseObjects_Parameters_ConfigureList_Code( Y )        \
363   void cpPlugins::BaseObjects::Parameters::                             \
364   ConfigureAs##Y##List( const std::string& name )                       \
365   { this->_Configure< Y##List >( name ); }                              \
366   bool cpPlugins::BaseObjects::Parameters::                             \
367   Has##Y##List( const std::string& name ) const                         \
368   { return( this->_Has< Y##List >( name ) ); }
369
370 // -------------------------------------------------------------------------
371 #define cpPlugins_BaseObjects_Parameters_GetSet_Code( Y )               \
372   cpPlugins::BaseObjects::Parameters::T##Y                              \
373   cpPlugins::BaseObjects::Parameters::                                  \
374   Get##Y( const std::string& name ) const                               \
375   { return( this->_Get< T##Y, Y >( name ) ); }                          \
376   void cpPlugins::BaseObjects::Parameters::Set##Y(                      \
377     const std::string& name, const T##Y& v                              \
378     )                                                                   \
379   { this->_Set< T##Y, Y >( name, v ); }
380
381 // -------------------------------------------------------------------------
382 #define cpPlugins_BaseObjects_Parameters_GetSetList_Code( Y )           \
383   std::vector< cpPlugins::BaseObjects::Parameters::T##Y >               \
384   cpPlugins::BaseObjects::Parameters::                                  \
385   Get##Y##List( const std::string& name ) const                         \
386   { return( this->_GetList< T##Y, Y##List >( name ) ); }                \
387   void cpPlugins::BaseObjects::Parameters::AddTo##Y##List(              \
388     const std::string& name,                                            \
389     const cpPlugins::BaseObjects::Parameters::T##Y& v                   \
390     )                                                                   \
391   { this->_AddToList< T##Y, Y##List >( name, v ); }                     \
392   void cpPlugins::BaseObjects::Parameters::                             \
393   Clear##Y##List( const std::string& name )                             \
394   { this->_ClearList< Y##List >( name ); }
395
396 // -------------------------------------------------------------------------
397 cpPlugins_BaseObjects_Parameters_Configure_Code( String );
398 cpPlugins_BaseObjects_Parameters_Configure_Code( Bool );
399 cpPlugins_BaseObjects_Parameters_Configure_Code( Int );
400 cpPlugins_BaseObjects_Parameters_Configure_Code( Uint );
401 cpPlugins_BaseObjects_Parameters_Configure_Code( Real );
402 cpPlugins_BaseObjects_Parameters_Configure_Code( OpenFileName );
403 cpPlugins_BaseObjects_Parameters_Configure_Code( SaveFileName );
404 cpPlugins_BaseObjects_Parameters_Configure_Code( PathName );
405
406 cpPlugins_BaseObjects_Parameters_ConfigureList_Code( String );
407 cpPlugins_BaseObjects_Parameters_ConfigureList_Code( Bool );
408 cpPlugins_BaseObjects_Parameters_ConfigureList_Code( Int );
409 cpPlugins_BaseObjects_Parameters_ConfigureList_Code( Uint );
410 cpPlugins_BaseObjects_Parameters_ConfigureList_Code( Real );
411 cpPlugins_BaseObjects_Parameters_ConfigureList_Code( OpenFileName );
412 cpPlugins_BaseObjects_Parameters_ConfigureList_Code( SaveFileName );
413 cpPlugins_BaseObjects_Parameters_ConfigureList_Code( PathName );
414
415 cpPlugins_BaseObjects_Parameters_GetSet_Code( Bool );
416 cpPlugins_BaseObjects_Parameters_GetSet_Code( Int );
417 cpPlugins_BaseObjects_Parameters_GetSet_Code( Uint );
418 cpPlugins_BaseObjects_Parameters_GetSet_Code( Real );
419 cpPlugins_BaseObjects_Parameters_GetSet_Code( OpenFileName );
420 cpPlugins_BaseObjects_Parameters_GetSet_Code( SaveFileName );
421 cpPlugins_BaseObjects_Parameters_GetSet_Code( PathName );
422
423 cpPlugins_BaseObjects_Parameters_GetSetList_Code( String );
424 cpPlugins_BaseObjects_Parameters_GetSetList_Code( Bool );
425 cpPlugins_BaseObjects_Parameters_GetSetList_Code( Int );
426 cpPlugins_BaseObjects_Parameters_GetSetList_Code( Uint );
427 cpPlugins_BaseObjects_Parameters_GetSetList_Code( Real );
428 cpPlugins_BaseObjects_Parameters_GetSetList_Code( PathName );
429
430 // -------------------------------------------------------------------------
431 std::vector< cpPlugins::BaseObjects::Parameters::TOpenFileName >
432 cpPlugins::BaseObjects::Parameters::
433 GetOpenFileNameList( const std::string& name ) const
434 {
435   return( this->_GetList< TOpenFileName, OpenFileNameList >( name ) );
436 }
437
438 // -------------------------------------------------------------------------
439 void cpPlugins::BaseObjects::Parameters::
440 AddToOpenFileNameList(
441   const std::string& name,
442   const cpPlugins::BaseObjects::Parameters::TOpenFileName& v
443   )
444 {
445   auto i = this->m_Parameters.find( name );
446   if( i != this->m_Parameters.end( ) )
447   {
448     if( i->second.first == OpenFileNameList )
449     {
450       auto pos = name.find_last_of( "/\\" );
451       if( i->second.second == "" )
452         i->second.second = name.substr( 0, pos );
453       i->second.second += std::string( "#" );
454       i->second.second += name.substr( pos + 1 );
455       this->Modified( );
456
457     } // fi
458
459   } // fi
460 }
461
462 // -------------------------------------------------------------------------
463 void cpPlugins::BaseObjects::Parameters::
464 ClearOpenFileNameList( const std::string& name )
465 {
466   this->_ClearList< OpenFileNameList >( name );
467 }
468
469 // -------------------------------------------------------------------------
470 std::vector< cpPlugins::BaseObjects::Parameters::TSaveFileName >
471 cpPlugins::BaseObjects::Parameters::
472 GetSaveFileNameList( const std::string& name ) const
473 {
474   return( this->_GetList< TSaveFileName, SaveFileNameList >( name ) );
475 }
476
477 // -------------------------------------------------------------------------
478 void cpPlugins::BaseObjects::Parameters::
479 AddToSaveFileNameList(
480   const std::string& name,
481   const cpPlugins::BaseObjects::Parameters::TSaveFileName& v
482   )
483 {
484   auto i = this->m_Parameters.find( name );
485   if( i != this->m_Parameters.end( ) )
486   {
487     if( i->second.first == SaveFileNameList )
488     {
489       auto pos = name.find_last_of( "/\\" );
490       if( i->second.second == "" )
491         i->second.second = name.substr( 0, pos );
492       i->second.second += std::string( "#" );
493       i->second.second += name.substr( pos + 1 );
494       this->Modified( );
495
496     } // fi
497
498   } // fi
499 }
500
501 // -------------------------------------------------------------------------
502 void cpPlugins::BaseObjects::Parameters::
503 ClearSaveFileNameList( const std::string& name )
504 {
505   this->_ClearList< SaveFileNameList >( name );
506 }
507
508 // -------------------------------------------------------------------------
509 template< unsigned int _Enum >
510 void cpPlugins::BaseObjects::Parameters::
511 _Configure( const std::string& name )
512 {
513   this->m_Parameters[ name ] = TParameter( ( Self::Type )( _Enum ), "" );
514   this->Modified( );
515 }
516
517 // -------------------------------------------------------------------------
518 template< unsigned int _Enum >
519 bool cpPlugins::BaseObjects::Parameters::
520 _Has( const std::string& name ) const
521 {
522   auto i = this->m_Parameters.find( name );
523   if( i != this->m_Parameters.end( ) )
524     return( i->second.first == ( Self::Type )( _Enum ) );
525   else
526     return( false );
527 }
528
529 // -------------------------------------------------------------------------
530 template< class _Type, unsigned int _Enum >
531 _Type cpPlugins::BaseObjects::Parameters::
532 _Get( const std::string& name ) const
533 {
534   auto i = this->m_Parameters.find( name );
535   if( i != this->m_Parameters.end( ) )
536   {
537     if( i->second.first == ( Self::Type )( _Enum ) )
538     {
539       if( typeid( _Type ) != typeid( std::string ) )
540       {
541         std::istringstream tok_str( i->second.second );
542         _Type v;
543         tok_str >> v;
544         return( v );
545       }
546       else
547       {
548         const _Type* ptr =
549           reinterpret_cast< const _Type* >( &( i->second.second ) );
550         return( *ptr );
551
552       } // fi
553
554     } // fi
555
556   } // fi
557   return( _Type( 0 ) );
558 }
559
560 // -------------------------------------------------------------------------
561 template< class _Type, unsigned int _Enum >
562 void cpPlugins::BaseObjects::Parameters::
563 _Set( const std::string& name, const _Type& v )
564 {
565   auto i = this->m_Parameters.find( name );
566   if( i != this->m_Parameters.end( ) )
567   {
568     if( i->second.first == ( Self::Type )( _Enum ) )
569     {
570       if( typeid( _Type ) != typeid( std::string ) )
571       {
572         std::stringstream str;
573         str << v;
574         if( i->second.second != str.str( ) )
575         {
576           i->second.second = str.str( );
577           this->Modified( );
578
579         } // fi
580       }
581       else
582       {
583         const std::string* str = reinterpret_cast< const std::string* >( &v );
584         if( i->second.second != *str )
585         {
586           i->second.second = *str;
587           this->Modified( );
588
589         } // fi
590
591       } // fi
592
593     } // fi
594
595   } // fi
596
597 }
598
599 // -------------------------------------------------------------------------
600 template< class _Type, unsigned int _Enum >
601 std::vector< _Type > cpPlugins::BaseObjects::Parameters::
602 _GetList( const std::string& name ) const
603 {
604   std::vector< _Type > lst;
605   std::vector< std::string >* slst =
606     reinterpret_cast< std::vector< std::string >* >( &lst );
607   auto i = this->m_Parameters.find( name );
608   if( i != this->m_Parameters.end( ) )
609   {
610     if( i->second.first == ( Self::Type )( _Enum ) )
611     {
612       std::vector< std::string > tokens;
613       cpExtensions::Tokenize( tokens, i->second.second, "#" );
614       for( auto t = tokens.begin( ); t != tokens.end( ); ++t )
615       {
616         if( typeid( _Type ) != typeid( std::string ) )
617         {
618           std::istringstream tok_str( *t );
619           _Type v;
620           tok_str >> v;
621           lst.push_back( v );
622         }
623         else
624           slst->push_back( *t );
625
626       } // rof
627
628     } // fi
629
630   } // fi
631   return( lst );
632 }
633
634 // -------------------------------------------------------------------------
635 template< class _Type, unsigned int _Enum >
636 void cpPlugins::BaseObjects::Parameters::
637 _AddToList( const std::string& name, const _Type& v )
638 {
639   auto i = this->m_Parameters.find( name );
640   if( i != this->m_Parameters.end( ) )
641   {
642     if( i->second.first == ( Self::Type )( _Enum ) )
643     {
644       std::stringstream str;
645       if( i->second.second != "" )
646         str << i->second.second << "#";
647       str << v;
648       i->second.second = str.str( );
649       this->Modified( );
650
651     } // fi
652
653   } // fi
654 }
655
656 // -------------------------------------------------------------------------
657 template< unsigned int _Enum >
658 void cpPlugins::BaseObjects::Parameters::
659 _ClearList( const std::string& name )
660 {
661   auto i = this->m_Parameters.find( name );
662   if( i != this->m_Parameters.end( ) )
663   {
664     if( i->second.first == ( Self::Type )( _Enum ) )
665     {
666       if( i->second.second != "" )
667       {
668         i->second.second = "";
669         this->Modified( );
670
671       } // fi
672
673     } // fi
674
675   } // fi
676 }
677
678 // eof - $RCSfile$