Orfeo Toolbox  4.0
itkObjectFactoryBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef __itkObjectFactoryBase_h
29 #define __itkObjectFactoryBase_h
30 
32 #include <list>
33 #include <vector>
34 
35 namespace itk
36 {
56 class OverRideMap;
57 
58 class ITKCommon_EXPORT ObjectFactoryBase:public Object
59 {
60 public:
63  typedef Object Superclass;
66 
68  itkTypeMacro(ObjectFactoryBase, Object);
69 
74  static LightObject::Pointer CreateInstance(const char *itkclassname);
75 
80  static std::list< LightObject::Pointer >
81  CreateAllInstance(const char *itkclassname);
82 
85  static void ReHash();
86 
94  static void RegisterFactoryInternal(ObjectFactoryBase *);
95 
99  typedef enum
100  {
103  INSERT_AT_POSITION
104  } InsertionPositionType;
105 
124  static bool RegisterFactory(ObjectFactoryBase *,
125  InsertionPositionType where=INSERT_AT_BACK, size_t position = 0);
126 
128  static void UnRegisterFactory(ObjectFactoryBase *);
129 
131  static void UnRegisterAllFactories();
132 
135  static std::list< ObjectFactoryBase * > GetRegisteredFactories();
136 
142  virtual const char * GetITKSourceVersion(void) const = 0;
143 
149  static void SetStrictVersionChecking( bool );
150  static void StrictVersionCheckingOn();
151  static void StrictVersionCheckingOff();
152  static bool GetStrictVersionChecking();
153 
155  virtual const char * GetDescription(void) const = 0;
156 
158  virtual std::list< std::string > GetClassOverrideNames();
159 
161  virtual std::list< std::string > GetClassOverrideWithNames();
162 
164  virtual std::list< std::string > GetClassOverrideDescriptions();
165 
167  virtual std::list< bool > GetEnableFlags();
168 
170  virtual void SetEnableFlag(bool flag,
171  const char *className,
172  const char *subclassName);
173 
175  virtual bool GetEnableFlag(const char *className,
176  const char *subclassName);
177 
181  virtual void Disable(const char *className);
182 
184  const char * GetLibraryPath();
185 
191  std::string m_Description;
192  std::string m_OverrideWithName;
195  };
196 
197 protected:
198  virtual void PrintSelf(std::ostream & os, Indent indent) const;
199 
201  void RegisterOverride(const char *classOverride,
202  const char *overrideClassName,
203  const char *description,
204  bool enableFlag,
205  CreateObjectFunctionBase *createFunction);
206 
210  virtual LightObject::Pointer CreateObject(const char *itkclassname);
211 
215  virtual std::list< LightObject::Pointer >
216  CreateAllObject(const char *itkclassname);
217 
219  virtual ~ObjectFactoryBase();
220 
221 private:
223 
224  ObjectFactoryBase(const Self &); //purposely not implemented
225  void operator=(const Self &); //purposely not implemented
226 
228  static void InitializeFactoryList();
229 
232  static void Initialize();
233 
235  static void RegisterInternal();
236 
238  static void LoadDynamicFactories();
239 
241  static void LoadLibrariesInPath(const char *);
242 
243  static void DeleteNonInternalFactory( ObjectFactoryBase * );
244 
248  unsigned long m_LibraryDate;
249  std::string m_LibraryPath;
250 
252 };
253 } // end namespace itk
254 
255 #endif

Generated at Sat Mar 8 2014 15:19:02 for Orfeo Toolbox with doxygen 1.8.3.1