vtkLinkedListWrapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkLinkedListWrapper.h,v $
00004 
00005   Copyright (c) Kitware, Inc.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 // .NAME vtkLinkedListWrapper - a base class for templated containers
00015 // .SECTION Description
00016 // vtkLinkedListWrapper is a superclass for all container classes.  Since it
00017 // does not provide any actuall data access methods, it is not
00018 // templated, but it provides a set of method that can be used on all
00019 // containers. It also provide a simple reference counting scheme.
00020 
00021 // .SECTION Caveates
00022 // Since vtkLinkedListWrapper and vtkAbstractList provide some pure virtual
00023 // methods, each object of type container will have v-tabe.
00024 //
00025 // For container of strings, use <const char*> as a template
00026 // argument. This way you will be able to use string literals as keys
00027 // or values. Key and Value types must be default constructable.
00028 //
00029 // Each container subclass have to understand the following methods:
00030 // 
00031 // vtkIdType GetNumberOfItems();
00032 //
00033 // Return the number of items currently held in this container. This
00034 // different from GetSize which is provided for some
00035 // containers. GetSize will return how many items the container can
00036 // currently hold.
00037 //
00038 // void RemoveAllItems();
00039 //
00040 // Removes all items from the container.
00041   
00042 // .SECTION See Also
00043 // vtkAbstractIterator, vtkAbstractList, vtkAbstractMap
00044 
00045 // Updates:
00046 //   The interface stayed the same, but the implementation changed
00047 //   to enable these lists to store data in the MRML tree as well as
00048 //   the local lists.  
00049 
00050 #include "vtkObject.h"
00051 
00052 #include "vtkMimxSurfacePolyDataActor.h"
00053 #include "vtkMimxUnstructuredGridActor.h"
00054 #include "vtkMimxMeshActor.h"
00055 #include "vtkMimxImageActor.h"
00056 #include "vtkMimxCommonWin32Header.h"
00057 
00058 #include "vtkSetGet.h" // For vtkTypeMacro.
00059 
00060 #include "vtkLinkedList.txx"
00061 
00062 // store using the MRML-backed lists, do declare them here
00063 
00064 class vtkFiniteElementImageList;
00065 class vtkFESurfaceList;
00066 class vtkFiniteElementBuildingBlockList;
00067 class vtkFiniteElementMeshList;
00068 class vtkMRMLScene;
00069 
00070 #ifndef __vtkLinkedListWrapper_h
00071 #define __vtkLinkedListWrapper_h
00072 
00073 
00074 class VTK_MIMXCOMMON_EXPORT vtkLinkedListWrapper : public vtkObject
00075 {
00076 public:
00077   static vtkLinkedListWrapper *New();
00078   vtkTypeMacro(vtkLinkedListWrapper, vtkObject);
00079   vtkLinkedList<vtkMimxActorBase*> *List;
00080   
00081   // this interface is abstract.  However, it will be used for
00082   // surface dataypes, buildingBlocks, and mesh datatypes.  Inside
00083   // the implementation, a test will be made on the datatype value
00084   // set in the actor to decide how it should be stored in MRML.  The
00085   // abstract interface serves as a dispatching method for the correct
00086   // concrete implementation
00087   
00088   int AppendItem(vtkMimxActorBase*);
00089   int AppendItem(vtkMimxImageActor*);
00090   int AppendItem(vtkMimxSurfacePolyDataActor* actor);
00091   int AppendItem(vtkMimxUnstructuredGridActor* actor);
00092   int AppendItem(vtkMimxMeshActor* actor);
00093 
00094   
00095   vtkMimxActorBase* GetItem(vtkIdType);
00096   int GetNumberOfItems();
00097   int RemoveItem(int );
00098   
00099   // save reference to the scene to be used for storage 
00100    void SetMRMLSceneForStorage(vtkMRMLScene* scene);
00101    
00102 protected:
00103   vtkLinkedListWrapper();
00104   virtual ~vtkLinkedListWrapper();
00105  
00106   // store objects in MRML-backed lists, instance these lists here.
00107   vtkFiniteElementImageList *MRMLImageList;
00108   vtkFESurfaceList *MRMLSurfaceList;
00109   vtkFiniteElementBuildingBlockList *MRMLBBlockList;
00110   vtkFiniteElementMeshList *MRMLMeshList;
00111 
00112   // since separate instances of this list will be used to store objects of different types,
00113   // record the proper datatype for this instance to store.  This is set during the first entry and
00114   // then used as an error check to make sure all types added to the list are consistent.  The types stored
00115   // here are defined in mimxCommonDefine and correspond to the types of actors used for storage. 
00116   int ListDatatype;
00117   
00118 private:
00119   vtkLinkedListWrapper(const vtkLinkedListWrapper&); // Not implemented
00120   void operator=(const vtkLinkedListWrapper&); // Not implemented
00121 };
00122 #endif 
00123 
00124 
00125 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1