00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkHierarchicalDataSetInternal.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00021 #ifndef __vtkHierarchicalDataSetInternal_h 00022 #define __vtkHierarchicalDataSetInternal_h 00023 00024 #include <vtkstd/vector> 00025 #include <vtkstd/algorithm> 00026 00027 #include "vtkDataObject.h" 00028 #include "vtkSmartPointer.h" 00029 00030 class vtkHDSNode; 00031 00032 struct vtkHierarchicalDataSetInternal 00033 { 00034 typedef vtkstd::vector<vtkSmartPointer<vtkDataObject> > LevelDataSetsType; 00035 typedef LevelDataSetsType::iterator LevelDataSetsIterator; 00036 typedef vtkstd::vector<LevelDataSetsType> DataSetsType; 00037 typedef DataSetsType::iterator DataSetsIterator; 00038 00039 DataSetsType DataSets; 00040 }; 00041 00042 struct vtkHDSNodeRef 00043 { 00044 vtkHDSNodeRef(int level, int index) : Level(level), Index(index) {} 00045 00046 vtkstd_bool operator==(const vtkHDSNodeRef& rhs) 00047 { 00048 return (this->Level == rhs.Level) && (this->Index == rhs.Index); 00049 } 00050 vtkstd_bool operator!=(const vtkHDSNodeRef& rhs) 00051 { 00052 return (this->Level != rhs.Level) || (this->Index != rhs.Index); 00053 } 00054 00055 int Level; 00056 int Index; 00057 }; 00058 00059 class vtkHDSNode 00060 { 00061 public: 00062 00063 // void AddParent(const vtkHDSNodeRef& parent); 00064 // void AddChild (const vtkHDSNodeRef& child ); 00065 00066 // void RemoveParent(const vtkHDSNodeRef& parent); 00067 // void RemoveChild (const vtkHDSNodeRef& child ); 00068 00069 // void DisconnectFromParent(const vtkHDSNodeRef& self, 00070 // const vtkHDSNodeRef& parent, 00071 // vtkHierarchicalDataSetInternal::DataSetsType& ds); 00072 // void DisconnectFromChild (const vtkHDSNodeRef& self, 00073 // const vtkHDSNodeRef& child, 00074 // vtkHierarchicalDataSetInternal::DataSetsType& ds); 00075 // void ConnectToParent(const vtkHDSNodeRef& self, 00076 // const vtkHDSNodeRef& parent, 00077 // vtkHierarchicalDataSetInternal::DataSetsType& ds); 00078 // void ConnectToChild (const vtkHDSNodeRef& self, 00079 // const vtkHDSNodeRef& child, 00080 // vtkHierarchicalDataSetInternal::DataSetsType& ds); 00081 00082 // void DisconnectAll(const vtkHDSNodeRef& self, 00083 // vtkHierarchicalDataSetInternal::DataSetsType& ds); 00084 00085 protected: 00086 vtkstd::vector<vtkHDSNodeRef> Parents; 00087 vtkstd::vector<vtkHDSNodeRef> Children; 00088 }; 00089 00090 // inline void vtkHDSNode::AddParent(const vtkHDSNodeRef& parent) 00091 // { 00092 // this->Parents.push_back(parent); 00093 // } 00094 00095 // inline void vtkHDSNode::AddChild(const vtkHDSNodeRef& child) 00096 // { 00097 // this->Children.push_back(child); 00098 // } 00099 00100 // inline void vtkHDSNode::RemoveParent(const vtkHDSNodeRef& parent) 00101 // { 00102 // vtkstd::vector<vtkHDSNodeRef>::iterator it = 00103 // vtkstd::find(this->Parents.begin(), this->Parents.end(), parent); 00104 // if (it != this->Parents.end()) 00105 // { 00106 // this->Parents.erase(it); 00107 // } 00108 // } 00109 00110 // inline void vtkHDSNode::RemoveChild (const vtkHDSNodeRef& child) 00111 // { 00112 // vtkstd::vector<vtkHDSNodeRef>::iterator it = 00113 // vtkstd::find(this->Children.begin(), this->Children.end(), child); 00114 // if (it != this->Children.end()) 00115 // { 00116 // this->Children.erase(it); 00117 // } 00118 // } 00119 00120 // inline void vtkHDSNode::ConnectToParent( 00121 // const vtkHDSNodeRef& self, 00122 // const vtkHDSNodeRef& parent, 00123 // vtkHierarchicalDataSetInternal::DataSetsType& ds) 00124 // { 00125 // this->AddParent(parent); 00126 // ds[parent.Level][parent.Index]->AddChild(self); 00127 // } 00128 00129 // inline void vtkHDSNode::ConnectToChild( 00130 // const vtkHDSNodeRef& self, 00131 // const vtkHDSNodeRef& child, 00132 // vtkHierarchicalDataSetInternal::DataSetsType& ds) 00133 // { 00134 // this->AddChild(child); 00135 // ds[child.Level][child.Index]->AddParent(self); 00136 // } 00137 00138 // inline void vtkHDSNode::DisconnectFromParent( 00139 // const vtkHDSNodeRef& self, 00140 // const vtkHDSNodeRef& parent, 00141 // vtkHierarchicalDataSetInternal::DataSetsType& ds) 00142 // { 00143 // this->RemoveParent(parent); 00144 // ds[parent.Level][parent.Index]->RemoveChild(self); 00145 // } 00146 00147 // inline void vtkHDSNode::DisconnectFromChild( 00148 // const vtkHDSNodeRef& self, 00149 // const vtkHDSNodeRef& child, 00150 // vtkHierarchicalDataSetInternal::DataSetsType& ds) 00151 // { 00152 // this->RemoveChild(child); 00153 // ds[child.Level][child.Index]->RemoveParent(self); 00154 // } 00155 00156 // inline void vtkHDSNode::DisconnectAll( 00157 // const vtkHDSNodeRef& self, vtkHierarchicalDataSetInternal::DataSetsType& ds) 00158 // { 00159 // vtkstd::vector<vtkHDSNodeRef>::iterator it; 00160 00161 // for(it=this->Parents.begin(); it!=this->Parents.end(); ++it) 00162 // { 00163 // this->DisconnectFromParent(self, *it, ds); 00164 // } 00165 00166 // for(it=this->Children.begin(); it!=this->Children.end(); ++it) 00167 // { 00168 // this->DisconnectFromChild(self, *it, ds); 00169 // } 00170 00171 // } 00172 00173 #endif