1 /*
2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
5
6 /*
7 * Copyright 1994 James Clark
8 * See the file COPYING for copying permission.
9 */
10
11 #pragma ident "%Z%%M% %I% %E% SMI"
12
13 #ifndef OwnerTable_DEF_INCLUDED
14 #define OwnerTable_DEF_INCLUDED 1
15
16 #ifdef SP_NAMESPACE
17 namespace SP_NAMESPACE {
18 #endif
19
20 template < class T, class K, class HF, class KF >
~OwnerTable()21 OwnerTable < T, K, HF, KF > ::~OwnerTable()
22 {
23 for (size_t i = 0; i < this->vec_.size(); i++)
24 delete this->vec_[i];
25 }
26
27 template < class T, class K, class HF, class KF >
clear()28 void OwnerTable < T, K, HF, KF > ::clear()
29 {
30 for (size_t i = 0; i < this->vec_.size(); i++)
31 delete this->vec_[i];
32 PointerTable < T *, K, HF, KF > ::clear();
33 }
34
35 template < class T, class K, class HF, class KF >
36 void
operator =(const CopyOwnerTable<T,K,HF,KF> & t)37 CopyOwnerTable < T, K, HF, KF > ::operator = (
38 const CopyOwnerTable < T, K, HF, KF > &t)
39 {
40 this->clear();
41 PointerTable < T *, K, HF, KF > ::operator = (t);
42 // FIXME This isn't exception safe.
43 for (size_t i = 0; i < this->vec_.size(); i++)
44 if (this->vec_[i])
45 this->vec_[i] = this->vec_[i]->copy();
46 }
47
48 #ifdef SP_NAMESPACE
49 }
50 #endif
51
52 #endif /* not OwnerTable_DEF_INCLUDED */
53