00001 #ifndef _IT_BUS_DELETING_VECTOR_H_ 00002 #define _IT_BUS_DELETING_VECTOR_H_ 00003 00004 // @Copyright 2003 IONA Technologies, Plc. All Rights Reserved. 00005 // 00006 00007 #include <it_dsa/vector.h> 00008 00009 00010 namespace IT_Bus 00011 { 00020 template <class T> 00021 class DeletingVector : public IT_Vector<T*> 00022 { 00023 public: 00024 00025 typedef IT_TYPENAME IT_Vector<T*>::iterator iterator; 00026 typedef IT_TYPENAME IT_Vector<T*>::const_iterator const_iterator; 00027 typedef IT_TYPENAME IT_Vector<T*>::reverse_iterator reverse_iterator; 00028 typedef IT_TYPENAME IT_Vector<T*>::const_reverse_iterator const_reverse_iterator; 00029 typedef IT_TYPENAME IT_Vector<T*>::reference reference; 00030 typedef IT_TYPENAME IT_Vector<T*>::const_reference const_reference; 00031 typedef IT_TYPENAME IT_Vector<T*>::size_type size_type; 00032 typedef IT_TYPENAME IT_Vector<T*>::difference_type difference_type; 00033 typedef IT_TYPENAME IT_Vector<T*>::value_type value_type; 00034 00038 DeletingVector() 00039 { 00040 // Complete 00041 } 00042 00046 IT_EXPLICIT DeletingVector( 00047 size_t n, 00048 T* init_val = 0 00049 ) : IT_Vector<T*>(n, init_val) 00050 { 00051 // Complete. 00052 } 00053 00057 ~DeletingVector() 00058 { 00059 for (iterator i = this->begin(); i != this->end(); ++i) 00060 { 00061 delete *i; 00062 } 00063 } 00064 00065 private: 00066 // private and unimplemented to prevent copying 00067 DeletingVector(const DeletingVector&); 00068 void operator=(const DeletingVector&); 00069 }; 00070 } 00071 00072 #endif