[Avida-cvs] [avida-svn] r694 - in development: Avida.xcodeproj source/actions source/analyze source/drivers source/event source/main

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Sat May 20 08:18:07 PDT 2006


Author: brysonda
Date: 2006-05-20 11:18:07 -0400 (Sat, 20 May 2006)
New Revision: 694

Added:
   development/source/actions/SaveLoadActions.cc
   development/source/actions/SaveLoadActions.h
   development/source/actions/cActionLibrary.cc
Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/actions/CMakeLists.txt
   development/source/actions/PrintActions.cc
   development/source/actions/cActionLibrary.h
   development/source/analyze/cAnalyzeUtil.cc
   development/source/analyze/cAnalyzeUtil.h
   development/source/drivers/cDriverManager.cc
   development/source/drivers/cDriverManager.h
   development/source/event/cEventManager.cc
   development/source/main/cInstSet.h
   development/source/main/cWorld.cc
Log:
Move a number of additional print items into PrintActions. Merge some of the cAnalyzeUtil backing code with their respective actions.

Update various print action file outputs to make use of cDataFile object rather than raw ostream.

Update various histogram actions to use tArray<int> objects, rather than allocated int arrays (that weren't being deleted BTW, thus we should no longer be leaking memory).

Move construction of cActionLibrary into a static class method.  Instantiation of cActionLibrary moved into cDriverManager so that multiple worlds can make use of one cActionLibrary. 

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2006-05-19 20:09:24 UTC (rev 693)
+++ development/Avida.xcodeproj/project.pbxproj	2006-05-20 15:18:07 UTC (rev 694)
@@ -102,6 +102,10 @@
 		707AF0B209EAC7FD001AEA89 /* LandscapeActions.cc in Sources */ = {isa = PBXBuildFile; fileRef = 707AF04509EAB529001AEA89 /* LandscapeActions.cc */; };
 		707AF0B309EAC801001AEA89 /* LandscapeActions.cc in Sources */ = {isa = PBXBuildFile; fileRef = 707AF04509EAB529001AEA89 /* LandscapeActions.cc */; };
 		707AF0B409EAC805001AEA89 /* LandscapeActions.cc in Sources */ = {isa = PBXBuildFile; fileRef = 707AF04509EAB529001AEA89 /* LandscapeActions.cc */; };
+		708051B20A1F663100CBB8B6 /* SaveLoadActions.cc in Sources */ = {isa = PBXBuildFile; fileRef = 708051A80A1F65FE00CBB8B6 /* SaveLoadActions.cc */; };
+		708051BB0A1F66B400CBB8B6 /* cActionLibrary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 708051BA0A1F66B400CBB8B6 /* cActionLibrary.cc */; };
+		708051BC0A1F66B400CBB8B6 /* cActionLibrary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 708051BA0A1F66B400CBB8B6 /* cActionLibrary.cc */; };
+		708051BD0A1F66B400CBB8B6 /* cActionLibrary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 708051BA0A1F66B400CBB8B6 /* cActionLibrary.cc */; };
 		709A09D409F3D3B400F9A4BF /* organism.smtx in CopyFiles */ = {isa = PBXBuildFile; fileRef = 707AF2F909EE8501001AEA89 /* organism.smtx */; };
 		70AA941A09D486CA006A24C8 /* system-alloc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70DCF50209CFB0B400924128 /* system-alloc.cc */; };
 		70AA941B09D486CB006A24C8 /* tcmalloc-logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70DCF57F09CFBD3D00924128 /* tcmalloc-logging.cc */; };
@@ -629,6 +633,9 @@
 		707AF2FD09EE8501001AEA89 /* organism.4stack */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = organism.4stack; sourceTree = "<group>"; };
 		707AF2FE09EE8501001AEA89 /* organism.parasite */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = organism.parasite; sourceTree = "<group>"; };
 		707AF2FF09EE8501001AEA89 /* SConscript */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SConscript; sourceTree = "<group>"; };
+		708051A70A1F65FE00CBB8B6 /* SaveLoadActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SaveLoadActions.h; sourceTree = "<group>"; };
+		708051A80A1F65FE00CBB8B6 /* SaveLoadActions.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SaveLoadActions.cc; sourceTree = "<group>"; };
+		708051BA0A1F66B400CBB8B6 /* cActionLibrary.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cActionLibrary.cc; sourceTree = "<group>"; };
 		7093DB4009D6F50300DE7FEB /* tSmartArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tSmartArray.h; sourceTree = "<group>"; };
 		70AA941909D486AE006A24C8 /* libtcmalloc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtcmalloc.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		70B0864808F4972600FC65FE /* cLandscape.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cLandscape.h; sourceTree = "<group>"; };
@@ -1054,6 +1061,9 @@
 				707AF04509EAB529001AEA89 /* LandscapeActions.cc */,
 				705ACD4C0A13FED4002D5BA0 /* PrintActions.h */,
 				705ACD4D0A13FED4002D5BA0 /* PrintActions.cc */,
+				708051A70A1F65FE00CBB8B6 /* SaveLoadActions.h */,
+				708051A80A1F65FE00CBB8B6 /* SaveLoadActions.cc */,
+				708051BA0A1F66B400CBB8B6 /* cActionLibrary.cc */,
 			);
 			path = actions;
 			sourceTree = "<group>";
@@ -2050,6 +2060,7 @@
 				7005A70609BA0FA90007E16E /* cTestCPUInterface.cc in Sources */,
 				707AF0B409EAC805001AEA89 /* LandscapeActions.cc in Sources */,
 				705ACD630A1403A5002D5BA0 /* PrintActions.cc in Sources */,
+				708051BD0A1F66B400CBB8B6 /* cActionLibrary.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2179,6 +2190,7 @@
 				7005A70409BA0FA90007E16E /* cTestCPUInterface.cc in Sources */,
 				707AF0B309EAC801001AEA89 /* LandscapeActions.cc in Sources */,
 				705ACD640A1403AA002D5BA0 /* PrintActions.cc in Sources */,
+				708051BC0A1F66B400CBB8B6 /* cActionLibrary.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2292,6 +2304,8 @@
 				7005A83209BA621F0007E16E /* cOrgMessage.cc in Sources */,
 				707AF0B209EAC7FD001AEA89 /* LandscapeActions.cc in Sources */,
 				705ACD4F0A13FED5002D5BA0 /* PrintActions.cc in Sources */,
+				708051B20A1F663100CBB8B6 /* SaveLoadActions.cc in Sources */,
+				708051BB0A1F66B400CBB8B6 /* cActionLibrary.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: development/source/actions/CMakeLists.txt
===================================================================
--- development/source/actions/CMakeLists.txt	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/actions/CMakeLists.txt	2006-05-20 15:18:07 UTC (rev 694)
@@ -1,8 +1,10 @@
 INCLUDE_DIRECTORIES(${ALL_INC_DIRS})
 
 SET(libactions_a_SOURCES
+  cActionLibrary.cc
   LandscapeActions.cc
   PrintActions.cc
+  SaveLoadActions.cc
 )
 
 ADD_LIBRARY(actions ${libactions_a_SOURCES})

Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/actions/PrintActions.cc	2006-05-20 15:18:07 UTC (rev 694)
@@ -12,8 +12,20 @@
 #include "cAction.h"
 #include "cActionLibrary.h"
 #include "cAnalyzeUtil.h"
+#include "cClassificationManager.h"
+#include "cGenotype.h"
+#include "cHardwareBase.h"
+#include "cHardwareManager.h"
+#include "cInjectGenotype.h"
+#include "cInstSet.h"
+#include "cOrganism.h"
+#include "cPopulation.h"
+#include "cPopulationCell.h"
+#include "cSpecies.h"
 #include "cStats.h"
+#include "cTestUtil.h"
 #include "cWorld.h"
+#include "cWorldDriver.h"
 
 
 #define STATS_OUT_FILE(METHOD, DEFAULT)                                                   /*  1 */ \
@@ -49,7 +61,24 @@
 STATS_OUT_FILE(PrintInstructionData,   instruction.dat     );
 STATS_OUT_FILE(PrintGenotypeMap,       genotype_map.m      );
 
+#define POP_OUT_FILE(METHOD, DEFAULT)                                                     /*  1 */ \
+class cAction ## METHOD : public cAction {                                                /*  2 */ \
+private:                                                                                  /*  3 */ \
+  cString m_filename;                                                                     /*  4 */ \
+public:                                                                                   /*  5 */ \
+  cAction ## METHOD(cWorld* world, const cString& args) : cAction(world, args)            /*  6 */ \
+  {                                                                                       /*  7 */ \
+    cString largs(args);                                                                  /*  8 */ \
+    if (largs == "") m_filename = #DEFAULT; else m_filename = largs.PopWord();            /*  9 */ \
+  }                                                                                       /* 10 */ \
+  const cString GetDescription() { return #METHOD " [cString fname=\"" #DEFAULT "\"]"; }  /* 11 */ \
+  void Process(cAvidaContext& ctx) { m_world->GetPopulation().METHOD(m_filename); }       /* 12 */ \
+}                                                                                         /* 13 */ \
 
+POP_OUT_FILE(PrintPhenotypeData,       phenotype_count.dat );
+POP_OUT_FILE(PrintPhenotypeStatus,     phenotype_status.dat);
+
+
 class cActionPrintData : public cAction
 {
 private:
@@ -76,6 +105,7 @@
 {
 private:
   cString m_filename;
+  
 public:
   cActionPrintInstructionAbundanceHistogram(cWorld* world, const cString& args) : cAction(world, args)
   {
@@ -87,7 +117,31 @@
   
   void Process(cAvidaContext& ctx)
   {
-    cAnalyzeUtil::PrintInstructionAbundanceHistogram(m_world, m_world->GetDataFileOFStream(m_filename));
+    cPopulation& population = m_world->GetPopulation();
+    
+    // ----- number of instructions available?
+    const int num_inst = m_world->GetNumInstructions();
+    tArray<int> inst_counts(num_inst);
+    inst_counts.SetAll(0);
+
+    //looping through all CPUs counting up instructions
+    const int num_cells = population.GetSize();
+    for (int x = 0; x < num_cells; x++) {
+      cPopulationCell& cell = population.GetCell(x);
+      if (cell.IsOccupied()) {
+        // access this CPU's code block
+        cCPUMemory& cpu_mem = cell.GetOrganism()->GetHardware().GetMemory();
+        const int mem_size = cpu_mem.GetSize();
+        for (int y = 0; y < mem_size; y++) inst_counts[cpu_mem[y].GetOp()]++;     
+      }
+    }
+    
+    // ----- output instruction counts
+    cInstSet& inst_set = m_world->GetHardwareManager().GetInstSet();
+    cDataFile& df = m_world->GetDataFile(m_filename);
+    df.Write(m_world->GetStats().GetUpdate(), "Update");
+    for (int i = 0; i < num_inst; i++) df.Write(inst_counts[i], inst_set.GetName(i));
+    df.Endl();
   }
 };
 
@@ -107,13 +161,286 @@
   
   void Process(cAvidaContext& ctx)
   {
-    cAnalyzeUtil::PrintDepthHistogram(m_world, m_world->GetDataFileOFStream(m_filename));
+    // Output format:    update  min  max  histogram_values...
+    int min = INT_MAX;
+    int max = 0;
+    
+    // Two pass method
+    
+    // Loop through all genotypes getting min and max values
+    cClassificationManager& classmgr = m_world->GetClassificationManager();
+    cGenotype* cur_genotype = classmgr.GetBestGenotype();
+    for (int i = 0; i < classmgr.GetGenotypeCount(); i++) {
+      if (cur_genotype->GetDepth() < min) min = cur_genotype->GetDepth();
+      if (cur_genotype->GetDepth() > max) max = cur_genotype->GetDepth();
+      cur_genotype = cur_genotype->GetNext();
+    }
+    assert(max >= min);
+    
+    // Allocate the array for the bins (& zero)
+    tArray<int> n(max - min + 1);
+    n.SetAll(0);
+    
+    // Loop through all genotypes binning the values
+    cur_genotype = classmgr.GetBestGenotype();
+    for (int i = 0; i < classmgr.GetGenotypeCount(); i++) {
+      n[cur_genotype->GetDepth() - min] += cur_genotype->GetNumOrganisms();
+      cur_genotype = cur_genotype->GetNext();
+    }
+    
+    cDataFile& df = m_world->GetDataFile(m_filename);
+    df.Write(m_world->GetStats().GetUpdate(), "Update");
+    df.Write(min, "Minimum");
+    df.Write(max, "Maximum");
+    for (int i = 0; i < n.GetSize(); i++)  df.Write(n[i], "");
+    df.Endl();
   }
 };
 
 
+class cActionEcho : public cAction
+{
+private:
+  cString m_filename;
+public:
+  cActionEcho(cWorld* world, const cString& args) : cAction(world, args) { ; }
+  
+  const cString GetDescription() { return "Echo <cString message>"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    if (m_args == "") {
+      m_args.Set("Echo : Update = %f\t AveGeneration = %f", m_world->GetStats().GetUpdate(),
+                 m_world->GetStats().SumGeneration().Average());
+    }
+    m_world->GetDriver().NotifyComment(m_args);
+  }
+};
+
+
+class cActionPrintGenotypeAbundanceHistogram : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionPrintGenotypeAbundanceHistogram(cWorld* world, const cString& args) : cAction(world, args)
+  {
+    cString largs(args);
+    if (largs == "") m_filename = "genotype_abundance_histogram.dat"; else m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "PrintGenotypeAbundanceHistogram [cString fname=\"genotype_abundance_histogram.dat\"]"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    // Allocate array for the histogram & zero it
+    tArray<int> hist(m_world->GetClassificationManager().GetBestGenotype()->GetNumOrganisms());
+    hist.SetAll(0);
+    
+    // Loop through all genotypes binning the values
+    cGenotype* cur_genotype = m_world->GetClassificationManager().GetBestGenotype();
+    for (int i = 0; i < m_world->GetClassificationManager().GetGenotypeCount(); i++) {
+      assert( cur_genotype->GetNumOrganisms() - 1 >= 0 );
+      assert( cur_genotype->GetNumOrganisms() - 1 < hist.GetSize() );
+      hist[cur_genotype->GetNumOrganisms() - 1]++;
+      cur_genotype = cur_genotype->GetNext();
+    }
+    
+    cDataFile& df = m_world->GetDataFile(m_filename);
+    df.Write(m_world->GetStats().GetUpdate(), "Update");
+    for (int i = 0; i < hist.GetSize(); i++) df.Write(hist[i],"");
+    df.Endl();
+  }
+};
+
+
+class cActionPrintSpeciesAbundanceHistogram : public cAction
+{
+private:
+  cString m_filename;
+public:
+  cActionPrintSpeciesAbundanceHistogram(cWorld* world, const cString& args) : cAction(world, args)
+  {
+    cString largs(args);
+    if (largs == "") m_filename = "species_abundance_histogram.dat"; else m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "PrintSpeciesAbundanceHistogram [cString fname=\"species_abundance_histogram.dat\"]"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    int max = 0;
+    
+    // Find max species abundance...
+    cClassificationManager& classmgr = m_world->GetClassificationManager();
+    cSpecies* cur_species = classmgr.GetFirstSpecies();
+    for (int i = 0; i < classmgr.GetNumSpecies(); i++) {
+      if (max < cur_species->GetNumOrganisms()) {
+        max = cur_species->GetNumOrganisms();
+      }
+      cur_species = cur_species->GetNext();
+    }
+    
+    // Allocate array for the histogram & zero it
+    tArray<int> hist(max);
+    hist.SetAll(0);
+    
+    // Loop through all species binning the values
+    cur_species = classmgr.GetFirstSpecies();
+    for (int i = 0; i < classmgr.GetNumSpecies(); i++) {
+      assert( cur_species->GetNumOrganisms() - 1 >= 0 );
+      assert( cur_species->GetNumOrganisms() - 1 < hist.GetSize() );
+      hist[cur_species->GetNumOrganisms() - 1]++;
+      cur_species = cur_species->GetNext();
+    }
+    
+    // Actual output
+    cDataFile& df = m_world->GetDataFile(m_filename);
+    df.Write(m_world->GetStats().GetUpdate(), "Update");
+    for (int i = 0; i < hist.GetSize(); i++) df.Write(hist[i], "");
+    df.Endl();
+  }
+};
+
+class cActionPrintLineageTotals : public cAction
+{
+private:
+  cString m_filename;
+  int m_verbose;
+public:
+  cActionPrintLineageTotals(cWorld* world, const cString& args) : cAction(world, args), m_verbose(1)
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord(); else m_filename = "lineage_totals.dat";
+    if (largs.GetSize()) m_verbose = largs.PopWord().AsInt();
+  }
+  
+  const cString GetDescription() { return "PrintLineageTotals [cString fname='lineage_totals.dat'] [int verbose=1]"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    if (!m_world->GetConfig().LOG_LINEAGES.Get()) {
+      m_world->GetDataFileOFStream(m_filename) << "No lineage data available!" << endl;
+      return;
+    }
+    m_world->GetClassificationManager().PrintLineageTotals(m_filename, m_verbose);
+  }
+};
+
+class cActionPrintLineageCounts : public cAction
+{
+private:
+  cString m_filename;
+  int m_verbose;
+public:
+  cActionPrintLineageCounts(cWorld* world, const cString& args) : cAction(world, args), m_verbose(1)
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord(); else m_filename = "lineage_counts.dat";
+    if (largs.GetSize()) m_verbose = largs.PopWord().AsInt();
+  }
+  
+  const cString GetDescription() { return "PrintLineageCounts [cString fname='lineage_counts.dat'] [int verbose=1]"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    if (!m_world->GetConfig().LOG_LINEAGES.Get()) {
+      m_world->GetDataFileOFStream(m_filename) << "No lineage data available!" << endl;
+      return;
+    }
+    if (m_verbose) {    // verbose mode is the same in both methods
+      m_world->GetClassificationManager().PrintLineageTotals(m_filename, m_verbose);
+      return;
+    }
+    m_world->GetClassificationManager().PrintLineageCurCounts(m_filename);
+  }
+};
+
+
+/*
+ Write the currently dominant genotype to disk.
+
+ Parameters:
+   filename (string)
+     The name under which the genotype should be saved. If no
+     filename is given, the genotype is saved into the directory
+     archive, under the name that the archive has associated with
+     this genotype.
+*/
+class cActionPrintDominantGenotype : public cAction
+{
+private:
+  cString m_filename;
+
+public:
+  cActionPrintDominantGenotype(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "PrintDominantGenotype [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cGenotype* dom = m_world->GetClassificationManager().GetBestGenotype();
+    cString filename(m_filename);
+    if (filename == "") filename.Set("archive/%s", static_cast<const char*>(dom->GetName()));
+    cTestUtil::PrintGenome(m_world, dom->GetGenome(), filename, dom, m_world->GetStats().GetUpdate());
+  }
+};
+
+/*
+ Write the currently dominant injected genotype to disk.
+ 
+ Parameters:
+   filename (string)
+     The name under which the genotype should be saved. If no
+     filename is given, the genotype is saved into the directory
+     archive, under the name that the archive has associated with
+     this genotype.
+*/
+class cActionPrintDominantParasiteGenotype : public cAction
+{
+private:
+  cString m_filename;
+
+public:
+  cActionPrintDominantParasiteGenotype(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "PrintDominantParasiteGenotype [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cInjectGenotype* dom = m_world->GetClassificationManager().GetBestInjectGenotype();
+    cString filename(m_filename);
+    if (filename == "") filename.Set("archive/%s", static_cast<const char*>(dom->GetName()));
+    cTestUtil::PrintGenome(m_world, dom, dom->GetGenome(), filename, m_world->GetStats().GetUpdate());
+  }
+};
+
+// This is a generic place for Developers to hook into an action for printing out debug information
+class cActionPrintDebug : public cAction
+{
+public:
+  cActionPrintDebug(cWorld* world, const cString& args) : cAction(world, args) { ; }
+  const cString GetDescription() { return "PrintDebug"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    m_world->GetPopulation().ParasiteDebug();
+  }
+};
+
+
 void RegisterPrintActions(cActionLibrary* action_lib)
 {
+  // Stats Out Files
   action_lib->Register<cActionPrintAverageData>("PrintAverageData");
   action_lib->Register<cActionPrintErrorData>("PrintErrorData");
   action_lib->Register<cActionPrintVarianceData>("PrintVarianceData");
@@ -133,20 +460,22 @@
   action_lib->Register<cActionPrintInstructionData>("PrintInstructionData");
   action_lib->Register<cActionPrintGenotypeMap>("PrintGenotypeMap");
   
+  // Population Out Files
+  action_lib->Register<cActionPrintPhenotypeData>("PrintPhenotypeData");
+  action_lib->Register<cActionPrintPhenotypeStatus>("PrintPhenotypeStatus");
+  
+  // Processed Data
   action_lib->Register<cActionPrintData>("PrintData");
   action_lib->Register<cActionPrintInstructionAbundanceHistogram>("PrintInstructionAbundanceHistogram");
   action_lib->Register<cActionPrintDepthHistogram>("PrintDepthHistogram");
-  // @DMB - TODO
-//  action_lib->Register<cActionEcho>("Echo");
-//  action_lib->Register<cActionPrintGenotypeAbundanceHistogram>("PrintGenotypeAbundanceHistogram");
-//  action_lib->Register<cActionPrintSpeciesAbundanceHistogram>("PrintSpeciesAbundanceHistogram");
-//  action_lib->Register<cActionPrintLineageTotals>("PrintLineageTotals");
-//  action_lib->Register<cActionPrintLineageCounts>("PrintLineageCounts");
-//  action_lib->Register<cActionPrintDominantGenotype>("PrintDominantGenotype");
-//  action_lib->Register<cActionPrintParasiteDebug>("PrintParasiteDebug");
-//  action_lib->Register<cActionPrintDominantParasiteGenotype>("PrintDominantParasiteGenotype");
-//  action_lib->Register<cActionPrintNumberPhenotypes>("PrintNumberPhenotypes");
-//  action_lib->Register<cActionPrintPhenotypeStatus>("PrintPhenotypeStatus");
+  action_lib->Register<cActionEcho>("Echo");
+  action_lib->Register<cActionPrintGenotypeAbundanceHistogram>("PrintGenotypeAbundanceHistogram");
+  action_lib->Register<cActionPrintSpeciesAbundanceHistogram>("PrintSpeciesAbundanceHistogram");
+  action_lib->Register<cActionPrintLineageTotals>("PrintLineageTotals");
+  action_lib->Register<cActionPrintLineageCounts>("PrintLineageCounts");
+  action_lib->Register<cActionPrintDominantGenotype>("PrintDominantGenotype");
+  action_lib->Register<cActionPrintDominantParasiteGenotype>("PrintDominantParasiteGenotype");
+  action_lib->Register<cActionPrintDebug>("PrintDebug");
   
 
 
@@ -170,18 +499,17 @@
   action_lib->Register<cActionPrintInstructionData>("print_instruction_data");
   action_lib->Register<cActionPrintGenotypeMap>("print_genotype_map");
   
+  action_lib->Register<cActionPrintPhenotypeData>("print_number_phenotypes");
+  action_lib->Register<cActionPrintPhenotypeStatus>("print_phenotype_status");
+  
   action_lib->Register<cActionPrintData>("print_data");
   action_lib->Register<cActionPrintInstructionAbundanceHistogram>("print_instruction_abundance_histogram");
   action_lib->Register<cActionPrintDepthHistogram>("print_depth_histogram");
-  // @DMB - TODO
-//  action_lib->Register<cActionEcho>("echo");
-//  action_lib->Register<cActionPrintGenotypeAbundanceHistogram>("print_genotype_abundance_histogram");
-//  action_lib->Register<cActionPrintSpeciesAbundanceHistogram>("print_species_abundance_histogram");
-//  action_lib->Register<cActionPrintLineageTotals>("print_lineage_totals");
-//  action_lib->Register<cActionPrintLineageCounts>("print_lineage_counts");
-//  action_lib->Register<cActionPrintDominantGenotype>("print_dom");
-//  action_lib->Register<cActionPrintParasiteDebug>("parasite_debug");
-//  action_lib->Register<cActionPrintDominantParasiteGenotype>("print_dom_parasite");
-//  action_lib->Register<cActionPrintNumberPhenotypes>("print_number_phenotypes");
-//  action_lib->Register<cActionPrintPhenotypeStatus>("print_phenotype_status");
+  action_lib->Register<cActionEcho>("echo");
+  action_lib->Register<cActionPrintGenotypeAbundanceHistogram>("print_genotype_abundance_histogram");
+  action_lib->Register<cActionPrintSpeciesAbundanceHistogram>("print_species_abundance_histogram");
+  action_lib->Register<cActionPrintLineageTotals>("print_lineage_totals");
+  action_lib->Register<cActionPrintLineageCounts>("print_lineage_counts");
+  action_lib->Register<cActionPrintDominantGenotype>("print_dom");
+  action_lib->Register<cActionPrintDominantParasiteGenotype>("print_dom_parasite");
 }

Added: development/source/actions/SaveLoadActions.cc
===================================================================
--- development/source/actions/SaveLoadActions.cc	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/actions/SaveLoadActions.cc	2006-05-20 15:18:07 UTC (rev 694)
@@ -0,0 +1,15 @@
+/*
+ *  SaveLoadActions.cc
+ *  Avida
+ *
+ *  Created by David on 5/20/06.
+ *  Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "SaveLoadActions.h"
+
+void RegisterSaveLoadActions(cActionLibrary* action_lib)
+{
+  
+}

Added: development/source/actions/SaveLoadActions.h
===================================================================
--- development/source/actions/SaveLoadActions.h	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/actions/SaveLoadActions.h	2006-05-20 15:18:07 UTC (rev 694)
@@ -0,0 +1,17 @@
+/*
+ *  SaveLoadActions.h
+ *  Avida
+ *
+ *  Created by David on 5/20/06.
+ *  Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef SaveLoadActions_h
+#define SaveLoadActions_h
+
+class cActionLibrary;
+
+void RegisterSaveLoadActions(cActionLibrary* action_lib);
+
+#endif

Added: development/source/actions/cActionLibrary.cc
===================================================================
--- development/source/actions/cActionLibrary.cc	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/actions/cActionLibrary.cc	2006-05-20 15:18:07 UTC (rev 694)
@@ -0,0 +1,26 @@
+/*
+ *  cActionLibrary.cc
+ *  Avida
+ *
+ *  Created by David on 5/20/06.
+ *  Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cActionLibrary.h"
+
+#include "LandscapeActions.h"
+#include "PrintActions.h"
+#include "SaveLoadActions.h"
+
+
+cActionLibrary* cActionLibrary::ConstructDefaultActionLibrary()
+{
+  cActionLibrary* actlib = new cActionLibrary();
+
+  RegisterLandscapeActions(actlib);
+  RegisterPrintActions(actlib);
+  RegisterSaveLoadActions(actlib);
+  
+  return actlib;
+}

Modified: development/source/actions/cActionLibrary.h
===================================================================
--- development/source/actions/cActionLibrary.h	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/actions/cActionLibrary.h	2006-05-20 15:18:07 UTC (rev 694)
@@ -24,8 +24,11 @@
 {
 public:
   cActionLibrary() { ; }
+
+  static cActionLibrary* ConstructDefaultActionLibrary();
 };
 
+
 #ifdef ENABLE_UNIT_TESTS
 namespace nActionLibrary {
   /**

Modified: development/source/analyze/cAnalyzeUtil.cc
===================================================================
--- development/source/analyze/cAnalyzeUtil.cc	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/analyze/cAnalyzeUtil.cc	2006-05-20 15:18:07 UTC (rev 694)
@@ -809,151 +809,3 @@
     genotype = genotype->GetNext();
   }
 }
-
-
-void cAnalyzeUtil::PrintDepthHistogram(cWorld* world, ofstream& fp)
-{
-  // Output format:    update  min  max  histogram_values...
-  int min = INT_MAX;
-  int max = 0;
-  assert(fp.good());
-  
-  // Two pass method
-  
-  // Loop through all genotypes getting min and max values
-  cClassificationManager& classmgr = world->GetClassificationManager();
-  cGenotype * cur_genotype = classmgr.GetBestGenotype();
-  for (int i = 0; i < classmgr.GetGenotypeCount(); i++) {
-    if (cur_genotype->GetDepth() < min) min = cur_genotype->GetDepth();
-    if (cur_genotype->GetDepth() > max) max = cur_genotype->GetDepth();
-    cur_genotype = cur_genotype->GetNext();
-  }
-  assert(max >= min);
-  
-  // Allocate the array for the bins (& zero)
-  int * n = new int[max - min + 1];
-  for (int i = 0; i < max - min + 1; i++) n[i] = 0;
-  
-  // Loop through all genotypes binning the values
-  cur_genotype = classmgr.GetBestGenotype();
-  for (int i = 0; i < classmgr.GetGenotypeCount(); i++) {
-    n[cur_genotype->GetDepth() - min] += cur_genotype->GetNumOrganisms();
-    cur_genotype = cur_genotype->GetNext();
-  }
-  
-  // Actual output
-  fp << world->GetStats().GetUpdate() << " "
-    << min << " "
-    << max;
-  
-  for (int i = 0; i < max - min + 1; i++)  fp << " " << n[i];
-  fp<<endl;
-}
-
-
-void cAnalyzeUtil::PrintGenotypeAbundanceHistogram(cWorld* world, ofstream& fp)
-{
-  assert(fp.good());
-  
-  // Allocate array for the histogram & zero it
-  tArray <int> hist(world->GetClassificationManager().GetBestGenotype()->GetNumOrganisms());
-  for (int i = 0; i < hist.GetSize(); i++) hist[i] = 0;
-  
-  // Loop through all genotypes binning the values
-  cGenotype * cur_genotype = world->GetClassificationManager().GetBestGenotype();
-  for (int i = 0; i < world->GetClassificationManager().GetGenotypeCount(); i++) {
-    assert( cur_genotype->GetNumOrganisms() - 1 >= 0 );
-    assert( cur_genotype->GetNumOrganisms() - 1 < hist.GetSize() );
-    hist[cur_genotype->GetNumOrganisms() - 1]++;
-    cur_genotype = cur_genotype->GetNext();
-  }
-  
-  // Actual output
-  fp << world->GetStats().GetUpdate() << " ";
-  for (int i = 0; i < hist.GetSize(); i++)  fp<<hist[i]<<" ";
-  fp << endl;
-}
-
-
-void cAnalyzeUtil::PrintSpeciesAbundanceHistogram(cWorld* world, ofstream& fp)
-{
-  int max = 0;
-  assert(fp.good());
-  
-  // Find max species abundance...
-  cClassificationManager& classmgr = world->GetClassificationManager();
-  cSpecies * cur_species = classmgr.GetFirstSpecies();
-  for (int i = 0; i < classmgr.GetNumSpecies(); i++) {
-    if (max < cur_species->GetNumOrganisms()) {
-      max = cur_species->GetNumOrganisms();
-    }
-    cur_species = cur_species->GetNext();
-  }
-  
-  // Allocate array for the histogram & zero it
-  tArray <int> hist(max);
-  for (int i = 0; i < hist.GetSize(); i++)  hist[i] = 0;
-  
-  // Loop through all species binning the values
-  cur_species = classmgr.GetFirstSpecies();
-  for (int i = 0; i < classmgr.GetNumSpecies(); i++) {
-    assert( cur_species->GetNumOrganisms() - 1 >= 0 );
-    assert( cur_species->GetNumOrganisms() - 1 < hist.GetSize() );
-    hist[cur_species->GetNumOrganisms() -1]++;
-    cur_species = cur_species->GetNext();
-  }
-  
-  // Actual output
-  fp << world->GetStats().GetUpdate() << " ";
-  for (int i = 0; i < hist.GetSize(); i++)  fp<<hist[i]<<" ";
-  fp<<endl;
-}
-
-
-// this adds support for evan dorn's InstructionHistogramEvent.  -- kgn
-/**
-* Count the number of each instruction present in the population.  Output
- * this info to a log file
- **/
-void cAnalyzeUtil::PrintInstructionAbundanceHistogram(cWorld* world, ofstream& fp)
-{
-  cPopulation* pop = &world->GetPopulation();
-  int i,x,y;
-  int num_inst=0;
-  int mem_size=0;
-  int * inst_counts;
-  cCPUMemory cpu_mem; // cCPUMemory is a subclass of cGenome
-  assert(fp.good());
-  
-  // ----- number of instructions available?
-  num_inst = world->GetNumInstructions();
-  inst_counts= new int[num_inst];
-  
-  // ----- create and initialize counting array
-  inst_counts  = new int[num_inst];
-  for (i=0;i<num_inst;i++)
-  { inst_counts[i]=0;
-  }
-  
-  int num_cells = pop->GetSize();
-  //looping through all CPUs counting up instructions
-  for( x=0; x<num_cells; x++ )
-  { cPopulationCell & cell=pop->GetCell(x);
-    if (cell.IsOccupied())
-    {
-      // access this CPU's code block
-      cpu_mem=cell.GetOrganism()->GetHardware().GetMemory();
-      mem_size=cpu_mem.GetSize();
-      for (y=0; y<mem_size ; y++)
-      { inst_counts[(cpu_mem[y]).GetOp()]++;     
-      }  
-    }
-  }
-  
-  // ----- output instruction counts
-  for(i=0; i<num_inst; i++)
-  { fp<<inst_counts[i]<<" ";
-  }
-  fp<<endl;
-}
-

Modified: development/source/analyze/cAnalyzeUtil.h
===================================================================
--- development/source/analyze/cAnalyzeUtil.h	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/analyze/cAnalyzeUtil.h	2006-05-20 15:18:07 UTC (rev 694)
@@ -61,14 +61,6 @@
   static void TaskGrid(cWorld* world, std::ofstream& fp);
   static void PrintViableTasksData(cWorld* world, std::ofstream& fp);
   static void PrintTreeDepths(cWorld* world, std::ofstream& fp);
-
-  static void PrintDepthHistogram(cWorld* world, std::ofstream& fp);
-  static void PrintGenotypeAbundanceHistogram(cWorld* world, std::ofstream& fp);
-  static void PrintSpeciesAbundanceHistogram(cWorld* world, std::ofstream& fp);
-
-  // this adds support for evan dorn's InstructionHistogramEvent.  -- kgn
-  static void PrintInstructionAbundanceHistogram(cWorld* world, std::ofstream& fp);
-  // -- kgn
 };
 
 #ifdef ENABLE_UNIT_TESTS

Modified: development/source/drivers/cDriverManager.cc
===================================================================
--- development/source/drivers/cDriverManager.cc	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/drivers/cDriverManager.cc	2006-05-20 15:18:07 UTC (rev 694)
@@ -9,6 +9,7 @@
 
 #include "cDriverManager.h"
 
+#include "cActionLibrary.h"
 #include "cAvidaDriver.h"
 #include "cWorldDriver.h"
 
@@ -18,6 +19,12 @@
 
 cDriverManager* cDriverManager::m_dm = NULL;
 
+cDriverManager::cDriverManager()
+{
+  pthread_mutex_init(&m_mutex, NULL);
+  m_actlib = cActionLibrary::ConstructDefaultActionLibrary();
+}
+
 cDriverManager::~cDriverManager()
 {
   cAvidaDriver* adrv;
@@ -30,6 +37,8 @@
     delete wdrv;
   }
   
+  delete m_actlib;
+  
   pthread_mutex_destroy(&m_mutex);
 }
 
@@ -81,3 +90,8 @@
   pthread_mutex_unlock(&m_dm->m_mutex);
 }
 
+cActionLibrary* cDriverManager::GetActionLibrary()
+{
+  assert(m_dm);
+  return m_dm->m_actlib;
+}

Modified: development/source/drivers/cDriverManager.h
===================================================================
--- development/source/drivers/cDriverManager.h	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/drivers/cDriverManager.h	2006-05-20 15:18:07 UTC (rev 694)
@@ -16,6 +16,7 @@
 
 #include <pthread.h>
 
+class cActionLibrary;
 class cAvidaDriver;
 class cWorldDriver;
 
@@ -29,8 +30,9 @@
   tList<cWorldDriver> m_wdrvs;
   
   pthread_mutex_t m_mutex;
+  cActionLibrary* m_actlib;
   
-  cDriverManager() { pthread_mutex_init(&m_mutex, NULL); }
+  cDriverManager();
   ~cDriverManager();
 
   cDriverManager(const cDriverManager&); // @not_implemented
@@ -46,6 +48,8 @@
 
   static void Unregister(cAvidaDriver* drv);
   static void Unregister(cWorldDriver* drv);
+  
+  static cActionLibrary* GetActionLibrary();
 };
 
 

Modified: development/source/event/cEventManager.cc
===================================================================
--- development/source/event/cEventManager.cc	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/event/cEventManager.cc	2006-05-20 15:18:07 UTC (rev 694)
@@ -188,335 +188,7 @@
   }
 };
 
-///// echo /////
 
-/**
-* Writes out a message. If no message is given, average update and
- * generation are written out.
- *
- * Parameters:
- * message (string)
- **/
-
-
-class cEvent_echo : public cEvent {
-private:
-  cString mesg;
-public:
-  const cString GetName() const { return "echo"; }
-  const cString GetDescription() const { return "echo  <cString mesg>"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    mesg = args.PopWord();
-  }
-  ///// echo /////
-  void Process(){
-    if( mesg == "" ){
-      mesg.Set("Echo : Update = %f\t AveGeneration = %f",
-               m_world->GetStats().GetUpdate(), m_world->GetStats().SumGeneration().Average());
-    }
-    m_world->GetDriver().NotifyComment(mesg);
-  }
-};
-
-
-///// print_genotype_abundance_histogram /////
-
-/**
-* Writes out a genotype abundance histogram.
- *
- * Parameters:
- * filename (string) default: genotype_abundance_histogram.dat
-   *   The name of the file into which the histogram is written.
-   **/
-
-
-class cEvent_print_genotype_abundance_histogram : public cEvent {
-private:
-  cString filename;
-public:
-  const cString GetName() const { return "print_genotype_abundance_histogram"; }
-  const cString GetDescription() const { return "print_genotype_abundance_histogram  [cString filename=\"genotype_abundance_histogram.dat\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") filename="genotype_abundance_histogram.dat"; else filename=args.PopWord();
-  }
-  ///// print_genotype_abundance_histogram /////
-  void Process(){
-    ofstream& fp = m_world->GetDataFileOFStream(filename);
-    cAnalyzeUtil::PrintGenotypeAbundanceHistogram(m_world, fp);
-  }
-};
-
-///// print_species_abundance_histogram /////
-
-/**
-* Writes out a species abundance histogram.
- *
- * Parameters:
- * filename (string) default: species_abundance_histogram.dat
-   *   The name of the file into which the histogram is written.
-   **/
-
-
-class cEvent_print_species_abundance_histogram : public cEvent {
-private:
-  cString filename;
-public:
-  const cString GetName() const { return "print_species_abundance_histogram"; }
-  const cString GetDescription() const { return "print_species_abundance_histogram  [cString filename=\"species_abundance_histogram.dat\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") filename="species_abundance_histogram.dat"; else filename=args.PopWord();
-  }
-  ///// print_species_abundance_histogram /////
-  void Process(){
-    ofstream& fp = m_world->GetDataFileOFStream(filename);
-    cAnalyzeUtil::PrintSpeciesAbundanceHistogram(m_world, fp);
-  }
-};
-
-///// print_lineage_totals /////
-
-/**
-**/
-
-
-class cEvent_print_lineage_totals : public cEvent {
-private:
-  cString fname;
-  int verbose;
-public:
-    const cString GetName() const { return "print_lineage_totals"; }
-  const cString GetDescription() const { return "print_lineage_totals  [cString fname=\"lineage_totals.dat\"] [int verbose=1]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname="lineage_totals.dat"; else fname=args.PopWord();
-    if (args == "") verbose=1; else verbose=args.PopWord().AsInt();
-  }
-  ///// print_lineage_totals /////
-  void Process(){
-    if (!m_world->GetConfig().LOG_LINEAGES.Get()) {
-      m_world->GetDataFileOFStream(fname) << "No lineage data available!" << endl;
-      return;
-    }
-    m_world->GetClassificationManager().PrintLineageTotals(fname, verbose);
-  }
-};
-
-///// print_lineage_counts /////
-
-/**
-**/
-
-
-class cEvent_print_lineage_counts : public cEvent {
-private:
-  cString fname;
-  int verbose;
-public:
-    const cString GetName() const { return "print_lineage_counts"; }
-  const cString GetDescription() const { return "print_lineage_counts  [cString fname=\"lineage_counts.dat\"] [int verbose=0]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname="lineage_counts.dat"; else fname=args.PopWord();
-    if (args == "") verbose=0; else verbose=args.PopWord().AsInt();
-  }
-  ///// print_lineage_counts /////
-  void Process(){
-    if (!m_world->GetConfig().LOG_LINEAGES.Get()) {
-      m_world->GetDataFileOFStream(fname) << "No lineage data available!" << endl;
-      return;
-    }
-    if (verbose) {    // verbose mode is the same in both methods
-      m_world->GetClassificationManager().PrintLineageTotals(fname, verbose);
-      return;
-    }
-    m_world->GetClassificationManager().PrintLineageCurCounts(fname);
-  }
-};
-
-///// print_dom /////
-
-/**
-* Write the currently dominant genotype to disk.
- *
- * Parameters:
- * filename (string)
- *   The name under which the genotype should be saved. If no
- *   filename is given, the genotype is saved into the directory
- *   archive, under the name that the archive has associated with
- *   this genotype.
- **/
-
-
-class cEvent_print_dom : public cEvent {
-private:
-  cString in_filename;
-public:
-  const cString GetName() const { return "print_dom"; }
-  const cString GetDescription() const { return "print_dom  [cString in_filename=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") in_filename=""; else in_filename=args.PopWord();
-  }
-  ///// print_dom /////
-  void Process(){
-    cGenotype * dom = m_world->GetClassificationManager().GetBestGenotype();
-    cString filename(in_filename);
-    if (filename == "") filename.Set("archive/%s", static_cast<const char*>(dom->GetName()));
-    cTestUtil::PrintGenome(m_world, dom->GetGenome(), filename, dom, m_world->GetStats().GetUpdate());
-  }
-};
-
-///// parasite_debug /////
-
-//midget
-
-
-class cEvent_parasite_debug : public cEvent {
-private:
-  cString in_filename;
-public:
-  const cString GetName() const { return "parasite_debug"; }
-  const cString GetDescription() const { return "parasite_debug  [cString in_filename=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") in_filename=""; else in_filename=args.PopWord();
-  }
-  ///// parasite_debug /////
-  void Process(){
-    m_world->GetPopulation().ParasiteDebug();
-  }
-};
-
-///// print_dom_parasite /////
-
-/**
-* Write the currently dominant injected genotype to disk.
- *
- * Parameters:
- * filename (string)
- *   The name under which the genotype should be saved. If no
- *   filename is given, the genotype is saved into the directory
- *   archive, under the name that the archive has associated with
- *   this genotype.
- **/
-
-
-class cEvent_print_dom_parasite : public cEvent {
-private:
-  cString in_filename;
-public:
-  const cString GetName() const { return "print_dom_parasite"; }
-  const cString GetDescription() const { return "print_dom_parasite  [cString in_filename=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") in_filename=""; else in_filename=args.PopWord();
-  }
-  ///// print_dom_parasite /////
-  void Process(){
-    cInjectGenotype * dom = m_world->GetClassificationManager().GetBestInjectGenotype();
-    if (dom!=NULL) {
-      cString filename(in_filename);
-      if (filename == "") filename.Set("archive/%s", static_cast<const char*>(dom->GetName()));
-      cTestUtil::PrintGenome(m_world, dom, dom->GetGenome(), filename, m_world->GetStats().GetUpdate()); }
-  }
-};
-
-///// print_number_phenotypes /////
-
-/**
-Output file with number of phenotypes based on tasks executed
- for this update.  Executing a task any numbers of times is considered
- the same as executing it once.
- **/
-
-
-class cEvent_print_number_phenotypes : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "print_number_phenotypes"; }
-  const cString GetDescription() const { return "print_number_phenotypes  [cString fname=\"phenotype_count.dat\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname="phenotype_count.dat"; else fname=args.PopWord();
-  }
-  ///// print_number_phenotypes /////
-  void Process(){
-    m_world->GetPopulation().PrintPhenotypeData(fname);
-  }
-};
-
-///// print_phenotype_status /////
-
-/**
-Prints merit status for all the organisms in the population.
- Used for testing/debuging. 
- **/
-
-
-class cEvent_print_phenotype_status : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "print_phenotype_status"; }
-  const cString GetDescription() const { return "print_phenotype_status  [cString fname=\"phenotype_status.dat\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname="phenotype_status.dat"; else fname=args.PopWord();
-  }
-  ///// print_phenotype_status /////
-  void Process(){
-    m_world->GetPopulation().PrintPhenotypeStatus(fname);
-  }
-};
-
-
-
-
-
 ///// save_population /////
 
 /**
@@ -3334,22 +3006,14 @@
   REGISTER(exit_if_update_greater_than);
   REGISTER(exit_if_ave_lineage_label_smaller);
   REGISTER(exit_if_ave_lineage_label_larger);
-  REGISTER(echo);
-  REGISTER(print_genotype_abundance_histogram);
-  REGISTER(print_species_abundance_histogram);
-  REGISTER(print_lineage_totals);
-  REGISTER(print_lineage_counts);
-  REGISTER(print_dom);
-  REGISTER(parasite_debug);
-  REGISTER(print_dom_parasite);
-  REGISTER(print_number_phenotypes);
-  REGISTER(print_phenotype_status);
+  
   REGISTER(save_population);
   REGISTER(load_population);
   REGISTER(save_clone);
   REGISTER(load_clone);
   REGISTER(load_dump_file);
   REGISTER(dump_pop);
+  
   REGISTER(print_genotypes);
   REGISTER(detail_pop);
   REGISTER(detail_sex_pop);
@@ -3357,6 +3021,7 @@
   REGISTER(dump_historic_pop);
   REGISTER(dump_historic_sex_pop);
   REGISTER(dump_memory);
+  
   REGISTER(inject);
   REGISTER(inject_all);
   REGISTER(inject_range);
@@ -3376,11 +3041,13 @@
   REGISTER(pairtest_landscape);
   REGISTER(test_dom);
   REGISTER(analyze_population);
+
   REGISTER(print_detailed_fitness_data);
   REGISTER(print_genetic_distance_data);
   REGISTER(genetic_distance_pop_dump);
   REGISTER(task_snapshot);
   REGISTER(print_viable_tasks_data);
+  
   REGISTER(apocalypse);
   REGISTER(kill_rectangle);
   REGISTER(rate_kill);
@@ -3392,6 +3059,7 @@
   REGISTER(reset_demes);
   REGISTER(print_deme_stats);
   REGISTER(copy_deme);
+  
   REGISTER(calc_consensus);
   REGISTER(test_size_change_robustness);
   REGISTER(test_threads);

Modified: development/source/main/cInstSet.h
===================================================================
--- development/source/main/cInstSet.h	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/main/cInstSet.h	2006-05-20 15:18:07 UTC (rev 694)
@@ -78,11 +78,11 @@
   bool OK() const;
 
   // Accessors
-  const cString & GetName(int id) const
+  const cString& GetName(int id) const
   { 
     return m_inst_lib->GetName(m_lib_name_map[id].lib_fun_id);
   }
-  const cString & GetName(const cInstruction & inst) const
+  const cString& GetName(const cInstruction & inst) const
   {
     return GetName(inst.GetOp());
   }

Modified: development/source/main/cWorld.cc
===================================================================
--- development/source/main/cWorld.cc	2006-05-19 20:09:24 UTC (rev 693)
+++ development/source/main/cWorld.cc	2006-05-20 15:18:07 UTC (rev 694)
@@ -10,7 +10,6 @@
 #include "cWorld.h"
 
 #include "avida.h"
-#include "cActionLibrary.h"
 #include "cAnalyze.h"
 #include "cAvidaTriggers.h"
 #include "cClassificationManager.h"
@@ -25,15 +24,12 @@
 #include "cTools.h"
 #include "cFallbackWorldDriver.h"
 
-#include "LandscapeActions.h"
-#include "PrintActions.h"
 
-
 cWorld::~cWorld()
 {
   m_data_mgr->FlushAll();
 
-  delete m_actlib;
+  // m_actlib is not owned by cWorld, DO NOT DELETE
   delete m_analyze;
   delete m_conf;
   delete m_data_mgr;
@@ -60,9 +56,7 @@
   if (rand_seed != m_rng.GetSeed()) cout << " -> " << m_rng.GetSeed();
   cout << endl;
   
-  m_actlib = new cActionLibrary();
-  RegisterLandscapeActions(m_actlib);
-  RegisterPrintActions(m_actlib);
+  m_actlib = cDriverManager::GetActionLibrary();
   
   // The data directory should end in a '/'
   cString dir = m_conf->DATA_DIR.Get();




More information about the Avida-cvs mailing list