Changeset 457 for trunk/Source/Base/Base/OSGMultiPoolTest.cpp
- Timestamp:
- 12/24/06 07:27:43 (2 years ago)
- Files:
-
- trunk/Source/Base/Base/OSGMultiPoolTest.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Source/Base/Base/OSGMultiPoolTest.cpp
r397 r457 1 /*---------------------------------------------------------------------------*\ 2 * OpenSG * 3 * * 4 * * 5 * Copyright (C) 2000-2006 by the OpenSG Forum * 6 * * 7 * www.opensg.org * 8 * * 9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 10 * * 11 \*---------------------------------------------------------------------------*/ 12 /*---------------------------------------------------------------------------*\ 13 * License * 14 * * 15 * This library is free software; you can redistribute it and/or modify it * 16 * under the terms of the GNU Library General Public License as published * 17 * by the Free Software Foundation, version 2. * 18 * * 19 * This library is distributed in the hope that it will be useful, but * 20 * WITHOUT ANY WARRANTY; without even the implied warranty of * 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 22 * Library General Public License for more details. * 23 * * 24 * You should have received a copy of the GNU Library General Public * 25 * License along with this library; if not, write to the Free Software * 26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 27 * * 28 \*---------------------------------------------------------------------------*/ 29 /*---------------------------------------------------------------------------*\ 30 * Changes * 31 * * 32 * * 33 * * 34 * * 35 * * 36 * * 37 \*---------------------------------------------------------------------------*/ 1 38 2 39 #include <UnitTest++.h> … … 11 48 OSG_USING_NAMESPACE 12 49 13 // make the test noisy. Not like it's supposed otbe used, but good for50 // make the test noisy. Not like it's supposed to be used, but good for 14 51 // debugging 15 52 #if 0 … … 28 65 OUT(("elBase %p\n", this)); 29 66 } 30 67 31 68 virtual ~elBase() 32 69 { 33 OUT(("~elBase %p\n", this)); 70 OUT(("~elBase %p\n", this)); 34 71 } 35 72 36 73 private: 37 74 virtual void reset(void) … … 40 77 return; 41 78 } 42 79 43 80 friend class MultiPool<elBase>::TypeStore; 44 81 }; … … 49 86 Int32 a; 50 87 51 el1(void) : a(1) 88 el1(void) : a(1) 52 89 { 53 90 OUT(("el1 %p\n", this)); 54 91 } 55 92 56 93 virtual ~el1() 57 94 { … … 59 96 a = -11; 60 97 } 61 98 62 99 private: 63 100 virtual void reset(void) … … 66 103 a = -1; 67 104 } 68 105 69 106 friend class MultiPool<elBase>::TypeStore; 70 107 }; … … 77 114 Int32 b; 78 115 79 el2(void) : a(2), b(3) 116 el2(void) : a(2), b(3) 80 117 { 81 118 OUT(("el2 %p\n", this)); 82 119 } 83 120 84 121 virtual ~el2() 85 122 { … … 96 133 b = -3; 97 134 } 98 135 99 136 friend class MultiPool<elBase>::TypeStore; 100 137 }; … … 106 143 OUT(("CreateAndInit: start\n")); 107 144 MultiPool<elBase> pool; 108 109 el1 *val1 = pool.create(el1::Proto); 145 146 el1 *val1 = pool.create(el1::Proto); 110 147 CHECK(val1 != 0); 111 148 CHECK(val1->a == 1); 112 149 113 150 el1 *val2 = pool.create(el1::Proto); 114 151 CHECK(val2 != 0); … … 122 159 OUT(("ReuseDataAndCallReset: start\n")); 123 160 MultiPool<elBase> pool; 124 125 el1 *val1 = pool.create(el1::Proto); 161 162 el1 *val1 = pool.create(el1::Proto); 126 163 CHECK(val1 != 0); 127 164 CHECK(val1->a == 1); 128 165 129 166 pool.freeAll(); 130 167 el1 *val2 = pool.create(el1::Proto); … … 142 179 143 180 UInt16 cnt = MultiPool<elBase>::TypeStore::BLOCKSIZE * 4; 144 181 145 182 for(UInt16 i = 0; i < cnt; ++i) 146 183 v.push_back(pool.create(el1::Proto)); 147 184 148 185 for(UInt16 i = 0; i < cnt; ++i) 149 186 CHECK(v[i]->a == 1); 150 187 151 188 pool.freeAll(); 152 189 153 190 for(UInt16 i = 0; i < cnt; ++i) 154 191 v.push_back(pool.create(el1::Proto)); 155 192 156 193 for(UInt16 i = 0; i < cnt; ++i) 157 194 CHECK(v[i]->a == -1); 158 195 159 196 OUT(("CreateMoreThanOneBlock: end\n")); 160 197 }
