selxComponentSelector.h 2.88 KB
Newer Older
1
2
/*=========================================================================
 *
3
 *  Copyright Leiden University Medical Center, Erasmus University Medical
Floris Berendsen's avatar
Floris Berendsen committed
4
 *  Center and contributors
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/
19
20
#ifndef ComponentSelector_h
#define ComponentSelector_h
21

22
#include "itkObjectFactory.h"
23
#include "selxComponentBase.h"
24

25
26
//#pragma once

Floris Berendsen's avatar
Floris Berendsen committed
27
namespace selx
28
{
29
/** \class ComponentFactor
30
31
32
 * \brief Create instances of MetaImageIO objects using an object factory.
 * \ingroup ITKIOMeta
 */
33
class ComponentSelector : public itk::Object
34
35
{
public:
36

37
  /** Standard class typedefs. */
38
39
  typedef ComponentSelector               Self;
  typedef Object                          Superclass;
Floris Berendsen's avatar
Floris Berendsen committed
40
41
  typedef itk::SmartPointer< Self >       Pointer;
  typedef itk::SmartPointer< const Self > ConstPointer;
42

43
44
  /** Class methods used to interface with the registered factories. */
  //virtual const char * GetITKSourceVersion() const { return ITK_SOURCE_VERSION; }
45

46
  /** Run-time type information (and related methods). */
47
  itkTypeMacro( ComponentSelector, Object );
48
49

  /** New macro for creation of through the object factory. */
50
51
  itkNewMacro( Self );

52
  /** Convenient typedefs. */
53
54
  typedef ComponentBase::Pointer       ComponentBasePointer;
  typedef ComponentBase::CriteriaType  CriteriaType;
55
  typedef ComponentBase::CriterionType CriterionType;
56
  typedef ComponentBase::InterfaceCriteriaType  InterfaceCriteriaType;
57

58
  typedef std::list< ComponentBasePointer > ComponentListType;
59
  typedef ComponentListType::size_type      NumberOfComponentsType;
60
  /** set selection criteria for possibleComponents*/
61

62
  /** Narrow selection criteria*/
63
64
  void AddCriterion( const CriterionType & criterion );

65
  /** Check for multiple versus 1 or 0 components*/
66
67
  bool HasMultipleComponents( void );

68
69
  unsigned int CountCompatibleInterfaces(ComponentBasePointer other);

70
  /** Return Component or Nullptr*/
71
72
  ComponentBasePointer GetComponent( void );

73
protected:
74
75

  CriteriaType      m_Criteria;
76
  ComponentListType m_PossibleComponents;
Floris Berendsen's avatar
Floris Berendsen committed
77
78
  ComponentSelector();
  ~ComponentSelector();
79

80
private:
81
82
83

  ComponentSelector( const Self & ); //purposely not implemented
  void operator=( const Self & );    //purposely not implemented
84
};
Floris Berendsen's avatar
Floris Berendsen committed
85
} // end namespace selx
86

87
88
89
//#ifndef ITK_MANUAL_INSTANTIATION
//#include "ComponentSelector.hxx"
//#endif
90

91
#endif