[Avida-cvs] [avida-svn] r421 - in development: . Avida.xcodeproj source source/analyze source/classification source/cpu source/drivers source/event source/main source/tools source/viewer

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Sun Dec 11 13:15:52 PST 2005


Author: brysonda
Date: 2005-12-11 16:15:51 -0500 (Sun, 11 Dec 2005)
New Revision: 421

Added:
   development/source/drivers/
   development/source/drivers/CMakeLists.txt
   development/source/drivers/cAvidaDriver.h
   development/source/drivers/cDefaultAnalyzeDriver.cc
   development/source/drivers/cDefaultAnalyzeDriver.h
   development/source/drivers/cDefaultRunDriver.cc
   development/source/drivers/cDefaultRunDriver.h
   development/source/drivers/cDriverManager.cc
   development/source/drivers/cDriverManager.h
   development/source/drivers/cFallbackWorldDriver.cc
   development/source/drivers/cFallbackWorldDriver.h
   development/source/drivers/cWorldDriver.h
Removed:
   development/source/main/cAvidaDriver_Analyze.cc
   development/source/main/cAvidaDriver_Analyze.h
   development/source/main/cAvidaDriver_Base.cc
   development/source/main/cAvidaDriver_Base.h
   development/source/main/cAvidaDriver_Population.cc
   development/source/main/cAvidaDriver_Population.h
Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/CMakeLists.txt
   development/source/CMakeLists.txt
   development/source/analyze/cAnalyzeGenotype.cc
   development/source/classification/cClassificationManager.cc
   development/source/classification/cGenotype.cc
   development/source/classification/cLineage.cc
   development/source/cpu/cHardware4Stack.cc
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareManager.cc
   development/source/cpu/cHardwareSMT.cc
   development/source/event/cEventManager.cc
   development/source/main/CMakeLists.txt
   development/source/main/avida.cc
   development/source/main/avida.h
   development/source/main/cPopulationInterface.h
   development/source/main/cWorld.cc
   development/source/main/cWorld.h
   development/source/main/primitive.cc
   development/source/tools/cDataFile.cc
   development/source/tools/cIntegratedScheduleNode.cc
   development/source/tools/cMerit.cc
   development/source/tools/cRefBlock.h
   development/source/tools/cWeightedIndex.cc
   development/source/tools/functions.h
   development/source/viewer/viewer.cc
Log:
Rework driver structure.  cWorld now holds a pointer to its driver object, which is used by events, etc. to notify the driver of various things.   Drivers now register themselves with the cDriverManager in order to be scheduled for safe deletion.   cDriverManager registers its Destroy method with atexit().

All of this should lead up to it being possible to have more than one driver object active at a time.

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2005-12-10 04:11:50 UTC (rev 420)
+++ development/Avida.xcodeproj/project.pbxproj	2005-12-11 21:15:51 UTC (rev 421)
@@ -27,20 +27,25 @@
 		7013846409028B3E0087ED2E /* cAvidaConfig.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7013846009028B3E0087ED2E /* cAvidaConfig.cc */; };
 		7013852D0902E36B0087ED2E /* avida.cfg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7013852C0902E36B0087ED2E /* avida.cfg */; };
 		7013852E0902E36B0087ED2E /* avida.cfg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7013852C0902E36B0087ED2E /* avida.cfg */; };
-		702D4EFF08DA5341007BA469 /* cAvidaDriver_Base.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EFA08DA5341007BA469 /* cAvidaDriver_Base.cc */; };
-		702D4F0008DA5341007BA469 /* cAvidaDriver_Population.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EFB08DA5341007BA469 /* cAvidaDriver_Population.cc */; };
+		701D915D094B864A008B845F /* cFallbackWorldDriver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701D915C094B864A008B845F /* cFallbackWorldDriver.cc */; };
+		701D915E094B864A008B845F /* cFallbackWorldDriver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701D915C094B864A008B845F /* cFallbackWorldDriver.cc */; };
+		701D92E4094C9E6F008B845F /* cDriverManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 701D92E0094C9E6F008B845F /* cDriverManager.h */; };
+		701D930E094CAD6B008B845F /* cDefaultRunDriver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701D930C094CAD6B008B845F /* cDefaultRunDriver.cc */; };
+		701D930F094CAD6B008B845F /* cDefaultRunDriver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 701D930B094CAD6B008B845F /* cDefaultRunDriver.h */; };
+		701D9310094CAD6B008B845F /* cDefaultRunDriver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701D930C094CAD6B008B845F /* cDefaultRunDriver.cc */; };
+		701D9383094CBA69008B845F /* cDriverManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701D9382094CBA69008B845F /* cDriverManager.cc */; };
+		701D9384094CBA69008B845F /* cDriverManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701D9382094CBA69008B845F /* cDriverManager.cc */; };
+		701D93E9094CBF71008B845F /* cDefaultAnalyzeDriver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701D93E7094CBF71008B845F /* cDefaultAnalyzeDriver.cc */; };
+		701D93EA094CBF71008B845F /* cDefaultAnalyzeDriver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 701D93E6094CBF71008B845F /* cDefaultAnalyzeDriver.h */; };
+		701D93EB094CBF71008B845F /* cDefaultAnalyzeDriver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701D93E7094CBF71008B845F /* cDefaultAnalyzeDriver.cc */; };
 		702D4F0108DA5341007BA469 /* cEnvironment.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EFC08DA5341007BA469 /* cEnvironment.cc */; };
 		702D4F0208DA5341007BA469 /* cPopulationInterface.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EFD08DA5341007BA469 /* cPopulationInterface.cc */; };
-		702D4F0308DA5341007BA469 /* cAvidaDriver_Analyze.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EF908DA5341007BA469 /* cAvidaDriver_Analyze.cc */; };
-		702D4F0408DA5341007BA469 /* cAvidaDriver_Base.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EFA08DA5341007BA469 /* cAvidaDriver_Base.cc */; };
-		702D4F0508DA5341007BA469 /* cAvidaDriver_Population.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EFB08DA5341007BA469 /* cAvidaDriver_Population.cc */; };
 		702D4F0608DA5341007BA469 /* cEnvironment.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EFC08DA5341007BA469 /* cEnvironment.cc */; };
 		702D4F0708DA5341007BA469 /* cPopulationInterface.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EFD08DA5341007BA469 /* cPopulationInterface.cc */; };
 		702D4F4508DA61FE007BA469 /* cBirthChamber.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4F3F08DA61FE007BA469 /* cBirthChamber.cc */; };
 		702D4F4B08DA61FE007BA469 /* cBirthChamber.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4F3F08DA61FE007BA469 /* cBirthChamber.cc */; };
 		7040CF1C0906A52E00AA820F /* cEventManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7040CF1A0906A52E00AA820F /* cEventManager.cc */; };
 		7040CF1E0906A52E00AA820F /* cEventManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7040CF1A0906A52E00AA820F /* cEventManager.cc */; };
-		7040D36E09095E5900AA820F /* cAvidaDriver_Analyze.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EF908DA5341007BA469 /* cAvidaDriver_Analyze.cc */; };
 		7040D3A6090964D100AA820F /* cMxCodeArray.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0865808F4974300FC65FE /* cMxCodeArray.cc */; };
 		70422A28091B141000A5E67F /* cAnalyze.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70422A1C091B141000A5E67F /* cAnalyze.cc */; };
 		70422A30091B141000A5E67F /* cAnalyzeGenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70422A24091B141000A5E67F /* cAnalyzeGenotype.cc */; };
@@ -301,6 +306,9 @@
 				700E2B7D085DE50C00CF158A /* inst_set.smt in CopyFiles */,
 				701384340900A45B0087ED2E /* organism.smtx in CopyFiles */,
 				7013852E0902E36B0087ED2E /* avida.cfg in CopyFiles */,
+				701D92E4094C9E6F008B845F /* cDriverManager.h in CopyFiles */,
+				701D930F094CAD6B008B845F /* cDefaultRunDriver.h in CopyFiles */,
+				701D93EA094CBF71008B845F /* cDefaultAnalyzeDriver.h in CopyFiles */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -337,14 +345,19 @@
 		7013846009028B3E0087ED2E /* cAvidaConfig.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cAvidaConfig.cc; sourceTree = "<group>"; };
 		701384A10902A16F0087ED2E /* defs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = defs.h; sourceTree = "<group>"; };
 		7013852C0902E36B0087ED2E /* avida.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = avida.cfg; sourceTree = "<group>"; };
-		702D4EF208DA5328007BA469 /* cAvidaDriver_Analyze.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cAvidaDriver_Analyze.h; sourceTree = "<group>"; };
-		702D4EF308DA5328007BA469 /* cAvidaDriver_Base.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cAvidaDriver_Base.h; sourceTree = "<group>"; };
-		702D4EF408DA5328007BA469 /* cAvidaDriver_Population.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cAvidaDriver_Population.h; sourceTree = "<group>"; };
+		701D9116094B773E008B845F /* cWorldDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cWorldDriver.h; sourceTree = "<group>"; };
+		701D912B094B7AC1008B845F /* cAvidaDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cAvidaDriver.h; sourceTree = "<group>"; };
+		701D9151094B8483008B845F /* cFallbackWorldDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cFallbackWorldDriver.h; sourceTree = "<group>"; };
+		701D915C094B864A008B845F /* cFallbackWorldDriver.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cFallbackWorldDriver.cc; sourceTree = "<group>"; };
+		701D92E0094C9E6F008B845F /* cDriverManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cDriverManager.h; sourceTree = "<group>"; };
+		701D930B094CAD6B008B845F /* cDefaultRunDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cDefaultRunDriver.h; sourceTree = "<group>"; };
+		701D930C094CAD6B008B845F /* cDefaultRunDriver.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cDefaultRunDriver.cc; sourceTree = "<group>"; };
+		701D9382094CBA69008B845F /* cDriverManager.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cDriverManager.cc; sourceTree = "<group>"; };
+		701D93E6094CBF71008B845F /* cDefaultAnalyzeDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cDefaultAnalyzeDriver.h; sourceTree = "<group>"; };
+		701D93E7094CBF71008B845F /* cDefaultAnalyzeDriver.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cDefaultAnalyzeDriver.cc; sourceTree = "<group>"; };
+		701D941C094CC5F1008B845F /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
 		702D4EF508DA5328007BA469 /* cEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cEnvironment.h; sourceTree = "<group>"; };
 		702D4EF608DA5328007BA469 /* cPopulationInterface.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cPopulationInterface.h; sourceTree = "<group>"; };
-		702D4EF908DA5341007BA469 /* cAvidaDriver_Analyze.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cAvidaDriver_Analyze.cc; sourceTree = "<group>"; };
-		702D4EFA08DA5341007BA469 /* cAvidaDriver_Base.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cAvidaDriver_Base.cc; sourceTree = "<group>"; };
-		702D4EFB08DA5341007BA469 /* cAvidaDriver_Population.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cAvidaDriver_Population.cc; sourceTree = "<group>"; };
 		702D4EFC08DA5341007BA469 /* cEnvironment.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cEnvironment.cc; sourceTree = "<group>"; };
 		702D4EFD08DA5341007BA469 /* cPopulationInterface.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cPopulationInterface.cc; sourceTree = "<group>"; };
 		702D4F3808DA61E2007BA469 /* cAvidaTriggers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cAvidaTriggers.h; sourceTree = "<group>"; };
@@ -767,6 +780,24 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		701D9115094B770B008B845F /* drivers */ = {
+			isa = PBXGroup;
+			children = (
+				701D9382094CBA69008B845F /* cDriverManager.cc */,
+				701D9116094B773E008B845F /* cWorldDriver.h */,
+				701D912B094B7AC1008B845F /* cAvidaDriver.h */,
+				701D9151094B8483008B845F /* cFallbackWorldDriver.h */,
+				701D915C094B864A008B845F /* cFallbackWorldDriver.cc */,
+				701D92E0094C9E6F008B845F /* cDriverManager.h */,
+				701D930B094CAD6B008B845F /* cDefaultRunDriver.h */,
+				701D930C094CAD6B008B845F /* cDefaultRunDriver.cc */,
+				701D93E6094CBF71008B845F /* cDefaultAnalyzeDriver.h */,
+				701D93E7094CBF71008B845F /* cDefaultAnalyzeDriver.cc */,
+				701D941C094CC5F1008B845F /* CMakeLists.txt */,
+			);
+			path = drivers;
+			sourceTree = "<group>";
+		};
 		70422A1B091B141000A5E67F /* analyze */ = {
 			isa = PBXGroup;
 			children = (
@@ -882,6 +913,7 @@
 				70422A1B091B141000A5E67F /* analyze */,
 				70F7D8C8092546DC009E311D /* classification */,
 				DCC30F7C0762539D008F7A48 /* cpu */,
+				701D9115094B770B008B845F /* drivers */,
 				DCC30FD00762539D008F7A48 /* event */,
 				DCC310040762539D008F7A48 /* main */,
 				DCC31340076253A0008F7A48 /* third-party */,
@@ -974,12 +1006,6 @@
 				70B086BE08F5D86100FC65FE /* avida.h */,
 				7013846009028B3E0087ED2E /* cAvidaConfig.cc */,
 				7013845F09028B3E0087ED2E /* cAvidaConfig.h */,
-				702D4EF908DA5341007BA469 /* cAvidaDriver_Analyze.cc */,
-				702D4EF208DA5328007BA469 /* cAvidaDriver_Analyze.h */,
-				702D4EFA08DA5341007BA469 /* cAvidaDriver_Base.cc */,
-				702D4EF308DA5328007BA469 /* cAvidaDriver_Base.h */,
-				702D4EFB08DA5341007BA469 /* cAvidaDriver_Population.cc */,
-				702D4EF408DA5328007BA469 /* cAvidaDriver_Population.h */,
 				702D4F3808DA61E2007BA469 /* cAvidaTriggers.h */,
 				702D4F3F08DA61FE007BA469 /* cBirthChamber.cc */,
 				702D4F3908DA61E2007BA469 /* cBirthChamber.h */,
@@ -1510,9 +1536,6 @@
 				70C1F03908C3C71300F50912 /* cTestUtil.cc in Sources */,
 				70C1F19908C6A11100F50912 /* cEventList.cc in Sources */,
 				70C1F19B08C6A11100F50912 /* cEventTriggers.cc in Sources */,
-				702D4F0308DA5341007BA469 /* cAvidaDriver_Analyze.cc in Sources */,
-				702D4F0408DA5341007BA469 /* cAvidaDriver_Base.cc in Sources */,
-				702D4F0508DA5341007BA469 /* cAvidaDriver_Population.cc in Sources */,
 				702D4F0608DA5341007BA469 /* cEnvironment.cc in Sources */,
 				702D4F0708DA5341007BA469 /* cPopulationInterface.cc in Sources */,
 				702D4F4B08DA61FE007BA469 /* cBirthChamber.cc in Sources */,
@@ -1604,6 +1627,10 @@
 				70533482092A4F5D006BD186 /* cSpecies.cc in Sources */,
 				70533483092A4F5F006BD186 /* cSpeciesControl.cc in Sources */,
 				70533484092A4F60006BD186 /* cSpeciesQueue.cc in Sources */,
+				701D915E094B864A008B845F /* cFallbackWorldDriver.cc in Sources */,
+				701D9310094CAD6B008B845F /* cDefaultRunDriver.cc in Sources */,
+				701D9384094CBA69008B845F /* cDriverManager.cc in Sources */,
+				701D93EB094CBF71008B845F /* cDefaultAnalyzeDriver.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1634,8 +1661,6 @@
 				70C1F03108C3C71300F50912 /* cTestUtil.cc in Sources */,
 				70C1F19408C6A11100F50912 /* cEventList.cc in Sources */,
 				70C1F19608C6A11100F50912 /* cEventTriggers.cc in Sources */,
-				702D4EFF08DA5341007BA469 /* cAvidaDriver_Base.cc in Sources */,
-				702D4F0008DA5341007BA469 /* cAvidaDriver_Population.cc in Sources */,
 				702D4F0108DA5341007BA469 /* cEnvironment.cc in Sources */,
 				702D4F0208DA5341007BA469 /* cPopulationInterface.cc in Sources */,
 				702D4F4508DA61FE007BA469 /* cBirthChamber.cc in Sources */,
@@ -1696,7 +1721,6 @@
 				70C5BC6509059A970028A785 /* cWorld.cc in Sources */,
 				70C5BD6B0905CE5F0028A785 /* cHardwareManager.cc in Sources */,
 				7040CF1C0906A52E00AA820F /* cEventManager.cc in Sources */,
-				7040D36E09095E5900AA820F /* cAvidaDriver_Analyze.cc in Sources */,
 				7040D3A6090964D100AA820F /* cMxCodeArray.cc in Sources */,
 				70422A34091B141000A5E67F /* cAnalyze.cc in Sources */,
 				70422A3C091B141000A5E67F /* cAnalyzeGenotype.cc in Sources */,
@@ -1713,6 +1737,10 @@
 				7053336F092A3DFC006BD186 /* cInjectGenotypeControl.cc in Sources */,
 				70533371092A3E00006BD186 /* cInjectGenotypeQueue.cc in Sources */,
 				705333E7092A4B7F006BD186 /* cLineage.cc in Sources */,
+				701D915D094B864A008B845F /* cFallbackWorldDriver.cc in Sources */,
+				701D930E094CAD6B008B845F /* cDefaultRunDriver.cc in Sources */,
+				701D9383094CBA69008B845F /* cDriverManager.cc in Sources */,
+				701D93E9094CBF71008B845F /* cDefaultAnalyzeDriver.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: development/CMakeLists.txt
===================================================================
--- development/CMakeLists.txt	2005-12-10 04:11:50 UTC (rev 420)
+++ development/CMakeLists.txt	2005-12-11 21:15:51 UTC (rev 421)
@@ -227,6 +227,7 @@
 SET(ANALYZE_SRC_DIR ${PROJECT_SOURCE_DIR}/source/analyze)
 SET(CLASSIFICATION_SRC_DIR ${PROJECT_SOURCE_DIR}/source/classification)
 SET(CPU_SRC_DIR ${PROJECT_SOURCE_DIR}/source/cpu)
+SET(DRIVERS_SRC_DIR ${PROJECT_SOURCE_DIR}/source/drivers)
 SET(EVENT_SRC_DIR ${PROJECT_SOURCE_DIR}/source/event)
 SET(MAIN_SRC_DIR ${PROJECT_SOURCE_DIR}/source/main)
 
@@ -236,6 +237,7 @@
 SET(ANALYZE_BLD_DIR ${PROJECT_BINARY_DIR}/source/analyze)
 SET(CLASSSIFICATION_BLD_DIR ${PROJECT_BINARY_DIR}/source/classification)
 SET(CPU_BLD_DIR ${PROJECT_BINARY_DIR}/source/cpu)
+SET(DRIVERS_BLD_DIR ${PROJECT_BINARY_DIR}/source/drivers)
 SET(EVENT_BLD_DIR ${PROJECT_BINARY_DIR}/source/event)
 SET(MAIN_BLD_DIR ${PROJECT_BINARY_DIR}/source/main)
 
@@ -246,6 +248,7 @@
   ${ANALYZE_SRC_DIR}
   ${CLASSIFICATION_SRC_DIR}
   ${CPU_SRC_DIR}
+  ${DRIVERS_SRC_DIR}
   ${EVENT_SRC_DIR}
   ${EVENT_BLD_DIR}
   ${MAIN_SRC_DIR}
@@ -259,6 +262,7 @@
   ${ANALYZE_BLD_DIR}
   ${CLASSIFICATION_BLD_DIR}
   ${CPU_BLD_DIR}
+  ${DRIVERS_BLD_DIR}
   ${EVENT_BLD_DIR}
   ${MAIN_BLD_DIR}
   ${LIBRARY_OUTPUT_PATH}

Modified: development/source/CMakeLists.txt
===================================================================
--- development/source/CMakeLists.txt	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/CMakeLists.txt	2005-12-11 21:15:51 UTC (rev 421)
@@ -1,5 +1,5 @@
 
-SUBDIRS(analyze classification cpu event main third-party tools support utils/task_events)
+SUBDIRS(analyze classification cpu drivers event main third-party tools support utils/task_events)
 IF(AVD_GUI_NCURSES)
   SUBDIRS(viewer)
 ENDIF(AVD_GUI_NCURSES)

Modified: development/source/analyze/cAnalyzeGenotype.cc
===================================================================
--- development/source/analyze/cAnalyzeGenotype.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/analyze/cAnalyzeGenotype.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -19,6 +19,7 @@
 #include "cEnvironment.h"
 #include "cHardwareManager.h"
 #include "cWorld.h"
+#include "cWorldDriver.h"
 
 using namespace std;
 
@@ -58,9 +59,11 @@
   // Make sure that the sequences jive with the inst_set
   for (int i = 0; i < genome.GetSize(); i++) {
     if (genome[i].GetOp() >= inst_set.GetSize()) {
-      cerr << "Error: Trying to load instruction " << genome[i].GetOp()
-	   << ".  Max in set is" << inst_set.GetSize() - 1
-	   << endl;
+      cString msg("Trying to load instruction ");
+      msg += genome[i].GetOp();
+      msg += ".  Max in set is";
+      msg += (inst_set.GetSize() - 1);
+      m_world->GetDriver().RaiseException(msg);
     }
   }
 }
@@ -191,9 +194,7 @@
   {
     cInstruction lib_null_inst = ko_inst_set.GetInstLib()->GetInst("NULL");
     if (lib_null_inst == ko_inst_set.GetInstLib()->GetInstError()) {
-      cout << "<cAnalyze::AnalyzeKnockouts> got error:" << endl
-      << "  instruction 'NULL' not in current hardware type" << endl;
-      exit(1);
+      m_world->GetDriver().RaiseFatalException(1, "instruction 'NULL' not in current hardware type");
     }
     // Add mapping to located instruction. 
     ko_inst_set.AddInst(lib_null_inst.GetOp());
@@ -224,7 +225,7 @@
       knockout_stats->pos_count++;
       ko_effect[line_num] = 1;
     } else {
-      cerr << "INTERNAL ERROR: illegal state in CalcKnockouts()" << endl;
+      m_world->GetDriver().RaiseException("internal: illegal state in CalcKnockouts()");
     }
     
     // Reset the mod_genome back to the original sequence.

Modified: development/source/classification/cClassificationManager.cc
===================================================================
--- development/source/classification/cClassificationManager.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/classification/cClassificationManager.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -21,6 +21,7 @@
 #include "cStringList.h"
 #include "cTestUtil.h"
 #include "cWorld.h"
+#include "cWorldDriver.h"
 
 using namespace std;
 
@@ -254,7 +255,6 @@
       // Test to see if we need to update the coalescent genotype.
       const int new_coal = m_genotype_ctl->UpdateCoalescent();
       m_world->GetStats().SetCoalescentGenotypeDepth(new_coal);
-      // cout << "Set coalescent to " << found_gen->GetDepth() << endl;
       
       if (parent->GetNumOrganisms() == 0) {
         // Regardless, run RemoveGenotype on the parent.
@@ -268,7 +268,6 @@
       // Test to see if we need to update the coalescent genotype.
       const int new_coal = m_genotype_ctl->UpdateCoalescent();
       m_world->GetStats().SetCoalescentGenotypeDepth(new_coal);
-      // cout << "Set coalescent to " << found_gen->GetDepth() << endl;
       
       if (parent2->GetNumOrganisms() == 0) {
         // Regardless, run RemoveGenotype on the parent.
@@ -1003,9 +1002,12 @@
     // lineage doesn't exist...
     if (child_lineage == NULL) {
       // create it
-      cout << "Creating new lineage 'by hand'!\nRequested lineage label: " << parent_lin_id;
       child_lineage = AddLineage(child_fitness, -1, parent_lin_id, 0, 0);
-      cout << ", actual lineage label: " << child_lineage->GetID() << endl;
+      cString msg("Creating new lineage 'by hand'!\nRequested lineage label: ");
+      msg += parent_lin_id;
+      msg += ", actual lineage label: ";
+      msg += child_lineage->GetID();
+      m_world->GetDriver().NotifyComment(msg);
     }
   }
   // otherwise, check for conditions that cause the creation of a new lineage
@@ -1142,7 +1144,9 @@
   for (; it != m_lineage_list.end(); it++ ) if ( (*it)->GetID() == lineage_id ) break;
   
   if (it == m_lineage_list.end()) {
-    cout << "Lineage " << lineage_id << " not found." << endl;
+    cString msg("Lineage ");
+    msg += lineage_id; msg += " not found.";
+    m_world->GetDriver().NotifyComment(msg);
     return NULL;
   }
   

Modified: development/source/classification/cGenotype.cc
===================================================================
--- development/source/classification/cGenotype.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/classification/cGenotype.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -198,8 +198,6 @@
 
 void cGenotype::CalcTestStats() const
 {
-  //  cerr << ".......Calculating test stats..." << endl;
-
   cCPUTestInfo test_info;
   m_world->GetTestCPU().TestGenome(test_info, genome);
   test_data.is_viable = test_info.IsViable();

Modified: development/source/classification/cLineage.cc
===================================================================
--- development/source/classification/cLineage.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/classification/cLineage.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -80,9 +80,8 @@
   map<const cGenotype *, int, gt_gentype>::iterator cur = m_genotype_map.find( genotype );
 
   // is the genotype part of the map?
-  if ( cur == m_genotype_map.end() ){
-    cerr << "Removing creature from lineage whose genotype is not part of the lineage!" << endl;
-    cerr << "  " << genotype->GetName()() << " " << GetID() << endl;
+  if ( cur == m_genotype_map.end() ) {
+    cerr << "Removing creature from lineage whose genotype is not part of the lineage!\n   " << genotype->GetName()() << " " << GetID() << endl;
     return false;
   }
 

Modified: development/source/cpu/cHardware4Stack.cc
===================================================================
--- development/source/cpu/cHardware4Stack.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/cpu/cHardware4Stack.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -25,6 +25,7 @@
 #include "cRandom.h"
 #include "cStringUtil.h"
 #include "cTestCPU.h"
+#include "cWorldDriver.h"
 
 #include <limits.h>
 
@@ -773,9 +774,6 @@
 // direction which the heads[nHardware::HEAD_IP] should progress through a creature.
 cHeadMultiMem cHardware4Stack::FindFullLabel(const cCodeLabel & in_label)
 {
-  // cout << "Running FindFullLabel with " << in_label.AsString() <<
-  // endl;
-  
   assert(in_label.GetSize() > 0); // Trying to find label of 0 size!
   
   cHeadMultiMem temp_head(this);
@@ -804,9 +802,6 @@
       continue;
     }
     
-    // cout << "Testing label at line " << temp_head.GetPosition() <<
-    // endl;
-    
     // ...and do the comparison...
     
     int j;
@@ -1124,7 +1119,7 @@
     case nMutation::TYPE_TEMP:
     case nMutation::TYPE_KILL:
     default:
-      cout << "Error: Mutation type not implemented!" << endl;
+      m_world->GetDriver().RaiseException("Mutation type not implemented!");
       break;
   };
 }

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/cpu/cHardwareCPU.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -26,6 +26,7 @@
 #include "cPhenotype.h"
 #include "cStringUtil.h"
 #include "cTestCPU.h"
+#include "cWorldDriver.h"
 
 #include <limits.h>
 #include <fstream>
@@ -882,9 +883,6 @@
 // direction which the heads[nHardware::HEAD_IP] should progress through a creature.
 cHeadCPU cHardwareCPU::FindFullLabel(const cCodeLabel & in_label)
 {
-  // cout << "Running FindFullLabel with " << in_label.AsString() <<
-  // endl;
-  
   assert(in_label.GetSize() > 0); // Trying to find label of 0 size!
   
   cHeadCPU temp_head(this);
@@ -913,9 +911,6 @@
       continue;
     }
     
-    // cout << "Testing label at line " << temp_head.GetPosition() <<
-    // endl;
-    
     // ...and do the comparison...
     
     int j;
@@ -1210,7 +1205,7 @@
     case nMutation::TYPE_TEMP:
     case nMutation::TYPE_KILL:
     default:
-      cout << "Error: Mutation type not implemented!" << endl;
+      m_world->GetDriver().RaiseException("Mutation type not implemented!");
       break;
   };
 }
@@ -1531,14 +1526,6 @@
       if (m_world->GetRandom().P(organism->GetSterilizePos())) sterilize = true;
     }
     
-    //     cout << "[ min(" << genome_size
-    // 	 << "," << copied_size
-    // 	 << "," << executed_size
-    // 	 << ") * " << phenotype.GetCurBonus()
-    // 	 << " / " << phenotype.GetTimeUsed()
-    // 	 << "] / " << phenotype.GetLastFitness()
-    // 	 << " == " << fitness_ratio;
-    
     if (sterilize == true) {
       //Don't let this organism have this or any more children!
       phenotype.IsFertile() = false;
@@ -3188,10 +3175,6 @@
   ReadLabel();
   organism->GetPhenotype().SetMateSelectID( GetLabel().AsInt(nHardwareCPU::NUM_NOPS) );
   
-  //   int mate_id = GetLabel().AsInt(nHardwareCPU::NUM_NOPS);
-  //   if (mate_id > 0) cout << mate_id << " "
-  // 			<< GetLabel().AsString() << endl;
-  
   // Proceed as normal with the rest of mate selection.
   organism->GetPhenotype().SetDivideSex(true);
   organism->GetPhenotype().SetCrossNum(1);

Modified: development/source/cpu/cHardwareManager.cc
===================================================================
--- development/source/cpu/cHardwareManager.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/cpu/cHardwareManager.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -16,6 +16,7 @@
 #include "cInstLibCPU.h"
 #include "cInstSet.h"
 #include "cWorld.h"
+#include "cWorldDriver.h"
 #include "tDictionary.h"
 
 cHardwareManager::cHardwareManager(cWorld* world) : m_world(world), m_inst_set(world), m_type(world->GetConfig().HARDWARE_TYPE.Get())
@@ -47,14 +48,13 @@
   
   if (filename == "") {
     filename = default_filename;
-    cerr << "Warning: No instruction set specified, using default '" << filename << "'." << endl;
+    m_world->GetDriver().NotifyWarning(cString("No instruction set specified, using default '") + filename + "'.");
   }
   
   cInitFile file(filename);
   
   if (file.IsOpen() == false) {
-    cerr << "Error: Could not open instruction set '" << filename << "'.  Exiting..." << endl;
-    exit(1);
+    m_world->GetDriver().RaiseFatalException(1, cString("Could not open instruction set '") + filename + "'.");
   }
   
   file.Load();
@@ -79,8 +79,9 @@
     // If this instruction has 0 redundancy, we don't want it!
     if (redundancy < 0) continue;
     if (redundancy > 256) {
-      cerr << "Warning: Max redundancy is 256.  Resetting redundancy of \""
-      << inst_name << "\" from " << redundancy << " to 256." << endl;
+      cString msg("Max redundancy is 256.  Resetting redundancy of \"");
+      msg += inst_name; msg += "\" from "; msg += redundancy; msg += " to 256.";
+      m_world->GetDriver().NotifyWarning(msg);
       redundancy = 256;
     }
     
@@ -100,11 +101,8 @@
     }
     
     // Oh oh!  Didn't find an instruction!
-    cerr << endl
-      << "Error: Could not find instruction '" << inst_name << "'" << endl
-      << "       (Best match = '"
-      << inst_dict.NearMatch(inst_name) << "').  Exiting..." << endl;
-    exit(1);
+    m_world->GetDriver().RaiseFatalException(1, cString("Could not find instruction '") + inst_name +
+                                             "'\n       (Best match = '" + inst_dict.NearMatch(inst_name) + "').");
   }
 }
 

Modified: development/source/cpu/cHardwareSMT.cc
===================================================================
--- development/source/cpu/cHardwareSMT.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/cpu/cHardwareSMT.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -24,6 +24,7 @@
 #include "cRandom.h"
 #include "cStringUtil.h"
 #include "cTestCPU.h"
+#include "cWorldDriver.h"
 
 #include <limits.h>
 
@@ -903,7 +904,7 @@
 		case nMutation::TYPE_TEMP:
 		case nMutation::TYPE_KILL:
 		default:
-			cout << "Error: Mutation type not implemented!" << endl;
+      m_world->GetDriver().RaiseException("Mutation type not implemented!");
 			break;
   };
 }
@@ -1748,8 +1749,6 @@
   read_head.Adjust();
   write_head.Adjust();
 	
-  // TriggerMutations(nMutation::TRIGGER_READ, read_head);
-  
   // Do mutations.
   cInstruction read_inst = read_head.GetInst();
   if (organism->TestCopyMut()) {
@@ -1766,8 +1765,6 @@
   write_head.SetInst(read_inst);
   write_head.FlagCopied() = true;  // Set the copied flag...
 	
-  // TriggerMutations(nMutation::TRIGGER_WRITE, write_head);
-	
   read_head.Advance();
   write_head.Advance();
   return true;

Added: development/source/drivers/CMakeLists.txt
===================================================================
--- development/source/drivers/CMakeLists.txt	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/CMakeLists.txt	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,11 @@
+INCLUDE_DIRECTORIES(${ALL_INC_DIRS})
+
+SET(libdrivers_a_SOURCES
+  cDefaultAnalyzeDriver.cc
+  cDefaultRunDriver.cc
+  cDriverManager.cc
+  cFallbackWorldDriver.cc
+)
+
+ADD_LIBRARY(drivers ${libdrivers_a_SOURCES})
+


Property changes on: development/source/drivers/CMakeLists.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cAvidaDriver.h
===================================================================
--- development/source/drivers/cAvidaDriver.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cAvidaDriver.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,29 @@
+/*
+ *  cAvidaDriver.h
+ *  Avida
+ *
+ *  Created by David on 12/10/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cAvidaDriver_h
+#define cAvidaDriver_h
+
+// This class is an abstract base class from which all driver classes
+// in Avida descend.  cAvidaDriver objects are friends with cWorld,
+// allowing them to register cWorldDriver's with an instance of cWorld.
+
+class cAvidaDriver
+{
+private:
+  cAvidaDriver(const cAvidaDriver&);  // not implemented
+
+public:
+  cAvidaDriver() { ; }
+  virtual ~cAvidaDriver() { ; }
+  
+  virtual void Run() = 0;
+};
+
+#endif


Property changes on: development/source/drivers/cAvidaDriver.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cDefaultAnalyzeDriver.cc
===================================================================
--- development/source/drivers/cDefaultAnalyzeDriver.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cDefaultAnalyzeDriver.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,64 @@
+/*
+ *  cDefaultAnalyzeDriver.cc
+ *  Avida
+ *
+ *  Created by David on 12/11/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cDefaultAnalyzeDriver.h"
+
+#include "cAnalyze.h"
+#include "cDriverManager.h"
+#include "cWorld.h"
+
+#include <stdlib.h>
+#include <iostream>
+
+using namespace std;
+
+
+cDefaultAnalyzeDriver::cDefaultAnalyzeDriver(cWorld* world, bool inter)
+  : m_world(world), m_interactive(inter)
+{
+  cDriverManager::Register(static_cast<cAvidaDriver*>(this));
+  world->SetDriver(this);
+}
+
+cDefaultAnalyzeDriver::~cDefaultAnalyzeDriver()
+{
+  cDriverManager::Unregister(static_cast<cAvidaDriver*>(this));
+  delete m_world;
+}
+
+
+void cDefaultAnalyzeDriver::Run()
+{
+  cout << "In analyze mode!!" << endl;
+  cAnalyze analyze(m_world);
+  if (m_interactive == true) {
+    analyze.RunInteractive();
+  }
+}
+
+void cDefaultAnalyzeDriver::RaiseException(const cString& in_string)
+{
+  cerr << "Error: " << in_string << endl;
+}
+
+void cDefaultAnalyzeDriver::RaiseFatalException(int exit_code, const cString& in_string)
+{
+  cerr << "Error: " << in_string << "  Exiting..." << endl;
+  exit(exit_code);
+}
+
+void cDefaultAnalyzeDriver::NotifyComment(const cString& in_string)
+{
+  cout << in_string << endl;
+}
+
+void cDefaultAnalyzeDriver::NotifyWarning(const cString& in_string)
+{
+  cout << "Warning: " << in_string << endl;
+}


Property changes on: development/source/drivers/cDefaultAnalyzeDriver.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cDefaultAnalyzeDriver.h
===================================================================
--- development/source/drivers/cDefaultAnalyzeDriver.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cDefaultAnalyzeDriver.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,50 @@
+/*
+ *  cDefaultAnalyzeDriver.h
+ *  Avida
+ *
+ *  Created by David on 12/11/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cDefaultAnalyzeDriver_h
+#define cDefaultAnalyzeDriver_h
+
+#ifndef cAvidaDriver_h
+#include "cAvidaDriver.h"
+#endif
+#ifndef cWorldDriver_h
+#include "cWorldDriver.h"
+#endif
+
+class cString;
+class cWorld;
+
+class cDefaultAnalyzeDriver : public cAvidaDriver, public cWorldDriver
+{
+private:
+  cDefaultAnalyzeDriver();  // not implemented
+  
+protected:
+  cWorld* m_world;
+  bool m_interactive;
+  
+public:
+  cDefaultAnalyzeDriver(cWorld* world, bool inter = false);
+  ~cDefaultAnalyzeDriver();
+  
+  void Run();
+  
+  // Driver Actions
+  void SignalBreakpoint() { return; }
+  void SetDone() { return; }
+  
+  void RaiseException(const cString& in_string);
+  void RaiseFatalException(int exit_code, const cString& in_string);
+  
+  // Notifications
+  void NotifyComment(const cString& in_string);
+  void NotifyWarning(const cString& in_string);
+};
+
+#endif


Property changes on: development/source/drivers/cDefaultAnalyzeDriver.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cDefaultRunDriver.cc
===================================================================
--- development/source/drivers/cDefaultRunDriver.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cDefaultRunDriver.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,138 @@
+/*
+ *  cDefaultRunDriver.cc
+ *  Avida
+ *
+ *  Created by David on 12/11/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cDefaultRunDriver.h"
+
+#include "cChangeList.h"
+#include "cClassificationManager.h"
+#include "cDriverManager.h"
+#include "cGenotype.h"
+#include "cHardwareBase.h"
+#include "cOrganism.h"
+#include "cPopulation.h"
+#include "cPopulationCell.h"
+#include "cStats.h"
+#include "cString.h"
+#include "cWorld.h"
+
+#include <stdlib.h>
+#include <iostream>
+#include <iomanip>
+
+using namespace std;
+
+
+cDefaultRunDriver::cDefaultRunDriver(cWorld* world) : m_world(world), m_done(false)
+{
+  cDriverManager::Register(static_cast<cAvidaDriver*>(this));
+  world->SetDriver(this);
+}
+
+cDefaultRunDriver::~cDefaultRunDriver()
+{
+  cDriverManager::Unregister(static_cast<cAvidaDriver*>(this));
+  delete m_world;
+}
+
+
+void cDefaultRunDriver::Run()
+{
+  cClassificationManager& classmgr = m_world->GetClassificationManager();
+  cPopulation& population = m_world->GetPopulation();
+  cStats& stats = m_world->GetStats();
+  
+  const int ave_time_slice = m_world->GetConfig().AVE_TIME_SLICE.Get();
+  const double point_mut_prob = m_world->GetConfig().POINT_MUT_PROB.Get();
+
+  while (!m_done) {
+    if (cChangeList* change_list = population.GetChangeList()) {
+      change_list->Reset();
+    }
+    
+    m_world->GetEvents();
+    if (m_done == true) break;
+    
+    // Increment the Update.
+    stats.IncCurrentUpdate();
+    
+    // Handle all data collection for previous update.
+    if (stats.GetUpdate() > 0) {
+      // Tell the stats object to do update calculations and printing.
+      stats.ProcessUpdate();
+      
+      // Update all the genotypes for the end of this update.
+      for (cGenotype * cur_genotype = classmgr.ResetThread(0);
+           cur_genotype != NULL && cur_genotype->GetThreshold();
+           cur_genotype = classmgr.NextGenotype(0)) {
+        cur_genotype->UpdateReset();
+      }
+    }
+    
+    
+    // Process the update.
+    const int UD_size = ave_time_slice * population.GetNumOrganisms();
+    const double step_size = 1.0 / (double) UD_size;
+    
+    for (int i = 0; i < UD_size; i++) {
+      if (population.GetNumOrganisms() == 0) {
+        m_done = true;
+        break;
+      }
+      population.ProcessStep(step_size);
+    }
+    
+
+    // end of update stats...
+    population.CalcUpdateStats();
+    
+    
+    // No viewer; print out status for this update....
+    cout.setf(ios::left);
+    cout.setf(ios::showpoint);
+    cout << "UD: " << setw(6) << stats.GetUpdate() << "  "
+      << "Gen: " << setw(9) << setprecision(7) << stats.SumGeneration().Average() << "  "
+      << "Fit: " << setw(9) << setprecision(7) << stats.GetAveFitness() << "  "
+      << "Size: " << population.GetNumOrganisms()
+      << endl;
+    
+    
+    // Do Point Mutations
+    if (point_mut_prob > 0 ) {
+      for (int i = 0; i < population.GetSize(); i++) {
+        if (population.GetCell(i).IsOccupied()) {
+          population.GetCell(i).GetOrganism()->GetHardware().PointMutate(point_mut_prob);
+        }
+      }
+    }
+    
+    // Exit conditons...
+    if (population.GetNumOrganisms() == 0) m_done = true;
+  }
+}
+
+void cDefaultRunDriver::RaiseException(const cString& in_string)
+{
+  cerr << "Error: " << in_string << endl;
+}
+
+void cDefaultRunDriver::RaiseFatalException(int exit_code, const cString& in_string)
+{
+  cerr << "Error: " << in_string << "  Exiting..." << endl;
+  exit(exit_code);
+}
+
+void cDefaultRunDriver::NotifyComment(const cString& in_string)
+{
+  cout << in_string << endl;
+}
+
+void cDefaultRunDriver::NotifyWarning(const cString& in_string)
+{
+  cout << "Warning: " << in_string << endl;
+}


Property changes on: development/source/drivers/cDefaultRunDriver.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cDefaultRunDriver.h
===================================================================
--- development/source/drivers/cDefaultRunDriver.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cDefaultRunDriver.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,50 @@
+/*
+ *  cDefaultRunDriver.h
+ *  Avida
+ *
+ *  Created by David on 12/11/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cDefaultRunDriver_h
+#define cDefaultRunDriver_h
+
+#ifndef cAvidaDriver_h
+#include "cAvidaDriver.h"
+#endif
+#ifndef cWorldDriver_h
+#include "cWorldDriver.h"
+#endif
+
+class cString;
+class cWorld;
+
+class cDefaultRunDriver : public cAvidaDriver, public cWorldDriver
+{
+private:
+  cDefaultRunDriver();  // not implemented
+
+protected:
+  cWorld* m_world;
+  bool m_done;  // This is set to true when run should finish.
+
+public:
+  cDefaultRunDriver(cWorld* world);
+  ~cDefaultRunDriver();
+  
+  void Run();
+  
+  // Driver Actions
+  void SignalBreakpoint() { return; }
+  void SetDone() { m_done = true; }
+  
+  void RaiseException(const cString& in_string);
+  void RaiseFatalException(int exit_code, const cString& in_string);
+  
+  // Notifications
+  void NotifyComment(const cString& in_string);
+  void NotifyWarning(const cString& in_string);
+};
+
+#endif


Property changes on: development/source/drivers/cDefaultRunDriver.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cDriverManager.cc
===================================================================
--- development/source/drivers/cDriverManager.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cDriverManager.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,48 @@
+/*
+ *  cDriverManager.cpp
+ *  Avida
+ *
+ *  Created by David on 12/11/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cDriverManager.h"
+
+#include "cAvidaDriver.h"
+#include "cWorldDriver.h"
+
+#include <stdlib.h>
+
+
+cDriverManager* cDriverManager::m_dm = NULL;
+
+cDriverManager::~cDriverManager()
+{
+  cAvidaDriver* adrv;
+  while (adrv = m_adrvs.Pop()) {
+    delete adrv;
+  }
+  
+  cWorldDriver* wdrv;
+  while (wdrv = m_wdrvs.Pop()) {
+    delete wdrv;
+  }
+}
+
+void cDriverManager::Initialize()
+{
+  if (m_dm == NULL)
+  {
+    m_dm = new cDriverManager();
+    if (atexit(cDriverManager::Destroy)) {
+      // Failed to register with atexit, this is bad, very bad.
+      exit(-1);
+    }
+  }
+}
+
+void cDriverManager::Destroy()
+{
+  delete m_dm;
+}


Property changes on: development/source/drivers/cDriverManager.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cDriverManager.h
===================================================================
--- development/source/drivers/cDriverManager.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cDriverManager.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,45 @@
+/*
+ *  cDriverManager.h
+ *  Avida
+ *
+ *  Created by David on 12/11/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cDriverManager_h
+#define cDriverManager_h
+
+#ifndef tList_h
+#include "tList.h"
+#endif
+
+class cAvidaDriver;
+class cWorldDriver;
+
+class cDriverManager
+{
+private:
+  static cDriverManager* m_dm;
+  
+  tList<cAvidaDriver> m_adrvs;
+  tList<cWorldDriver> m_wdrvs;
+  
+  cDriverManager() { ; }
+  ~cDriverManager();
+
+  // not implemented
+  cDriverManager(const cDriverManager&);
+
+public:
+  static void Initialize(); // initialize static driver manager.  This method is NOT thread-safe.
+  static void Destroy();    // destory the driver manager, and all registered drivers.  Registered with atexit(). 
+
+  static void Register(cAvidaDriver* drv) { if (m_dm) m_dm->m_adrvs.Push(drv); }
+  static void Register(cWorldDriver* drv) { if (m_dm) m_dm->m_wdrvs.Push(drv); }
+
+  static void Unregister(cAvidaDriver* drv) { if (m_dm) m_dm->m_adrvs.Remove(drv); }
+  static void Unregister(cWorldDriver* drv) { if (m_dm) m_dm->m_wdrvs.Remove(drv); }
+};
+
+#endif


Property changes on: development/source/drivers/cDriverManager.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cFallbackWorldDriver.cc
===================================================================
--- development/source/drivers/cFallbackWorldDriver.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cFallbackWorldDriver.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,39 @@
+/*
+ *  cFallbackWorldDriver.cc
+ *  Avida
+ *
+ *  Created by David on 12/10/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cFallbackWorldDriver.h"
+
+#include "cString.h"
+
+#include <stdlib.h>
+#include <iostream>
+
+using namespace std;
+
+
+void cFallbackWorldDriver::RaiseException(const cString& in_string)
+{
+  cerr << "Error: " << in_string << endl;
+}
+
+void cFallbackWorldDriver::RaiseFatalException(int exit_code, const cString& in_string)
+{
+  cerr << "Error: " << in_string << "  Exiting..." << endl;
+  exit(exit_code);
+}
+
+void cFallbackWorldDriver::NotifyComment(const cString& in_string)
+{
+  cout << in_string << endl;
+}
+
+void cFallbackWorldDriver::NotifyWarning(const cString& in_string)
+{
+  cout << "Warning: " << in_string << endl;
+}


Property changes on: development/source/drivers/cFallbackWorldDriver.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cFallbackWorldDriver.h
===================================================================
--- development/source/drivers/cFallbackWorldDriver.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cFallbackWorldDriver.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,38 @@
+/*
+ *  cFallbackWorldDriver.h
+ *  Avida
+ *
+ *  Created by David on 12/10/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cFallbackWorldDriver_h
+#define cFallbackWorldDriver_h
+
+#ifndef cDriverManager_h
+#include "cDriverManager.h"
+#endif
+#ifndef cWorldDriver_h
+#include "cWorldDriver.h"
+#endif
+
+class cFallbackWorldDriver : public cWorldDriver
+{
+public:
+  cFallbackWorldDriver() { cDriverManager::Register(this); }
+  ~cFallbackWorldDriver() { cDriverManager::Unregister(this); }
+  
+  // Driver Actions
+  void SignalBreakpoint() { return; }
+  void SetDone() { return; }
+  
+  void RaiseException(const cString& in_string);
+  void RaiseFatalException(int exit_code, const cString& in_string);
+  
+  // Notifications
+  void NotifyComment(const cString& in_string);
+  void NotifyWarning(const cString& in_string);
+};
+
+#endif


Property changes on: development/source/drivers/cFallbackWorldDriver.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: development/source/drivers/cWorldDriver.h
===================================================================
--- development/source/drivers/cWorldDriver.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/drivers/cWorldDriver.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -0,0 +1,39 @@
+/*
+ *  cWorldDriver.h
+ *  Avida
+ *
+ *  Created by David on 12/10/05.
+ *  Copyright 2005 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cWorldDriver_h
+#define cWorldDriver_h
+
+// This class is an abstract base class that is used by actions within
+// a cWorld to notify its driver of various states and conditions.
+
+class cString;
+
+class cWorldDriver
+{
+private:
+  cWorldDriver(const cWorldDriver&);  // not implemented
+
+public:
+  cWorldDriver() { ; }
+  virtual ~cWorldDriver() { ; }
+  
+  // Driver Actions
+  virtual void SignalBreakpoint() = 0;
+  virtual void SetDone() = 0;
+
+  virtual void RaiseException(const cString& in_string) = 0;
+  virtual void RaiseFatalException(int exit_code, const cString& in_string) = 0;
+  
+  // Notifications
+  virtual void NotifyComment(const cString& in_string) = 0;
+  virtual void NotifyWarning(const cString& in_string) = 0;
+};
+
+#endif


Property changes on: development/source/drivers/cWorldDriver.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: development/source/event/cEventManager.cc
===================================================================
--- development/source/event/cEventManager.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/event/cEventManager.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -12,7 +12,6 @@
 
 #include "cAnalyzeUtil.h"
 #include "avida.h"
-#include "cAvidaDriver_Base.h"
 #include "cClassificationManager.h"
 #include "cEnvironment.h"
 #include "cEvent.h"
@@ -32,6 +31,7 @@
 #include "cTestUtil.h"
 #include "cTools.h"
 #include "cWorld.h"
+#include "cWorldDriver.h"
 
 #include <ctype.h>           // for isdigit
 #include <iostream>
@@ -46,7 +46,7 @@
   
   void Configure(cWorld* world, const cString& in_args) { ; }
   void Process(){
-    cAvidaDriver_Base::main_driver->SetDone();
+    m_world->GetDriver().SetDone();
   }
 };
 
@@ -77,7 +77,7 @@
   ///// exit_if_generation_greater_than /////
   void Process(){
     if( m_world->GetStats().SumGeneration().Average() > max_generation ){
-      cAvidaDriver_Base::main_driver->SetDone();
+      m_world->GetDriver().SetDone();
     }
   }
 };
@@ -111,7 +111,7 @@
   ///// exit_if_update_greater_than /////
   void Process(){
     if( m_world->GetStats().GetUpdate() > max_update ){
-      cAvidaDriver_Base::main_driver->SetDone();
+      m_world->GetDriver().SetDone();
     }
   }
 };
@@ -145,7 +145,7 @@
   ///// exit_if_ave_lineage_label_smaller /////
   void Process(){
     if( m_world->GetStats().GetAveLineageLabel() < lineage_label_crit_value ){
-      cAvidaDriver_Base::main_driver->SetDone();
+      m_world->GetDriver().SetDone();
     }
   }
 };
@@ -179,7 +179,7 @@
   ///// exit_if_ave_lineage_label_larger /////
   void Process(){
     if( m_world->GetStats().GetAveLineageLabel() > lineage_label_crit_value ){
-      cAvidaDriver_Base::main_driver->SetDone();
+      m_world->GetDriver().SetDone();
     }
   }
 };
@@ -215,7 +215,7 @@
       mesg.Set("Echo : Update = %f\t AveGeneration = %f",
                m_world->GetStats().GetUpdate(), m_world->GetStats().SumGeneration().Average());
     }
-    cAvidaDriver_Base::main_driver->NotifyComment(mesg);
+    m_world->GetDriver().NotifyComment(mesg);
   }
 };
 
@@ -1737,7 +1737,7 @@
     if (start_cell < 0 ||
         end_cell > m_world->GetPopulation().GetSize() ||
         start_cell >= end_cell) {
-      cout << "Warning: inject_range has invalid range!";
+      m_world->GetDriver().NotifyWarning("inject_range has invalid range!");
     }
     else {
       cGenome genome =
@@ -1806,9 +1806,7 @@
     if (start_cell < 0 ||
         end_cell > m_world->GetPopulation().GetSize() ||
         start_cell >= end_cell) {
-      cout << "Warning: inject_sequence has invalid range!" << endl;
-      cout << "start=" << start_cell << "  end=" << end_cell
-        << "genome length=" << seq.GetSize() << endl;
+      m_world->GetDriver().NotifyWarning("inject_sequence has invalid range!");
     }
     else {
       cGenome genome(seq);
@@ -1931,7 +1929,7 @@
     if (start_cell < 0 ||
         end_cell > m_world->GetPopulation().GetSize() ||
         start_cell >= end_cell) {
-      cout << "Warning: inject_range has invalid range!";
+      m_world->GetDriver().NotifyWarning("inject_range has invalid range!");
     }
     else {
       cGenome genome_parasite =
@@ -2007,7 +2005,7 @@
     if (start_cell < 0 ||
         end_cell > m_world->GetPopulation().GetSize() ||
         start_cell >= end_cell) {
-      cout << "Warning: inject_range has invalid range!";
+      m_world->GetDriver().NotifyWarning("inject_range has invalid range!");
     }
     else {
       cGenome genome =

Modified: development/source/main/CMakeLists.txt
===================================================================
--- development/source/main/CMakeLists.txt	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/CMakeLists.txt	2005-12-11 21:15:51 UTC (rev 421)
@@ -3,9 +3,6 @@
 SET(libmain_a_SOURCES
   avida.cc
   cAvidaConfig.cc
-  cAvidaDriver_Analyze.cc
-  cAvidaDriver_Base.cc
-  cAvidaDriver_Population.cc
   cBirthChamber.cc
   cEnvironment.cc
   cFitnessMatrix.cc
@@ -42,7 +39,7 @@
 
 IF(AVD_PRIMITIVE)
   ADD_EXECUTABLE(primitive primitive.cc)
-  TARGET_LINK_LIBRARIES(primitive main classification cpu event analyze cpu main tools)
+  TARGET_LINK_LIBRARIES(primitive main classification cpu event analyze drivers analyze cpu main tools)
   LINK_DIRECTORIES(${ALL_LIB_DIRS})
   INSTALL_TARGETS(/work primitive)
 ENDIF(AVD_PRIMITIVE)

Modified: development/source/main/avida.cc
===================================================================
--- development/source/main/avida.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/avida.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -10,7 +10,6 @@
 
 #include "avida.h"
 
-#include "cAvidaDriver_Base.h"
 #include "cString.h"
 #include "defs.h"
 
@@ -18,12 +17,13 @@
 #include "revision.h"
 #endif
 
+#include <iostream>
 #include <signal.h>
 #include <stdio.h>
 
 using namespace std;
 
-cString AvidaVersion()
+cString getAvidaVersion()
 {
   cString version("Avida ");
   version += VERSION;
@@ -57,9 +57,21 @@
   return version;
 }
 
+void printVersionBanner()
+{
+  // output copyright message
+  cout << getAvidaVersion() << endl;
+  cout << "----------------------------------------------------------------------" << endl;
+  cout << "Copyright (C) 1999-2005 Michigan State University." << endl;
+  cout << "Copyright (C) 1993-2004 California Institute of Technology." << endl << endl;
+  
+  cout << "Avida comes with ABSOLUTELY NO WARRANTY." << endl;
+  cout << "This is free software, and you are welcome to redistribute it" << endl;
+  cout << "under certain conditions. See file COPYING for details." << endl << endl;
+}
+
 void ExitAvida(int exit_code)
 {
   signal(SIGINT, SIG_IGN);          // Ignore all future interupts.
-  delete cAvidaDriver_Base::main_driver;
   exit(exit_code);
 }

Modified: development/source/main/avida.h
===================================================================
--- development/source/main/avida.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/avida.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -13,7 +13,8 @@
 
 class cString;
 
-cString AvidaVersion();
+cString getAvidaVersion();
+void printVersionBanner();
 
 /**
  * This function properly shuts down the Avida program.

Deleted: development/source/main/cAvidaDriver_Analyze.cc
===================================================================
--- development/source/main/cAvidaDriver_Analyze.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cAvidaDriver_Analyze.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -1,27 +0,0 @@
-/*
- *  cAvidaDriver_Analyze.cc
- *  Avida
- *
- *  Created by David on 12/2/05.
- *  Copyright 2005 Michigan State University. All rights reserved.
- *  Copyright 1993-2003 California Institute of Technology.
- *
- */
-
-#include "cAvidaDriver_Analyze.h"
-
-#include "cAnalyze.h"
-
-#include <iostream>
-
-using namespace std;
-
-
-void cAvidaDriver_Analyze::Run()
-{
-  cout << "In analyze mode!!" << endl;
-  cAnalyze analyze(m_world);
-  if (m_interactive == true) {
-    analyze.RunInteractive();
-  }
-}

Deleted: development/source/main/cAvidaDriver_Analyze.h
===================================================================
--- development/source/main/cAvidaDriver_Analyze.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cAvidaDriver_Analyze.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -1,33 +0,0 @@
-/*
- *  cAvidaDriver_Analyze.h
- *  Avida
- *
- *  Created by David on 12/2/05.
- *  Copyright 2005 Michigan State University. All rights reserved.
- *  Copyright 1993-2003 California Institute of Technology.
- *
- */
-
-#ifndef cAvidaDriver_Analyze_h
-#define cAvidaDriver_Analyze_h
-
-#include <cstdlib>
-
-#ifndef cAvidaDriver_Base_h
-#include "cAvidaDriver_Base.h"
-#endif
-
-class cWorld;
-
-class cAvidaDriver_Analyze : public cAvidaDriver_Base {
-protected:
-  bool m_interactive;
-  cWorld* m_world;
-public:
-  cAvidaDriver_Analyze(cWorld* world, bool inter = false) : m_interactive(inter), m_world(world) { ; }
-  ~cAvidaDriver_Analyze() { delete m_world; }
-  
-  virtual void Run();
-};
-
-#endif

Deleted: development/source/main/cAvidaDriver_Base.cc
===================================================================
--- development/source/main/cAvidaDriver_Base.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cAvidaDriver_Base.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -1,50 +0,0 @@
-/*
- *  cAvidaDriver_Base.cc
- *  Avida
- *
- *  Created by David on 12/2/05.
- *  Copyright 2005 Michigan State University. All rights reserved.
- *  Copyright 1993-2003 California Institute of Technology.
- *
- */
-
-#include "cAvidaDriver_Base.h"
-
-#include "cString.h"
-
-#include <iostream>
-
-using namespace std;
-
-
-// Static variable definitions
-cAvidaDriver_Base * cAvidaDriver_Base::main_driver = NULL;
-
-
-cAvidaDriver_Base::cAvidaDriver_Base() : done_flag(false)
-{
-}
-
-cAvidaDriver_Base::~cAvidaDriver_Base()
-{
-}
-
-void cAvidaDriver_Base::ExitProgram(int exit_code)
-{
-  exit(exit_code);   // If nothing is setup, nothing needs to be shutdown.
-}
-
-void cAvidaDriver_Base::NotifyComment(const cString & in_string)
-{
-  cout << in_string << endl;  // Just output
-}
-
-void cAvidaDriver_Base::NotifyWarning(const cString & in_string)
-{
-  cerr << in_string << endl;  // Just output
-}
-
-void cAvidaDriver_Base::NotifyError(const cString & in_string)
-{
-  cerr << in_string << endl;  // Just output
-}

Deleted: development/source/main/cAvidaDriver_Base.h
===================================================================
--- development/source/main/cAvidaDriver_Base.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cAvidaDriver_Base.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -1,50 +0,0 @@
-/*
- *  cAvidaDriver_Base.h
- *  Avida
- *
- *  Created by David on 12/2/05.
- *  Copyright 2005 Michigan State University. All rights reserved.
- *  Copyright 1993-2003 California Institute of Technology.
- *
- */
-
-#ifndef cAvidaDriver_Base_h
-#define cAvidaDriver_Base_h
-
-/**
- *  cAvidaDriver_Base
- *
- *  This class is the base class for driving an avida run (be it in analyze
- *  mode or as a population).  It includes all of the functions that should
- *  be overloaded to make any viewer work.
- **/
-
-class cString;
-
-class cAvidaDriver_Base {
-protected:
-  bool done_flag;   // This is set to true when run should finish.
-
-public:
-  static cAvidaDriver_Base * main_driver;
-
-  cAvidaDriver_Base();
-  virtual ~cAvidaDriver_Base();
-
-  virtual void Run() = 0;  // Called when Driver should take over execution.
-  virtual void ExitProgram(int exit_code);  // Called on an interupt,
-
-  // There functions are ideally called by avida whenever a message needs to
-  // be sent to the user.
-  virtual void NotifyComment(const cString & in_string);
-  virtual void NotifyWarning(const cString & in_string);
-  virtual void NotifyError(const cString & in_string);
-
-  // Called when the driver should stop what its doing for the moment, to
-  // let the user see what just happened.
-  virtual void SignalBreakpoint() { ; }
-
-  void SetDone() { done_flag = true; }
-};
-
-#endif

Deleted: development/source/main/cAvidaDriver_Population.cc
===================================================================
--- development/source/main/cAvidaDriver_Population.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cAvidaDriver_Population.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -1,127 +0,0 @@
-/*
- *  cAvidaDriver_Popultion.cc
- *  Avida
- *
- *  Created by David on 12/2/05.
- *  Copyright 2005 Michigan State University. All rights reserved.
- *  Copyright 1993-2003 California Institute of Technology.
- *
- */
-
-#include "cAvidaDriver_Population.h"
-
-#include "cChangeList.h"
-#include "cPopulation.h"
-#include "cString.h"
-#include "cClassificationManager.h"
-#include "cGenotype.h"
-#include "cPopulationCell.h"
-#include "cOrganism.h"
-#include "cStats.h"
-#include "cHardwareBase.h"
-
-#include <iostream>
-#include <iomanip>
-
-using namespace std;
-
-
-void cAvidaDriver_Population::Run()
-{
-  assert( m_world != NULL );
-  
-  // Process until done...
-  while ( !ProcessUpdate() ) {} 
-}
-
-bool cAvidaDriver_Population::ProcessUpdate()
-{
-  if (cChangeList* change_list = m_world->GetPopulation().GetChangeList()) {
-    change_list->Reset();
-  }
-  
-  m_world->GetEvents();
-  if (done_flag == true) return true;
-  
-  // Increment the Update.
-  cStats& stats = m_world->GetStats();
-  stats.IncCurrentUpdate();
-  
-  cPopulation* population = &m_world->GetPopulation();
-  
-  // Handle all data collection for previous update.
-  if (stats.GetUpdate() > 0) {
-    // Tell the stats object to do update calculations and printing.
-    stats.ProcessUpdate();
-    
-    // Update all the genotypes for the end of this update.
-    cClassificationManager& classmgr = m_world->GetClassificationManager();
-    for (cGenotype * cur_genotype = classmgr.ResetThread(0);
-         cur_genotype != NULL && cur_genotype->GetThreshold();
-         cur_genotype = classmgr.NextGenotype(0)) {
-      cur_genotype->UpdateReset();
-    }
-  }
-  
-  ProcessOrganisms();
-  
-  // Do Point Mutations
-  if (m_world->GetConfig().POINT_MUT_PROB.Get() > 0 ) {
-    for (int i = 0; i < population->GetSize(); i++) {
-      if (population->GetCell(i).IsOccupied()) {
-        population->GetCell(i).GetOrganism()->GetHardware().PointMutate(m_world->GetConfig().POINT_MUT_PROB.Get());
-      }
-    }
-  }
-  
-  
-#ifdef DEBUG_CHECK_OK
-  // If we're in a debug mode, make sure the population is OK.
-  if (population->OK() == false) {
-    g_debug.Warning("Population::OK() is failing.");
-  }
-#endif
-  
-  // Exit conditons...
-  if (population->GetNumOrganisms() == 0) done_flag = true;
-  
-  return done_flag;
-}
-
-
-void cAvidaDriver_Population::NotifyUpdate()
-{
-  // Nothing here for now.  This method should be overloaded and only
-  // run if there is no proper viewer.
-}
-
-
-void cAvidaDriver_Population::ProcessOrganisms()
-{
-  cPopulation* population = &m_world->GetPopulation();
-  
-  // Process the update.
-  const int UD_size = m_world->GetConfig().AVE_TIME_SLICE.Get() * population->GetNumOrganisms();
-  const double step_size = 1.0 / (double) UD_size;
-  
-  for (int i = 0; i < UD_size; i++) {
-    if (population->GetNumOrganisms() == 0) {
-      done_flag = true;
-      break;
-    }
-    population->ProcessStep(step_size);
-  }
-  
-  // end of update stats...
-  population->CalcUpdateStats();
-  
-  // No viewer; print out status for this update....
-  cStats & stats = m_world->GetStats();
-  cout.setf(ios::left);
-  cout.setf(ios::showpoint);
-  cout << "UD: " << setw(6) << stats.GetUpdate() << "  "
-    << "Gen: " << setw(9) << setprecision(7) << stats.SumGeneration().Average() << "  "
-    << "Fit: " << setw(9) << setprecision(7) << stats.GetAveFitness() << "  "
-    << "Size: " << population->GetNumOrganisms()
-    << endl;
-}

Deleted: development/source/main/cAvidaDriver_Population.h
===================================================================
--- development/source/main/cAvidaDriver_Population.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cAvidaDriver_Population.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -1,48 +0,0 @@
-/*
- *  cAvidaDriver_Population.h
- *  Avida
- *
- *  Created by David on 12/2/05.
- *  Copyright 2005 Michigan State University. All rights reserved.
- *  Copyright 1993-2003 California Institute of Technology.
- *
- */
-
-#ifndef cAvidaDriver_Population_h
-#define cAvidaDriver_Population_h
-
-#ifndef cAvidaDriver_Base_h
-#include "cAvidaDriver_Base.h"
-#endif
-#ifndef cString_h
-#include "cString.h"
-#endif
-#ifndef cWorld_h
-#include "cWorld.h"
-#endif
-
-class cChangeList;
-
-class cAvidaDriver_Population : public cAvidaDriver_Base {
-protected:
-  cWorld* m_world;
-
-public:  
-  cWorld& GetWorld() { return *m_world; }
-
-  /**
-   * Processes one complete update.
-   *
-   * Returns true when finished.
-   **/
-  virtual bool ProcessUpdate();
-  virtual void ProcessOrganisms();
-			
-  cAvidaDriver_Population(cWorld* world, cChangeList* change_list = 0) : m_world(world) { ; }
-  virtual ~cAvidaDriver_Population() { delete m_world; }
-  
-  virtual void Run();
-  virtual void NotifyUpdate();
-};
-
-#endif

Modified: development/source/main/cPopulationInterface.h
===================================================================
--- development/source/main/cPopulationInterface.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cPopulationInterface.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -11,8 +11,12 @@
 #ifndef cPopulationInterface_h
 #define cPopulationInterface_h
 
+#ifndef cWorld_h
 #include "cWorld.h"
-#include "cAvidaDriver_Base.h"
+#endif
+#ifndef cWorldDriver_h
+#include "cWorldDriver.h"
+#endif
 
 class cHardwareBase;
 class cPopulation;
@@ -42,7 +46,7 @@
   cOrganism * GetNeighbor();
   int GetNumNeighbors();
   void Rotate(int direction=1);
-  void Breakpoint() { cAvidaDriver_Base::main_driver->SignalBreakpoint(); }
+  void Breakpoint() { m_world->GetDriver().SignalBreakpoint(); }
   double TestFitness();
   int GetInput();
   int GetInputAt(int & input_pointer);

Modified: development/source/main/cWorld.cc
===================================================================
--- development/source/main/cWorld.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cWorld.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -21,7 +21,9 @@
 #include "cStats.h"
 #include "cTestCPU.h"
 #include "cTools.h"
+#include "cFallbackWorldDriver.h"
 
+
 cWorld::~cWorld()
 {
   m_data_mgr->FlushAll();
@@ -35,10 +37,16 @@
   delete m_pop;
   delete m_stats;
   delete m_test_cpu;
+
+  // cleanup driver object, if needed
+  if (m_own_driver) delete m_driver;
 }
 
 void cWorld::Setup()
 {
+  m_own_driver = true;
+  m_driver = new cFallbackWorldDriver();
+  
   // Setup Random Number Generator
   const int rand_seed = m_conf->RANDOM_SEED.Get();
   cout << "Random Seed: " << rand_seed;
@@ -164,3 +172,13 @@
 {
   return m_env->GetResourceLib().GetSize();
 }
+
+void cWorld::SetDriver(cWorldDriver* driver, bool take_ownership)
+{
+  // cleanup current driver, if needed
+  if (m_own_driver) delete m_driver;
+  
+  // store new driver information
+  m_driver = driver;
+  m_own_driver = take_ownership;
+}

Modified: development/source/main/cWorld.h
===================================================================
--- development/source/main/cWorld.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/cWorld.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -20,6 +20,7 @@
 #include "cRandom.h"
 #endif
 
+class cAvidaDriver;
 class cClassificationManager;
 class cEnvironment;
 class cEventManager;
@@ -28,6 +29,7 @@
 class cPopulation;
 class cStats;
 class cTestCPU;
+class cWorldDriver;
 
 class cWorld
 {
@@ -42,20 +44,25 @@
   cPopulation* m_pop;
   cStats* m_stats;
   cTestCPU* m_test_cpu;
+  cWorldDriver* m_driver;
 
   cRandom m_rng;
   
-  bool m_test_on_div;
-  bool m_test_sterilize;
+  bool m_test_on_div;     // flag derived from a collection of configuration settings
+  bool m_test_sterilize;  // flag derived from a collection of configuration settings
+  
+  bool m_own_driver;      // specifies whether this world object should manage its driver object
 
+  // Internal Methods
   void Setup();
-
+  
 public:
   explicit cWorld() : m_conf(new cAvidaConfig()) { Setup(); }
   cWorld(cAvidaConfig* cfg) : m_conf(cfg) { Setup(); }
   ~cWorld();
   
   void SetConfig(cAvidaConfig* cfg) { delete m_conf; m_conf = cfg; }
+  void SetDriver(cWorldDriver* driver, bool take_ownership = false);
   
   // General Object Accessors
   cAvidaConfig& GetConfig() { return *m_conf; }
@@ -67,6 +74,7 @@
   cRandom& GetRandom() { return m_rng; }
   cStats& GetStats() { return *m_stats; }
   cTestCPU& GetTestCPU() { return *m_test_cpu; }
+  cWorldDriver& GetDriver() { return *m_driver; }
   
   // Access to Data File Manager
   std::ofstream& GetDataFileOFStream(const cString& fname) { return m_data_mgr->GetOFStream(fname); }

Modified: development/source/main/primitive.cc
===================================================================
--- development/source/main/primitive.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/main/primitive.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -10,8 +10,9 @@
 
 #include "avida.h"
 #include "cAvidaConfig.h"
-#include "cAvidaDriver_Analyze.h"
-#include "cAvidaDriver_Population.h"
+#include "cDefaultAnalyzeDriver.h"
+#include "cDefaultRunDriver.h"
+#include "cDriverManager.h"
 #include "cWorld.h"
 
 using namespace std;
@@ -21,28 +22,23 @@
   // Catch Interrupt making sure to close appropriately
   signal(SIGINT, ExitAvida);
 
-  // output copyright message
-  cout << AvidaVersion() << endl;
-  cout << "----------------------------------------------------------------------" << endl;
-  cout << "Copyright (C) 1999-2005 Michigan State University." << endl;
-  cout << "Copyright (C) 1993-2003 California Institute of Technology." << endl << endl;
+  printVersionBanner();
   
-  cout << "Avida comes with ABSOLUTELY NO WARRANTY." << endl;
-  cout << "This is free software, and you are welcome to redistribute it" << endl;
-  cout << "under certain conditions. See file COPYING for details." << endl << endl;
+  cDriverManager::Initialize();
   
   // Initialize the configuration data...
   cWorld* world = new cWorld(cAvidaConfig::LoadWithCmdLineArgs(argc, argv));
-  
+  cAvidaDriver* driver = NULL;
+
   if (world->GetConfig().ANALYZE_MODE.Get() > 0) {
-    cAvidaDriver_Base::main_driver = new cAvidaDriver_Analyze(world, (world->GetConfig().ANALYZE_MODE.Get() == 2));
+    driver = new cDefaultAnalyzeDriver(world, (world->GetConfig().ANALYZE_MODE.Get() == 2));
   } else {
-    cAvidaDriver_Base::main_driver = new cAvidaDriver_Population(world);
+    driver = new cDefaultRunDriver(world);
   }
 
   cout << endl;
   
-  cAvidaDriver_Base::main_driver->Run();
+  driver->Run();
 
   // Exit Nicely
   ExitAvida(0);

Modified: development/source/tools/cDataFile.cc
===================================================================
--- development/source/tools/cDataFile.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/tools/cDataFile.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -35,9 +35,9 @@
 {
   Init();
    
-  if( fopen(name,"r") ){
+  //if (fopen(name,"r")) {
     // cout << "File " << name() << " exists and is being overwritten" << endl;
-  }
+  //}
   m_fp.open(name);
   assert(m_fp.good());
   m_descr_written = false;

Modified: development/source/tools/cIntegratedScheduleNode.cc
===================================================================
--- development/source/tools/cIntegratedScheduleNode.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/tools/cIntegratedScheduleNode.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -166,8 +166,5 @@
     if (process_count >= process_size) execute = false;
   }
 
-//  cout << "Running " << active_entry << " from node " << node_id
-//       << " (size = " << size << ", first = " << first_entry << ")" << endl;
-
   return active_entry;
 }

Modified: development/source/tools/cMerit.cc
===================================================================
--- development/source/tools/cMerit.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/tools/cMerit.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -24,11 +24,9 @@
 
   // Initilize multipliers only once
   if( mult_initilalized == false ){
-    //cout<<"initializing multipliers"<<endl;
     mult_initilalized = true;
     for( int i=0; i<max_bits; ++i ){
       mult[i] = pow((double)2,i);
-      //cout<<"  mult["<<i<<"] = "<<mult[i]<<endl;
     }
   }
 
@@ -36,8 +34,6 @@
 
   double mant = frexp (value , &bits);
 
-  //cout<<value<<" = "<<mant<<" * 2 ^ "<<bits<<endl;
-
   if( bits > max_bits ){
     offset = bits - max_bits;
   }else{
@@ -45,9 +41,6 @@
   }
 
   base = (unsigned int) (mant * mult[bits-offset-1] * 2 );
-
-  //cout<<value<<" = "<<base<<" ["<<bits<<" bits] "<<" * 2 ^ "<<offset;
-  //cout<<" = "<<(base * pow((double)2,offset))<<endl;
 }
 
 

Modified: development/source/tools/cRefBlock.h
===================================================================
--- development/source/tools/cRefBlock.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/tools/cRefBlock.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -21,7 +21,7 @@
   int size;
   cFixedCoords start_coords;
 public:
-  cRefBlock(int in_ref = 0, int in_size = 0) ref_num(in_ref), size(in_size) { ; }
+  cRefBlock(int in_ref = 0, int in_size = 0) : ref_num(in_ref), size(in_size) { ; }
   ~cRefBlock() { ; }
 
   inline int GetRef() const { return ref_num; }

Modified: development/source/tools/cWeightedIndex.cc
===================================================================
--- development/source/tools/cWeightedIndex.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/tools/cWeightedIndex.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -67,13 +67,6 @@
 
 int cWeightedIndex::FindPosition(double position, int root_id)
 {
-//   cout << "Seeking " << position
-//        << " at root " << root_id 
-//        << " subtree size = " << subtree_weight[root_id]
-//        << " (left=" << subtree_weight[GetLeftChild(root_id)]
-//        << " , right=" << subtree_weight[GetRightChild(root_id)]
-//        << " , this=" << item_weight[root_id] << ")"
-//        << endl;
   assert(position < subtree_weight[root_id]);
 
   // First, see if we should just return this node.

Modified: development/source/tools/functions.h
===================================================================
--- development/source/tools/functions.h	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/tools/functions.h	2005-12-11 21:15:51 UTC (rev 421)
@@ -36,12 +36,9 @@
 
   inline void Swap(int & in1, int & in2)
   {
-// cout << "Swapping " << in1 << " with " << in2 << endl;
     const int tmp = in1;
     in1 = in2;
     in2 = tmp;
-// cout << "Outputing " << in1 << "  " << " and " << in2 << endl;
-
   }
   
   inline void Swap(double & in1, double & in2)

Modified: development/source/viewer/viewer.cc
===================================================================
--- development/source/viewer/viewer.cc	2005-12-10 04:11:50 UTC (rev 420)
+++ development/source/viewer/viewer.cc	2005-12-11 21:15:51 UTC (rev 421)
@@ -21,16 +21,8 @@
   // Catch Interrupt making sure to close appropriately
   signal(SIGINT, ExitAvida);
 
-  // output copyright message
-  cout << AvidaVersion() << endl;
-  cout << "----------------------------------------------------------------------" << endl;
-  cout << "Copyright (C) 1999-2005 Michigan State University." << endl;
-  cout << "Copyright (C) 1993-2003 California Institute of Technology." << endl << endl;
+  printVersionBanner();
   
-  cout << "Avida comes with ABSOLUTELY NO WARRANTY." << endl;
-  cout << "This is free software, and you are welcome to redistribute it" << endl;
-  cout << "under certain conditions. See file COPYING for details." << endl << endl;
-  
   // Initialize the configuration data...
   cWorld* world = new cWorld(cAvidaConfig::LoadWithCmdLineArgs(argc, argv));
   




More information about the Avida-cvs mailing list