selxComponentSelector.h 3.1 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
66
67
  void AddAcceptingInterfaceCriteria(const InterfaceCriteriaType & interfaceCriteria);
  void AddProvidingInterfaceCriteria(const InterfaceCriteriaType & interfaceCriteria);

68
  /** Check for multiple versus 1 or 0 components*/
69
70
  bool HasMultipleComponents( void );

71
  unsigned int RequireAcceptInterfaceFrom(ComponentBasePointer other, const InterfaceCriteriaType & interfaceCriteria);
72

73
  /** Return Component or Nullptr*/
74
75
  ComponentBasePointer GetComponent( void );

76
protected:
77
78

  CriteriaType      m_Criteria;
79
  ComponentListType m_PossibleComponents;
Floris Berendsen's avatar
Floris Berendsen committed
80
81
  ComponentSelector();
  ~ComponentSelector();
82

83
private:
84
85
86

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

90
91
92
//#ifndef ITK_MANUAL_INSTANTIATION
//#include "ComponentSelector.hxx"
//#endif
93

94
#endif