Changeset 21031
- Timestamp:
- 02/13/08 17:49:12 (7 months ago)
- Files:
-
- juggler/trunk/modules/vapor/ChangeLog (modified) (1 diff)
- juggler/trunk/modules/vapor/VERSION (modified) (1 diff)
- juggler/trunk/modules/vapor/vpr/Thread/TSObjectProxy.h (modified) (6 diffs)
- juggler/trunk/modules/vapor/vpr/Util/BadCastException.cpp (added)
- juggler/trunk/modules/vapor/vpr/Util/BadCastException.h (added)
- juggler/trunk/modules/vapor/vpr/Util/Makefile.in (modified) (1 diff)
- juggler/trunk/vc7/VPR/VPR.vcproj (modified) (2 diffs)
- juggler/trunk/vc8/VPR/VPR.vcproj (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/trunk/modules/vapor/ChangeLog
r21007 r21031 1 1 DATE AUTHOR CHANGE 2 2 ---------- -------- ----------------------------------------------------------- 3 2008-02-13 patrick Changed vpr::TSObjectProxy<T> smart pointer interface to 4 throw an exception (of the new type vpr::BadCastException) 5 if the downcast part of the thread-specific data access 6 fails. 7 NEW VERSION: 2.1.12 3 8 2008-01-16 patrick Added vpr::AveragingAllocationStrategy for use with 4 9 vpr::NoPushWriter. juggler/trunk/modules/vapor/VERSION
r21007 r21031 1 2.1.12-0 @02/13/2008 23:50:00 UTC@ 1 2 2.1.11-0 @01/17/2008 03:10:00 UTC@ 2 3 2.1.10-0 @01/13/2008 14:15:00 UTC@ juggler/trunk/modules/vapor/vpr/Thread/TSObjectProxy.h
r20974 r21031 39 39 40 40 #include <vpr/vprConfig.h> 41 #include <stdlib.h> 41 42 #include <sstream> 43 #include <cstdlib> 42 44 #include <typeinfo> 45 43 46 #include <vpr/Thread/Thread.h> 44 47 #include <vpr/Thread/TSObject.h> 45 48 #include <vpr/Thread/ThreadManager.h> 46 49 #include <vpr/Util/Assert.h> 50 #include <vpr/Util/BadCastException.h> 47 51 48 52 … … 105 109 {;} 106 110 111 /** 112 * @throw vpr::BadCastException 113 * Thrown when the cast from vpr::TSBaseObject* to T* fails. 114 */ 107 115 T* operator->() 108 116 { … … 110 118 } 111 119 120 /** 121 * @throw vpr::BadCastException 122 * Thrown when the cast from vpr::TSBaseObject* to T* fails. 123 */ 112 124 T& operator*() 113 125 { … … 120 132 * @note This should only be used by expert users. It can cause MAJOR 121 133 * synchronization issues and even data corruption. 134 * 135 * @throw vpr::BadCastException 136 * Thrown when the cast from vpr::TSBaseObject* to T* fails. 122 137 */ 123 138 T* getObjPtrForThread(vpr::Thread* thread) … … 136 151 * 137 152 * @param reqThread Request for this specific thread. 153 * 154 * @throw vpr::BadCastException 155 * Thrown when the cast from vpr::TSBaseObject* to T* fails. 138 156 */ 139 157 T* getSpecific(vpr::Thread* reqThread = NULL) … … 184 202 TSObject<T>* real_object = dynamic_cast< TSObject<T>* >(object); 185 203 186 if(real_object == NULL) // Failed cast 187 { 188 std::cout << "Failed dynamic cast\n"; 189 std::cout << "Have pointer of type: " << typeid(*object).name() 190 << std::endl; 191 std::cout << "Want type: " << typeid(T).name() << std::endl; 192 } 193 194 // If fails, it means that "real" object was different type than the 195 // proxy. 196 // XXX: Throw an exception here instead of asserting. With optimized 197 // code, a segmentation fault occurs for less-than-obvious reasons due 198 // to the smart pointer indirection. -PH 7/13/2004 199 vprASSERT((real_object != NULL) && "Dynamic_cast of TS object failed"); 204 // If dynamic_cast fails, it means that "real" object was different type 205 // than the proxy. 206 if ( NULL == real_object ) // Failed cast 207 { 208 std::ostringstream msg_stream; 209 msg_stream << "Failed dynamic_cast for thread-specific object:\n" 210 << "\tA pointer of type " << typeid(*object).name() 211 << " was found,\n" 212 << "\tbut we wanted it to be of type " 213 << typeid(T).name(); 214 throw vpr::BadCastException(msg_stream.str(), VPR_LOCATION); 215 } 200 216 201 217 // Return the pointer. juggler/trunk/modules/vapor/vpr/Util/Makefile.in
r20974 r21031 65 65 endif 66 66 67 SRCS= Debug.cpp \ 67 SRCS= BadCastException.cpp \ 68 Debug.cpp \ 68 69 Exception.cpp \ 69 70 FileUtils.cpp \ juggler/trunk/vc7/VPR/VPR.vcproj
r21007 r21031 195 195 </File> 196 196 <File 197 RelativePath="..\..\modules\vapor\vpr\Util\BadCastException.cpp"> 198 </File> 199 <File 197 200 RelativePath="..\..\modules\vapor\vpr\IO\Stats\BandwidthIOStatsStrategy.cpp"> 198 201 </File> … … 425 428 <File 426 429 RelativePath="..\..\modules\vapor\vpr\AutoLink.h"> 430 </File> 431 <File 432 RelativePath="..\..\modules\vapor\vpr\Util\BadCastException.h"> 427 433 </File> 428 434 <File juggler/trunk/vc8/VPR/VPR.vcproj
r21007 r21031 561 561 </File> 562 562 <File 563 RelativePath="..\..\modules\vapor\vpr\Util\BadCastException.cpp" 564 > 565 </File> 566 <File 563 567 RelativePath="..\..\modules\vapor\vpr\IO\Stats\BandwidthIOStatsStrategy.cpp" 564 568 > … … 870 874 </File> 871 875 <File 876 RelativePath="..\..\modules\vapor\vpr\Util\BadCastException.h" 877 > 878 </File> 879 <File 872 880 RelativePath="..\..\modules\vapor\vpr\IO\Stats\BandwidthIOStatsStrategy.h" 873 881 >
