selxComponentBase.h 2.81 KB
Newer Older
Floris Berendsen's avatar
Floris Berendsen committed
1
2
/*=========================================================================
 *
3
 *  Copyright Leiden University Medical Center, Erasmus University Medical
Floris Berendsen's avatar
Floris Berendsen committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *  Center and contributors
 *
 *  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.
 *
 *=========================================================================*/

20
21
22
#ifndef ComponentBase_h
#define ComponentBase_h

Floris Berendsen's avatar
Floris Berendsen committed
23
24
#include "itkLightObject.h"
#include "itkObjectFactory.h"
25
26
#include "itkMacro.h"

Floris Berendsen's avatar
Floris Berendsen committed
27
28
//#include "itkComponentBase.h"
#include <list>
29
#include <iostream>
Floris Berendsen's avatar
Floris Berendsen committed
30
31
#include <fstream>
#include <string>
32
#include <cstring>
Floris Berendsen's avatar
Floris Berendsen committed
33
34
35
#include <map>

namespace selx
36
{
37
38
39
class ComponentBase : public itk::LightObject
{
public:
40

41
42
43
44
  /** Standard class typedefs */
  typedef ComponentBase             Self;
  typedef itk::LightObject          Superclass;
  typedef itk::SmartPointer< Self > Pointer;
Floris Berendsen's avatar
Floris Berendsen committed
45

46
47
  /** Run-time type information (and related methods). */
  itkTypeMacro( ComponentBase, Superclass );
Floris Berendsen's avatar
Floris Berendsen committed
48

49
50
51
52
53
54
  typedef std::string                ParameterKeyType;
  typedef std::vector< std::string > ParameterValueType;
  //typedef std::map< ParameterKeyType, ParameterValueType >           ParameterMapType;
  //TODO choose uniform naming for Typedefs
  typedef std::map< ParameterKeyType, ParameterValueType >  CriteriaType;
  typedef std::pair< ParameterKeyType, ParameterValueType > CriterionType;
Floris Berendsen's avatar
Floris Berendsen committed
55

Floris Berendsen's avatar
Floris Berendsen committed
56
57
  typedef std::map< std::string, std::string >  InterfaceCriteriaType;

58
  enum interfaceStatus { success, noaccepter, noprovider, multiple };
Floris Berendsen's avatar
Floris Berendsen committed
59

60
  virtual interfaceStatus AcceptConnectionFrom( const char *, ComponentBase * ) = 0;
61

62
  virtual int AcceptConnectionFrom( ComponentBase * ) = 0;
Floris Berendsen's avatar
Floris Berendsen committed
63

64
65
  /** if there is any failed criterion, return false (like a short - circuit AND) */
  bool MeetsCriterionBase( const CriterionType & criterion );
Floris Berendsen's avatar
Floris Berendsen committed
66

67
68
  virtual bool MeetsCriterion( const CriterionType & criterion ) = 0;

69
  virtual interfaceStatus CanAcceptConnectionFrom(ComponentBase*, const InterfaceCriteriaType) = 0;
70

Floris Berendsen's avatar
Floris Berendsen committed
71
  //experimental:
72
  virtual unsigned int CountAcceptingInterfaces(const InterfaceCriteriaType) = 0;
Floris Berendsen's avatar
Floris Berendsen committed
73

74
  virtual unsigned int CountProvidingInterfaces(const InterfaceCriteriaType) = 0;
75
protected:
Floris Berendsen's avatar
Floris Berendsen committed
76

77
78
79
80
  virtual bool HasAcceptingInterface( const char * ) = 0;

  virtual bool HasProvidingInterface( const char * ) = 0;
  
81
82
83
84
  ComponentBase() {}
  virtual ~ComponentBase() {}
};
} // end namespace selx
Floris Berendsen's avatar
Floris Berendsen committed
85
86

#endif // ComponentBase_h