[Avida-cvs] [avida-svn] r898 - in development: . documentation source/actions source/main source/tools

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Fri Aug 25 14:21:47 PDT 2006


Author: brysonda
Date: 2006-08-25 17:21:47 -0400 (Fri, 25 Aug 2006)
New Revision: 898

Modified:
   development/README
   development/documentation/structure.html
   development/source/actions/DriverActions.cc
   development/source/actions/EnvironmentActions.cc
   development/source/actions/LandscapeActions.cc
   development/source/actions/PopulationActions.cc
   development/source/actions/PrintActions.cc
   development/source/actions/SaveLoadActions.cc
   development/source/actions/cAction.h
   development/source/actions/cActionLibrary.cc
   development/source/actions/cActionLibrary.h
   development/source/main/cAvidaConfig.cc
   development/source/tools/tObjectFactory.h
Log:
Rework action description methods so that they are static methods that do not require the class to be constructed.  cActionLibrary now maintains a dictionary mapping names to description functions to facilitate description lookup.  Implement DescribeAll() and re-enable the command line option -e that describes all supported actions.

Also of note, cActionLibrary no longer 'is' a tObjectFactory, but rather 'contains' one.

Removed unused FactoryID methods from tObjectFactory.

Modified: development/README
===================================================================
--- development/README	2006-08-25 20:39:41 UTC (rev 897)
+++ development/README	2006-08-25 21:21:47 UTC (rev 898)
@@ -35,7 +35,7 @@
 type within your Mac (G4, G5, or Intel).  Click the 'Build' button on
 the project window.  The compiled binary and starting config files
 will be copied (by default) into:
-${PROJECT_DIR}/build/Deployment-{selected processor type}/Avida.work
+${PROJECT_DIR}/build/Deployment-{selected processor type}/work
 
 
 CMAKE CONFIGURATION OPTIONS

Modified: development/documentation/structure.html
===================================================================
--- development/documentation/structure.html	2006-08-25 20:39:41 UTC (rev 897)
+++ development/documentation/structure.html	2006-08-25 21:21:47 UTC (rev 898)
@@ -138,7 +138,7 @@
 
 <h3>
 Directory: <kbd style="color: #008844">build/work/</kbd> (CMake)
-<br />Directory: <kbd style="color: #008844">build/{Target Name}/Avida.work/</kbd> (Xcode)
+<br />Directory: <kbd style="color: #008844">build/{Target Name}/work/</kbd> (Xcode)
 </h3>
 
 

Modified: development/source/actions/DriverActions.cc
===================================================================
--- development/source/actions/DriverActions.cc	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/DriverActions.cc	2006-08-25 21:21:47 UTC (rev 898)
@@ -19,7 +19,7 @@
 {
 public:
   cActionExit(cWorld* world, const cString& args) : cAction(world, args) { ; }
-  const cString GetDescription() { return "Exit"; }
+  static const cString GetDescription() { return "No Arguments"; }
   void Process(cAvidaContext& ctx) { m_world->GetDriver().SetDone(); }
 };
 
@@ -34,7 +34,7 @@
     if (largs.GetSize()) m_threshold = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "ExitAveLineageLabelGreater <double threshold>"; }
+  static const cString GetDescription() { return "Arguments: <double threshold>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -55,7 +55,7 @@
     if (largs.GetSize()) m_threshold = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "ExitAveLineageLabelLess <double threshold>"; }
+  static const cString GetDescription() { return "Arguments: <double threshold>"; }
   
   void Process(cAvidaContext& ctx)
   {

Modified: development/source/actions/EnvironmentActions.cc
===================================================================
--- development/source/actions/EnvironmentActions.cc	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/EnvironmentActions.cc	2006-08-25 21:21:47 UTC (rev 898)
@@ -31,7 +31,7 @@
     if (largs.GetSize()) m_res_count = largs.PopWord().AsDouble();
   }
 
-  const cString GetDescription() { return "InjectResource <string res_name> <double res_count>"; }
+  static const cString GetDescription() { return "Arguments: <string res_name> <double res_count>"; }
 
   void Process(cAvidaContext& ctx)
   {
@@ -59,7 +59,7 @@
     if (largs.GetSize()) m_res_count = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "InjectScaledResource <string res_name> <double res_count>"; }
+  static const cString GetDescription() { return "Arguments: <string res_name> <double res_count>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -91,7 +91,7 @@
     if (largs.GetSize()) m_res_percent = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "OutflowScaledResource <string res_name> <double res_percent>"; }
+  static const cString GetDescription() { return "Arguments: <string res_name> <double res_percent>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -124,7 +124,7 @@
     if (largs.GetSize()) m_res_count = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "SetResource <string res_name> <double res_count>"; }
+  static const cString GetDescription() { return "Arguments: <string res_name> <double res_count>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -148,7 +148,7 @@
     if (largs.GetSize()) m_value = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "SetReactionValue <string reaction_name> <double value>"; }
+  static const cString GetDescription() { return "Arguments: <string reaction_name> <double value>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -171,7 +171,7 @@
     if (largs.GetSize()) m_value = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "SetReactionValueMult <string reaction_name> <double value>"; }
+  static const cString GetDescription() { return "Arguments: <string reaction_name> <double value>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -194,7 +194,7 @@
     if (largs.GetSize()) m_inst = largs.PopWord();
   }
   
-  const cString GetDescription() { return "SetReactionInst <string reaction_name> <string inst>"; }
+  static const cString GetDescription() { return "Arguments: <string reaction_name> <string inst>"; }
   
   void Process(cAvidaContext& ctx)
   {

Modified: development/source/actions/LandscapeActions.cc
===================================================================
--- development/source/actions/LandscapeActions.cc	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/LandscapeActions.cc	2006-08-25 21:21:47 UTC (rev 898)
@@ -56,9 +56,9 @@
     if (m_max_dist <= 0) m_max_dist = 10;
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "AnalyzeLandscape [filename='land-analyze.dat'] [int trials=1000] [int min_found=0] [int max_trials=0] [int max_dist=10]";
+    return "Arguments: [filename='land-analyze.dat'] [int trials=1000] [int min_found=0] [int max_trials=0] [int max_dist=10]";
   }
   
   void Process(cAvidaContext& ctx)
@@ -153,9 +153,9 @@
 public:
   cActionPrecalcLandscape(cWorld* world, const cString& args) : cAction(world, args) { ; }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "PrecalcLandscape";
+    return "No Arguments";
   }
   
   void Process(cAvidaContext& ctx)
@@ -200,9 +200,9 @@
       if (largs.GetSize()) m_cfilename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "FullLandscape [string filename='land-full.dat'] [int distance=1] [string entropy_file=''] [string sitecount_file='']";
+    return "Arguments: [string filename='land-full.dat'] [int distance=1] [string entropy_file=''] [string sitecount_file='']";
   }
   
   void Process(cAvidaContext& ctx)
@@ -272,9 +272,9 @@
       if (largs.GetSize()) m_cfilename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "DeletionLandscape [string filename='land-del.dat'] [int distance=1] [string sitecount_file='']";
+    return "Arguments: [string filename='land-del.dat'] [int distance=1] [string sitecount_file='']";
   }
   
   void Process(cAvidaContext& ctx)
@@ -343,9 +343,9 @@
       if (largs.GetSize()) m_cfilename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "InsertionLandscape [string filename='land-ins.dat'] [int distance=1] [string sitecount_file='']";
+    return "Arguments: [string filename='land-ins.dat'] [int distance=1] [string sitecount_file='']";
   }
   
   void Process(cAvidaContext& ctx)
@@ -409,9 +409,9 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "PredictWLandscape [string filename='land-predict.dat']";
+    return "Arguments: [string filename='land-predict.dat']";
   }
   
   void Process(cAvidaContext& ctx)
@@ -459,9 +459,9 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "PredictNuLandscape [string filename='land-predict.dat']";
+    return "Arguments: [string filename='land-predict.dat']";
   }
   
   void Process(cAvidaContext& ctx)
@@ -514,9 +514,9 @@
     if (largs.GetSize()) m_trials = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "RandomLandscape [string filename='land-random.dat'] [int distance=1] [int trials=0]";
+    return "Arguments: [string filename='land-random.dat'] [int distance=1] [int trials=0]";
   }
   
   void Process(cAvidaContext& ctx)
@@ -585,9 +585,9 @@
     if (m_trials == 0) m_trials = m_world->GetHardwareManager().GetInstSet().GetSize() - 1;
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "SampleLandscape [string filename='land-sample.dat'] [int trials=0]";
+    return "Arguments: [string filename='land-sample.dat'] [int trials=0]";
   }
   
   void Process(cAvidaContext& ctx)
@@ -650,9 +650,9 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "HillClimb [string filename='hillclimb.dat']";
+    return "Arguments: [string filename='hillclimb.dat']";
   }
   
   void Process(cAvidaContext& ctx)
@@ -700,9 +700,9 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "HillClimbNeut [string filename='hillclimb.dat']";
+    return "Arguments: [string filename='hillclimb.dat']";
   }
   
   void Process(cAvidaContext& ctx)
@@ -750,9 +750,9 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "HillClimbRand [string filename='hillclimb.dat']";
+    return "Arguments: [string filename='hillclimb.dat']";
   }
   
   void Process(cAvidaContext& ctx)
@@ -812,9 +812,9 @@
       if (largs.GetSize()) m_target = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "MutationalNeighborhood [string fname='mut-neighborhood.dat'] [int target=-1]";
+    return "Arguments: [string fname='mut-neighborhood.dat'] [int target=-1]";
   }
   
   void Process(cAvidaContext& ctx)
@@ -881,9 +881,9 @@
     if (largs.GetSize()) m_sample_size = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "PairTestLandscape [string filename=''] [int sample_size=0]";
+    return "Arguments: [string filename=''] [int sample_size=0]";
   }
   
   void Process(cAvidaContext& ctx)
@@ -973,9 +973,9 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription()
+  static const cString GetDescription()
   {
-    return "AnalyzePopulation [double sample_prob=1] [int landscape=0] [int save_genotype=0] [string filename='']";
+    return "Arguments: [double sample_prob=1] [int landscape=0] [int save_genotype=0] [string filename='']";
   }
   
   void Process(cAvidaContext& ctx)

Modified: development/source/actions/PopulationActions.cc
===================================================================
--- development/source/actions/PopulationActions.cc	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/PopulationActions.cc	2006-08-25 21:21:47 UTC (rev 898)
@@ -59,7 +59,7 @@
     if (m_filename == "START_CREATURE") m_filename = m_world->GetConfig().START_CREATURE.Get();
 }
   
-  const cString GetDescription() { return "Inject [string fname=\"START_CREATURE\"] [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
+  static const cString GetDescription() { return "Arguments: [string fname=\"START_CREATURE\"] [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
 
   void Process(cAvidaContext& ctx)
   {
@@ -103,7 +103,7 @@
     if (largs.GetSize()) m_neutral_metric = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "InjectRandom <int length> [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
+  static const cString GetDescription() { return "Arguments: <int length> [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
 
   void Process(cAvidaContext& ctx)
   {
@@ -149,7 +149,7 @@
     if (m_filename == "START_CREATURE") m_filename = m_world->GetConfig().START_CREATURE.Get();
   }
   
-  const cString GetDescription() { return "InjectAll [string fname=\"START_CREATURE\"] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
+  static const cString GetDescription() { return "Arguments: [string fname=\"START_CREATURE\"] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -203,7 +203,7 @@
     if (m_cell_end == -1) m_cell_end = m_cell_start + 1;
   }
   
-  const cString GetDescription() { return "InjectRange [string fname=\"START_CREATURE\"] [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
+  static const cString GetDescription() { return "Arguments: [string fname=\"START_CREATURE\"] [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -261,7 +261,7 @@
     if (m_cell_end == -1) m_cell_end = m_cell_start + 1;
   }
   
-  const cString GetDescription() { return "InjectSequence [string fname=\"START_CREATURE\"] [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
+  static const cString GetDescription() { return "Arguments: [string fname=\"START_CREATURE\"] [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -310,7 +310,7 @@
     if (m_cell_end == -1) m_cell_end = m_cell_start + 1;
   }
   
-  const cString GetDescription() { return "InjectParasite <string filename> <string label> [int cell_start=0] [int cell_end=-1]"; }
+  static const cString GetDescription() { return "Arguments: <string filename> <string label> [int cell_start=0] [int cell_end=-1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -376,7 +376,7 @@
     if (m_cell_end == -1) m_cell_end = m_cell_start + 1;
   }
   
-  const cString GetDescription() { return "InjectParasitePair <string filename_genome> <string filename_parasite> <string label> [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
+  static const cString GetDescription() { return "Arguments: <string filename_genome> <string filename_parasite> <string label> [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -413,7 +413,7 @@
       if (largs.GetSize()) m_killprob = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "KillProb [double probability=0.9]"; }
+  static const cString GetDescription() { return "Arguments: [double probability=0.9]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -449,7 +449,7 @@
     if (largs.GetSize()) m_killrate = largs.PopWord().AsDouble();
   }
   
-  const cString GetDescription() { return "KillRate <double probability>"; }
+  static const cString GetDescription() { return "Arguments: <double probability>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -520,7 +520,7 @@
     }
   }
   
-  const cString GetDescription() { return "KillRectangle [int x1=0] [int y1=0] [int x2=0] [int y2=0]"; }
+  static const cString GetDescription() { return "Arguments: [int x1=0] [int y1=0] [int x2=0] [int y2=0]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -567,7 +567,7 @@
     if (m_size < 0) m_size = 1;
   }
   
-  const cString GetDescription() { return "SerialTransfer [int transfer_size=1] [int ignore_deads=1]"; }
+  static const cString GetDescription() { return "Arguments: [int transfer_size=1] [int ignore_deads=1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -623,7 +623,7 @@
     if (m_end > m_world->GetPopulation().GetSize()) m_end = m_world->GetPopulation().GetSize();
   }
   
-  const cString GetDescription() { return "SetMutProb [string mut_type='copy'] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]"; }
+  static const cString GetDescription() { return "Arguments: [string mut_type='copy'] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -712,7 +712,7 @@
       if (m_end > m_world->GetPopulation().GetSize()) m_end = m_world->GetPopulation().GetSize();
   }
   
-  const cString GetDescription() { return "ModMutProb [string mut_type='copy'] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]"; }
+  static const cString GetDescription() { return "Arguments: [string mut_type='copy'] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -778,7 +778,7 @@
 {
 public:
   cActionZeroMuts(cWorld* world, const cString& args) : cAction(world, args) { ; }
-  const cString GetDescription() { return "ZeroMuts"; }
+  static const cString GetDescription() { return "No Arguments"; }
   void Process(cAvidaContext& ctx)
   {
     for (int i = 0; i < m_world->GetPopulation().GetSize(); i++) {
@@ -807,7 +807,7 @@
     if (largs.GetSize()) m_type = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "CompeteDemes [int type=1]"; }
+  static const cString GetDescription() { return "Arguments: [int type=1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -825,7 +825,7 @@
 public:
   cActionResetDemes(cWorld* world, const cString& args) : cAction(world, args) { ; }
   
-  const cString GetDescription() { return "ResetDemes"; }
+  static const cString GetDescription() { return "No Arguments"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -847,7 +847,7 @@
     if (largs.GetSize()) m_id2 = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "CopyDeme <int src_id> <int dest_id>"; }
+  static const cString GetDescription() { return "Arguments: <int src_id> <int dest_id>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -882,7 +882,7 @@
     if (largs.GetSize()) m_max = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "SeverGridCol [int col_id=-1] [int min_row=0] [int max_row=-1]"; }
+  static const cString GetDescription() { return "Arguments: [int col_id=-1] [int min_row=0] [int max_row=-1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -946,7 +946,7 @@
     if (largs.GetSize()) m_max = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "SeverGridRow [int row_id=-1] [int min_col=0] [int max_col=-1]"; }
+  static const cString GetDescription() { return "Arguments: [int row_id=-1] [int min_col=0] [int max_col=-1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -1008,7 +1008,7 @@
     if (largs.GetSize()) m_max = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "JoinGridCol [int col_id=-1] [int min_col=0] [int max_col=-1]"; }
+  static const cString GetDescription() { return "Arguments: [int col_id=-1] [int min_col=0] [int max_col=-1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -1070,7 +1070,7 @@
     if (largs.GetSize()) m_max = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "JoinGridRow [int col_id=-1] [int min_col=0] [int max_col=-1]"; }
+  static const cString GetDescription() { return "Arguments: [int col_id=-1] [int min_col=0] [int max_col=-1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -1123,7 +1123,7 @@
     if (largs.GetSize()) m_b_y = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "ConnectCells <int cellA_x> <int cellA_y> <int cellB_x> <int cellB_y>"; }
+  static const cString GetDescription() { return "Arguments: <int cellA_x> <int cellA_y> <int cellB_x> <int cellB_y>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -1163,7 +1163,7 @@
     if (largs.GetSize()) m_b_y = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "DisconnectCells <int cellA_x> <int cellA_y> <int cellB_x> <int cellB_y>"; }
+  static const cString GetDescription() { return "Arguments: <int cellA_x> <int cellA_y> <int cellB_x> <int cellB_y>"; }
   
   void Process(cAvidaContext& ctx)
   {

Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/PrintActions.cc	2006-08-25 21:21:47 UTC (rev 898)
@@ -42,7 +42,7 @@
     cString largs(args);                                                                  /*  8 */ \
     if (largs == "") m_filename = #DEFAULT; else m_filename = largs.PopWord();            /*  9 */ \
   }                                                                                       /* 10 */ \
-  const cString GetDescription() { return #METHOD " [string fname=\"" #DEFAULT "\"]"; }  /* 11 */ \
+  static const cString GetDescription() { return "Arguments: [string fname=\"" #DEFAULT "\"]"; }  /* 11 */ \
   void Process(cAvidaContext& ctx) { m_world->GetStats().METHOD(m_filename); }            /* 12 */ \
 }                                                                                         /* 13 */ \
 
@@ -74,7 +74,7 @@
     cString largs(args);                                                                  /*  8 */ \
     if (largs == "") m_filename = #DEFAULT; else m_filename = largs.PopWord();            /*  9 */ \
   }                                                                                       /* 10 */ \
-  const cString GetDescription() { return #METHOD " [string fname=\"" #DEFAULT "\"]"; }  /* 11 */ \
+  static const cString GetDescription() { return "Arguments: [string fname=\"" #DEFAULT "\"]"; }  /* 11 */ \
   void Process(cAvidaContext& ctx) { m_world->GetPopulation().METHOD(m_filename); }       /* 12 */ \
 }                                                                                         /* 13 */ \
 
@@ -95,7 +95,7 @@
     m_format = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintData <cString fname> <cString format>"; }
+  static const cString GetDescription() { return "Arguments: <cString fname> <cString format>"; }
 
   void Process(cAvidaContext& ctx)
   {
@@ -116,7 +116,7 @@
     if (largs == "") m_filename = "instruction_histogram.dat"; else m_filename = largs.PopWord();
   }
 
-  const cString GetDescription() { return "PrintInstructionAbundanceHistogram [string fname=\"instruction_histogram.dat\"]"; }
+  static const cString GetDescription() { return "Arguments: [string fname=\"instruction_histogram.dat\"]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -160,7 +160,7 @@
     if (largs == "") m_filename = "depth_histogram.dat"; else m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintDepthHistogram [string fname=\"depth_histogram.dat\"]"; }
+  static const cString GetDescription() { return "Arguments: [string fname=\"depth_histogram.dat\"]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -208,7 +208,7 @@
 public:
   cActionEcho(cWorld* world, const cString& args) : cAction(world, args) { ; }
   
-  const cString GetDescription() { return "Echo <cString message>"; }
+  static const cString GetDescription() { return "Arguments: <cString message>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -233,7 +233,7 @@
     if (largs == "") m_filename = "genotype_abundance_histogram.dat"; else m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintGenotypeAbundanceHistogram [string fname=\"genotype_abundance_histogram.dat\"]"; }
+  static const cString GetDescription() { return "Arguments: [string fname=\"genotype_abundance_histogram.dat\"]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -269,7 +269,7 @@
     if (largs == "") m_filename = "species_abundance_histogram.dat"; else m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintSpeciesAbundanceHistogram [string fname=\"species_abundance_histogram.dat\"]"; }
+  static const cString GetDescription() { return "Arguments: [string fname=\"species_abundance_histogram.dat\"]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -319,7 +319,7 @@
     if (largs.GetSize()) m_verbose = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "PrintLineageTotals [string fname='lineage_totals.dat'] [int verbose=1]"; }
+  static const cString GetDescription() { return "Arguments: [string fname='lineage_totals.dat'] [int verbose=1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -344,7 +344,7 @@
     if (largs.GetSize()) m_verbose = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "PrintLineageCounts [string fname='lineage_counts.dat'] [int verbose=1]"; }
+  static const cString GetDescription() { return "Arguments: [string fname='lineage_counts.dat'] [int verbose=1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -383,7 +383,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintDominantGenotype [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -416,7 +416,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintDominantParasiteGenotype [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -434,7 +434,7 @@
 {
 public:
   cActionPrintDebug(cWorld* world, const cString& args) : cAction(world, args) { ; }
-  const cString GetDescription() { return "PrintDebug"; }
+  static const cString GetDescription() { return "No Arguments"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -476,7 +476,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintGenotypes [string data_fields=\"all\"] [int historic=0] [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string data_fields=\"all\"] [int historic=0] [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -537,7 +537,7 @@
     if (!largs.GetSize()) m_filenames[2] = "fitness_histos_testCPU.dat"; else m_filenames[2] = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintDetailedFitnessData [int save_max_f_genotype=0] [int print_fitness_histo=0] [double hist_fmax=1] [double hist_fstep=0.1] [string datafn=\"fitness.dat\"] [string histofn=\"fitness_histos.dat\"] [string histotestfn=\"fitness_histos_testCPU.dat\"]"; }
+  static const cString GetDescription() { return "Arguments: [int save_max_f_genotype=0] [int print_fitness_histo=0] [double hist_fmax=1] [double hist_fstep=0.1] [string datafn=\"fitness.dat\"] [string histofn=\"fitness_histos.dat\"] [string histotestfn=\"fitness_histos_testCPU.dat\"]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -690,7 +690,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "PrintGeneticDistanceData [string ref_creature_file='START_CREATURE'] [string fname='genetic_distance.dat']"; }
+  static const cString GetDescription() { return "Arguments: [string ref_creature_file='START_CREATURE'] [string fname='genetic_distance.dat']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -744,7 +744,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "DumpMemory [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -780,7 +780,7 @@
     if (m_creature == "" || m_creature == "START_CREATURE") m_creature = m_world->GetConfig().START_CREATURE.Get();
 }
   
-  const cString GetDescription() { return "PrintPopulationDistanceData [string creature=\"START_CREATURE\"] [string fname=\"\"] [int save_genotypes=0]"; }
+  static const cString GetDescription() { return "Arguments: [string creature=\"START_CREATURE\"] [string fname=\"\"] [int save_genotypes=0]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -838,7 +838,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "TestDominant [string fname='dom-test.dat']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='dom-test.dat']"; }
   void Process(cAvidaContext& ctx)
   {
     cGenome& genome = m_world->GetClassificationManager().GetBestGenotype()->GetGenome();
@@ -875,7 +875,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "PrintTaskSnapshot [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   void Process(cAvidaContext& ctx)
   {
     cString filename(m_filename);
@@ -950,7 +950,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "PrintViableTasksData [string fname='viable_tasks.dat']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='viable_tasks.dat']"; }
   void Process(cAvidaContext& ctx)
   {
     cDataFile& df = m_world->GetDataFile(m_filename);
@@ -993,7 +993,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "PrintTreeDepths [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   void Process(cAvidaContext& ctx)
   {
     cString filename(m_filename);
@@ -1032,7 +1032,7 @@
     cString largs(args);
     if (largs.GetSize()) m_lines_saved = largs.PopWord().AsInt();  
   }
-  const cString GetDescription() { return "CalcConsensus [int lines_saved=0]"; }
+  static const cString GetDescription() { return "Arguments: [int lines_saved=0]"; }
   void Process(cAvidaContext& ctx)
   {
     const int num_inst = m_world->GetHardwareManager().GetInstSet().GetSize();
@@ -1204,7 +1204,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "DumpFitnessGrid [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   void Process(cAvidaContext& ctx)
   {
     cString filename(m_filename);
@@ -1235,7 +1235,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "DumpGenotypeIDGrid [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   void Process(cAvidaContext& ctx)
   {
     cString filename(m_filename);
@@ -1266,7 +1266,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "DumpTaskGrid [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   void Process(cAvidaContext& ctx)
   {
     cString filename(m_filename);
@@ -1313,7 +1313,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "DumpDonorGrid [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   void Process(cAvidaContext& ctx)
   {
     cString filename(m_filename);
@@ -1344,7 +1344,7 @@
     cString largs(args);
     if (largs.GetSize()) m_filename = largs.PopWord();  
   }
-  const cString GetDescription() { return "DumpReceiverGrid [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   void Process(cAvidaContext& ctx)
   {
     cString filename(m_filename);
@@ -1369,7 +1369,7 @@
 public:
   cActionPrintDemeStats(cWorld* world, const cString& args) : cAction(world, args) { ; }
   
-  const cString GetDescription() { return "PrintDemeStats"; }
+  static const cString GetDescription() { return "No Arguments"; }
   
   void Process(cAvidaContext& ctx)
   {

Modified: development/source/actions/SaveLoadActions.cc
===================================================================
--- development/source/actions/SaveLoadActions.cc	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/SaveLoadActions.cc	2006-08-25 21:21:47 UTC (rev 898)
@@ -39,7 +39,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
 
-  const cString GetDescription() { return "SaveClone [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
 
   void Process(cAvidaContext& ctx)
   {
@@ -70,7 +70,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "LoadClone <cString fname>"; }
+  static const cString GetDescription() { return "Arguments: <cString fname>"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -105,7 +105,7 @@
     if (largs.GetSize()) m_update = largs.PopWord().AsInt();
   }
   
-  const cString GetDescription() { return "LoadPopulation <cString fname> [int update=-1]"; }
+  static const cString GetDescription() { return "Arguments: <cString fname> [int update=-1]"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -135,7 +135,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "DumpPopulation [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -165,7 +165,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "SavePopulation [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -197,7 +197,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "SaveSexPopulation [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -221,7 +221,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "SaveParasitePopulation [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -260,7 +260,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "SaveHistoricPopulation [int back_dist=-1] [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [int back_dist=-1] [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {
@@ -292,7 +292,7 @@
     if (largs.GetSize()) m_filename = largs.PopWord();
   }
   
-  const cString GetDescription() { return "SaveHistoricSexPopulation [string fname='']"; }
+  static const cString GetDescription() { return "Arguments: [string fname='']"; }
   
   void Process(cAvidaContext& ctx)
   {

Modified: development/source/actions/cAction.h
===================================================================
--- development/source/actions/cAction.h	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/cAction.h	2006-08-25 21:21:47 UTC (rev 898)
@@ -34,7 +34,6 @@
   
   const cString& GetArgs() const { return m_args; }
   
-  virtual const cString GetDescription() = 0;
   virtual void Process(cAvidaContext& ctx) = 0;
 };
 

Modified: development/source/actions/cActionLibrary.cc
===================================================================
--- development/source/actions/cActionLibrary.cc	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/cActionLibrary.cc	2006-08-25 21:21:47 UTC (rev 898)
@@ -30,3 +30,19 @@
   
   return actlib;
 }
+
+const cString cActionLibrary::DescribeAll() const
+{
+  tList<cString> names;
+  tList<ClassDescFunction> funcs;
+  m_desc_funcs.AsLists(names, funcs);
+  
+  cString ret("");
+  
+  tListIterator<cString> names_it(names);
+  for (int i = 0; names_it.Next() != NULL; i++) {
+    ret = ret + *names_it.Get() + " - " + Describe(*names_it.Get()) + "\n";
+  }
+  
+  return ret;
+}

Modified: development/source/actions/cActionLibrary.h
===================================================================
--- development/source/actions/cActionLibrary.h	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/actions/cActionLibrary.h	2006-08-25 21:21:47 UTC (rev 898)
@@ -20,11 +20,41 @@
 class cWorld;
 class cString;
 
-class cActionLibrary : public tObjectFactory<cAction* (cWorld*, const cString&)>
+class cActionLibrary
 {
+private:
+  typedef const cString (*ClassDescFunction)();
+  
+  tObjectFactory<cAction* (cWorld*, const cString&)> m_factory;
+  tDictionary<ClassDescFunction> m_desc_funcs;
+
 public:
   cActionLibrary() { ; }
-
+  
+  template<typename ClassType> bool Register(const cString& key)
+  {
+    ClassDescFunction func;
+    if (m_desc_funcs.Find(key, func)) return false;
+    m_desc_funcs.Add(key, &ClassType::GetDescription);
+    return m_factory.Register<ClassType>(key);
+  }
+  bool Unregister(const cString& key)
+  {
+    m_desc_funcs.Remove(key);
+    return m_factory.Unregister(key);
+  }
+  
+  cAction* Create(const cString& key, cWorld* world, const cString& args) { return m_factory.Create(key, world, args); }
+  bool Supports(const cString& key) const { return m_factory.Supports(key); }  
+  
+  const cString Describe(const cString& key) const
+  {
+    ClassDescFunction func;
+    if (m_desc_funcs.Find(key, func)) return func();
+    return "(Not Available)";
+  }  
+  const cString DescribeAll() const;
+  
   static cActionLibrary* ConstructDefaultActionLibrary();
 };
 

Modified: development/source/main/cAvidaConfig.cc
===================================================================
--- development/source/main/cAvidaConfig.cc	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/main/cAvidaConfig.cc	2006-08-25 21:21:47 UTC (rev 898)
@@ -12,6 +12,8 @@
 
 #include <fstream>
 #include "defs.h"
+#include "cActionLibrary.h"
+#include "cDriverManager.h"
 #include "cInitFile.h"
 #include "tDictionary.h"
 
@@ -301,20 +303,15 @@
     
     // Test against the possible inputs.
 
-// @DMB - todo: print out all now *actions* 
-//
-//    if (cur_arg == "-events" || cur_arg == "-e") {
-//      cout << "Known events:" << endl;
-//      cEventManager event_manager(NULL);
-//      event_manager.PrintAllEventDescriptions();
-//      exit(0);
-//    } else
-    
-    if (cur_arg == "--help" || cur_arg == "-help" || cur_arg == "-h") {
+    if (cur_arg == "-e") {
+      cout << endl << "Supported Actions:" << endl;
+      cout << cDriverManager::GetActionLibrary()->DescribeAll() << endl;
+      exit(0);
+    } else if (cur_arg == "--help" || cur_arg == "-help" || cur_arg == "-h") {
       cout << "Options:"<<endl
       << "  -c[onfig] <filename>  Set config file to be <filename>"<<endl
       << "  -h[elp]               Help on options (this listing)"<<endl
-      << "  -e[vents]             Print a list of all known events"<< endl
+      << "  -e                    Print a list of all known actions"<< endl
       << "  -s[eed] <value>       Set random seed to <value>"<<endl
       << "  -v[ersion]            Prints the version number"<<endl
       << "  -v0 -v1 -v2 -v3 -v4   Set output verbosity to 0..4"

Modified: development/source/tools/tObjectFactory.h
===================================================================
--- development/source/tools/tObjectFactory.h	2006-08-25 20:39:41 UTC (rev 897)
+++ development/source/tools/tObjectFactory.h	2006-08-25 21:21:47 UTC (rev 898)
@@ -61,15 +61,11 @@
   typedef BaseType (*CreateObjectFunction)();
   
   tDictionary<CreateObjectFunction> m_create_funcs;
-  int m_factory_id;
   mutable pthread_mutex_t m_mutex;
   
 public:
-  tObjectFactory() : m_factory_id(0) { pthread_mutex_init(&m_mutex, NULL); }
+  tObjectFactory() { pthread_mutex_init(&m_mutex, NULL); }
   virtual ~tObjectFactory() { pthread_mutex_destroy(&m_mutex); }
-  
-  void SetFactoryId(int id) { m_factory_id = id; }
-  int GetFactoryId() { return m_factory_id; }
 
   template<typename ClassType> bool Register(const cString& key)
   {
@@ -141,16 +137,12 @@
   typedef BaseType (*CreateObjectFunction)(Arg1Type);
   
   tDictionary<CreateObjectFunction> m_create_funcs;
-  int m_factory_id;
   mutable pthread_mutex_t m_mutex;
   
 public:
-  tObjectFactory() : m_factory_id(0) { pthread_mutex_init(&m_mutex, NULL); }
+  tObjectFactory() { pthread_mutex_init(&m_mutex, NULL); }
   virtual ~tObjectFactory() { pthread_mutex_destroy(&m_mutex); }
   
-  void SetFactoryId(int id) { m_factory_id = id; }
-  int GetFactoryId() { return m_factory_id; }
-  
   template<typename ClassType> bool Register(const cString& key)
   {
     CreateObjectFunction func;
@@ -201,16 +193,12 @@
   typedef BaseType (*CreateObjectFunction)(Arg1Type, Arg2Type);
   
   tDictionary<CreateObjectFunction> m_create_funcs;
-  int m_factory_id;
   mutable pthread_mutex_t m_mutex;
   
 public:
-    tObjectFactory() : m_factory_id(0) { pthread_mutex_init(&m_mutex, NULL); }
+  tObjectFactory() { pthread_mutex_init(&m_mutex, NULL); }
   virtual ~tObjectFactory() { pthread_mutex_destroy(&m_mutex); }
   
-  void SetFactoryId(int id) { m_factory_id = id; }
-  int GetFactoryId() { return m_factory_id; }
-  
   template<typename ClassType> bool Register(const cString& key)
   {
     CreateObjectFunction func;
@@ -261,16 +249,12 @@
   typedef BaseType (*CreateObjectFunction)(Arg1Type, Arg2Type, Arg3Type);
   
   tDictionary<CreateObjectFunction> m_create_funcs;
-  int m_factory_id;
   mutable pthread_mutex_t m_mutex;
   
 public:
-  tObjectFactory() : m_factory_id(0) { pthread_mutex_init(&m_mutex, NULL); }
+  tObjectFactory() { pthread_mutex_init(&m_mutex, NULL); }
   virtual ~tObjectFactory() { pthread_mutex_destroy(&m_mutex); }
   
-  void SetFactoryId(int id) { m_factory_id = id; }
-  int GetFactoryId() { return m_factory_id; }
-  
   template<typename ClassType> bool Register(const cString& key)
   {
     CreateObjectFunction func;




More information about the Avida-cvs mailing list