Orfeo Toolbox  4.0
itkDataObject.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 __itkDataObject_h
29 #define __itkDataObject_h
30 
31 #include "itkObject.h"
33 #include "itkMacro.h"
34 #include "itkRealTimeStamp.h"
35 
36 namespace itk
37 {
38 class ProcessObject;
39 class DataObject;
40 
41 /*--------------------Data Object Exceptions---------------------------*/
42 
47 class ITKCommon_EXPORT DataObjectError:public ExceptionObject
48 {
49 public:
53 
55  virtual ~DataObjectError()
56  throw( ) {}
57 
59  DataObjectError(const char *file, unsigned int lineNumber);
60 
62  DataObjectError(const std::string & file, unsigned int lineNumber);
63 
65  DataObjectError(const DataObjectError & orig);
66 
68  DataObjectError & operator=(const DataObjectError & orig);
69 
71  itkTypeMacro(DataObjectError, ExceptionObject);
72 
74  void SetDataObject(DataObject *dobj);
75 
77  DataObject * GetDataObject();
78 
79 protected:
84  virtual void PrintSelf(std::ostream & os, Indent indent) const;
85 
86 private:
88 };
89 
96 class ITKCommon_EXPORT InvalidRequestedRegionError:public DataObjectError
97 {
98 public:
102 
105  throw( ) {}
106 
108  InvalidRequestedRegionError(const char *file, unsigned int lineNumber);
109 
111  InvalidRequestedRegionError(const std::string & file, unsigned int lineNumber);
112 
115 
118 
121 
122 protected:
127  virtual void PrintSelf(std::ostream & os, Indent indent) const;
128 };
129 
130 /*----------------------------Data Object--------------------------------*/
131 
275 class ITKCommon_EXPORT DataObject:public Object
276 {
277 public:
279  typedef DataObject Self;
283 
284  typedef std::string DataObjectIdentifierType;
285 
287  itkTypeMacro(DataObject, Object);
288 
294  void DisconnectPipeline();
295 
309 
311  const DataObjectIdentifierType & GetSourceOutputName() const;
312 
314  typedef std::vector< Pointer >::size_type DataObjectPointerArraySizeType;
315  DataObjectPointerArraySizeType GetSourceOutputIndex() const;
316 
319  virtual void Initialize();
320 
323  void SetReleaseDataFlag(bool flag)
324  {
325  m_ReleaseDataFlag = flag;
326  }
327 
328  itkGetConstReferenceMacro(ReleaseDataFlag, bool);
329  itkBooleanMacro(ReleaseDataFlag);
330 
334  static void SetGlobalReleaseDataFlag(bool val);
335 
336  static bool GetGlobalReleaseDataFlag();
337 
338  static void GlobalReleaseDataFlagOn()
339  { Self::SetGlobalReleaseDataFlag(true); }
340  static void GlobalReleaseDataFlagOff()
341  { Self::SetGlobalReleaseDataFlag(false); }
342 
347  void ReleaseData();
348 
351  bool ShouldIReleaseData() const;
352 
354  bool GetDataReleased() const
355  { return m_DataReleased; }
356 
367  virtual void Update();
368 
378  virtual void UpdateOutputInformation();
379 
382  virtual void PropagateRequestedRegion();
383 
384  virtual void UpdateOutputData();
385 
389  virtual void ResetPipeline();
390 
393  void SetPipelineMTime(ModifiedTimeType time)
394  { m_PipelineMTime = time; }
395  itkGetConstReferenceMacro(PipelineMTime, ModifiedTimeType);
396 
398  virtual ModifiedTimeType GetUpdateMTime() const;
399 
405  itkSetMacro( RealTimeStamp, RealTimeStamp );
406  itkGetConstReferenceMacro( RealTimeStamp, RealTimeStamp );
407 
416  virtual void PrepareForNewData()
417  { this->Initialize(); }
418 
423  virtual void DataHasBeenGenerated();
424 
429 
439  virtual bool RequestedRegionIsOutsideOfTheBufferedRegion()
440  { return false; }
441 
454  virtual bool VerifyRequestedRegion() { return true; }
455 
465  virtual void CopyInformation(const DataObject *) {}
466 
472  virtual void SetRequestedRegion(const DataObject *) {}
473 
479  virtual void Graft(const DataObject *) {}
480 
481 protected:
482  DataObject();
483  ~DataObject();
484  void PrintSelf(std::ostream & os, Indent indent) const;
485 
487  virtual void PropagateResetPipeline();
488 
489 private:
490  DataObject(const Self &); //purposely not implemented
491  void operator=(const Self &); //purposely not implemented
492 
496 
502 
505 
506  bool m_ReleaseDataFlag; //Data will release after use by a filter if on
507  bool m_DataReleased; //Keep track of data release during pipeline execution
508 
512 
515 
520  bool ConnectSource(ProcessObject *s, const DataObjectIdentifierType & name);
521 
530  bool DisconnectSource(ProcessObject *s, const DataObjectIdentifierType & name);
531 
533  friend class ProcessObject;
534  friend class DataObjectError;
535 };
536 } // end namespace itk
537 
538 #endif

Generated at Sat Mar 8 2014 14:32:08 for Orfeo Toolbox with doxygen 1.8.3.1