You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(140) |
Feb
(98) |
Mar
(152) |
Apr
(104) |
May
(71) |
Jun
(94) |
Jul
(169) |
Aug
(83) |
Sep
(47) |
Oct
(134) |
Nov
(7) |
Dec
(20) |
2004 |
Jan
(41) |
Feb
(14) |
Mar
(42) |
Apr
(47) |
May
(68) |
Jun
(143) |
Jul
(65) |
Aug
(29) |
Sep
(40) |
Oct
(34) |
Nov
(33) |
Dec
(97) |
2005 |
Jan
(29) |
Feb
(30) |
Mar
(9) |
Apr
(37) |
May
(13) |
Jun
(31) |
Jul
(22) |
Aug
(23) |
Sep
|
Oct
(37) |
Nov
(34) |
Dec
(117) |
2006 |
Jan
(48) |
Feb
(6) |
Mar
(2) |
Apr
(71) |
May
(10) |
Jun
(16) |
Jul
(7) |
Aug
(1) |
Sep
(14) |
Oct
(17) |
Nov
(25) |
Dec
(26) |
2007 |
Jan
(8) |
Feb
(2) |
Mar
(7) |
Apr
(26) |
May
|
Jun
(12) |
Jul
(30) |
Aug
(14) |
Sep
(9) |
Oct
(4) |
Nov
(7) |
Dec
(6) |
2008 |
Jan
(10) |
Feb
(10) |
Mar
(6) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(18) |
Aug
(15) |
Sep
(16) |
Oct
(5) |
Nov
(3) |
Dec
(10) |
2009 |
Jan
(11) |
Feb
(2) |
Mar
|
Apr
(15) |
May
(31) |
Jun
(18) |
Jul
(11) |
Aug
(26) |
Sep
(52) |
Oct
(17) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ww...> - 2004-06-29 10:21:13
|
Author: delta Date: 2004-06-29 03:21:05 -0700 (Tue, 29 Jun 2004) New Revision: 1100 Modified: trunk/CSP/CSPSim/Include/Systems/AircraftInputSystem.h trunk/CSP/CSPSim/Include/Systems/AircraftSimpleFCS.h Log: Workaround for conflicts with min/macro macros under vs .net. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1100 Modified: trunk/CSP/CSPSim/Include/Systems/AircraftInputSystem.h =================================================================== --- trunk/CSP/CSPSim/Include/Systems/AircraftInputSystem.h 2004-06-29 09:07:05 UTC (rev 1099) +++ trunk/CSP/CSPSim/Include/Systems/AircraftInputSystem.h 2004-06-29 10:21:05 UTC (rev 1100) @@ -26,9 +26,11 @@ #ifndef __AIRCRAFTINPUTSYSTEM_H__ #define __AIRCRAFTINPUTSYSTEM_H__ -#include <System.h> +#include <SimData/Math.h> +#include "System.h" + class AircraftInputSystem: public System { class CombinedInput { @@ -55,7 +57,7 @@ m_DecayCount--; if (m_Increment == 0.0) v *= m_Decay; } - m_Channel->value() = std::min(1.0, std::max(-1.0, v)); + m_Channel->value() = simdata::clampTo(v,-1.0,1.0); } double getValue() { return m_Channel->value(); Modified: trunk/CSP/CSPSim/Include/Systems/AircraftSimpleFCS.h =================================================================== --- trunk/CSP/CSPSim/Include/Systems/AircraftSimpleFCS.h 2004-06-29 09:07:05 UTC (rev 1099) +++ trunk/CSP/CSPSim/Include/Systems/AircraftSimpleFCS.h 2004-06-29 10:21:05 UTC (rev 1100) @@ -59,11 +59,11 @@ double input = 0.0; double output = b_Output->value(); if (b_Input.valid()) input = b_Input->value() * m_Limit; - double smooth = std::min(1.0, 10.0*fabs(output-input)); + double smooth = std::min<double>(1.0, 10.0*fabs(output-input)); if (output < input) { - output = std::min(output + smooth*m_Rate*dt, m_Limit); + output = std::min<double>(output + smooth*m_Rate*dt, m_Limit); } else { - output = std::max(output - smooth*m_Rate*dt, -m_Limit); + output = std::max<double>(output - smooth*m_Rate*dt, -m_Limit); } b_Output->value() = output; } |
From: <sv...@ww...> - 2004-06-29 09:07:12
|
Author: delta Date: 2004-06-29 02:07:05 -0700 (Tue, 29 Jun 2004) New Revision: 1099 Modified: trunk/CSP/CSPSim/Include/NumericalMethod.h Log: Test and typo correction. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1099 Modified: trunk/CSP/CSPSim/Include/NumericalMethod.h =================================================================== --- trunk/CSP/CSPSim/Include/NumericalMethod.h 2004-06-29 03:50:48 UTC (rev 1098) +++ trunk/CSP/CSPSim/Include/NumericalMethod.h 2004-06-29 09:07:05 UTC (rev 1099) @@ -213,7 +213,7 @@ * adapted from: * J. R. Cash, A. H. Karp, A variable order Runge-Kutta method for initial value * problems with rapidly varying right-hand sides, ACM Transactions on Mathematical -* Software, Vol. 16, No. 3, Spet 1990, pp. 201-222. +* Software, Vol. 16, No. 3, Sept 1990, pp. 201-222. */ class RKCK_VS_VO: public NumericalMethod { /** |
From: <sv...@ww...> - 2004-06-29 03:50:54
|
Author: wolverine Date: 2004-06-28 20:50:48 -0700 (Mon, 28 Jun 2004) New Revision: 1098 Modified: trunk/CSP/CSPSim/Source/Makefile.in trunk/CSP/CSPSim/Source/SimNet/DispatchMessageHandler.cpp trunk/CSP/CSPSim/Source/SimNet/EchoMessageHandler.cpp trunk/CSP/CSPSim/Source/SimNet/MessageSocketDuplex.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkAddress.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkBroadcaster.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkListener.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkMessage.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkMessenger.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkNode.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkSocket.cpp trunk/CSP/CSPSim/Source/SimNet/ObjectUpdateMessage.cpp trunk/CSP/CSPSim/Source/SimNet/PrintMessageHandler.cpp trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp trunk/CSP/CSPSim/Source/cCSP.i Log: moved networking to a new subdirectory Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1098 Modified: trunk/CSP/CSPSim/Source/Makefile.in =================================================================== --- trunk/CSP/CSPSim/Source/Makefile.in 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/Makefile.in 2004-06-29 03:50:48 UTC (rev 1098) @@ -2,7 +2,7 @@ BIN = $(TOPDIR)/Bin -SUBDIRS = Theater Networking Views +SUBDIRS = Theater SimNet Views Systems DEMETER_PREFIX = $(TOPDIR)/$(DEMETER_RELATIVE) DEMETER_INCLUDE = -I$(DEMETER_PREFIX) @@ -68,19 +68,19 @@ LogoScreen.cpp \ MenuScreen.cpp \ Message.cpp \ - Networking/NetworkNode.cpp \ - Networking/NetworkMessage.cpp \ - Networking/ObjectUpdateMessage.cpp \ - Networking/NetworkMessenger.cpp \ - Networking/NetworkBroadcaster.cpp \ - Networking/NetworkListener.cpp \ - Networking/NetworkSocket.cpp \ - Networking/MessageSocketDuplex.cpp \ - Networking/NetworkAddress.cpp \ - Networking/PrintMessageHandler.cpp \ - Networking/RedirectMessageHandler.cpp \ - Networking/EchoMessageHandler.cpp \ - Networking/DispatchMessageHandler.cpp \ + SimNet/NetworkNode.cpp \ + SimNet/NetworkMessage.cpp \ + SimNet/ObjectUpdateMessage.cpp \ + SimNet/NetworkMessenger.cpp \ + SimNet/NetworkBroadcaster.cpp \ + SimNet/NetworkListener.cpp \ + SimNet/NetworkSocket.cpp \ + SimNet/MessageSocketDuplex.cpp \ + SimNet/NetworkAddress.cpp \ + SimNet/PrintMessageHandler.cpp \ + SimNet/RedirectMessageHandler.cpp \ + SimNet/EchoMessageHandler.cpp \ + SimNet/DispatchMessageHandler.cpp \ NumericalMethod.cpp \ ObjectModel.cpp \ ObjectRangeInfo.cpp \ @@ -126,7 +126,7 @@ SWDEP = $(SWIG) -M $(SWOPTS) DEPFILES = $(addprefix $(DEPDIR)/,$(addsuffix .d, $(SOURCES))) $(DEPDIR)/cCSP.i.swigdep DEPFILTER = -DEPS_MAGIC := $(shell mkdir $(DEPDIR) $(DEPDIR)/Theater $(DEPDIR)/Systems $(DEPDIR)/Networking $(DEPDIR)/Views > /dev/null 2>&1 || :) +DEPS_MAGIC := $(shell mkdir $(DEPDIR) $(DEPDIR)/Theater $(DEPDIR)/Systems $(DEPDIR)/SimNet $(DEPDIR)/Views > /dev/null 2>&1 || :) .PHONY: clean-deps clean all default Modified: trunk/CSP/CSPSim/Source/SimNet/DispatchMessageHandler.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/DispatchMessageHandler.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/DispatchMessageHandler.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -1,4 +1,4 @@ -#include "Networking.h" +#include <SimNet/Networking.h> #include "DynamicObject.h" #include "Config.h" Modified: trunk/CSP/CSPSim/Source/SimNet/EchoMessageHandler.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/EchoMessageHandler.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/EchoMessageHandler.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -29,7 +29,7 @@ #include <SimData/LogStream.h> #include "Log.h" -#include "Networking.h" +#include <SimNet/Networking.h> EchoMessageHandler::EchoMessageHandler() { Modified: trunk/CSP/CSPSim/Source/SimNet/MessageSocketDuplex.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/MessageSocketDuplex.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/MessageSocketDuplex.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -21,7 +21,7 @@ * @file NetworkSocket.cpp: * @author Scott Flicker (Wolverine) */ -#include "Networking.h" +#include <SimNet/Networking.h> #include "Log.h" MessageSocketDuplex::MessageSocketDuplex() Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkAddress.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkAddress.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkAddress.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -24,7 +24,7 @@ * This class encapsulates a node in the simulation network. */ -#include "Networking.h" +#include <SimNet/Networking.h> NetworkAddress::NetworkAddress() { Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkBroadcaster.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkBroadcaster.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkBroadcaster.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -23,7 +23,7 @@ * * Broadcasts network messages */ -#include "Networking.h" +#include <SimNet/Networking.h> NetworkBroadcaster::NetworkBroadcaster() { Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkListener.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkListener.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkListener.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -24,7 +24,7 @@ * Listens for network messages */ -#include "Networking.h" +#include <SimNet/Networking.h> NetworkListener::NetworkListener() Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkMessage.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkMessage.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkMessage.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -25,7 +25,7 @@ * Currently contains for header and buffer routines */ -#include "Networking.h" +#include <SimNet/Networking.h> unsigned short NetworkMessage::m_magicNumber = 0xACDC; unsigned short NetworkMessage::m_HeaderLen = 16; Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkMessenger.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkMessenger.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkMessenger.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -24,7 +24,7 @@ #include <SimData/LogStream.h> #include "Log.h" -#include "Networking.h" +#include <SimNet/Networking.h> NetworkMessenger::NetworkMessenger() { Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkNode.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkNode.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkNode.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -24,7 +24,7 @@ * This class encapsulates a node in the simulation network. */ -#include "Networking.h" +#include <SimNet/Networking.h> NetworkNode::NetworkNode() { Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkSocket.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkSocket.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkSocket.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -22,7 +22,7 @@ * @author Scott Flicker (Wolverine) */ -#include "Networking.h" +#include <SimNet/Networking.h> NetworkSocket::NetworkSocket() { Modified: trunk/CSP/CSPSim/Source/SimNet/ObjectUpdateMessage.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/ObjectUpdateMessage.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/ObjectUpdateMessage.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -22,7 +22,7 @@ * @author Scott Flicker (Wolverine) */ -#include "Networking.h" +#include <SimNet/Networking.h> //ObjectUpdateMessage::ObjectUpdateMessage(simdata::uint16 id, simdata::Vector3 position, simdata::Vector3 velocity) //{ Modified: trunk/CSP/CSPSim/Source/SimNet/PrintMessageHandler.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/PrintMessageHandler.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/PrintMessageHandler.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -29,7 +29,7 @@ #include <SimData/LogStream.h> #include "Log.h" -#include "Networking.h" +#include <SimNet/Networking.h> #include <stdio.h> PrintMessageHandler::PrintMessageHandler() Modified: trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp 2004-06-29 03:50:48 UTC (rev 1098) @@ -29,7 +29,7 @@ #include <SimData/LogStream.h> #include "Log.h" -#include "Networking.h" +#include <SimNet/Networking.h> RedirectMessageHandler::RedirectMessageHandler() { Modified: trunk/CSP/CSPSim/Source/cCSP.i =================================================================== --- trunk/CSP/CSPSim/Source/cCSP.i 2004-06-29 03:50:05 UTC (rev 1097) +++ trunk/CSP/CSPSim/Source/cCSP.i 2004-06-29 03:50:48 UTC (rev 1098) @@ -36,7 +36,7 @@ %include "VirtualBattlefield.i" %include "VirtualScene.i" -%include "Networking.i" +%include "SimNet/Networking.i" %include "CSPSim.i" //%include "SimpleConfig.i" %include "Config.i" |
From: <sv...@ww...> - 2004-06-29 03:50:11
|
Author: wolverine Date: 2004-06-28 20:50:05 -0700 (Mon, 28 Jun 2004) New Revision: 1097 Removed: trunk/CSP/CSPSim/Include/Networking.h trunk/CSP/CSPSim/Include/Networking.i Log: moved networking to a new subdirectory Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1097 Diff omitted (16922 bytes). |
From: <sv...@ww...> - 2004-06-29 03:49:36
|
Author: wolverine Date: 2004-06-28 20:49:30 -0700 (Mon, 28 Jun 2004) New Revision: 1096 Added: trunk/CSP/CSPSim/Include/SimNet/ trunk/CSP/CSPSim/Include/SimNet/Networking.h trunk/CSP/CSPSim/Include/SimNet/Networking.i Log: moved networking to a new subdirectory Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1096 Diff omitted (16974 bytes). |
From: <sv...@ww...> - 2004-06-29 03:48:44
|
Author: wolverine Date: 2004-06-28 20:48:36 -0700 (Mon, 28 Jun 2004) New Revision: 1095 Modified: trunk/CSP/CSPSim/CHANGES.current Log: New change log Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1095 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2004-06-29 01:45:26 UTC (rev 1094) +++ trunk/CSP/CSPSim/CHANGES.current 2004-06-29 03:48:36 UTC (rev 1095) @@ -1,6 +1,10 @@ Version 0.4.0 (in progress) =========================== +2004-06-28: wolverine + * Changed subdirectory name from Networking to SimNet. Also moved the + Networking.h include file to a SimNet subdirectory. + 2004-06-27: wolverine * Fixed a number of problems with the new callback handling code. |
From: <sv...@ww...> - 2004-06-29 01:45:32
|
Author: wolverine Date: 2004-06-28 18:45:26 -0700 (Mon, 28 Jun 2004) New Revision: 1094 Added: trunk/CSP/CSPSim/Source/SimNet/ Removed: trunk/CSP/CSPSim/Source/Networking/ Modified: trunk/CSP/CSPSim/Source/CSPSim.cpp trunk/CSP/CSPSim/Source/ClientNode.cpp trunk/CSP/CSPSim/Source/DispatchCenter.cpp trunk/CSP/CSPSim/Source/DynamicObject.cpp trunk/CSP/CSPSim/Source/EchoServerNode.cpp trunk/CSP/CSPSim/Source/RedirectServerNode.cpp Log: Moving Files Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1094 Modified: trunk/CSP/CSPSim/Source/CSPSim.cpp =================================================================== --- trunk/CSP/CSPSim/Source/CSPSim.cpp 2004-06-28 17:43:18 UTC (rev 1093) +++ trunk/CSP/CSPSim/Source/CSPSim.cpp 2004-06-29 01:45:26 UTC (rev 1094) @@ -51,7 +51,7 @@ #include "ConsoleCommands.h" #include "Profile.h" -#include "Networking.h" +#include <SimNet/Networking.h> #include <SimData/Types.h> #include <SimData/ExceptionBase.h> Modified: trunk/CSP/CSPSim/Source/ClientNode.cpp =================================================================== --- trunk/CSP/CSPSim/Source/ClientNode.cpp 2004-06-28 17:43:18 UTC (rev 1093) +++ trunk/CSP/CSPSim/Source/ClientNode.cpp 2004-06-29 01:45:26 UTC (rev 1094) @@ -1,4 +1,4 @@ -#include "Networking.h" +#include <SimNet/Networking.h> #include <stdio.h> #include <stdlib.h> #include "Config.h" Modified: trunk/CSP/CSPSim/Source/DispatchCenter.cpp =================================================================== --- trunk/CSP/CSPSim/Source/DispatchCenter.cpp 2004-06-28 17:43:18 UTC (rev 1093) +++ trunk/CSP/CSPSim/Source/DispatchCenter.cpp 2004-06-29 01:45:26 UTC (rev 1094) @@ -27,7 +27,7 @@ #include "Dispatch.h" #include "Log.h" #include "Config.h" -#include "Networking.h" +#include <SimNet/Networking.h> #include <SimData/TaggedRecordRegistry.h> Modified: trunk/CSP/CSPSim/Source/DynamicObject.cpp =================================================================== --- trunk/CSP/CSPSim/Source/DynamicObject.cpp 2004-06-28 17:43:18 UTC (rev 1093) +++ trunk/CSP/CSPSim/Source/DynamicObject.cpp 2004-06-29 01:45:26 UTC (rev 1094) @@ -35,7 +35,7 @@ #include <SimData/Quat.h> -#include "Networking.h" +#include <SimNet/Networking.h> SIMDATA_REGISTER_INTERFACE(DynamicObject) Modified: trunk/CSP/CSPSim/Source/EchoServerNode.cpp =================================================================== --- trunk/CSP/CSPSim/Source/EchoServerNode.cpp 2004-06-28 17:43:18 UTC (rev 1093) +++ trunk/CSP/CSPSim/Source/EchoServerNode.cpp 2004-06-29 01:45:26 UTC (rev 1094) @@ -1,4 +1,4 @@ -#include "Networking.h" +#include <SimNet/Networking.h> #include "EchoServerNode.h" #include <stdio.h> #include <stdlib.h> Modified: trunk/CSP/CSPSim/Source/RedirectServerNode.cpp =================================================================== --- trunk/CSP/CSPSim/Source/RedirectServerNode.cpp 2004-06-28 17:43:18 UTC (rev 1093) +++ trunk/CSP/CSPSim/Source/RedirectServerNode.cpp 2004-06-29 01:45:26 UTC (rev 1094) @@ -1,4 +1,4 @@ -#include "Networking.h" +#include <SimNet/Networking.h> #include "RedirectServerNode.h" #include <stdio.h> #include <stdlib.h> Copied: trunk/CSP/CSPSim/Source/SimNet (from rev 1093, trunk/CSP/CSPSim/Source/Networking) |
From: <sv...@ww...> - 2004-06-28 17:43:24
|
Author: delta Date: 2004-06-28 10:43:18 -0700 (Mon, 28 Jun 2004) New Revision: 1093 Modified: trunk/CSP/SimData/CHANGES.current Log: General update, fixes for vc++ .net Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1093 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-06-28 17:42:01 UTC (rev 1092) +++ trunk/CSP/SimData/CHANGES.current 2004-06-28 17:43:18 UTC (rev 1093) @@ -1,6 +1,20 @@ Version 0.4.0 (in progress) =========================== +2004-06-28: delta. Mainly vs .net's fixes. Here's a few details: + * Added Source/Timing.cpp, ThreadBase.cpp to the vs .net build. + + * Added pthread (linked against pthreadVC.lib for now) to the build. +==> Windows users need to update their dev pack. + + * Changed min/max macros to std::min/std::max in Interpolate.cpp. + + * Added export symbols in Include/Timing.h + + * Moved public keyword outside #ifdef ___GNUC___ in class Trace. + + * Changed macro min/max to using std:min/max in Interpolate.cpp. + 2004-06-27: onsight * Opps, forgot Source/ThreadBase.cpp |
From: <sv...@ww...> - 2004-06-28 17:42:07
|
Author: delta Date: 2004-06-28 10:42:01 -0700 (Mon, 28 Jun 2004) New Revision: 1092 Modified: trunk/CSP/SimData/VisualStudio2003/SimData.vcproj Log: See CHANGES.current. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1092 Modified: trunk/CSP/SimData/VisualStudio2003/SimData.vcproj =================================================================== --- trunk/CSP/SimData/VisualStudio2003/SimData.vcproj 2004-06-28 17:39:44 UTC (rev 1091) +++ trunk/CSP/SimData/VisualStudio2003/SimData.vcproj 2004-06-28 17:42:01 UTC (rev 1092) @@ -52,6 +52,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" + AdditionalDependencies="pthreadVC.lib" OutputFile="../SimData/_cSimData.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" @@ -124,6 +125,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" + AdditionalDependencies="pthreadVC.lib" OutputFile="../SimData/_cSimDatad.dll" LinkIncremental="2" SuppressStartupBanner="TRUE" @@ -253,6 +255,12 @@ RelativePath="..\Source\Real.cpp"> </File> <File + RelativePath="..\Source\ThreadBase.cpp"> + </File> + <File + RelativePath="..\Source\Timing.cpp"> + </File> + <File RelativePath="..\Source\TypeAdapter.cpp"> </File> <File @@ -266,9 +274,18 @@ Name="Header Files" Filter="h;hpp;hxx;hm;inl"> <File + RelativePath="..\Include\SimData\Archive.h"> + </File> + <File + RelativePath="..\Include\SimData\AtomicCounter.h"> + </File> + <File RelativePath="..\Include\SimData\BaseType.h"> </File> <File + RelativePath="..\Include\SimData\Composite.h"> + </File> + <File RelativePath="..\Include\SimData\Conversions.h"> </File> <File @@ -293,9 +310,6 @@ RelativePath="..\Include\SimData\GeoPos.h"> </File> <File - RelativePath="..\Include\SimData\GlibCsp.h"> - </File> - <File RelativePath="..\Include\SimData\hash_map.h"> </File> <File @@ -347,6 +361,9 @@ RelativePath="..\Include\SimData\ObjectInterface.h"> </File> <File + RelativePath="..\Include\SimData\osg.h"> + </File> + <File RelativePath="..\Include\SimData\Path.h"> </File> <File @@ -365,18 +382,48 @@ RelativePath="..\Include\SimData\Ref.h"> </File> <File + RelativePath="..\Include\SimData\ScopedPointer.h"> + </File> + <File + RelativePath="..\Include\SimData\Singleton.h"> + </File> + <File RelativePath="..\Include\SimData\String.h"> </File> <File RelativePath="..\Include\SimData\TaggedRecord.h"> </File> <File + RelativePath="..\Include\SimData\TaggedRecordRegistry.h"> + </File> + <File + RelativePath="..\Include\SimData\Thread.h"> + </File> + <File + RelativePath="..\Include\SimData\ThreadBase.h"> + </File> + <File + RelativePath="..\Include\SimData\ThreadLog.h"> + </File> + <File + RelativePath="..\Include\SimData\ThreadQueue.h"> + </File> + <File + RelativePath="..\Include\SimData\Timing.h"> + </File> + <File + RelativePath="..\Include\SimData\Trace.h"> + </File> + <File RelativePath="..\Include\SimData\TypeAdapter.h"> </File> <File RelativePath="..\Include\SimData\Types.h"> </File> <File + RelativePath="..\Include\SimData\Uniform.h"> + </File> + <File RelativePath="..\Include\SimData\Vector3.h"> </File> <File |
From: <sv...@ww...> - 2004-06-28 17:39:50
|
Author: delta Date: 2004-06-28 10:39:44 -0700 (Mon, 28 Jun 2004) New Revision: 1091 Modified: trunk/CSP/SimData/Source/Interpolate.cpp Log: Changed macros min/max to STL ones. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1091 Modified: trunk/CSP/SimData/Source/Interpolate.cpp =================================================================== --- trunk/CSP/SimData/Source/Interpolate.cpp 2004-06-28 17:27:43 UTC (rev 1090) +++ trunk/CSP/SimData/Source/Interpolate.cpp 2004-06-28 17:39:44 UTC (rev 1091) @@ -26,8 +26,8 @@ NAMESPACE_SIMDATA -#define min(a, b) (((a)<(b)) ? (a) : (b)) -#define max(a, b) (((a)>(b)) ? (a) : (b)) +using std::min; +using std::max; template <typename T> const Enumeration InterpolatedData<T>::Method("LINEAR SPLINE"); |
From: <sv...@ww...> - 2004-06-28 17:27:50
|
Author: delta Date: 2004-06-28 10:27:43 -0700 (Mon, 28 Jun 2004) New Revision: 1090 Modified: trunk/CSP/SimData/Include/SimData/Timing.h trunk/CSP/SimData/Include/SimData/Trace.h Log: Fixes for vc++ .net. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1090 Modified: trunk/CSP/SimData/Include/SimData/Timing.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Timing.h 2004-06-28 03:31:08 UTC (rev 1089) +++ trunk/CSP/SimData/Include/SimData/Timing.h 2004-06-28 17:27:43 UTC (rev 1090) @@ -27,6 +27,7 @@ #ifndef __SIMDATA_TIMING_H__ #define __SIMDATA_TIMING_H__ +#include <SimData/Export.h> #include <SimData/Namespace.h> @@ -42,18 +43,18 @@ /** Start the timer. */ -void tstart(void); +void SIMDATA_EXPORT tstart(void); /** Stop the timer. */ -void tend(void); +void SIMDATA_EXPORT tend(void); /** Get the time interval (in seconds) between last calls to tstart() * and tend(). * * The precision should be about 1-2 ms on most platforms. */ -double tval(); +double SIMDATA_EXPORT tval(); /** Return the current time in seconds. * Modified: trunk/CSP/SimData/Include/SimData/Trace.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Trace.h 2004-06-28 03:31:08 UTC (rev 1089) +++ trunk/CSP/SimData/Include/SimData/Trace.h 2004-06-28 17:27:43 UTC (rev 1090) @@ -105,9 +105,10 @@ */ class Trace: public TraceBase { +public: + #ifdef __GNUC__ -public: static void StackDump(std::ostream &out, int skip=0) { void *trace[64]; char **messages = (char **)NULL; |
From: <sv...@ww...> - 2004-06-28 03:31:14
|
Author: mkrose Date: 2004-06-27 20:31:08 -0700 (Sun, 27 Jun 2004) New Revision: 1089 Added: trunk/CSP/SimData/SimData/Tests/test_Ref.cpp Modified: trunk/CSP/SimData/CHANGES.current Log: Added a unit test for reference counting. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1089 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-06-28 01:34:48 UTC (rev 1088) +++ trunk/CSP/SimData/CHANGES.current 2004-06-28 03:31:08 UTC (rev 1089) @@ -13,6 +13,8 @@ * Small fixes to TaggedRecord.h + * Added a unit test for reference counting. + 2004-06-26: onsight * Remove superflous logging in interface registry, and suppress swig warnings. Added: trunk/CSP/SimData/SimData/Tests/test_Ref.cpp =================================================================== --- trunk/CSP/SimData/SimData/Tests/test_Ref.cpp 2004-06-28 01:34:48 UTC (rev 1088) +++ trunk/CSP/SimData/SimData/Tests/test_Ref.cpp 2004-06-28 03:31:08 UTC (rev 1089) @@ -0,0 +1,70 @@ +/* SimData: Data Infrastructure for Simulations + * Copyright (C) 2004 Mark Rose <mk...@us...> + * + * This file is part of SimData. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +/** + * @file test_Ref.h + * @brief Test reference counting. + */ + + +#include <SimData/Ref.h> + +#include <cstdlib> +#include <cassert> + +int count = 0; + +struct R: public simdata::Referenced { + R() { ++count; } + ~R() { --count; } +}; + +typedef simdata::Ref<R> Ref; + +void test() { + { + assert(count == 0); + Ref x = new R; + assert(count == 1); + { + Ref y = x; + assert(count == 1); + } + assert(count == 1); + { + Ref y = new R; + assert(count == 2); + y = x; + assert(count == 1); + y = new R; + assert(count == 2); + } + assert(count == 1); + } + assert(count == 0); + ::exit(0); +} + +int main() { + test(); + return 0; +}; + |
From: <sv...@ww...> - 2004-06-28 01:34:54
|
Author: wolverine Date: 2004-06-27 18:34:48 -0700 (Sun, 27 Jun 2004) New Revision: 1088 Modified: trunk/CSP/CSPSim/Source/EchoServerNode.cpp trunk/CSP/CSPSim/Source/RedirectServerNode.cpp Log: Changes for new log stream methods Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1088 Modified: trunk/CSP/CSPSim/Source/EchoServerNode.cpp =================================================================== --- trunk/CSP/CSPSim/Source/EchoServerNode.cpp 2004-06-28 00:56:03 UTC (rev 1087) +++ trunk/CSP/CSPSim/Source/EchoServerNode.cpp 2004-06-28 01:34:48 UTC (rev 1088) @@ -34,7 +34,8 @@ int count = 0; int level = g_Config.getInt("Debug", "LoggingLevel", 0, true); - csplog().setLogLevels(CSP_ALL, level); + csplog().setLogCategory(CSP_ALL); + csplog().setLogPriority(level); std::string logfile = g_Config.getString("Debug", "LogFile", "ServerNode.log", true); csplog().setOutput(logfile); Modified: trunk/CSP/CSPSim/Source/RedirectServerNode.cpp =================================================================== --- trunk/CSP/CSPSim/Source/RedirectServerNode.cpp 2004-06-28 00:56:03 UTC (rev 1087) +++ trunk/CSP/CSPSim/Source/RedirectServerNode.cpp 2004-06-28 01:34:48 UTC (rev 1088) @@ -34,7 +34,8 @@ int count = 0; int level = g_Config.getInt("Debug", "LoggingLevel", 0, true); - csplog().setLogLevels(CSP_ALL, level); + csplog().setLogCategory(CSP_ALL); + csplog().setLogPriority(level); csplog().setOutput("RedirectServerNode.log"); printf("Network test redirect server starting up...\n"); |
From: <sv...@ww...> - 2004-06-28 00:56:08
|
Author: wolverine Date: 2004-06-27 17:56:03 -0700 (Sun, 27 Jun 2004) New Revision: 1087 Modified: trunk/CSP/CSPSim/Bin/CSPSim.py Log: Networking changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1087 Modified: trunk/CSP/CSPSim/Bin/CSPSim.py =================================================================== --- trunk/CSP/CSPSim/Bin/CSPSim.py 2004-06-28 00:55:41 UTC (rev 1086) +++ trunk/CSP/CSPSim/Bin/CSPSim.py 2004-06-28 00:56:03 UTC (rev 1087) @@ -49,7 +49,7 @@ print " --slog=level set the simdata logging level" print " --dump-data show the contents of sim.dar" print " --client-node run networking test client node" - print " --server-node run networking test server node" + print " --echo-server-node run networking test echo server node" print " --help help message" @@ -146,15 +146,18 @@ print def runClientNode(args): - print "Starting Test Client Node..." + print "CSPSim.py - runClientNode - Starting Test Client Node..." + print "CSPSim.py - runClientNode - calling loadCSP" loadCSP() + print "CSPSim.py - runClientNode - calling CSP.ClientNode" app = CSP.ClientNode() + print "CSPSim.py - runClientNode - calling app.run" app.run() -def runServerNode(args): - print "Starting Test Server Node..." +def runEchoServerNode(args): + print "Starting Test Echo Server Node..." loadCSP() - app = CSP.ServerNode() + app = CSP.EchoServerNode() app.run() def loadSimData(): @@ -262,8 +265,8 @@ other_args.append(arg) elif arg == '--client-node': action = runClientNode - elif arg == '--server-node': - action = runServerNode + elif arg == '--echo-server-node': + action = runEchoServerNode elif arg == '--pause': pause = 1 elif arg in ("--help", "-h", "-help"): |
From: <sv...@ww...> - 2004-06-28 00:55:48
|
Author: wolverine Date: 2004-06-27 17:55:41 -0700 (Sun, 27 Jun 2004) New Revision: 1086 Modified: trunk/CSP/CSPSim/CHANGES.current Log: new change log Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1086 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2004-06-28 00:54:29 UTC (rev 1085) +++ trunk/CSP/CSPSim/CHANGES.current 2004-06-28 00:55:41 UTC (rev 1086) @@ -1,6 +1,9 @@ Version 0.4.0 (in progress) =========================== +2004-06-27: wolverine + * Fixed a number of problems with the new callback handling code. + 2004-06-27: onsight * Added DispatchCenter.h, and DispatchCenter.cpp. Rough outline for adding tagged record support to the network layer. Not yet integrated |
From: <sv...@ww...> - 2004-06-28 00:54:35
|
Author: wolverine Date: 2004-06-27 17:54:29 -0700 (Sun, 27 Jun 2004) New Revision: 1085 Added: trunk/CSP/CSPSim/Source/EchoServerNode.cpp trunk/CSP/CSPSim/Source/Networking/RedirectMessageHandler.cpp trunk/CSP/CSPSim/Source/RedirectServerNode.cpp Removed: trunk/CSP/CSPSim/Source/ServerNode.cpp Modified: trunk/CSP/CSPSim/Source/CSPSim.cpp trunk/CSP/CSPSim/Source/ClientNode.cpp trunk/CSP/CSPSim/Source/Makefile.in trunk/CSP/CSPSim/Source/Networking/DispatchMessageHandler.cpp trunk/CSP/CSPSim/Source/Networking/NetworkMessage.cpp trunk/CSP/CSPSim/Source/Networking/NetworkMessenger.cpp trunk/CSP/CSPSim/Source/Networking/NetworkNode.cpp trunk/CSP/CSPSim/Source/cCSP.i Log: Networking changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1085 Diff omitted (25402 bytes). |
From: <sv...@ww...> - 2004-06-28 00:52:12
|
Author: wolverine Date: 2004-06-27 17:52:05 -0700 (Sun, 27 Jun 2004) New Revision: 1084 Added: trunk/CSP/CSPSim/Include/EchoServerNode.h trunk/CSP/CSPSim/Include/EchoServerNode.i trunk/CSP/CSPSim/Include/RedirectServerNode.h trunk/CSP/CSPSim/Include/RedirectServerNode.i Removed: trunk/CSP/CSPSim/Include/ServerNode.h trunk/CSP/CSPSim/Include/ServerNode.i Modified: trunk/CSP/CSPSim/Include/Networking.h Log: new networking changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1084 Copied: trunk/CSP/CSPSim/Include/EchoServerNode.h (from rev 1065, trunk/CSP/CSPSim/Include/ServerNode.h) =================================================================== --- trunk/CSP/CSPSim/Include/ServerNode.h 2004-06-23 16:47:53 UTC (rev 1065) +++ trunk/CSP/CSPSim/Include/EchoServerNode.h 2004-06-28 00:52:05 UTC (rev 1084) @@ -0,0 +1,10 @@ + + +class EchoServerNode +{ + + public: + EchoServerNode(); + int run(); + +}; Copied: trunk/CSP/CSPSim/Include/EchoServerNode.i (from rev 1065, trunk/CSP/CSPSim/Include/ServerNode.i) =================================================================== --- trunk/CSP/CSPSim/Include/ServerNode.i 2004-06-23 16:47:53 UTC (rev 1065) +++ trunk/CSP/CSPSim/Include/EchoServerNode.i 2004-06-28 00:52:05 UTC (rev 1084) @@ -0,0 +1,7 @@ +%module EchoServerNode +%{ +#include "EchoServerNode.h" +%} + +%include "EchoServerNode.h" + Modified: trunk/CSP/CSPSim/Include/Networking.h =================================================================== --- trunk/CSP/CSPSim/Include/Networking.h 2004-06-28 00:43:19 UTC (rev 1083) +++ trunk/CSP/CSPSim/Include/Networking.h 2004-06-28 00:52:05 UTC (rev 1084) @@ -34,6 +34,7 @@ #include <sys/types.h> #include <list> #include <map> +#include <set> #include <SimData/Vector3.h> #include <SimData/String.h> @@ -144,7 +145,6 @@ Port getOriginatorPort(); NetworkNode * getOriginatorNode(); - bool isInitialized(); bool isHeaderValid(); }; @@ -219,20 +219,23 @@ private: ost::InetHostAddress m_addr; Port m_port; - uint16 m_node_id; + //uint16 m_node_id; public: NetworkNode(); - NetworkNode(int node_id, ost::InetHostAddress addr, Port port); - NetworkNode(int node_id, simdata::uint32 addr, Port port); - NetworkNode(int node_id, const char * hostname, Port port); +// NetworkNode(int node_id, ost::InetHostAddress addr, Port port); +// NetworkNode(int node_id, simdata::uint32 addr, Port port); +// NetworkNode(int node_id, const char * hostname, Port port); + NetworkNode(ost::InetHostAddress addr, Port port); + NetworkNode(simdata::uint32 addr, Port port); + NetworkNode(const char * hostname, Port port); void setAddress(ost::InetHostAddress addr); void setPort(Port port); - void setId(short node_id); +// void setId(short node_id); - short getId(); +// short getId(); Port getPort(); ost::InetHostAddress getAddress(); const char * getHostname(); @@ -249,34 +252,97 @@ class DynamicObject; -class RemoteObjectWrapper +//class RemoteObjectWrapper +//{ +// public: +// RemoteObjectWrapper(simdata::Ref<DynamicObject> & object) { m_Object = object; } +// NetworkNode * getObjectHost() { return m_Host; } +// simdata::Ref<DynamicObject> getWrappedObject() { return m_Object; } +// private: +// simdata::Ref<DynamicObject> m_Object; +// NetworkNode * m_Host; +// +// +//}; + +class RemoteObjectKey { + protected: + int m_ipaddr; + short m_port; + int m_id; + public: - RemoteObjectWrapper(simdata::Ref<DynamicObject> & object) { m_Object = object; } - NetworkNode * getObjectHost() { return m_Host; } - simdata::Ref<DynamicObject> getWrappedObject() { return m_Object; } - private: - simdata::Ref<DynamicObject> m_Object; - NetworkNode * m_Host; - + RemoteObjectKey() { m_ipaddr = 0; m_port = 0; m_id = 0; } + + RemoteObjectKey(const RemoteObjectKey & key) + { m_ipaddr = key.m_ipaddr; m_port = key.m_port; m_id = key.m_id; } + + RemoteObjectKey(int ipaddr, short port, int id) + { m_ipaddr = ipaddr; m_port = port; m_id = id; } + const RemoteObjectKey & operator=(const RemoteObjectKey & key) + { + m_ipaddr = key.m_ipaddr; m_port = key.m_port; m_id = key.m_id; + return *this; + } + + + bool operator==(const RemoteObjectKey & key) + { return ( (m_ipaddr == key.m_ipaddr) && (m_port == key.m_port) && (m_id == key.m_id) ); } + + bool operator!=(const RemoteObjectKey & key) + { return ( (m_ipaddr != key.m_ipaddr) || (m_port != key.m_port) || (m_id == key.m_id) ); } + + friend bool operator<( const RemoteObjectKey & lhs, const RemoteObjectKey & rhs); + + // bool operator>( RemoteObjectKey & key) +// { +// if ( m_ipaddr != key.m_ipaddr ) +// return ( m_ipaddr > key.m_ipaddr); +// if ( m_port != key.m_port ) +// return ( m_port > key.m_port ); +// return ( m_id > key.m_id ); +// } +// bool operator<=( RemoteObjectKey & key) +// { +// if ( m_ipaddr != key.m_ipaddr ) +// return ( m_ipaddr <= key.m_ipaddr); +// if ( m_port != key.m_port ) +// return ( m_port <= key.m_port ); +// return ( m_id <= key.m_id ); +// } +// bool operator>=( RemoteObjectKey & key) +// { +// if ( m_ipaddr != key.m_ipaddr ) +// return ( m_ipaddr >= key.m_ipaddr); +// if ( m_port != key.m_port ) +// return ( m_port >= key.m_port ); +// return ( m_id >= key.m_id ); +// } + }; +bool operator<( const RemoteObjectKey & lhs, const RemoteObjectKey & rhs); + class RemoteObjectTable { public: - RemoteObjectWrapper * getRemoteObject(int ipaddr, short port, int id) + simdata::Ref<DynamicObject> getRemoteObject(RemoteObjectKey key) { - return m_table[ipaddr][port][id]; + printf("RemoteObjectTable::getRemoteObject()\n"); + return m_table[key]; } - void putRemoteObject(int ipaddr, short port, int id, RemoteObjectWrapper * object) + void putRemoteObject(RemoteObjectKey key, simdata::Ref<DynamicObject> object) { - m_table[ipaddr][port][id] = object; + printf("RemoteObjectTable::putRemoteObject() - entering\n"); + m_table[key] = object; + printf("RemoteObjectTable::putRemoteObject() - exiting\n"); } private: - std::map< int , std::map < short, std::map < short, RemoteObjectWrapper * > > > m_table; + std::map< RemoteObjectKey, simdata::Ref<DynamicObject> > m_table; }; @@ -296,7 +362,7 @@ int m_messageReceiveArrayGrow; NetworkNode * m_originatorNode; std::list<NetworkMessage*> m_messagePool; - std::list<NetworkMessageHandler *> m_ReceiveHandlerList; + std::list<NetworkMessageHandler *> m_MessageHandlerList; ost::UDPSocket * m_UDPReceiverSocket; ost::UDPSocket * m_UDPSenderSocket; @@ -322,7 +388,7 @@ NetworkMessage * allocMessageBuffer(); void freeMessageBuffer(NetworkMessage * message); - void registerReceiveHandler(NetworkMessageHandler * handler); + void registerMessageHandler(NetworkMessageHandler * handler); int sendto(NetworkMessage * message, ost::InetHostAddress * remoteAddress, Port * remotePort); int sendto(NetworkMessage * message, NetworkNode * node); @@ -363,6 +429,24 @@ }; +class RedirectMessageHandler : public NetworkMessageHandler +{ + protected: + NetworkMessenger * m_messenger; + std::set<NetworkNode *> m_ClientNodeList; + public: + RedirectMessageHandler(); + virtual void process(NetworkMessage * message); + virtual ~RedirectMessageHandler(); + + + virtual void setMessenger(NetworkMessenger * messenger) + { m_messenger = messenger; } + virtual NetworkMessenger * getMessenger() + { return m_messenger; } + +}; + class PrintMessageHandler : public NetworkMessageHandler { protected: @@ -411,6 +495,21 @@ }; +class CallHandler +{ + private: + NetworkMessage* m_NetworkMessage; + public: + CallHandler(NetworkMessage* network_message): + m_NetworkMessage(network_message) { } + void operator()(NetworkMessageHandler* network_message_handler) + { + network_message_handler->process(m_NetworkMessage); + } +}; + + +// NetworkMessage * message = (NetworkMessage*)(new simdata::uint8[512]); // not currently using these below class NetworkBroadcaster Added: trunk/CSP/CSPSim/Include/RedirectServerNode.h =================================================================== --- trunk/CSP/CSPSim/Include/RedirectServerNode.h 2004-06-28 00:43:19 UTC (rev 1083) +++ trunk/CSP/CSPSim/Include/RedirectServerNode.h 2004-06-28 00:52:05 UTC (rev 1084) @@ -0,0 +1,10 @@ + + +class RedirectServerNode +{ + + public: + RedirectServerNode(); + int run(); + +}; Added: trunk/CSP/CSPSim/Include/RedirectServerNode.i =================================================================== --- trunk/CSP/CSPSim/Include/RedirectServerNode.i 2004-06-28 00:43:19 UTC (rev 1083) +++ trunk/CSP/CSPSim/Include/RedirectServerNode.i 2004-06-28 00:52:05 UTC (rev 1084) @@ -0,0 +1,7 @@ +%module RedirectServerNode +%{ +#include "RedirectServerNode.h" +%} + +%include "RedirectServerNode.h" + Deleted: trunk/CSP/CSPSim/Include/ServerNode.h =================================================================== --- trunk/CSP/CSPSim/Include/ServerNode.h 2004-06-28 00:43:19 UTC (rev 1083) +++ trunk/CSP/CSPSim/Include/ServerNode.h 2004-06-28 00:52:05 UTC (rev 1084) @@ -1,10 +0,0 @@ - - -class ServerNode -{ - - public: - ServerNode(); - int run(); - -}; Deleted: trunk/CSP/CSPSim/Include/ServerNode.i =================================================================== --- trunk/CSP/CSPSim/Include/ServerNode.i 2004-06-28 00:43:19 UTC (rev 1083) +++ trunk/CSP/CSPSim/Include/ServerNode.i 2004-06-28 00:52:05 UTC (rev 1084) @@ -1,7 +0,0 @@ -%module ServerNode -%{ -#include "ServerNode.h" -%} - -%include "ServerNode.h" - |
From: <sv...@ww...> - 2004-06-28 00:43:25
|
Author: mkrose Date: 2004-06-27 17:43:19 -0700 (Sun, 27 Jun 2004) New Revision: 1083 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/TaggedRecord.h trunk/CSP/SimData/Makefile trunk/CSP/SimData/SimData/Tests/Makefile Log: Small fixes to the main makefile and the unit test makefile. Small fixes to TaggedRecord.h Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1083 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-06-28 00:38:49 UTC (rev 1082) +++ trunk/CSP/SimData/CHANGES.current 2004-06-28 00:43:19 UTC (rev 1083) @@ -9,6 +9,10 @@ * Clean up base class construction of ThreadLog, removing suspect references to 'this' in ctor initializer list. + * Small fixes to the main makefile and the unit test makefile. + + * Small fixes to TaggedRecord.h + 2004-06-26: onsight * Remove superflous logging in interface registry, and suppress swig warnings. Modified: trunk/CSP/SimData/Include/SimData/TaggedRecord.h =================================================================== --- trunk/CSP/SimData/Include/SimData/TaggedRecord.h 2004-06-28 00:38:49 UTC (rev 1082) +++ trunk/CSP/SimData/Include/SimData/TaggedRecord.h 2004-06-28 00:43:19 UTC (rev 1083) @@ -127,7 +127,7 @@ _buffer.append(x); return *this; } - std::string str() const { + std::string const & str() const { return _buffer; } }; @@ -327,6 +327,7 @@ */ class TaggedRecord: public Referenced { public: + typedef Ref<TaggedRecord> Ref; typedef int64 Id; virtual void serialize(TagReader &reader) = 0; virtual void serialize(TagWriter &writer) const = 0; Modified: trunk/CSP/SimData/Makefile =================================================================== --- trunk/CSP/SimData/Makefile 2004-06-28 00:38:49 UTC (rev 1082) +++ trunk/CSP/SimData/Makefile 2004-06-28 00:43:19 UTC (rev 1083) @@ -1,6 +1,6 @@ SUBDIRS = Source -export PYTHON_INCLUDE := $(shell python setup.py python_include_path) +export PYTHON_INCLUDE = $(shell python setup.py python_include_path) export GSWOPTS = $(shell python setup.py swigopts) export GLDOPTS = $(shell python setup.py ldopts) @@ -32,7 +32,7 @@ tests: @$(MAKE) --no-print-directory -C SimData/Tests all - python SimData/Tests/RunTests.py + @SIMDATA_LOGFILE=SimData/Tests/.testlog python SimData/Tests/RunTests.py tests-clean: @$(MAKE) --no-print-directory -C SimData/Tests clean Modified: trunk/CSP/SimData/SimData/Tests/Makefile =================================================================== --- trunk/CSP/SimData/SimData/Tests/Makefile 2004-06-28 00:38:49 UTC (rev 1082) +++ trunk/CSP/SimData/SimData/Tests/Makefile 2004-06-28 00:43:19 UTC (rev 1083) @@ -46,7 +46,7 @@ %: %.cpp @echo -n "Building $@..." @for foo in a; do \ - $(CXX) -o $@ $(CFLAGS) $(@:=.cpp) -L$(TOPDIR)/SimData -lSimData 2>.buildlog 1>/dev/null; \ + $(CXX) -o $@ $(CFLAGS) $(@:=.cpp) -L$(TOPDIR)/SimData -lSimData -lpthread 2>.buildlog 1>/dev/null; \ if [ $$? = "0" ]; then echo "ok"; else echo "failed!"; exit 1; fi; \ done $ |
From: <sv...@ww...> - 2004-06-28 00:38:56
|
Author: mkrose Date: 2004-06-27 17:38:49 -0700 (Sun, 27 Jun 2004) New Revision: 1082 Added: trunk/CSP/CSPSim/Include/DispatchCenter.h trunk/CSP/CSPSim/Source/DispatchCenter.cpp Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Include/Dispatch.h Log: Add DispatchCenter.h, and DispatchCenter.cpp. Rough outline for adding tagged record support to the network layer. Not yet integrated with the build, and relies a simdata header that isn't checked in yet. Wrote some additional docs for Dispatch.h. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1082 Diff omitted (11097 bytes). |
From: <sv...@ww...> - 2004-06-27 21:30:12
|
Author: mkrose Date: 2004-06-27 14:30:06 -0700 (Sun, 27 Jun 2004) New Revision: 1081 Modified: trunk/CSP/CSPSim/Include/StaticObject.h Log: Remove superfluous comments Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1081 Modified: trunk/CSP/CSPSim/Include/StaticObject.h =================================================================== --- trunk/CSP/CSPSim/Include/StaticObject.h 2004-06-27 21:28:19 UTC (rev 1080) +++ trunk/CSP/CSPSim/Include/StaticObject.h 2004-06-27 21:30:06 UTC (rev 1081) @@ -47,8 +47,6 @@ SIMDATA_OBJECT(StaticObject, 0, 0) protected: - //virtual void serialize(simdata::Reader&); - //virtual void serialize(simdata::Writer&); virtual void dump() {} virtual double onUpdate(double) { return 0.0; } virtual void initialize() {} |
From: <sv...@ww...> - 2004-06-27 21:28:26
|
Author: mkrose Date: 2004-06-27 14:28:19 -0700 (Sun, 27 Jun 2004) New Revision: 1080 Modified: trunk/CSP/CSPSim/Source/ClientNode.cpp Log: Fix log setup calls Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1080 Modified: trunk/CSP/CSPSim/Source/ClientNode.cpp =================================================================== --- trunk/CSP/CSPSim/Source/ClientNode.cpp 2004-06-27 17:57:10 UTC (rev 1079) +++ trunk/CSP/CSPSim/Source/ClientNode.cpp 2004-06-27 21:28:19 UTC (rev 1080) @@ -126,7 +126,8 @@ printf("Network test client starting up...\n"); printf("ClientNode::init()\n"); int level = g_Config.getInt("Debug", "LoggingLevel", 0, true); - csplog().setLogLevels(CSP_ALL, level); + csplog().setLogCategory(CSP_ALL); + csplog().setLogPriority(level); csplog().setOutput("ClientNode.log"); m_battlefield = new VirtualBattlefield(); |
From: <sv...@ww...> - 2004-06-27 17:57:16
|
Author: mkrose Date: 2004-06-27 10:57:10 -0700 (Sun, 27 Jun 2004) New Revision: 1079 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/ThreadLog.h Log: Clean up base class construction of ThreadLog, removing suspect references to 'this' in ctor initializer list. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1079 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-06-27 17:34:40 UTC (rev 1078) +++ trunk/CSP/SimData/CHANGES.current 2004-06-27 17:57:10 UTC (rev 1079) @@ -6,6 +6,9 @@ * Added ThreadLog.h to setup.py + * Clean up base class construction of ThreadLog, removing suspect + references to 'this' in ctor initializer list. + 2004-06-26: onsight * Remove superflous logging in interface registry, and suppress swig warnings. Modified: trunk/CSP/SimData/Include/SimData/ThreadLog.h =================================================================== --- trunk/CSP/SimData/Include/SimData/ThreadLog.h 2004-06-27 17:34:40 UTC (rev 1078) +++ trunk/CSP/SimData/Include/SimData/ThreadLog.h 2004-06-27 17:57:10 UTC (rev 1079) @@ -52,17 +52,16 @@ int m_priority; const char *m_file; int m_line; + LogStream &m_log; void init() { m_buffer.reserve(1024); } -protected: - - // accessed directly by ThreadLog - LogStream &m_log; typedef ScopedLock<LogStream> ScopedLogLock; +public: + /** Default constructor, connects to the global simdata log. */ StringBuf(): m_category(LOG_ALL), m_priority(LOG_INFO), m_file(0), m_line(0), m_log(::simdata::log()) { @@ -75,6 +74,21 @@ init(); } + /** Cache the log entry parameters. + */ + inline void setPrefix(int priority, int category, const char *file, int line) { + m_priority = priority; + m_category = category; + m_file = file; + m_line = line; + } + + /** Retrieve the associated LogStream. + */ + inline LogStream &getLogStream() const { return m_log; } + +protected: + /** Overflow (cache characters internally) */ virtual int overflow(int c) { @@ -93,96 +107,111 @@ return 1; } - /** Cache the log entry parameters. - */ - inline void setPrefix(int priority, int category, const char *file, int line) { - m_priority = priority; - m_category = category; - m_file = file; - m_line = line; - } }; +/** A helper class for ThreadLog construction. + * + * A helper class that ensures a streambuf and ostream are constructed and + * destroyed in the correct order. The streambuf must be created before the + * ostream but bases are constructed before members. Thus, making this class + * a private base of ThreadLog, declared to the left of ostream, we ensure the + * correct order of construction and destruction. + */ +struct SIMDATA_EXPORT ThreadLogBase: public NonCopyable +{ +protected: + ThreadLogBase(): m_stringbuf() {} + ThreadLogBase(LogStream &base): m_stringbuf(base) {} + virtual ~ThreadLogBase() { } + + inline LogStream &getLogStream() const { return m_stringbuf.getLogStream(); } + + StringBuf m_stringbuf; +}; + + /** A thread-safe logging class that provides serialized access to an * underlying LogStream instance. The public interface is the same as * LogStream, and the logging macro as defined to use thread-specific * ThreadLog instances instead of the global LogStream whenever threading * is enabled. */ -class SIMDATA_EXPORT ThreadLog: private StringBuf, protected std::ostream +class SIMDATA_EXPORT ThreadLog: private ThreadLogBase, protected std::ostream { + typedef ScopedLock<LogStream> ScopedLogLock; + public: /** Default constructor, connects to the global simdata log. */ - ThreadLog(): std::ostream(this) {} + ThreadLog(): ThreadLogBase(), std::ostream(&m_stringbuf) {} /** Constructor, connects to the specified LogStream */ - ThreadLog(LogStream &base): StringBuf(base), std::ostream(this) {} + ThreadLog(LogStream &base): ThreadLogBase(base), std::ostream(&m_stringbuf) {} /** Close the underlying (shared) LogStream. */ void _close() { - ScopedLogLock lock(m_log); - m_log._close(); + ScopedLogLock lock(getLogStream()); + getLogStream()._close(); } /** Set the output stream used by the underlying (shared) LogStream. */ void setOutput(std::ostream& out_) { - ScopedLogLock lock(m_log); - m_log.setOutput(out_); + ScopedLogLock lock(getLogStream()); + getLogStream().setOutput(out_); } /** Set the output file used by the underlying (shared) LogStream. */ void setOutput(std::string const &filename) { - ScopedLogLock lock(m_log); - m_log.setOutput(filename); + ScopedLogLock lock(getLogStream()); + getLogStream().setOutput(filename); } /** Set the logging priority threshold of the underlying (shared) LogStream. */ void setLogPriority(int p) { - ScopedLogLock lock(m_log); - m_log.setLogPriority(p); + ScopedLogLock lock(getLogStream()); + getLogStream().setLogPriority(p); } /** Set the logging category mask of the underlying (shared) LogStream. */ void setLogCategory(int c) { - ScopedLogLock lock(m_log); - m_log.setLogCategory(c); + ScopedLogLock lock(getLogStream()); + getLogStream().setLogCategory(c); } /** Enable or disable point logging (source file and line number) by the * underlying (shared) LogStream. */ void setPointLogging(bool enabled) { - ScopedLogLock lock(m_log); - m_log.setPointLogging(enabled); + ScopedLogLock lock(getLogStream()); + getLogStream().setPointLogging(enabled); } /** Get the point logging state of the underlying (shared) LogStream. */ bool getPointLogging() const { - return m_log.getPointLogging(); + return getLogStream().getPointLogging(); } /** Enable or disable time stamping of log entries written to the * underlying (shared) LogStream. */ void setTimeLogging(bool enabled) { - ScopedLogLock lock(m_log); - m_log.setTimeLogging(enabled); + ScopedLogLock lock(getLogStream()); + getLogStream().setTimeLogging(enabled); } /** Get the time logging state of the underlying (shared) LogStream. */ bool getTimeLogging() const { - return m_log.getTimeLogging(); + return getLogStream().getTimeLogging(); } /** Method for logging a message to the underlying (shared) LogStream. @@ -194,7 +223,7 @@ * @return an output stream to receive the message contents. */ std::ostream & entry(int priority, int category=LOG_ALL, const char *file=0, int line=0) { - setPrefix(priority, category, file, line); + m_stringbuf.setPrefix(priority, category, file, line); return *this; } |
From: <sv...@ww...> - 2004-06-27 17:34:48
|
Author: mkrose Date: 2004-06-27 10:34:40 -0700 (Sun, 27 Jun 2004) New Revision: 1078 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/setup.py Log: Added ThreadLog.h to setup.py Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1078 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-06-27 17:32:36 UTC (rev 1077) +++ trunk/CSP/SimData/CHANGES.current 2004-06-27 17:34:40 UTC (rev 1078) @@ -4,6 +4,8 @@ 2004-06-27: onsight * Opps, forgot Source/ThreadBase.cpp + * Added ThreadLog.h to setup.py + 2004-06-26: onsight * Remove superflous logging in interface registry, and suppress swig warnings. Modified: trunk/CSP/SimData/setup.py =================================================================== --- trunk/CSP/SimData/setup.py 2004-06-27 17:32:36 UTC (rev 1077) +++ trunk/CSP/SimData/setup.py 2004-06-27 17:34:40 UTC (rev 1078) @@ -1,18 +1,18 @@ # SimDataCSP: Data Infrastructure for Simulations # Copyright (C) 2002 Mark Rose <tm...@st...> -# +# # This file is part of SimDataCSP. -# +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -38,7 +38,7 @@ print >>sys.stderr, "SimData requires Python version %s or higher. (current version is %s)" % \ (min_python_version, sys.version[:5]) sys.exit(old) - + from distutils.core import setup from distutils.core import Extension import distutils.command.build_ext @@ -149,7 +149,7 @@ if file.endswith(".py"): script = os.path.join(modpath, file) if os.path.exists(script): - py_compile.compile(script) + py_compile.compile(script) os.chmod(script+"c", 0644) except Exception, e: print e @@ -164,13 +164,13 @@ sys.exit(0) class build_swig_ext(build_ext): - + options = [] def build_extension(self, ext): self.ext = ext build_ext.build_extension(self, ext) - + def swig_sources (self, sources): """Walk the list of source files in 'sources', looking for SWIG @@ -209,7 +209,7 @@ swig = self.find_swig() swig_cmd = [swig] + build_swig_ext.options - + if 1 or self.inplace: fullname = self.get_ext_fullname(self.ext.name) modpath = string.split(fullname, '.') @@ -329,6 +329,7 @@ "TaggedRecordRegistry.h", "Thread.h", "ThreadBase.h", + "ThreadLog.h", "ThreadQueue.h", "Timing.h", "Trace.h", @@ -411,11 +412,11 @@ print ' '.join(swigopts) sys.exit(0) -cSimData = Extension("SimData._cSimData", - sources + main_interface_fullpath, +cSimData = Extension("SimData._cSimData", + sources + main_interface_fullpath, include_dirs = includes, define_macros = defines, - libraries = libraries, + libraries = libraries, extra_compile_args = cflags, ) |
From: <sv...@ww...> - 2004-06-27 17:32:43
|
Author: mkrose Date: 2004-06-27 10:32:36 -0700 (Sun, 27 Jun 2004) New Revision: 1077 Added: trunk/CSP/SimData/Source/ThreadBase.cpp Modified: trunk/CSP/SimData/CHANGES.current Log: Opps, forgot Source/ThreadBase.cpp Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1077 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-06-27 08:24:41 UTC (rev 1076) +++ trunk/CSP/SimData/CHANGES.current 2004-06-27 17:32:36 UTC (rev 1077) @@ -1,6 +1,9 @@ Version 0.4.0 (in progress) =========================== +2004-06-27: onsight + * Opps, forgot Source/ThreadBase.cpp + 2004-06-26: onsight * Remove superflous logging in interface registry, and suppress swig warnings. Added: trunk/CSP/SimData/Source/ThreadBase.cpp =================================================================== --- trunk/CSP/SimData/Source/ThreadBase.cpp 2004-06-27 08:24:41 UTC (rev 1076) +++ trunk/CSP/SimData/Source/ThreadBase.cpp 2004-06-27 17:32:36 UTC (rev 1077) @@ -0,0 +1,142 @@ +/* SimData: Data Infrastructure for Simulations + * Copyright 2004 Mark Rose <mk...@us...> + * + * This file is part of SimData. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +/** + * @file ThreadBase.cpp + * @brief PosixThreads wrapper and utility classes. + **/ + +#ifndef SIMDATA_NOTHREADS + +#include <SimData/ThreadBase.h> +#include <SimData/Log.h> + + +NAMESPACE_SIMDATA + +ThreadException::ThreadException(const int error): Exception("ThreadException"), m_error(error) { + translateError(); +} + +void ThreadException::checkThrow(const int result) { + if (result != 0) { + throw ThreadException(result); + } +} + +void ThreadException::checkLog(const int result) { + if (result != 0) { + ThreadException e(result); + SIMDATA_ERROR(LOG_THREAD, e); + e.clear(); + } +} + +void ThreadException::translateError() { + std::stringstream msg; + switch (m_error) { + case EDEADLK: msg << "deadlock (EDEADLK)"; break; + case EAGAIN: msg << "unable to allocate resource (EAGAIN)"; break; + case EBUSY: msg << "busy: resource already in use (EBUSY)"; break; + case EINVAL: msg << "invalid parameters (EINVAL)"; break; + case ENOMEM: msg << "out of memory (ENOMEM)"; break; + case ETIMEDOUT: msg << "timed out (ETIMEDOUT)"; break; + case EPERM: msg << "permission denied (EPERM)"; break; + case ESRCH: msg << "not found (ESRCH)"; break; + default: msg << "ISO C99 error code: " << m_error; + } + addMessage(msg.str()); +} + + +template <class TYPE> +ThreadSpecific<TYPE>::~ThreadSpecific() { + if (m_once) { + // delete the current thread's instance, if any (the callback will not + // do so after the key is deleted). + ValueType *tss_data = reinterpret_cast<ValueType*>(pthread_getspecific(this->m_key)); + delete tss_data; + const int result = pthread_key_delete(m_key); + // not safe to throw from a dtor, so just log the error + ThreadException::checkLog(result); + } +} + +template <class TYPE> +TYPE *ThreadSpecific<TYPE>::operator->() { + // the first call needs to construct a shared key that is + // used to access the thread-specific data. + if (!this->m_once) { + ScopedLock<ThreadMutex> lock(this->m_keylock); + if (!this->m_once) { + const int result = pthread_key_create(&this->m_key, &this->cleanup_hook); + ThreadException::checkThrow(result); + this->m_once = true; + } + } + + // use the shared key to retrieve the data (ValueType*) for this thread. + ValueType *tss_data = reinterpret_cast<ValueType*>(pthread_getspecific(this->m_key)); + + // if the pointer is null, this is the first access from this + // thread and we need to allocate a new instance. + if (tss_data == 0) { + tss_data = createNew(); + const int result = pthread_setspecific(this->m_key, reinterpret_cast<void*>(tss_data)); + ThreadException::checkThrow(result); + } + + // return the instance specific to the current thread. + return tss_data; +} + +ThreadCondition::~ThreadCondition() { + int result = pthread_cond_destroy(&m_cond); + // not safe to throw from a dtor, so just log the error + ThreadException::checkLog(result); + if (&m_local_mutex == &m_mutex) { + result = pthread_mutex_destroy(&m_local_mutex); + // not safe to throw from a dtor, so just log the error + ThreadException::checkLog(result); + } +} + +bool ThreadCondition::wait(double timeout) { + if (timeout < 0) { + const int result = pthread_cond_wait(&m_cond, &m_mutex); + ThreadException::checkThrow(result); + } else { + double abstime_sec = get_realtime() + timeout; + timespec abstime; + double sec = floor(abstime_sec); + abstime.tv_sec = static_cast<int>(sec); + abstime.tv_nsec = static_cast<int>(1e+9 * (abstime_sec - sec)); + const int result = pthread_cond_timedwait(&m_cond, &m_mutex, &abstime); + if (result == ETIMEDOUT) return false; + ThreadException::checkThrow(result); + } + return true; +} + +NAMESPACE_SIMDATA_END + +#endif // SIMDATA_NOTHREADS + |
From: <sv...@ww...> - 2004-06-27 08:24:48
|
Author: mkrose Date: 2004-06-27 01:24:41 -0700 (Sun, 27 Jun 2004) New Revision: 1076 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/Math.h trunk/CSP/SimData/Include/SimData/Namespace.h trunk/CSP/SimData/Include/SimData/ObjectInterface.h trunk/CSP/SimData/Include/SimData/TypeAdapter.h trunk/CSP/SimData/Source/Timing.cpp Log: Misc doxygen cleanup. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1076 Diff omitted (13494 bytes). |