00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkImportImageContainer_h
00018 #define __itkImportImageContainer_h
00019
00020 #include "itkObject.h"
00021 #include "itkObjectFactory.h"
00022 #include <utility>
00023
00024 namespace itk
00025 {
00026
00044 template <typename TElementIdentifier, typename TElement>
00045 class ImportImageContainer: public Object
00046 {
00047 public:
00049 typedef ImportImageContainer Self;
00050 typedef Object Superclass;
00051 typedef SmartPointer<Self> Pointer;
00052 typedef SmartPointer<const Self> ConstPointer;
00053
00055 typedef TElementIdentifier ElementIdentifier;
00056 typedef TElement Element;
00057
00059 itkNewMacro(Self);
00060
00062 itkTypeMacro(ImportImageContainer, Object);
00063
00065 TElement *GetImportPointer() {return m_ImportPointer;};
00066
00073 void SetImportPointer(TElement *ptr, TElementIdentifier num,
00074 bool LetContainerManageMemory = false);
00075
00077 TElement & operator[](const ElementIdentifier id)
00078 { return m_ImportPointer[id]; };
00079
00081 const TElement & operator[](const ElementIdentifier id) const
00082 { return m_ImportPointer[id]; };
00083
00086 TElement *GetBufferPointer()
00087 { return m_ImportPointer; };
00088
00090 unsigned long Capacity(void) const
00091 { return (unsigned long) m_Capacity; };
00092
00094 unsigned long Size(void) const
00095 { return (unsigned long) m_Size; };
00096
00105 void Reserve(ElementIdentifier num);
00106
00113 void Squeeze(void);
00114
00116 void Initialize(void);
00117
00118
00128 itkSetMacro(ContainerManageMemory,bool);
00129 itkGetMacro(ContainerManageMemory,bool);
00130 itkBooleanMacro(ContainerManageMemory);
00132
00133
00134 protected:
00135 ImportImageContainer();
00136 virtual ~ImportImageContainer();
00137
00141 void PrintSelf(std::ostream& os, Indent indent) const;
00142
00143 virtual TElement* AllocateElements(ElementIdentifier size) const;
00144 private:
00145 ImportImageContainer(const Self&);
00146 void operator=(const Self&);
00147
00148 TElement *m_ImportPointer;
00149 TElementIdentifier m_Size;
00150 TElementIdentifier m_Capacity;
00151 bool m_ContainerManageMemory;
00152
00153 };
00154
00155 }
00156
00157
00158 #define ITK_TEMPLATE_ImportImageContainer(_, EXPORT, x, y) namespace itk { \
00159 _(2(class EXPORT ImportImageContainer< ITK_TEMPLATE_2 x >)) \
00160 namespace Templates { typedef ImportImageContainer< ITK_TEMPLATE_2 x > ImportImageContainer##y; } \
00161 }
00162
00163 #if ITK_TEMPLATE_EXPLICIT
00164 # include "Templates/itkImportImageContainer+-.h"
00165 #endif
00166
00167 #if ITK_TEMPLATE_TXX
00168 # include "itkImportImageContainer.txx"
00169 #endif
00170
00171 #endif
00172