KWStyle - itkImageContainerInterface.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkImageContainerInterface.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:37 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkImageContainerInterface_h
18 #define __itkImageContainerInterface_h
19
20 #include "itkObject.h"
21
22 namespace itk
23 {
24
25 /** \class ImageContainerInterface
26  * This should only be used for reference when writing containers
27  * conforming to this interface.  ITK uses generic programming to
28  * allow container type substitution, so polymorphism is not needed to
29  * use containers through this interface.  This means that a container
30  * conforming to this interface need not be derived from it, and that
31  * their methods should not be virtual.  However, the container must
32  * derive from Object in order to support the reference counting,
33  * modification time, and debug information required by this
34  * interface.
35  *
36  * Note that many comments refer to a "default element" or "default element
37  * value".  This value is equal to the default constructor of the
38  * Element type.  Also note that all non-const methods assume that the
39  * container was modified, and update the modification time.
40  *
41  * Template parameters for ImageContainerInterface:
42  *
43  * TElementIdentifier =
44  *    A type that shall be used to index the container.
45  *    It must have a < operator defined for ordering.
46  *
47  * TElement =
48  *    The element type stored in the container.
49  * 
50  * \ingroup ImageObjects
51  */
52 template <typename TElementIdentifier, typename TElement>
53 class ITK_EXPORT ImageContainerInterface: public Object
54 {
55 public:
56   /** Standard class typedefs. */
57   typedef ImageContainerInterface      Self;
58 TDA   typedef Object  Superclass;
59 TDA   typedef SmartPointer<Self>  Pointer;
60 TDA   typedef SmartPointer<const Self>  ConstPointer;
61   
62   /** Standard part of every itk Object. */
63   itkTypeMacro(ImageContainerInterface, Object);
64
65   /** Save the template parameters. */
66   typedef TElementIdentifier  ElementIdentifier;
67   typedef TElement            Element;
68   
69   /** Index operator. This version can be an lvalue. */
70   virtual TElement & operator[](const ElementIdentifier)=0;
71
72   /** Index operator. This version can only be an rvalue */
73   virtual const TElement & operator[](const ElementIdentifier) const =0;
74
75   /** Return a pointer to the beginning of the buffer.  This is used by
76    * the image iterator class. */
77   virtual TElement *GetBufferPointer()=0;
78   
79   /** Get the number of elements currently stored in the container. */
80   virtual unsigned long Size(void) const =0;
81
82   /** Tell the container to allocate enough memory to allow at least
83    * as many elements as the size given to be stored.  This is NOT
84    * guaranteed to actually allocate any memory, but is useful if the
85    * implementation of the container allocates contiguous storage. */
86   virtual void Reserve(ElementIdentifier)=0;
87   
88   /** Tell the container to try to minimize its memory usage for storage of
89    * the current number of elements.  This is NOT guaranteed to decrease
90    * memory usage. */
91   virtual void Squeeze(void)=0;
92   
93 };
94
95 // end namespace itk
96   
97 #endif
98

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:13PM
© Kitware Inc.