[Avida-cvs] [Avida2-svn] r203 - in branches/brysonda: Avida2.xcodeproj source source/cpu source/event source/main source/tools
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Fri Jun 10 17:57:17 PDT 2005
Author: brysonda
Date: 2005-06-10 20:57:17 -0400 (Fri, 10 Jun 2005)
New Revision: 203
Removed:
branches/brysonda/source/event/cPopulation.events
branches/brysonda/source/event/event.cc
branches/brysonda/source/event/event_factory.cc
branches/brysonda/source/event/event_factory.hh
branches/brysonda/source/event/event_list_entry.cc
branches/brysonda/source/event/make_events.pl
Modified:
branches/brysonda/Avida2.xcodeproj/project.pbxproj
branches/brysonda/source/cpu/hardware_tracer.hh
branches/brysonda/source/cpu/hardware_tracer_4stack.hh
branches/brysonda/source/cpu/hardware_tracer_cpu.hh
branches/brysonda/source/cpu/hardware_tracer_test_cpu.hh
branches/brysonda/source/defs.hh
branches/brysonda/source/event/event.hh
branches/brysonda/source/event/event.pri
branches/brysonda/source/event/event_factory_manager.cc
branches/brysonda/source/event/event_factory_manager.hh
branches/brysonda/source/event/event_list_entry.hh
branches/brysonda/source/event/event_triggers.hh
branches/brysonda/source/event/population_event_factory.cc
branches/brysonda/source/event/population_event_factory.hh
branches/brysonda/source/main/analyze.cc
branches/brysonda/source/main/genebank.cc
branches/brysonda/source/tools/message_display.hh
branches/brysonda/source/tools/tObjectFactory.h
Log:
Events cleanup, fix some GCC warnings.
Modified: branches/brysonda/Avida2.xcodeproj/project.pbxproj
===================================================================
--- branches/brysonda/Avida2.xcodeproj/project.pbxproj 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/Avida2.xcodeproj/project.pbxproj 2005-06-11 00:57:17 UTC (rev 203)
@@ -86,11 +86,8 @@
DCC3169507628584008F7A48 /* stats.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC311280762539E008F7A48 /* stats.cc */; };
DCC3169607628585008F7A48 /* task_entry.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3112A0762539E008F7A48 /* task_entry.cc */; };
DCC3169707628585008F7A48 /* task_lib.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3112C0762539E008F7A48 /* task_lib.cc */; };
- DCC316980762858C008F7A48 /* event.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FEE0762539D008F7A48 /* event.cc */; };
- DCC316990762858D008F7A48 /* event_factory.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FF10762539D008F7A48 /* event_factory.cc */; };
DCC3169A0762858E008F7A48 /* event_factory_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FF30762539D008F7A48 /* event_factory_manager.cc */; };
DCC3169B0762858F008F7A48 /* event_list.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FF50762539D008F7A48 /* event_list.cc */; };
- DCC3169D076285C4008F7A48 /* event_list_entry.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FF70762539D008F7A48 /* event_list_entry.cc */; };
DCC3169E076285C5008F7A48 /* event_list_iterator.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FF90762539D008F7A48 /* event_list_iterator.cc */; };
DCC3169F076285C6008F7A48 /* event_triggers.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FFB0762539D008F7A48 /* event_triggers.cc */; };
DCC316A1076285C8008F7A48 /* population_event_factory.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC310010762539D008F7A48 /* population_event_factory.cc */; };
@@ -109,9 +106,6 @@
DCC316AF076285DF008F7A48 /* memory_flags.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FC80762539D008F7A48 /* memory_flags.cc */; };
DCC316B0076285DF008F7A48 /* test_cpu.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FCA0762539D008F7A48 /* test_cpu.cc */; };
DCC316B1076285E0008F7A48 /* test_util.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC30FCC0762539D008F7A48 /* test_util.cc */; };
- DCC316B507628724008F7A48 /* trio.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC3146D076253A1008F7A48 /* trio.c */; };
- DCC316B607628726008F7A48 /* trionan.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC31471076253A1008F7A48 /* trionan.c */; };
- DCC316B707628728008F7A48 /* triostr.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC31474076253A1008F7A48 /* triostr.c */; };
DCC316B807628742008F7A48 /* weighted_index.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC315B3076253A5008F7A48 /* weighted_index.cc */; };
DCC316B907628744008F7A48 /* tools.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC315AA076253A4008F7A48 /* tools.cc */; };
DCC316BA07628749008F7A48 /* block_struct.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC31545076253A4008F7A48 /* block_struct.cc */; };
@@ -476,24 +470,18 @@
DCC30FCE0762539D008F7A48 /* defs.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = defs.hh; sourceTree = "<group>"; };
DCC30FCF0762539D008F7A48 /* Doxyfile */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; };
DCC30FEB0762539D008F7A48 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
- DCC30FEC0762539D008F7A48 /* cPopulation.events */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 30; path = cPopulation.events; sourceTree = "<group>"; };
DCC30FED0762539D008F7A48 /* cPopulation_event_list */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = cPopulation_event_list; sourceTree = "<group>"; };
- DCC30FEE0762539D008F7A48 /* event.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = event.cc; sourceTree = "<group>"; };
DCC30FEF0762539D008F7A48 /* event.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = event.hh; sourceTree = "<group>"; };
DCC30FF00762539D008F7A48 /* event.pri */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = event.pri; sourceTree = "<group>"; };
- DCC30FF10762539D008F7A48 /* event_factory.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = event_factory.cc; sourceTree = "<group>"; };
- DCC30FF20762539D008F7A48 /* event_factory.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = event_factory.hh; sourceTree = "<group>"; };
DCC30FF30762539D008F7A48 /* event_factory_manager.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = event_factory_manager.cc; sourceTree = "<group>"; };
DCC30FF40762539D008F7A48 /* event_factory_manager.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = event_factory_manager.hh; sourceTree = "<group>"; };
DCC30FF50762539D008F7A48 /* event_list.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = event_list.cc; sourceTree = "<group>"; };
DCC30FF60762539D008F7A48 /* event_list.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = event_list.hh; sourceTree = "<group>"; };
- DCC30FF70762539D008F7A48 /* event_list_entry.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = event_list_entry.cc; sourceTree = "<group>"; };
DCC30FF80762539D008F7A48 /* event_list_entry.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = event_list_entry.hh; sourceTree = "<group>"; };
DCC30FF90762539D008F7A48 /* event_list_iterator.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = event_list_iterator.cc; sourceTree = "<group>"; };
DCC30FFA0762539D008F7A48 /* event_list_iterator.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = event_list_iterator.hh; sourceTree = "<group>"; };
DCC30FFB0762539D008F7A48 /* event_triggers.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = event_triggers.cc; sourceTree = "<group>"; };
DCC30FFC0762539D008F7A48 /* event_triggers.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = event_triggers.hh; sourceTree = "<group>"; };
- DCC30FFD0762539D008F7A48 /* make_events.pl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.perl; path = make_events.pl; sourceTree = "<group>"; };
DCC310000762539D008F7A48 /* population_event.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = population_event.hh; sourceTree = "<group>"; };
DCC310010762539D008F7A48 /* population_event_factory.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = population_event_factory.cc; sourceTree = "<group>"; };
DCC310020762539D008F7A48 /* population_event_factory.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = population_event_factory.hh; sourceTree = "<group>"; };
@@ -1504,24 +1492,18 @@
isa = PBXGroup;
children = (
DCC30FEB0762539D008F7A48 /* CMakeLists.txt */,
- DCC30FEC0762539D008F7A48 /* cPopulation.events */,
DCC30FED0762539D008F7A48 /* cPopulation_event_list */,
- DCC30FEE0762539D008F7A48 /* event.cc */,
DCC30FEF0762539D008F7A48 /* event.hh */,
DCC30FF00762539D008F7A48 /* event.pri */,
- DCC30FF10762539D008F7A48 /* event_factory.cc */,
- DCC30FF20762539D008F7A48 /* event_factory.hh */,
DCC30FF30762539D008F7A48 /* event_factory_manager.cc */,
DCC30FF40762539D008F7A48 /* event_factory_manager.hh */,
DCC30FF50762539D008F7A48 /* event_list.cc */,
DCC30FF60762539D008F7A48 /* event_list.hh */,
- DCC30FF70762539D008F7A48 /* event_list_entry.cc */,
DCC30FF80762539D008F7A48 /* event_list_entry.hh */,
DCC30FF90762539D008F7A48 /* event_list_iterator.cc */,
DCC30FFA0762539D008F7A48 /* event_list_iterator.hh */,
DCC30FFB0762539D008F7A48 /* event_triggers.cc */,
DCC30FFC0762539D008F7A48 /* event_triggers.hh */,
- DCC30FFD0762539D008F7A48 /* make_events.pl */,
DCC310000762539D008F7A48 /* population_event.hh */,
DCC310010762539D008F7A48 /* population_event_factory.cc */,
DCC310020762539D008F7A48 /* population_event_factory.hh */,
@@ -2816,7 +2798,6 @@
isa = PBXNativeTarget;
buildConfigurationList = 702442D20859E0B00059BD9B /* Build configuration list for PBXNativeTarget "primitive" */;
buildPhases = (
- DCBB56590763EA7F00FA9C7E /* ShellScript */,
DCC3164A07626CF3008F7A48 /* Sources */,
DCC3164B07626CF3008F7A48 /* Frameworks */,
70486B9508267145009328F0 /* CopyFiles */,
@@ -2874,29 +2855,6 @@
};
/* End PBXProject section */
-/* Begin PBXShellScriptBuildPhase section */
- DCBB56590763EA7F00FA9C7E /* ShellScript */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- comments = "This is a hackish way to get the system to build the auto-generated code before compiling the rest of the system.";
- files = (
- );
- inputPaths = (
- );
- outputPaths = (
- "$(DERIVED_FILES_DIR)/cPopulation_construct_event_auto.ci",
- "$(DERIVED_FILES_DIR)/cPopulation_descr.ci",
- "$(DERIVED_FILES_DIR)/cPopulation_descr.hi",
- "$(DERIVED_FILES_DIR)/cPopulation_enums_auto.ci",
- "$(DERIVED_FILES_DIR)/cPopulation_name2enum_auto.ci",
- "$(DERIVED_FILES_DIR)/cPopulation_process_auto.ci",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "perl source/event/make_events.pl -x[source/event/cPopulation][$DERIVED_FILES_DIR]";
- };
-/* End PBXShellScriptBuildPhase section */
-
/* Begin PBXSourcesBuildPhase section */
DCC3164A07626CF3008F7A48 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -2960,11 +2918,8 @@
DCC3169507628584008F7A48 /* stats.cc in Sources */,
DCC3169607628585008F7A48 /* task_entry.cc in Sources */,
DCC3169707628585008F7A48 /* task_lib.cc in Sources */,
- DCC316980762858C008F7A48 /* event.cc in Sources */,
- DCC316990762858D008F7A48 /* event_factory.cc in Sources */,
DCC3169A0762858E008F7A48 /* event_factory_manager.cc in Sources */,
DCC3169B0762858F008F7A48 /* event_list.cc in Sources */,
- DCC3169D076285C4008F7A48 /* event_list_entry.cc in Sources */,
DCC3169E076285C5008F7A48 /* event_list_iterator.cc in Sources */,
DCC3169F076285C6008F7A48 /* event_triggers.cc in Sources */,
DCC316A1076285C8008F7A48 /* population_event_factory.cc in Sources */,
@@ -2983,9 +2938,6 @@
DCC316AF076285DF008F7A48 /* memory_flags.cc in Sources */,
DCC316B0076285DF008F7A48 /* test_cpu.cc in Sources */,
DCC316B1076285E0008F7A48 /* test_util.cc in Sources */,
- DCC316B507628724008F7A48 /* trio.c in Sources */,
- DCC316B607628726008F7A48 /* trionan.c in Sources */,
- DCC316B707628728008F7A48 /* triostr.c in Sources */,
DCC316B807628742008F7A48 /* weighted_index.cc in Sources */,
DCC316B907628744008F7A48 /* tools.cc in Sources */,
DCC316BA07628749008F7A48 /* block_struct.cc in Sources */,
Modified: branches/brysonda/source/cpu/hardware_tracer.hh
===================================================================
--- branches/brysonda/source/cpu/hardware_tracer.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/cpu/hardware_tracer.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -8,8 +8,9 @@
#ifndef HARDWARE_TRACER_HH
#define HARDWARE_TRACER_HH
-struct cHardwareTracer {
- virtual ~cHardwareTracer(){}
+struct cHardwareTracer
+{
+ virtual ~cHardwareTracer() { ; }
};
#endif
Modified: branches/brysonda/source/cpu/hardware_tracer_4stack.hh
===================================================================
--- branches/brysonda/source/cpu/hardware_tracer_4stack.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/cpu/hardware_tracer_4stack.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -10,6 +10,7 @@
class cHardware4Stack;
struct cHardwareTracer_4Stack {
+ virtual ~cHardwareTracer_4Stack() { ; }
virtual void TraceHardware_4Stack(cHardware4Stack &) = 0;
virtual void TraceHardware_4StackBonus(cHardware4Stack &) = 0;
};
Modified: branches/brysonda/source/cpu/hardware_tracer_cpu.hh
===================================================================
--- branches/brysonda/source/cpu/hardware_tracer_cpu.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/cpu/hardware_tracer_cpu.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -10,6 +10,7 @@
class cHardwareCPU;
struct cHardwareTracer_CPU {
+ virtual ~cHardwareTracer_CPU() { ; }
virtual void TraceHardware_CPU(cHardwareCPU &) = 0;
virtual void TraceHardware_CPUBonus(cHardwareCPU &) = 0;
};
Modified: branches/brysonda/source/cpu/hardware_tracer_test_cpu.hh
===================================================================
--- branches/brysonda/source/cpu/hardware_tracer_test_cpu.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/cpu/hardware_tracer_test_cpu.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -10,6 +10,7 @@
class cString;
struct cHardwareTracer_TestCPU {
+ virtual ~cHardwareTracer_TestCPU() { ; }
virtual void TraceHardware_TestCPU(
int time_used,
int time_allocated,
Modified: branches/brysonda/source/defs.hh
===================================================================
--- branches/brysonda/source/defs.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/defs.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -152,6 +152,7 @@
#ifndef _WINDEF_ // Defined by WINDOWS.H
#define UCHAR unsigned char
+ #undef UINT
#define UINT unsigned int
#endif
Deleted: branches/brysonda/source/event/cPopulation.events
===================================================================
--- branches/brysonda/source/event/cPopulation.events 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/cPopulation.events 2005-06-11 00:57:17 UTC (rev 203)
@@ -1,2147 +0,0 @@
-######## Meta Events ###########
-exit
-:descr:
-/**
-* Ends the Avida run immediately.
-**/
-:args:
-:body:
-cAvidaDriver_Base::main_driver->SetDone();
-
-exit_if_generation_greater_than
-:descr:
-/**
-* Ends the Avida run when the current generation exceeds the
-* maximum generation given as parameter.
-*
-* Parameters:
-* max generation (int)
-* The generation at which the run should be stopped.
-**/
-:args:
-int max_generation
-:body:
-if( population->GetGeneration() > max_generation ){
- cAvidaDriver_Base::main_driver->SetDone();
-}
-
-exit_if_update_greater_than
-:descr:
-/**
-* Ends the Avida run when the current update exceeds the
-* maximum update given as parameter.
-*
-* Parameters:
-* max update (int)
-* The update at which the run should be stopped.
-**/
-:args:
-int max_update
-:body:
-if( population->GetUpdate() > max_update ){
- cAvidaDriver_Base::main_driver->SetDone();
-}
-
-
-exit_if_ave_lineage_label_smaller
-:descr:
-/**
-* Halts the avida run if the current average lineage label is smaller
-* than the value given as parameter.
-*
-* Parameters:
-* lineage_label_crit_value (int)
-* The critical value to which the average lineage label is compared.
-**/
-:args:
-double lineage_label_crit_value
-:body:
-if( population->GetStats().GetAveLineageLabel() < lineage_label_crit_value ){
- cAvidaDriver_Base::main_driver->SetDone();
-}
-
-exit_if_ave_lineage_label_larger
-:descr:
-/**
-* Halts the avida run if the current average lineage label is larger
-* than the value given as parameter.
-*
-* Parameters:
-* lineage_label_crit_value (int)
-* The critical value to which the average lineage label is compared.
-**/
-:args:
-double lineage_label_crit_value
-:body:
-if( population->GetStats().GetAveLineageLabel() > lineage_label_crit_value ){
- cAvidaDriver_Base::main_driver->SetDone();
-}
-
-echo
-:descr:
-/**
-* Writes out a message. If no message is given, average update and
-* generation are written out.
-*
-* Parameters:
-* message (string)
-**/
-:args:
-cString mesg
-:body:
-if( mesg == "" ){
- mesg.Set("Echo : Update = %f\t AveGeneration = %f",
- population->GetUpdate(), population->GetGeneration());
-}
-cAvidaDriver_Base::main_driver->NotifyComment(mesg);
-
-####### Printing Data Files ###########
-print_data
-:descr:
-/**
-* Output user-defined data from the cStats object...
-*
-* Parameters:
-* filename (string)
-* The name of the data file.
-* format
-* A comma-seperated list of statistics to output.
-**/
-:args:
-cString filename
-cString format
-:body:
-population->GetStats().PrintDataFile(filename, format, ',');
-
-print_average_data
-:descr:
-/**
-* Output various average quantities into datafile.
-*
-* Parameters:
-* filename (string) default: average.dat
-* The name of the data file.
-**/
-:args:
-cString fname "average.dat"
-:body:
-population->GetStats().PrintAverageData(fname);
-
-print_error_data
-:descr:
-/**
-* Prints out various data related to statistical errors.
-*
-* Parameters:
-* filename (string) default: error.dat
-* The name of the data file.
-**/
-:args:
-cString fname "error.dat"
-:body:
-population->GetStats().PrintErrorData(fname);
-
-print_variance_data
-:descr:
-/**
-* Prints out various variances.
-*
-* Parameters:
-* filename (string) default: variance.dat
-* The name of the data file.
-**/
-:args:
-cString fname "variance.dat"
-:body:
-population->GetStats().PrintVarianceData(fname);
-
-print_dominant_data
-:descr:
-/**
-* Output various quantities related to the dominant organism.
-*
-* Parameters:
-* filename (string) default: dominant.dat
-* The name of the data file.
-**/
-:args:
-cString fname "dominant.dat"
-:body:
-population->GetStats().PrintDominantData(fname);
-
-print_stats_data
-:descr:
-/**
-* Output various statistical quantities.
-*
-* Parameters:
-* filename (string) default: stats.dat
-* The name of the data file.
-**/
-:args:
-cString fname "stats.dat"
-:body:
-population->GetStats().PrintStatsData(fname);
-
-print_count_data
-:descr:
-/**
-* Output various counts, such as number of organisms etc.
-*
-* Parameters:
-* filename (string) default: count.dat
-* The name of the data file.
-**/
-:args:
-cString fname "count.dat"
-:body:
-population->GetStats().PrintCountData(fname);
-
-print_totals_data
-:descr:
-/**
-* Various total numbers.
-*
-* Parameters:
-* filename (string) default: totals.dat
-* The name of the data file.
-**/
-:args:
-cString fname "totals.dat"
-:body:
-population->GetStats().PrintTotalsData(fname);
-
-print_tasks_data
-:descr:
-/**
-* Output the number of times the various tasks have been performed in the
-* last update.
-*
-* Parameters:
-* filename (string) default: tasks.dat
-* The name of the data file.
-**/
-:args:
-cString fname "tasks.dat"
-:body:
-population->GetStats().PrintTasksData(fname);
-
-print_tasks_exe_data
-:descr:
-/**
-**/
-:args:
-cString fname "tasks_exe.dat"
-:body:
-population->GetStats().PrintTasksExeData(fname);
-
-print_resource_data
-:descr:
-/**
-**/
-:args:
-cString fname "resource.dat"
-:body:
-population->GetStats().PrintResourceData(fname);
-
-print_time_data
-:descr:
-/**
-* Output time related data, such as update, generation, etc.
-*
-* Parameters:
-* filename (string) default: time.dat
-* The name of the data file.
-**/
-:args:
-cString fname "time.dat"
-:body:
-population->GetStats().PrintTimeData(fname);
-
-print_mutation_data
-:descr:
-/**
-**/
-:args:
-cString fname "mutation.dat"
-:body:
-population->GetStats().PrintMutationData(fname);
-
-print_mutation_rate_data
-:descr:
-/**
-Output (regular and log) statistics about individual copy
-mutation rates (aver, stdev, skew, cur).
-Useful only when mutation rate is set per organism.
-**/
-:args:
-cString fname "mutation_rates.dat"
-:body:
-population->GetStats().PrintMutationRateData(fname);
-
-print_divide_mut_data
-:descr:
-/**
-Output (regular and log) statistics about individual, per site,
-rates divide mutation rates (aver, stdev, skew, cur).
-Use with multiple divide instuction set.
-**/
-:args:
-cString fname "divide_mut.dat"
-:body:
-population->GetStats().PrintDivideMutData(fname);
-
-print_dom_parasite_data
-:descr:
-/**
-* Output various quantities related to the dominant parasite.
-*
-* Parameters:
-* filename (string) default: parasite.dat
-* The name of the data file.
-**/
-:args:
-cString fname "parasite.dat"
-:body:
-population->GetStats().PrintDominantParaData(fname);
-
-######### Instruction Data Output ##############
-print_instruction_data
-:descr:
-/**
-Sum of the by-organisms counts of what instructions they _successfully_
-execute beteween birth and divide. Prior to their first divide, organisms
-report values for their parents.
-**/
-:args:
-cString fname "instruction.dat"
-:body:
-population->GetStats().PrintInstructionData(fname);
-
-########### Population Instruction Abundance ######
-########### ED 2002-Sept-7 #################
-print_instruction_abundance_histogram
-:descr:
-/**
-*
-* Appends a line containing the bulk count (abundance) of
-* each instruction in the population onto a file.
-*
-* Parameters:
-* filename (string) default: "instruction_histogram.dat"
-*
-**/
-:args:
-cString filename "instruction_histogram.dat"
-:body:
-ofstream & fp = population->GetStats().GetDataFileOFStream(filename);
-cAnalyzeUtil::PrintInstructionAbundanceHistogram(fp, population);
-
-
-
-########### Misc Output #################3
-print_depth_histogram
-:descr:
-/**
-**/
-:args:
-cString filename "depth_histogram.dat"
-:body:
-ofstream & fp = population->GetStats().GetDataFileOFStream(filename);
-cAnalyzeUtil::PrintDepthHistogram(fp, population);
-
-print_genotype_abundance_histogram
-:descr:
-/**
-* 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.
-**/
-:args:
-cString filename "genotype_abundance_histogram.dat"
-:body:
-ofstream & fp = population->GetStats().GetDataFileOFStream(filename);
-cAnalyzeUtil::PrintGenotypeAbundanceHistogram(fp, population);
-
-print_species_abundance_histogram
-:descr:
-/**
-* 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.
-**/
-:args:
-cString filename "species_abundance_histogram.dat"
-:body:
-ofstream & fp = population->GetStats().GetDataFileOFStream(filename);
-cAnalyzeUtil::PrintSpeciesAbundanceHistogram(fp, population);
-
-print_lineage_totals
-:descr:
-/**
-**/
-:args:
-cString fname "lineage_totals.dat"
-int verbose 1
-:body:
-static bool msg_printed = false;
-if (population->GetLineageControl() == NULL) {
- if ( msg_printed == false ){
- ofstream & fp = population->GetStats().GetDataFileOFStream(fname);
- fp << "No lineage data available!" << endl;
- msg_printed = true;
- }
- return;
-}
-population->GetLineageControl()->PrintLineageTotals(fname, verbose);
-
-print_lineage_counts
-:descr:
-/**
-**/
-:args:
-cString fname "lineage_counts.dat"
-int verbose 0
-:body:
-static bool msg_printed = false;
-if (population->GetLineageControl() == NULL) {
- if ( msg_printed == false ){
- ofstream & fp = population->GetStats().GetDataFileOFStream(fname);
- fp << "No lineage data available!" << endl;
- msg_printed = true;
- }
- return;
-}
-if (verbose) { // verbose mode is the same in both methods
- population->GetLineageControl()->PrintLineageTotals(fname, verbose);
- return;
-}
-population->GetLineageControl()->PrintLineageCurCounts(fname);
-
-print_dom
-:descr:
-/**
-* 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
-* genebank, under the name that the genebank has associated with
-* this genotype.
-**/
-:args:
-cString in_filename ""
-:body:
-cGenotype * dom = population->GetGenebank().GetBestGenotype();
-cString filename(in_filename);
-if (filename == "") filename.Set("genebank/%s", dom->GetName()());
-cTestUtil::PrintGenome(dom->GetGenome(), filename, dom, population->GetUpdate());
-
-parasite_debug
-:descr:
-//midget
-:args:
-cString in_filename ""
-:body:
-population->ParasiteDebug();
-
-print_dom_parasite
-:descr:
-/**
-* 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
-* genebank, under the name that the genebank has associated with
-* this genotype.
-**/
-:args:
-cString in_filename ""
-:body:
-cInjectGenotype * dom = population->GetInjectGenebank().GetBestInjectGenotype();
-if (dom!=NULL) {
-cString filename(in_filename);
-if (filename == "") filename.Set("genebank/%s", dom->GetName()());
-cTestUtil::PrintGenome(dom, dom->GetGenome(), filename, population->GetUpdate()); }
-
-print_genotype_map
-:descr:
-/**
-* write a matrix of genotype ID's to a file (matlab format)
-**/
-:args:
-cString fname "genotype_map.m"
-:body:
-population->GetStats().PrintGenotypeMap(fname);
-
-print_number_phenotypes
-:descr:
-/**
-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.
-**/
-:args:
-cString fname "phenotype_count.dat"
-:body:
-population->PrintPhenotypeData(fname);
-
-print_phenotype_status
-:descr:
-/**
-Prints merit status for all the organisms in the population.
-Used for testing/debuging.
-**/
-:args:
-cString fname "phenotype_status.dat"
-:body:
-population->PrintPhenotypeStatus(fname);
-
-######### SAVE/LOAD POPULATION ######################
-save_population
-:descr:
-/**
-* Saves the full state of the population.
-*
-* Parameters:
-* filename (string) default: save_pop.*
-* The name of the file into which the population should
-* be saved. If it is not given, then the name 'save_pop.*'
-* is used, with '*' replaced by the current update.
-**/
-:args:
-cString fname ""
-:body:
-cString filename;
-if( fname == "" ){
- filename.Set("save_pop.%d", population->GetUpdate());
-}
-ofstream fp(filename());
-population->SavePopulation(fp);
-
-load_population
-:descr:
-/**
-* Loads the full state of the population.
-*
-* Parameters:
-* filename (string)
-* The name of the file to open.
-**/
-:args:
-cString fname
-:body:
-ifstream fp(fname());
-population->LoadPopulation(fp);
-
-
-######### CLONES ######################
-save_clone
-:descr:
-/**
-**/
-:args:
-cString fname ""
-:body:
-cString filename;
-if( fname == "" ){
- filename.Set("clone.%d", population->GetUpdate());
-}
-ofstream fp(filename());
-population->SaveClone(fp);
-
-load_clone
-:descr:
-/**
-**/
-:args:
-cString fname
-:body:
-ifstream fp(fname());
-population->LoadClone(fp);
-
-
-load_dump_file
-:descr:
-/**
-* Sets up a population based on a dump file such as written out by
-* detail_pop. It is also possible to append a history file to the dump
-* file, in order to preserve the history of a previous run.
-**/
-:args:
-cString fname
-int update -1
-:body:
-population->LoadDumpFile(fname, update);
-
-########## DUMP A TEXT SUMMARY ###########
-dump_pop
-:descr:
-/**
-* Writes out a line of data for each genotype in the current population. The
-* line contains the genome as string, the number of organisms of that genotype,
-* and the genotype ID.
-*
-* Parameters:
-* filename (string) default: "dump.<update>"
-* The name of the file into which the population dump should be written.
-**/
-:args:
-cString fname ""
-:body:
-cString filename;
-if( fname == "" ){
- filename.Set("dump.%d", population->GetUpdate());
-}
-ofstream fp(filename());
-population->GetGenebank().DumpTextSummary(fp);
-
-print_genotypes
-:descr:
-/**
-* This is a new version of "detail_pop" or "historic_dump". It allows you to
-* output one line per genotype in memory where you get to choose what data
-* should be included.
-*
-* Parameters
-* data_fields (string)
-* This must be a comma separated string of all data you wish to output.
-* Options include: id, parent_id, parent2_id (for sex), parent_dist,
-* num_cpus, total_cpus, length, merit, gest_time, fitness, update_born,
-* update_dead, depth, lineage, sequence
-* historic (int) default: 0
-* How many updates back of history should we include (-1 = all)
-* filename (string) default: "genotypes-<update>.dat"
-* The name of the file into which the population dump should be written.
-**/
-:args:
-cString data_fields "all"
-int historic 0
-cString fname ""
-:body:
-cString filename = fname;
-if (filename == "") {
- filename.Set("genotypes-%d.dat", population->GetUpdate());
-}
-ofstream fp(filename());
-population->GetGenebank().PrintGenotypes(fp, data_fields, historic);
-
-detail_pop
-:descr:
-/**
-* Like dump_pop, but more detailed data is written out.
-*
-* Parameters:
-* filename (string) default: "detail_pop.<update>"
-* The name of the file into which the population dump should be written.
-**/
-:args:
-cString fname ""
-:body:
-cString filename;
-if( fname == "" ){
- filename.Set("detail_pop.%d", population->GetUpdate());
-}
-ofstream fp(filename());
-population->GetGenebank().DumpDetailedSummary(fp);
-
-detail_sex_pop
-:descr:
-/**
-* Like detail_pop, but for sexual populations.
-* Info for both parents is writen out.
-*
-* Parameters:
-* filename (string) default: "detail_pop.<update>"
-* The name of the file into which the population dump should be written.
-**/
-:args:
-cString fname ""
-:body:
-cString filename;
-if( fname == "" ){
- filename.Set("detail_pop.%d", population->GetUpdate());
-}
-ofstream fp(filename());
-population->GetGenebank().DumpDetailedSexSummary(fp);
-
-
-detail_parasite_pop
-:descr:
-/**
-* Like dump_pop, but more detailed data is written out.
-*
-* Parameters:
-* filename (string) default: "detail_pop.<update>"
-* The name of the file into which the population dump should be written.
-**/
-:args:
-cString fname ""
-:body:
-cString filename;
-if( fname == "" ){
- filename.Set("detail_parasite_pop.%d", population->GetUpdate());
-}
-//ofstream fp(filename());
-population->GetInjectGenebank().DumpDetailedSummary(filename, population->GetUpdate());
-
-dump_historic_pop
-:descr:
-/**
-* Similar to detail_pop. However, only genotypes that are not in the
-* current population anymore are included. Genotypes that are not in
-* the line of descent of any of the current genotypes to the ultimate
-* ancestor are excluded.
-*
-* Parameters:
-* back_dist (int) default: -1
-* How many updates back should we print? -1 goes forever. Use the
-* distance to the last dump historic if you only want a "diff".
-* filename (string) default: "historic_dump.<update>"
-* The name of the file into which the historic dump should be written.
-**/
-:args:
-int back_dist -1
-cString fname ""
-:body:
-cString filename;
-if( fname == "" ){
- filename.Set("historic_dump.%d", population->GetUpdate());
-}
-ofstream fp(filename());
-population->GetGenebank().DumpHistoricSummary(fp, back_dist);
-
-dump_historic_sex_pop
-:descr:
-/**
-* Similar to dump_historic_pop, but for sexual populations.
-* ID of both parents is writen out.
-*
-* Parameters:
-* filename (string) default: "historic_dump.<update>"
-* The name of the file into which the historic dump should be written.
-**/
-:args:
-cString fname ""
-:body:
-cString filename;
-if( fname == "" ){
- filename.Set("historic_dump.%d", population->GetUpdate());
-}
-ofstream fp(filename());
-population->GetGenebank().DumpHistoricSexSummary(fp);
-
-dump_memory
-:descr:
-/**
-* Dump the current memory state of all CPUs to a file.
-**/
-:args:
-cString fname ""
-:body:
-cString filename;
-if (fname == "") {
- filename.Set("memory_dump.%d", population->GetUpdate());
-}
-ofstream fp(filename());
-population->DumpMemorySummary(fp);
-
-################ INJECT ###################
-inject
-:descr:
-/**
-* Injects a single organism into the population.
-*
-* Parameters:
-* filename (string)
-* The filename of the genotype to load. If this is left empty, or the keyword
-* "START_CREATURE" is given, than the genotype specified in the genesis
-* file under "START_CREATURE" is used.
-* cell ID (integer) default: 0
-* The grid-point into which the organism should be placed.
-* merit (double) default: -1
-* The initial merit of the organism. If set to -1, this is ignored.
-* lineage label (integer) default: 0
-* An integer that marks all descendants of this organism.
-* neutral metric (double) default: 0
-* A double value that randomly drifts over time.
-**/
-:args:
-cString fname "START_CREATURE"
-int cell_id 0
-double merit -1
-int lineage_label 0
-double neutral_metric 0
-:body:
-if (fname == "START_CREATURE") fname=cConfig::GetStartCreature();
-cGenome genome =
- cInstUtil::LoadGenome(fname, population->GetEnvironment().GetInstSet());
-population->Inject(genome, cell_id, merit, lineage_label, neutral_metric);
-
-inject_all
-:descr:
-/**
-* Injects identical organisms into all cells of the population.
-*
-* Parameters:
-* filename (string)
-* The filename of the genotype to load. If this is left empty, or the keyword
-* "START_CREATURE" is given, than the genotype specified in the genesis
-* file under "START_CREATURE" is used.
-* merit (double) default: -1
-* The initial merit of the organism. If set to -1, this is ignored.
-* lineage label (integer) default: 0
-* An integer that marks all descendants of this organism.
-* neutral metric (double) default: 0
-* A double value that randomly drifts over time.
-**/
-:args:
-cString fname "START_CREATURE"
-double merit -1
-int lineage_label 0
-double neutral_metric 0
-:body:
-if (fname == "START_CREATURE") fname=cConfig::GetStartCreature();
-cGenome genome =
- cInstUtil::LoadGenome(fname, population->GetEnvironment().GetInstSet());
-for (int i = 0; i < population->GetSize(); i++) {
- population->Inject(genome, i, merit, lineage_label, neutral_metric);
-}
-population->SetSyncEvents(true);
-
-inject_range
-:descr:
-/**
-* Injects identical organisms into a range of cells of the population.
-*
-* Parameters:
-* filename (string)
-* The filename of the genotype to load. If this is left empty, or the keyword
-* "START_CREATURE" is given, than the genotype specified in the genesis
-* file under "START_CREATURE" is used.
-* start_cell (int)
-* First cell to inject into.
-* stop_cell (int)
-* First cell *not* to inject into.
-* merit (double) default: -1
-* The initial merit of the organism. If set to -1, this is ignored.
-* lineage label (integer) default: 0
-* An integer that marks all descendants of this organism.
-* neutral metric (double) default: 0
-* A double value that randomly drifts over time.
-*
-* Example:
-* inject_range creature.gen 0 10
-*
-* Will inject 10 organisms into cells 0 through 9.
-**/
-:args:
-cString fname "START_CREATURE"
-int start_cell 0
-int end_cell -1
-double merit -1
-int lineage_label 0
-double neutral_metric 0
-:body:
-if (fname == "START_CREATURE") fname=cConfig::GetStartCreature();
-if (end_cell == -1) end_cell = start_cell + 1;
-if (start_cell < 0 ||
- end_cell > population->GetSize() ||
- start_cell >= end_cell) {
- cout << "Warning: inject_range has invalid range!";
-}
-else {
- cGenome genome =
- cInstUtil::LoadGenome(fname, population->GetEnvironment().GetInstSet());
- for (int i = start_cell; i < end_cell; i++) {
- population->Inject(genome, i, merit, lineage_label, neutral_metric);
- }
- population->SetSyncEvents(true);
-}
-
-inject_sequence
-:descr:
-/**
-* Injects identical organisms into a range of cells of the population.
-*
-* Parameters:
-* sequence (string)
-* The genome sequence for this organism. This is a mandatory argument.
-* start_cell (int)
-* First cell to inject into.
-* stop_cell (int)
-* First cell *not* to inject into.
-* merit (double) default: -1
-* The initial merit of the organism. If set to -1, this is ignored.
-* lineage label (integer) default: 0
-* An integer that marks all descendants of this organism.
-* neutral metric (double) default: 0
-* A double value that randomly drifts over time.
-*
-* Example:
-* inject_range ckdfhgklsahnfsaggdsgajfg 0 10 100
-*
-* Will inject 10 organisms into cells 0 through 9 with a merit of 100.
-**/
-:args:
-cString seq
-int start_cell 0
-int end_cell -1
-double merit -1
-int lineage_label 0
-double neutral_metric 0
-:body:
-if (end_cell == -1) end_cell = start_cell + 1;
-if (start_cell < 0 ||
- end_cell > population->GetSize() ||
- start_cell >= end_cell) {
- cout << "Warning: inject_sequence has invalid range!" << endl;
- cout << "start=" << start_cell << " end=" << end_cell
- << "genome length=" << seq.GetSize() << endl;
-}
-else {
- cGenome genome(seq);
- for (int i = start_cell; i < end_cell; i++) {
- population->Inject(genome, i, merit, lineage_label, neutral_metric);
- }
- population->SetSyncEvents(true);
-}
-
-inject_random
-:descr:
-/**
-* Injects a randomly generated genome into the population.
-*
-* Parameters:
-* length (integer) [required]
-* Number of instructions in the randomly generated genome.
-* cell ID (integer) default: -1
-* The grid-point into which the genome should be placed. Default is random.
-* merit (double) default: -1
-* The initial merit of the organism. If set to -1, this is ignored.
-* lineage label (integer) default: 0
-* An integer that marks all descendants of this organism.
-* neutral metric (double) default: 0
-* A double value that randomly drifts over time.
-**/
-:args:
-int length
-int cell_id -1
-double merit -1
-int lineage_label 0
-double neutral_metric 0
-:body:
-if (cell_id == -1) cell_id = g_random.GetUInt(population->GetSize());
-cGenome genome =
- cInstUtil::RandomGenome(length, population->GetEnvironment().GetInstSet());
-population->Inject(genome, cell_id, merit, lineage_label, neutral_metric);
-
-inject_range_parasite
-:descr:
-/**
-* Injects identical organisms into a range of cells of the population.
-*
-* Parameters:
-* filename (string)
-* The filename of the genotype to load. If this is left empty, or the keyword
-* "START_CREATURE" is given, than the genotype specified in the genesis
-* file under "START_CREATURE" is used.
-* start_cell (int)
-* First cell to inject into.
-* stop_cell (int)
-* First cell *not* to inject into.
-* merit (double) default: -1
-* The initial merit of the organism. If set to -1, this is ignored.
-* lineage label (integer) default: 0
-* An integer that marks all descendants of this organism.
-* neutral metric (double) default: 0
-* A double value that randomly drifts over time.
-*
-* Example:
-* inject_range creature.gen 0 10
-*
-* Will inject 10 organisms into cells 0 through 9.
-**/
-:args:
-cString fname_parasite "organism.parasite"
-int start_cell 0
-int end_cell -1
-double merit -1
-int lineage_label 0
-double neutral_metric 0
-int mem_space 2
-:body:
-if (fname_parasite == "START_CREATURE") fname_parasite=cConfig::GetStartCreature();
-if (end_cell == -1) end_cell = start_cell + 1;
-if (start_cell < 0 ||
- end_cell > population->GetSize() ||
- start_cell >= end_cell) {
- cout << "Warning: inject_range has invalid range!";
-}
-else {
- cGenome genome_parasite =
- cInstUtil::LoadGenome(fname_parasite, population->GetEnvironment().GetInstSet());
- for (int i = start_cell; i < end_cell; i++) {
- population->Inject(genome_parasite, i, merit, lineage_label, neutral_metric, mem_space);
- }
- population->SetSyncEvents(true);
-}
-
-inject_range_pair
-:descr:
-/**
-* Injects identical organisms into a range of cells of the population.
-*
-* Parameters:
-* filename (string)
-* The filename of the genotype to load. If this is left empty, or the keyword
-* "START_CREATURE" is given, than the genotype specified in the genesis
-* file under "START_CREATURE" is used.
-* start_cell (int)
-* First cell to inject into.
-* stop_cell (int)
-* First cell *not* to inject into.
-* merit (double) default: -1
-* The initial merit of the organism. If set to -1, this is ignored.
-* lineage label (integer) default: 0
-* An integer that marks all descendants of this organism.
-* neutral metric (double) default: 0
-* A double value that randomly drifts over time.
-*
-* Example:
-* inject_range creature.gen 0 10
-*
-* Will inject 10 organisms into cells 0 through 9.
-**/
-:args:
-cString fname "START_CREATURE"
-cString fname_parasite "organism.parasite"
-int start_cell 0
-int end_cell -1
-double merit -1
-int lineage_label 0
-double neutral_metric 0
-int mem_space 2
-:body:
-if (fname == "START_CREATURE") fname=cConfig::GetStartCreature();
-if (end_cell == -1) end_cell = start_cell + 1;
-if (start_cell < 0 ||
- end_cell > population->GetSize() ||
- start_cell >= end_cell) {
- cout << "Warning: inject_range has invalid range!";
-}
-else {
- cGenome genome =
- cInstUtil::LoadGenome(fname, population->GetEnvironment().GetInstSet());
- cGenome genome_parasite =
- cInstUtil::LoadGenome(fname_parasite, population->GetEnvironment().GetInstSet());
- for (int i = start_cell; i < end_cell; i++) {
- population->Inject(genome, i, merit, lineage_label, neutral_metric);
- population->Inject(genome_parasite, i, merit, lineage_label, neutral_metric, mem_space);
- }
- population->SetSyncEvents(true);
-}
-
-################ MUTATION RATES ###############
-zero_muts
-:descr:
-/**
- * This event will set all mutation rates to zero...
- **/
-:args:
-:body:
-for (int i = 0; i < population->GetSize(); i++) {
- population->GetCell(i).MutationRates().Clear();
-}
-
-mod_copy_mut
-:descr:
-/**
-**/
-:args:
-double cmut_inc
-int cell -1
-:body:
-const double new_cmut = cConfig::GetCopyMutProb() + cmut_inc;
-if (cell < 0) { // cell == -1 --> all
- for (int i = 0; i < population->GetSize(); i++) {
- population->GetCell(i).MutationRates().SetCopyMutProb(new_cmut);
- }
- cConfig::SetCopyMutProb(new_cmut);
-} else {
- population->GetCell(cell).MutationRates().SetCopyMutProb(new_cmut);
-}
-
-mod_div_mut
-:descr:
-/**
-**/
-:args:
-double dmut_inc
-int cell -1
-:body:
-const double new_div_mut = cConfig::GetDivMutProb() + dmut_inc;
-if (cell < 0) { // cell == -1 --> all
- for (int i = 0; i < population->GetSize(); i++) {
- population->GetCell(i).MutationRates().SetDivMutProb(new_div_mut);
- }
- cConfig::SetDivMutProb(new_div_mut);
-} else {
- population->GetCell(cell).MutationRates().SetDivMutProb(new_div_mut);
-}
-
-
-set_copy_mut
-:descr:
-/**
-**/
-:args:
-double cmut
-int start_cell -1
-int end_cell -1
-:body:
-if (start_cell < 0) { // start_cell == -1 --> all
- cConfig::SetCopyMutProb(cmut);
- start_cell = 0;
- end_cell = population->GetSize();
-}
-else if (end_cell < -1) { // end_cell == -1 --> Only one cell!
- end_cell = start_cell + 1;
-}
-assert(start_cell >= 0 && start_cell < population->GetSize());
-assert(end_cell > 0 && end_cell <= population->GetSize());
-for (int i = start_cell; i < end_cell; i++) {
- population->GetCell(i).MutationRates().SetCopyMutProb(cmut);
-}
-
-mod_point_mut
-:descr:
-/**
-**/
-:args:
-double pmut_inc
-int cell -1
-:body:
-const double new_pmut = cConfig::GetPointMutProb() + pmut_inc;
-if (cell < 0) { // cell == -1 --> all
- for (int i = 0; i < population->GetSize(); i++) {
- population->GetCell(i).MutationRates().SetPointMutProb(new_pmut);
- }
- cConfig::SetPointMutProb(new_pmut);
-} else {
- population->GetCell(cell).MutationRates().SetPointMutProb(new_pmut);
-}
-
-set_point_mut
-:descr:
-/**
-**/
-:args:
-double pmut
-int cell -1
-:body:
-if (cell < 0) { // cell == -1 --> all
- for (int i = 0; i < population->GetSize(); i++) {
- population->GetCell(i).MutationRates().SetPointMutProb(pmut);
- }
- cConfig::SetPointMutProb(pmut);
-} else {
- population->GetCell(cell).MutationRates().SetPointMutProb(pmut);
-}
-
-######## Landscapeing #########
-calc_landscape
-:descr:
-/**
-**/
-:args:
-int landscape_dist 1
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-cAnalyzeUtil::CalcLandscape(landscape_dist, genome,
- population->GetEnvironment().GetInstSet());
-
-predict_w_landscape
-:descr:
-/**
-**/
-:args:
-cString datafile "land-predict.dat"
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-cLandscape landscape(genome, population->GetEnvironment().GetInstSet());
-static ofstream fp(datafile);
-landscape.PredictWProcess(fp);
-
-predict_nu_landscape
-:descr:
-/**
-**/
-:args:
-cString datafile "land-predict.dat"
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-cLandscape landscape(genome, population->GetEnvironment().GetInstSet());
-static ofstream fp(datafile);
-landscape.PredictNuProcess(fp);
-
-sample_landscape
-:descr:
-/**
-**/
-:args:
-int sample_size 0
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-cLandscape landscape(genome, population->GetEnvironment().GetInstSet());
-if (sample_size == 0) sample_size = population->GetEnvironment().GetInstSet().GetSize() - 1;
-landscape.SampleProcess(sample_size);
-static ofstream fp("land-sample.dat");
-landscape.PrintStats(fp, population->GetUpdate());
-
-random_landscape
-:descr:
-/**
-**/
-:args:
-int landscape_dist 1
-int sample_size 0
-int min_found 0
-int max_sample_size 0
-bool print_if_found false
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-cLandscape landscape(genome, population->GetEnvironment().GetInstSet());
-landscape.RandomProcess(sample_size, landscape_dist, min_found,
- max_sample_size, print_if_found);
-static ofstream fp("land-random.dat");
-landscape.PrintStats(fp, population->GetUpdate());
-
-analyze_landscape
-:descr:
-/**
-**/
-:args:
-int sample_size 1000
-int min_found 0
-int max_sample_size 0
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-cAnalyzeUtil::
-AnalyzeLandscape(genome, population->GetEnvironment().GetInstSet(),
- sample_size, min_found, max_sample_size,
- population->GetUpdate());
-
-pairtest_landscape
-:descr:
-/**
-* If sample_size = 0, pairtest the full landscape.
-**/
-:args:
-int sample_size 0
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-cAnalyzeUtil::PairTestLandscape(genome, population->GetEnvironment().GetInstSet(), sample_size, population->GetUpdate());
-
-test_dom
-:descr:
-/**
-**/
-:args:
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-static ofstream fp("dom-test.dat");
-cAnalyzeUtil::TestGenome(genome, population->GetEnvironment().GetInstSet(), fp, population->GetUpdate());
-
-analyze_population
-:descr:
-/**
-**/
-:args:
-double sample_prob 1
-int landscape 0
-int save_genotype 0
-cString filename ""
-:body:
-static bool auto_filename = false;
-if( filename == "" )
- auto_filename = true;
-if ( auto_filename )
- filename.Set("population_info_%d.dat",population->GetUpdate());
-ofstream population_info(filename());
-cAnalyzeUtil::AnalyzePopulation(population, population_info, sample_prob,
- landscape, save_genotype);
-
-print_detailed_fitness_data
-:descr:
-/**
-**/
-:args:
-int save_max_f_genotype 0
-int print_fitness_histo 0
-double hist_fmax 1
-double hist_fstep 0.1
-cString filename "fitness.dat"
-cString filename2 "fitness_histos.dat"
-cString filename3 "fitness_histos_testCPU.dat"
-:body:
-static ofstream datafile(filename());
-static ofstream histofile;
-static ofstream histofile_testCPU;
-if (print_fitness_histo && !histofile.is_open()){
- histofile.open(filename2());
- histofile_testCPU.open(filename3());
-}
-cAnalyzeUtil::PrintDetailedFitnessData( population, datafile, histofile, histofile_testCPU, save_max_f_genotype, print_fitness_histo, hist_fmax, hist_fstep );
-
-print_genetic_distance_data
-:descr:
-/**
-**/
-:args:
-cString creature_name ""
-cString filename "genetic_distance.dat"
-:body:
-static ofstream popdump(filename());
-if( creature_name == "" || creature_name == "START_CREATURE" ){
- creature_name = cConfig::GetStartCreature(); }
-cAnalyzeUtil::PrintGeneticDistanceData( population, popdump, creature_name() );
-
-genetic_distance_pop_dump
-:descr:
-/**
-**/
-:args:
-cString creature_name ""
-cString filename ""
-int save_genotype 0
-:body:
-static bool auto_filename = false;
-if( creature_name == "" || creature_name == "START_CREATURE" ){
- creature_name = cConfig::GetStartCreature(); }
-if( filename == "" || filename == "AUTO" )
- auto_filename = true;
-if ( auto_filename )
- filename.Set("pop_dump_%d.dat",population->GetUpdate());
-ofstream popdump(filename());
-cAnalyzeUtil::GeneticDistancePopDump( population, popdump, creature_name(), save_genotype );
-
-
-task_snapshot
-:descr:
-/**
-**/
-:args:
-cString filename ""
-:body:
-static bool auto_filename = false;
-if( filename == "" )
- auto_filename = true;
-if ( auto_filename )
- filename.Set("tasks_%d.dat",population->GetUpdate());
-ofstream snapshot_file(filename());
-cAnalyzeUtil::TaskSnapshot( population, snapshot_file );
-
-print_viable_tasks_data
-:descr:
-/**
-**/
-:args:
-cString filename "viable_tasks.dat"
-:body:
-static ofstream datafile(filename());
-cAnalyzeUtil::PrintViableTasksData( population, datafile );
-
-
-############ Removal of creatures #############
-apocalypse
-:descr:
-/**
-* Randomly removes a certain proportion of the population.
-*
-* Parameters:
-* removal probability (double) default: 0.9
-* The probability with which a single organism is removed.
-**/
-:args:
-double kill_prob .9
-:body:
-for (int i = 0; i < population->GetSize(); i++) {
- cPopulationCell & cell = population->GetCell(i);
- if (cell.IsOccupied() == false) continue;
- if (g_random.P(kill_prob)) population->KillOrganism(cell);
-}
-
-kill_rectangle
-:descr:
-/**
-* Kills all cell in a rectangle.
-*
-* Parameters:
-* cell [X1][Y1][x2][Y2] (integer) default: 0
-* The start and stoping grid-points into which the organism should
-be killed.
-**/
-:args:
-int cell_X1 0
-int cell_Y1 0
-int cell_X2 0
-int cell_Y2 0
-:body:
-int i, j, loc;
-/* Be sure the user entered a valid range */
-if (cell_X1 < 0) {
- cell_X1 = 0;
-} else if (cell_X1 > population->GetWorldX() - 1) {
- cell_X1 = population->GetWorldX() - 1;
-}
-if (cell_X2 < 0) {
- cell_X2 = 0;
-} else if (cell_X2 > population->GetWorldX() - 1) {
- cell_X2 = population->GetWorldX() - 1;
-}
-if (cell_Y1 < 0) {
- cell_Y1 = 0;
-} else if (cell_Y1 > population->GetWorldY() - 1) {
- cell_Y1 = population->GetWorldY() - 1;
-}
-if (cell_Y2 < 0) {
- cell_Y2 = 0;
-} else if (cell_Y2 > population->GetWorldY() - 1) {
- cell_Y2 = population->GetWorldY() - 1;
-}
-/* Account for a rectangle that crosses over the Zero X or Y cell */
-if (cell_X2 < cell_X1) {
- cell_X2 = cell_X2 + population->GetWorldX();
-}
-if (cell_Y2 < cell_Y1) {
- cell_Y2 = cell_Y2 + population->GetWorldY();
-}
-for (i = cell_Y1; i <= cell_Y2; i++) {
- for (j = cell_X1; j <= cell_X2; j++) {
- loc = (i % population->GetWorldY()) * population->GetWorldX() +
- (j % population->GetWorldX());
- cPopulationCell & cell = population->GetCell(loc);
- if (cell.IsOccupied() == true) {
- population->KillOrganism(cell);
- }
- }
-}
-population->SetSyncEvents(true);
-
-rate_kill
-:descr:
-/**
-* Randomly removes a certain proportion of the population.
-* In principle, this event does the same thing as the apocalypse event.
-* However, instead of a probability, here one has to specify a rate. The
-* rate has the same unit as fitness. So if the average fitness is 20000,
-* then you remove 50% of the population on every update with a removal rate
-* of 10000.
-*
-* Parameters:
-* removal rate (double)
-* The rate at which organisms are removed.
-**/
-:args:
-double kill_rate
-:body:
-double ave_merit = population->GetStats().SumMerit().Average();
-if ( ave_merit <= 0 )
- ave_merit = 1; // make sure that we don't get NAN's or negative numbers
-ave_merit /= cConfig::GetAveTimeslice();
-const double kill_prob = kill_rate / ave_merit;
-for (int i = 0; i < population->GetSize(); i++) {
- cPopulationCell & cell = population->GetCell(i);
- if (cell.IsOccupied() == false) continue;
- if (g_random.P(kill_prob)) population->KillOrganism(cell);
-}
-
-serial_transfer
-:descr:
-/**
-* This event does again the same thing as apocalypse. However, now
-* the number of organisms to be retained can be specified
-* exactly. Also, it is possible to specify whether any of these
-* organisms may be dead or not.
-*
-* Parameters:
-* transfer size (int) default: 1
-* The number of organisms to retain. If there are fewer living
-* organisms than the specified transfer size, then all living
-* organisms are retained.
-* ignore deads (int) default: 1
-* When set to 1, only living organisms are retained. Otherwise,
-* every type of organism can be retained.
-**/
-:args:
-int transfer_size 1
-int ignore_deads 1
-:body:
-population->SerialTransfer( transfer_size, ignore_deads );
-
-
-############ Hill Climbing #############
-hillclimb
-:descr:
-/**
-* Does a hill climb with the dominant genotype.
-**/
-:args:
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-ofstream fp("hillclimb.dat");
-cLandscape landscape(genome, population->GetEnvironment().GetInstSet());
-landscape.HillClimb(fp);
-
-hillclimb_neut
-:descr:
-/**
-**/
-:args:
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-ofstream fp("hillclimb.dat");
-cLandscape landscape(genome, population->GetEnvironment().GetInstSet());
-landscape.HillClimb_Neut(fp);
-
-hillclimb_rand
-:descr:
-/**
-**/
-:args:
-:body:
-cGenome & genome = population->GetGenebank().GetBestGenotype()->GetGenome();
-ofstream fp("hillclimb.dat");
-cLandscape landscape(genome, population->GetEnvironment().GetInstSet());
-landscape.HillClimb_Rand(fp);
-
-############ Demes ###############
-compete_demes
-:descr:
-/**
-* Compete all of the demes using a basic genetic algorithm approach. Fitness
-* of each deme is determined differently depending on the competition_type:
-* 0: deme fitness = 1 (control, random deme selection)
-* 1: deme fitness = number of births since last competition (default)
-* 2: deme fitness = average organism fitness at the current update
-* 3: deme fitness = average mutation rate at the current update
-* Merit can optionally be passed in.
-**/
-:args:
-int competition_type 1
-:body:
-population->CompeteDemes(competition_type);
-
-reset_demes
-:descr:
-/**
-* Designed to serve as a control for the compete_demes. Each deme is
-* copied into itself and the parameters reset.
-**/
-:args:
-:body:
-population->ResetDemes();
-
-print_deme_stats
-:descr:
-/**
-* Print stats about individual demes
-**/
-:args:
-:body:
-population->PrintDemeStats();
-
-copy_deme
-:descr:
-/**
-* Takes two numbers as arguments and copies the contents of the first deme
-* listed into the second.
-**/
-:args:
-int deme1_id
-int deme2_id
-:body:
-population->CopyDeme(deme1_id, deme2_id);
-
-############ Consensus #############
-calc_consensus
-:descr:
-/**
-* Calculates the consensus sequence.
-*
-* Parameters:
-* lines saved (integer) default: 0
-* ???
-**/
-:args:
-int lines_saved 0
-:body:
-cAnalyzeUtil::CalcConsensus(population, lines_saved);
-
-############ Other Population Called Tests ##########
-test_size_change_robustness
-:descr:
-/**
-**/
-:args:
-int num_trials 100
-cString filename "size_change.dat"
-:body:
-ofstream & fp = population->GetStats().GetDataFileOFStream(filename);
-cAnalyzeUtil::TestInsSizeChangeRobustness(fp,
- population->GetEnvironment().GetInstSet(),
- population->GetGenebank().GetBestGenotype()->GetGenome(),
- num_trials, population->GetUpdate());
-
-########### Threads ################
-test_threads
-:descr:
-/**
-**/
-:args:
-:body:
-cTestCPU::TestThreads(population->GetGenebank().GetBestGenotype()->GetGenome());
-
-print_threads
-:descr:
-/**
-**/
-:args:
-:body:
-cTestCPU::PrintThreads( population->GetGenebank().GetBestGenotype()->GetGenome() );
-
-########### Grid Output ##############
-# This event depends on the ncurses viewer (cSymbolUtil).
-# That's not good. The event can only be reactivated if that
-# dependency is removed. Claus
-#dump_basic_grid
-#:descr:
-#/**
-#**/
-#:args:
-#:body:
-#cString filename;
-#filename.Set("grid.% 05d.out", population->GetUpdate());
-#ofstream fp(filename());
-#for (int i = 0; i < population->GetWorldX(); i++) {
-# for (int j = 0; j < population->GetWorldY(); j++) {
-# cPopulationCell & cell = population->GetCell(j*population->GetWorldX()+i);
-# char out_char = cSymbolUtil::GetBasicSymbol(cell);
-# switch (out_char) {
-# case ' ':
-# fp << -3;
-# break;
-# case '.':
-# fp << -2;
-# break;
-# case '+':
-# fp << -1;
-# break;
-# default:
-# fp << out_char - 'A';
-# }
-# fp << " ";
-# }
-# fp << endl;
-#}
-#
-dump_fitness_grid
-:descr:
-/**
-* Writes out all fitness values of the organisms currently in the
-* population.
-*
-* The output file is called "fgrid.*.out", where '*' is replaced by the
-* number of the current update.
-**/
-:args:
-:body:
-cString filename;
-filename.Set("fgrid.%05d.out", population->GetUpdate());
-ofstream fp(filename());
-for (int i = 0; i < population->GetWorldX(); i++) {
- for (int j = 0; j < population->GetWorldY(); j++) {
- cPopulationCell & cell = population->GetCell(j*population->GetWorldX()+i);
- double fitness = (cell.IsOccupied()) ?
- cell.GetOrganism()->GetGenotype()->GetFitness() : 0.0;
- fp << fitness << " ";
- }
- fp << endl;
-}
-
-dump_genotype_grid
-:descr:
-/**
-* Writes out all genotype id values of the organisms currently in the
-* population.
-*
-* The output file is called "idgrid.*.out", where '*' is replaced by the
-* number of the current update.
-**/
-:args:
-:body:
-cString filename;
-filename.Set("idgrid.%05d.out", population->GetUpdate());
-ofstream fp(filename());
-for (int i = 0; i < population->GetWorldX(); i++) {
- for (int j = 0; j < population->GetWorldY(); j++) {
- cPopulationCell & cell = population->GetCell(j*population->GetWorldX()+i);
- int id = (cell.IsOccupied()) ?
- cell.GetOrganism()->GetGenotype()->GetID() : -1;
- fp << id << " ";
- }
- fp << endl;
-}
-
-dump_task_grid
-:descr:
-/**
-* Writes out a grid of tasks done by each organism
-* Tasks are encoded as a binary string first, and then converted into a
-* base 10 number
-**/
-:args:
-:body:
-cString filename;
-filename.Set("task_grid_%d.dat",population->GetUpdate());
-ofstream fp(filename());
-cAnalyzeUtil::TaskGrid( population, fp );
-
-/**
-* Writes out tasks done for all current organisms
-* output is the base 10 representation of 0-1 binary strings
-* representing the all tasks done, with NOT = 2^0, EQU = 2^8
-*
-* The output file is called "task_grid.*.out", where '*' is replaced by the
-* number of the current update.
-**/
-
-dump_donor_grid
-:descr:
-/**
-* Writes out the grid of donor organisms in the population
-*
-* The output file is called "donor_grid.*.out", where '*' is replaced by the
-* number of the current update.
-**/
-:args:
-:body:
-cString filename;
-filename.Set("donor_grid.%05d.out", population->GetUpdate());
-ofstream fp(filename());
-for (int i = 0; i < population->GetWorldX(); i++) {
- for (int j = 0; j < population->GetWorldY(); j++) {
- cPopulationCell & cell = population->GetCell(j*population->GetWorldX()+i);
- int donor = cell.IsOccupied() ?
- cell.GetOrganism()->GetPhenotype().IsDonorLast() : -1;
- fp << donor << " ";
- }
- fp << endl;
-}
-
-dump_receiver_grid
-:descr:
-/**
-* Writes out the grid of organisms which received merit in the population
-*
-* The output file is called "receiver_grid.*.out", where '*' is replaced by the
-* number of the current update.
-**/
-:args:
-:body:
-cString filename;
-filename.Set("receiver_grid.%05d.out", population->GetUpdate());
-ofstream fp(filename());
-for (int i = 0; i < population->GetWorldX(); i++) {
- for (int j = 0; j < population->GetWorldY(); j++) {
- cPopulationCell & cell = population->GetCell(j*population->GetWorldX()+i);
- int receiver = cell.IsOccupied() ?
- cell.GetOrganism()->GetPhenotype().IsReceiver() : -1;
- fp << receiver << " ";
- }
- fp << endl;
-}
-
-
-######### Tree Reconstruction ##########
-print_tree_depths
-:descr:
-/**
-* Reconstruction of phylogenetic trees.
-**/
-:args:
-cString filename ""
-:body:
-if (filename == "") filename.Set("tree_depth.%d.dat", population->GetUpdate());
-ofstream fp(filename);
-cAnalyzeUtil::PrintTreeDepths(population, fp);
-
-
-########## Grid Structure ############
-sever_grid_col
-:descr:
-/**
-* Remove the connections between cells along a column in an avida grid.
-* Arguments:
-* col_id: indicates the number of columns to the left of the cut.
-* default (or -1) = cut population in half
-* min_row: First row to start cutting from
-* default = 0
-* max_row: Last row to cut to
-* default (or -1) = last row in population.
-**/
-:args:
-int col_id -1
-int min_row 0
-int max_row -1
-:body:
-const int world_x = population->GetWorldX();
-const int world_y = population->GetWorldY();
-if (col_id == -1) col_id = world_x / 2;
-if (max_row == -1) max_row = world_y;
-if (col_id < 0 || col_id >= world_x) {
- cerr << "Event Error: Column ID " << col_id
- << " out of range for sever_grid_col" << endl;
- return;
-}
-// Loop through all of the rows and make the cut on each...
-for (int row_id = min_row; row_id < max_row; row_id++) {
- int idA = row_id * world_x + col_id;
- int idB = GridNeighbor(idA, world_x, world_y, -1, 0);
- int idA0 = GridNeighbor(idA, world_x, world_y, 0, -1);
- int idA1 = GridNeighbor(idA, world_x, world_y, 0, 1);
- int idB0 = GridNeighbor(idA, world_x, world_y, -1, -1);
- int idB1 = GridNeighbor(idA, world_x, world_y, -1, 1);
- cPopulationCell & cellA = population->GetCell(idA);
- cPopulationCell & cellB = population->GetCell(idB);
- tList<cPopulationCell> & cellA_list = cellA.ConnectionList();
- tList<cPopulationCell> & cellB_list = cellB.ConnectionList();
- cellA_list.Remove(&population->GetCell(idB));
- cellA_list.Remove(&population->GetCell(idB0));
- cellA_list.Remove(&population->GetCell(idB1));
- cellB_list.Remove(&population->GetCell(idA));
- cellB_list.Remove(&population->GetCell(idA0));
- cellB_list.Remove(&population->GetCell(idA1));
-}
-
-sever_grid_row
-:descr:
-/**
-* Remove the connections between cells along a column in an avida grid.
-* Arguments:
-* row_id: indicates the number of rows above the cut.
-* default (or -1) = cut population in half
-* min_col: First row to start cutting from
-* default = 0
-* max_col: Last row to cut to
-* default (or -1) = last row in population.
-**/
-:args:
-int row_id -1
-int min_col 0
-int max_col -1
-:body:
-const int world_x = population->GetWorldX();
-const int world_y = population->GetWorldY();
-if (row_id == -1) row_id = world_y / 2;
-if (max_col == -1) max_col = world_x;
-if (row_id < 0 || row_id >= world_y) {
- cerr << "Event Error: Row ID " << row_id
- << " out of range for sever_grid_row" << endl;
- return;
-}
-// Loop through all of the cols and make the cut on each...
-for (int col_id = min_col; col_id < max_col; col_id++) {
- int idA = row_id * world_x + col_id;
- int idB = GridNeighbor(idA, world_x, world_y, 0, -1);
- int idA0 = GridNeighbor(idA, world_x, world_y, -1, 0);
- int idA1 = GridNeighbor(idA, world_x, world_y, 1, 0);
- int idB0 = GridNeighbor(idA, world_x, world_y, -1, -1);
- int idB1 = GridNeighbor(idA, world_x, world_y, 1, -1);
- cPopulationCell & cellA = population->GetCell(idA);
- cPopulationCell & cellB = population->GetCell(idB);
- tList<cPopulationCell> & cellA_list = cellA.ConnectionList();
- tList<cPopulationCell> & cellB_list = cellB.ConnectionList();
- cellA_list.Remove(&population->GetCell(idB));
- cellA_list.Remove(&population->GetCell(idB0));
- cellA_list.Remove(&population->GetCell(idB1));
- cellB_list.Remove(&population->GetCell(idA));
- cellB_list.Remove(&population->GetCell(idA0));
- cellB_list.Remove(&population->GetCell(idA1));
-}
-
-join_grid_col
-:descr:
-/**
-* Join the connections between cells along a column in an avida grid.
-* Arguments:
-* col_id: indicates the number of columns to the left of the joining.
-* default (or -1) = join population halves.
-* min_row: First row to start joining from
-* default = 0
-* max_row: Last row to join to
-* default (or -1) = last row in population.
-**/
-:args:
-int col_id -1
-int min_row 0
-int max_row -1
-:body:
-const int world_x = population->GetWorldX();
-const int world_y = population->GetWorldY();
-if (col_id == -1) col_id = world_x / 2;
-if (max_row == -1) max_row = world_y;
-if (col_id < 0 || col_id >= world_x) {
- cerr << "Event Error: Column ID " << col_id
- << " out of range for join_grid_col" << endl;
- return;
-}
-// Loop through all of the rows and make the cut on each...
-for (int row_id = min_row; row_id < max_row; row_id++) {
- int idA = row_id * world_x + col_id;
- int idB = GridNeighbor(idA, world_x, world_y, -1, 0);
- cPopulationCell & cellA = population->GetCell(idA);
- cPopulationCell & cellB = population->GetCell(idB);
- cPopulationCell & cellA0 =
- population->GetCell(GridNeighbor(idA, world_x, world_y, 0, -1));
- cPopulationCell & cellA1 =
- population->GetCell(GridNeighbor(idA, world_x, world_y, 0, 1));
- cPopulationCell & cellB0 =
- population->GetCell(GridNeighbor(idA, world_x, world_y, -1, -1));
- cPopulationCell & cellB1 =
- population->GetCell(GridNeighbor(idA, world_x, world_y, -1, 1));
- tList<cPopulationCell> & cellA_list = cellA.ConnectionList();
- tList<cPopulationCell> & cellB_list = cellB.ConnectionList();
- if (cellA_list.FindPtr(&cellB) == NULL) cellA_list.Push(&cellB);
- if (cellA_list.FindPtr(&cellB0) == NULL) cellA_list.Push(&cellB0);
- if (cellA_list.FindPtr(&cellB1) == NULL) cellA_list.Push(&cellB1);
- if (cellB_list.FindPtr(&cellA) == NULL) cellB_list.Push(&cellA);
- if (cellB_list.FindPtr(&cellA0) == NULL) cellB_list.Push(&cellA0);
- if (cellB_list.FindPtr(&cellA1) == NULL) cellB_list.Push(&cellA1);
-}
-
-join_grid_row
-:descr:
-/**
-* Remove the connections between cells along a column in an avida grid.
-* Arguments:
-* row_id: indicates the number of rows abovef the cut.
-* default (or -1) = cut population in half
-* min_col: First row to start cutting from
-* default = 0
-* max_col: Last row to cut to
-* default (or -1) = last row in population.
-**/
-:args:
-int row_id -1
-int min_col 0
-int max_col -1
-:body:
-const int world_x = population->GetWorldX();
-const int world_y = population->GetWorldY();
-if (row_id == -1) row_id = world_y / 2;
-if (max_col == -1) max_col = world_x;
-if (row_id < 0 || row_id >= world_y) {
- cerr << "Event Error: Row ID " << row_id
- << " out of range for join_grid_row" << endl;
- return;
-}
-// Loop through all of the cols and make the cut on each...
-for (int col_id = min_col; col_id < max_col; col_id++) {
- int idA = row_id * world_x + col_id;
- int idB = GridNeighbor(idA, world_x, world_y, 0, -1);
- cPopulationCell & cellA = population->GetCell(idA);
- cPopulationCell & cellB = population->GetCell(idB);
- cPopulationCell & cellA0 =
- population->GetCell(GridNeighbor(idA, world_x, world_y, -1, 0));
- cPopulationCell & cellA1 =
- population->GetCell(GridNeighbor(idA, world_x, world_y, 1, 0));
- cPopulationCell & cellB0 =
- population->GetCell(GridNeighbor(idA, world_x, world_y, -1, -1));
- cPopulationCell & cellB1 =
- population->GetCell(GridNeighbor(idA, world_x, world_y, 1, -1));
- tList<cPopulationCell> & cellA_list = cellA.ConnectionList();
- tList<cPopulationCell> & cellB_list = cellB.ConnectionList();
- if (cellA_list.FindPtr(&cellB) == NULL) cellA_list.Push(&cellB);
- if (cellA_list.FindPtr(&cellB0) == NULL) cellA_list.Push(&cellB0);
- if (cellA_list.FindPtr(&cellB1) == NULL) cellA_list.Push(&cellB1);
- if (cellB_list.FindPtr(&cellA) == NULL) cellB_list.Push(&cellA);
- if (cellB_list.FindPtr(&cellA0) == NULL) cellB_list.Push(&cellA0);
- if (cellB_list.FindPtr(&cellA1) == NULL) cellB_list.Push(&cellA1);
-}
-
-connect_cells
-:descr:
-/**
-* Connects a pair of specified cells.
-* Arguments:
-* cellA_x, cellA_y, cellB_x, cellB_y
-**/
-:args:
-int cellA_x
-int cellA_y
-int cellB_x
-int cellB_y
-:body:
-const int world_x = population->GetWorldX();
-const int world_y = population->GetWorldY();
-if (cellA_x < 0 || cellA_x >= world_x ||
- cellA_y < 0 || cellA_y >= world_y ||
- cellB_x < 0 || cellB_x >= world_x ||
- cellB_y < 0 || cellB_y >= world_y) {
- cerr << "Event 'connect_cells' cell out of range." << endl;
- return;
-}
-int idA = cellA_y * world_x + cellA_x;
-int idB = cellB_y * world_x + cellB_x;
-cPopulationCell & cellA = population->GetCell(idA);
-cPopulationCell & cellB = population->GetCell(idB);
-tList<cPopulationCell> & cellA_list = cellA.ConnectionList();
-tList<cPopulationCell> & cellB_list = cellB.ConnectionList();
-cellA_list.PushRear(&cellB);
-cellB_list.PushRear(&cellA);
-
-disconnect_cells
-:descr:
-/**
-* Connects a pair of specified cells.
-* Arguments:
-* cellA_x, cellA_y, cellB_x, cellB_y
-**/
-:args:
-int cellA_x
-int cellA_y
-int cellB_x
-int cellB_y
-:body:
-const int world_x = population->GetWorldX();
-const int world_y = population->GetWorldY();
-if (cellA_x < 0 || cellA_x >= world_x ||
- cellA_y < 0 || cellA_y >= world_y ||
- cellB_x < 0 || cellB_x >= world_x ||
- cellB_y < 0 || cellB_y >= world_y) {
- cerr << "Event 'connect_cells' cell out of range." << endl;
- return;
-}
-int idA = cellA_y * world_x + cellA_x;
-int idB = cellB_y * world_x + cellB_x;
-cPopulationCell & cellA = population->GetCell(idA);
-cPopulationCell & cellB = population->GetCell(idB);
-tList<cPopulationCell> & cellA_list = cellA.ConnectionList();
-tList<cPopulationCell> & cellB_list = cellB.ConnectionList();
-cellA_list.Remove(&cellB);
-cellB_list.Remove(&cellA);
-
-########## Resources ############
-inject_resource
-:descr:
-/**
-* Inject (add) a specified amount of a specified resource.
-**/
-:args:
-cString res_name
-double res_count
-:body:
-cResourceLib & res_lib = population->GetEnvironment().GetResourceLib();
-int res_id = res_lib.GetResource(res_name)->GetID();
-population->UpdateResource(res_id, res_count);
-
-set_resource
-:descr:
-/**
-* Set the resource amount to a specific level
-**/
-:args:
-cString res_name
-double res_count
-:body:
-cResourceLib & res_lib = population->GetEnvironment().GetResourceLib();
-cResource * found_resource = res_lib.GetResource(res_name);
-if (found_resource != NULL) {
- population->SetResource(found_resource->GetID(), res_count);
-}
-
-inject_scaled_resource
-:descr:
-/**
-* Inject (add) a specified amount of a specified resource, scaled by
-* the current average merit divided by the average time slice.
-**/
-:args:
-cString res_name
-double res_count
-:body:
-double ave_merit = population->GetStats().SumMerit().Average();
-if ( ave_merit <= 0 )
- ave_merit = 1; // make sure that we don't get NAN's or negative numbers
-ave_merit /= cConfig::GetAveTimeslice();
-cResourceLib & res_lib = population->GetEnvironment().GetResourceLib();
-int res_id = res_lib.GetResource(res_name)->GetID();
-population->UpdateResource(res_id, res_count/ave_merit);
-
-
-outflow_scaled_resource
-:descr:
-/**
-* Removes a specified percentage of a specified resource, scaled by
-* the current average merit divided by the average time slice.
-**/
-:args:
-cString res_name
-double res_perc
-:body:
-double ave_merit = population->GetStats().SumMerit().Average();
-if ( ave_merit <= 0 )
- ave_merit = 1; // make sure that we don't get NAN's or negative numbers
-ave_merit /= cConfig::GetAveTimeslice();
-cResourceLib & res_lib = population->GetEnvironment().GetResourceLib();
-int res_id = res_lib.GetResource(res_name)->GetID();
-double res_level = population->GetResource(res_id);
-// a quick calculation shows that this formula guarantees that
-// the equilibrium level when resource is not used is independent
-// of the average merit
-double scaled_perc = 1/(1+ave_merit*(1-res_perc)/res_perc);
-res_level -= res_level*scaled_perc;
-population->SetResource(res_id, res_level);
-
-
-set_reaction_value
-:descr:
-/**
-* Set the value associated with a reaction to a specific level
-**/
-:args:
-cString reaction_name
-double reaction_value
-:body:
-population->GetEnvironment().SetReactionValue(reaction_name, reaction_value);
-
-set_reaction_value_mult
-:descr:
-/**
-* Change the value of the reaction by multiplying it with the imput number
-**/
-:args:
-cString reaction_name
-double value_mult
-:body:
-population->GetEnvironment().SetReactionValueMult(reaction_name, value_mult);
-
-set_reaction_inst
-:descr:
-/**
-* Change the instruction triggered by the task **/
-:args:
-cString reaction_name
-cString inst_name
-:body:
-population->GetEnvironment().SetReactionInst(reaction_name, inst_name);
-
Deleted: branches/brysonda/source/event/event.cc
===================================================================
--- branches/brysonda/source/event/event.cc 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event.cc 2005-06-11 00:57:17 UTC (rev 203)
@@ -1,18 +0,0 @@
-
-
-#include "event.hh"
-
-
-using namespace std;
-
-
-cEvent::cEvent( const cString & name, const cString & args ,
- int factory_id )
- : m_name( name ), m_args( args ), m_factory_id( factory_id )
-{
-}
-
-
-cEvent::~cEvent()
-{
-}
Modified: branches/brysonda/source/event/event.hh
===================================================================
--- branches/brysonda/source/event/event.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -37,10 +37,9 @@
public:
// constructors
- cEvent( const cString & name = "Undefined",
- const cString & args = "",
- int handler_id = -1 );
- virtual ~cEvent();
+ cEvent( const cString & name = "Undefined", const cString & args = "", int factory_id = -1 )
+ : m_name( name ), m_args( args ), m_factory_id( factory_id ) { ; }
+ virtual ~cEvent() { ; }
// manipulators
Modified: branches/brysonda/source/event/event.pri
===================================================================
--- branches/brysonda/source/event/event.pri 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event.pri 2005-06-11 00:57:17 UTC (rev 203)
@@ -1,13 +1,11 @@
event {
HEADERS += $$EVENT_HH/event.hh \
- $$EVENT_HH/event_factory.hh \
$$EVENT_HH/event_factory_manager.hh \
$$EVENT_HH/event_list.hh \
$$EVENT_HH/population_event_factory.hh
SOURCES += $$EVENT_CC/event.cc \
- $$EVENT_CC/event_factory.cc \
$$EVENT_CC/event_factory_manager.cc \
$$EVENT_CC/event_list.cc \
$$EVENT_CC/event_list_entry.cc \
Deleted: branches/brysonda/source/event/event_factory.cc
===================================================================
--- branches/brysonda/source/event/event_factory.cc 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event_factory.cc 2005-06-11 00:57:17 UTC (rev 203)
@@ -1,16 +0,0 @@
-
-#include "event_factory.hh"
-
-
-#include "defs.hh"
-#include "file.hh"
-#include "string.hh"
-#include "./event.hh"
-
-
-using namespace std;
-
-
-//////// cEventFactory ////////////
-
-
Deleted: branches/brysonda/source/event/event_factory.hh
===================================================================
--- branches/brysonda/source/event/event_factory.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event_factory.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -1,59 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef EVENT_FACTORY_HH
-#define EVENT_FACTORY_HH
-
-/**
- * This class is used to construct events from a given name and argument list.
- * You have to overload it to construct events that need particular additional
- * information (like a pointer to a class they should act on).
- **/
-
-class cEvent;
-class cString;
-
-class cEventFactory {
-private:
- int m_factory_id;
-
- // not implemented, prevents inadvertent wrong instantiation
- cEventFactory( const cEventFactory & );
- cEventFactory& operator=( const cEventFactory& );
-
-public:
- cEventFactory() : m_factory_id(0) { ; }
- virtual ~cEventFactory() { ; }
-
- void SetFactoryId(int id) { m_factory_id = id; }
- int GetFactoryId() { return m_factory_id; }
-
- /**
- * Returns an id for an event name. The id holds only for this factory,
- * a second factory might use the same id for something else.
- **/
- virtual int EventNameToEnum(const cString & name) const = 0;
-
- /**
- * Constructs an event.
- *
- * @param event_enum The identifier of the event to be constructed.
- * @param args The argument list of the event.
- **/
- virtual cEvent * ConstructEvent( int event_enum, const cString & args )=0;
-
- /**
- * Constructs an event.
- *
- * @param name The name of the event to be constructed.
- * @param args The argument list of the event.
- **/
- cEvent * ConstructEvent( const cString & name, const cString & args ){
- return ConstructEvent( EventNameToEnum(name), args ); }
-};
-
-#endif
Modified: branches/brysonda/source/event/event_factory_manager.cc
===================================================================
--- branches/brysonda/source/event/event_factory_manager.cc 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event_factory_manager.cc 2005-06-11 00:57:17 UTC (rev 203)
@@ -9,11 +9,6 @@
#include "event.hh"
#endif
-#ifndef EVENT_FACTORY_HH
-#include "event_factory.hh"
-#endif
-
-
using namespace std;
@@ -26,7 +21,7 @@
}
cEventFactoryManager::~cEventFactoryManager(){
- vector<tObjectFactory<cEvent, const cString&>*>::iterator it = m_factory_list.begin();
+ vector<tObjectFactory<cEvent (const cString&)>*>::iterator it = m_factory_list.begin();
for( ; it != m_factory_list.end(); it++ )
delete *it;
@@ -41,7 +36,7 @@
// factory_id < 0 => send to all factories
if( factory_id < 0 ){
- vector<tObjectFactory<cEvent, const cString&>*>::iterator it;
+ vector<tObjectFactory<cEvent (const cString&)>*>::iterator it;
for( it = m_factory_list.begin(); it != m_factory_list.end(); it++ ){
if( *it != NULL )
event = (*it)->Create(name,args);
@@ -62,7 +57,7 @@
int
-cEventFactoryManager::AddFactory(tObjectFactory<cEvent, const cString&>* factory)
+cEventFactoryManager::AddFactory(tObjectFactory<cEvent (const cString&)>* factory)
{
assert( factory != NULL );
m_factory_list.push_back(factory);
Modified: branches/brysonda/source/event/event_factory_manager.hh
===================================================================
--- branches/brysonda/source/event/event_factory_manager.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event_factory_manager.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -31,7 +31,7 @@
class cEventFactoryManager {
private:
- std::vector<tObjectFactory<cEvent, const cString&>*> m_factory_list;
+ std::vector<tObjectFactory<cEvent (const cString&)>*> m_factory_list;
// not implemented, prevents inadvertent wrong instantiation
cEventFactoryManager( const cEventFactoryManager & );
@@ -40,7 +40,7 @@
cEventFactoryManager();
~cEventFactoryManager();
- int AddFactory(tObjectFactory<cEvent, const cString&>* factory);
+ int AddFactory(tObjectFactory<cEvent (const cString&)>* factory);
/**
* This function is used to construct an event. It sends the event's name
Deleted: branches/brysonda/source/event/event_list_entry.cc
===================================================================
--- branches/brysonda/source/event/event_list_entry.cc 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event_list_entry.cc 2005-06-11 00:57:17 UTC (rev 203)
@@ -1,40 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef EVENT_LIST_ENTRY_HH
-#include "event_list_entry.hh"
-#endif
-
-
-/////////////////
-// cEventListEntry
-/////////////////
-
-
-cEventListEntry::cEventListEntry( cEvent * event,
- cEventTriggers::eTriggerVariable trigger,
- double start,
- double interval,
- double stop,
- cEventListEntry * prev,
- cEventListEntry * next ) :
- m_event( event ),
- m_trigger( trigger ),
- m_start( start ),
- m_interval( interval ),
- m_stop( stop ),
- m_original_start( start ),
- m_prev( prev ),
- m_next( next )
-{
-}
-
-
-cEventListEntry::~cEventListEntry()
-{
- delete m_event;
-}
Modified: branches/brysonda/source/event/event_list_entry.hh
===================================================================
--- branches/brysonda/source/event/event_list_entry.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event_list_entry.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -45,16 +45,25 @@
cEventListEntry& operator=( const cEventListEntry& );
public:
// creators
- cEventListEntry( cEvent *event = NULL,
- cEventTriggers::eTriggerVariable trigger
- = cEventTriggers::UPDATE,
- double start = cEventTriggers::TRIGGER_BEGIN,
- double interval = cEventTriggers::TRIGGER_ONCE,
- double stop = cEventTriggers::TRIGGER_END,
- cEventListEntry *prev = NULL,
- cEventListEntry *next = NULL );
+ cEventListEntry(cEvent *event = NULL,
+ cEventTriggers::eTriggerVariable trigger = cEventTriggers::UPDATE,
+ double start = cEventTriggers::TRIGGER_BEGIN,
+ double interval = cEventTriggers::TRIGGER_ONCE,
+ double stop = cEventTriggers::TRIGGER_END,
+ cEventListEntry *prev = NULL,
+ cEventListEntry *next = NULL ) :
+ m_event( event ),
+ m_trigger( trigger ),
+ m_start( start ),
+ m_interval( interval ),
+ m_stop( stop ),
+ m_original_start( start ),
+ m_prev( prev ),
+ m_next( next )
+ {
+ }
- virtual ~cEventListEntry();
+ virtual ~cEventListEntry() { delete m_event; }
// manipulators
Modified: branches/brysonda/source/event/event_triggers.hh
===================================================================
--- branches/brysonda/source/event/event_triggers.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/event_triggers.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -28,7 +28,8 @@
cEventTriggers( const cEventTriggers& );
cEventTriggers& operator=( const cEventTriggers& );
public:
- cEventTriggers() {}
+ cEventTriggers() { ; }
+ virtual ~cEventTriggers() { ; }
virtual double GetUpdate() const = 0;
virtual double GetGeneration() const = 0;
Deleted: branches/brysonda/source/event/make_events.pl
===================================================================
--- branches/brysonda/source/event/make_events.pl 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/make_events.pl 2005-06-11 00:57:17 UTC (rev 203)
@@ -1,287 +0,0 @@
-#
-# Make events_auto.cc & events_auto.hh from a simplified template file
-# to handle creation of code for simple events
-#
-# Input file format:
-# _event_name_
-# :descr:
-# /**
-# * Documentation of the event in the typical
-# * class definition style
-# **/
-# :args:
-# _arg_type _arg_name_ [= _default_value_]
-# _arg_type _arg_name_ [= _default_value_]
-# ...
-# :body:
-# _body_of_Process()_function_
-# ...
-#
-# _event_name_...
-
-use strict;
-
-$/ = "\n\n";
-$" = "|"; #" <- this quote sign in the comment is necessary for emacs highlighting mode
-
-my @event_lists = @ARGV; #("cPopulation", ...);
-
-my ( $event_dir, $fname, $fname_root );
-
-# Clobber the events_list
-foreach $fname (@event_lists)
-{
- # separate filename in root name and directory
- if ( $fname =~ m/^-x/ )
- {
- # handle paths from Xcode
- # added by David 2004-12-05
-
- ($fname, $fname_root, $event_dir) = $fname =~ /^-x\[(.*\/)(.*)\]\[(.*)\]/;
- $fname .= $fname_root;
- $event_dir .= "/";
- }
- elsif ( $fname =~ /\// )
- {
- $fname =~ /(.*\/)(.*)/;
- ##
- ## change by kaben...
- ##
- ## this change places all generated files
- ## in the build directory
- ## rather than in the source directory.
- ##
- #$event_dir = $1;
- $event_dir = "./";
- ##
- $fname_root = $2;
-
- }
- else
- {
- $event_dir = "./";
- $fname_root = $fname;
- }
-
- printf " --- make_events.pl: opening ".$fname.".events.\n";
- open(IN,$fname.".events") || die $!;
-
- # open the output files
- open(LIST,"> ".$event_dir.$fname_root."_event_list");
- open(NCI, "> ".$event_dir.$fname_root."_construct_event_auto.ci");
- open(PCI, "> ".$event_dir.$fname_root."_process_auto.ci");
- open(DEFS,"> ".$event_dir.$fname_root."_enums_auto.ci");
- open(N2E,"> ".$event_dir.$fname_root."_name2enum_auto.ci");
- open(DESCR_DECL,"> ".$event_dir.$fname_root."_descr.hi");
- open(DESCR_DEF,"> ".$event_dir.$fname_root."_descr.ci");
-
-
- print LIST "#### ".$fname_root."-Events ####\n\n";
-
- print DEFS " enum eEvent { EVENT_undefined = 0,\n";
-
- print N2E "int ".$fname_root."EventFactory::EventNameToEnum(const cString & name) const{\n";
- print N2E " if( name == \"\" ){\n";
- print N2E " return ".$fname_root."EventFactory::EVENT_NO_EVENT;\n";
-
- print DESCR_DECL "class cEventEntry{
- private:
- const char* m_name;
- const char* m_description;
- public:
- cEventEntry( const char* name, const char* description )
- : m_name( name ), m_description( description ) {;}
- ~cEventEntry() {;}
- /**
- * \@return The name of the event.
- **/
- const char* GetName() const { return m_name; }
-
- /**
- * \@return The description of the event.
- **/
- const char* GetDescription() const { return m_description; }
- };
-
-
- class cEventDescrs{
- public:
- const static int num_of_events;
- const static cEventEntry entries[];
- };
-
- ";
-
- print DESCR_DEF "const cEventEntry cEventDescrs::entries[] = {
- ";
-
- my $no_of_events = 0;
-
- while( <IN> ){
- my @line = split(/\n/);
- my $line_string = "";
- my $i;
-
- # Filter out blank lines and comments (#)
- for $i (0..$#line){
- $_ = $line[$i];
- s/\#.*$//;
- $line_string .= "$_\n" unless( /^\s*$/ );
- }
- my ( $name, $tmp_string ) = split(/\:descr\:\n/, $line_string);
- my ( $descrstring, $tmp_string2 ) = split(/\:args\:\n/, $tmp_string);
- my ( $argstring, $body ) = split(/\:body\:\n/, $tmp_string2);
- my @args = split(/\n/,$argstring);
- $name =~ /^\s*([a-z_0-9]*)\s*$/i; $name = $1; # Trim ws off of name
- # XXX the perl expression below stopped working on
- # rodan.css.msu.edu; I don't know why; the expression above is a
- # quick workaround. @kgn 21 September 2004
- #$name =~ /\s*([^\s]*)\s*$/; $name = $1; # Trim ws off of name
-
-
- if( $name ){
- # print warning if no documentation has been written
- chomp( $descrstring );
- if ( $descrstring eq "" ){
- print "Warning: Event $name comes without documentation!\nPlease change!\n";
- }
-
- ##### Output Class Declaration
- print PCI "///// $name /////\n\n";
- print PCI $descrstring."\n\n";
- print PCI "class ".$fname_root."Event$name : public ".$fname_root."Event {\nprivate:\n";
- for $i (0..$#args){
- my ($type, $vname, $default) = split(/\s+/, $args[$i]);
- print PCI " $type $vname;\n";
- }
- $" = ", ";
- print PCI "public:\n";
- print PCI " ".$fname_root."Event$name(const cString & in_args):\n";
- print PCI " ".$fname_root."Event(\"$name\", in_args) {\n";
-
- # Argument intialization
- if( @args ){
- print PCI "\n";
- print PCI " cString args(in_args);\n";
- for $i (0..$#args){
- my ($type, $vname, $default) = split(/\s+/, $args[$i]);
- # @TCC--- SOMEHOW THIS NEEDS TO TAKE MULTI_WORD DEFAULTS
- my $default_provided_flag = 0; # for checking syntax
- my $pop_cmd = "args.PopWord()";
- if( $type eq "cString" ){
- # This is the default type
- }elsif( $type eq "int" ){
- $pop_cmd .= ".AsInt()";
- }elsif( $type eq "double" ){
- $pop_cmd .= ".AsDouble()";
- }
- if( defined $default ){
- $default_provided_flag = 1;
- print PCI " if (args == \"\") $vname=$default; else $vname=$pop_cmd;\n";
- }else{
- die "Must Provide Defaults for all variables after first default value\n" if( $default_provided_flag == 1 );
- print PCI " $vname = $pop_cmd;\n";
- }
- }
- print PCI " }\n";
-
- }else{
- print PCI " (void)in_args; }\n";
- }
-
- ##### the process command
- print PCI "///// $name /////\n";
- print PCI " void Process(){\n";
- my @body_line = split(/\n/,$body);
- for $i (0..$#body_line){
- print PCI " $body_line[$i]\n";
- }
- print PCI " }\n";
- print PCI "};\n\n";
-
-
-
- ##### CC File stuff... Name to class instantiation
- print NCI " case ".$fname_root."EventFactory::EVENT_$name :\n";
- print NCI " event = new ".$fname_root."Event$name(arg_list);\n";
- print NCI " break;\n";
-
- ##### Name to Enum #########
- print N2E " }else if (name == \"$name\") {\n";
- print N2E " return ".$fname_root."EventFactory::EVENT_$name;\n";
-
- ##### List of Events #####
- print LIST "$name ";
- for $i (0..$#args){
- my ($type, $vname, $default) = split(/\s+/, $args[$i]);
- if( defined $default ){
- print LIST " [$type $vname=$default]";
- }else{
- print LIST " <$type $vname>";
- }
- }
- print LIST "\n";
-
- ###### DEFS ######
- print DEFS " EVENT_$name,\n";
-
- ###### DESCR ######
- #
- # The description needs some reg-expression magic to
- # remove the c-style like comments.
- #
- ###################
- $descrstring =~ s/\"/\\\"/g; #" escape all quote characters
-
-
- # now tokenize and remove comment characters ('\','*')
- my ( $descr_line, $descr, $finaldescr, @tokens );
- @tokens = split /\n/, $descrstring;
-
- $finaldescr = "";
-
- foreach $descr_line (@tokens){
- if ( $descr_line =~ /\s*[\S]+\s(.*)/ ){
- $descr = $1;
- }else{
- $descr = "";
- }
- $finaldescr = $finaldescr."\n".$descr;
- }
-
- # remove leading or trailing '\n's
- if ( $finaldescr =~ /\n*(.*\n)\n*/s ){
- $finaldescr = $1;
- }
- else {
- $finaldescr = "\n";
- }
-
- # finally, escape all \n's.
- $finaldescr =~ s/\n/\\n/g;
-
- if ( $no_of_events > 0 ){
- print DESCR_DEF ",\n";
- }
- print DESCR_DEF " cEventEntry( \"$name\", \"$finaldescr\" )";
-
- $no_of_events += 1;
- } # if( $name )
- }
-
- print DEFS "EVENT_NO_EVENT };\n";
-
- print N2E " }else{\n";
- print N2E " return ".$fname_root."EventFactory::EVENT_undefined;\n";
- print N2E " }\n";
- print N2E "}\n";
-
- print DESCR_DEF " };
-
- const int cEventDescrs::num_of_events = $no_of_events;
-
- ";
-
-} # for each ARGV to fnameroot
-
-
Modified: branches/brysonda/source/event/population_event_factory.cc
===================================================================
--- branches/brysonda/source/event/population_event_factory.cc 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/population_event_factory.cc 2005-06-11 00:57:17 UTC (rev 203)
@@ -101,13 +101,17 @@
* Ends the Avida run immediately.
**/
-
-class cPopulationEventexit : public cPopulationEvent {
+namespace nPopulation {
+
+class cEvent_exit : public cPopulationEvent {
private:
public:
- cPopulationEventexit(const cString& in_key, const cString& in_args):
- cPopulationEvent("exit", in_args) {
- (void)in_args; }
+ cEvent_exit(const cString& in_args)
+ :cPopulationEvent("exit", in_args)
+ {
+ (void)in_args;
+ }
+
///// exit /////
void Process(){
cAvidaDriver_Base::main_driver->SetDone();
@@ -126,11 +130,11 @@
**/
-class cPopulationEventexit_if_generation_greater_than : public cPopulationEvent {
+class cEvent_exit_if_generation_greater_than : public cPopulationEvent {
private:
int max_generation;
public:
- cPopulationEventexit_if_generation_greater_than(const cString& in_key, const cString& in_args):
+ cEvent_exit_if_generation_greater_than(const cString& in_args):
cPopulationEvent("exit_if_generation_greater_than", in_args) {
cString args(in_args);
@@ -156,11 +160,11 @@
**/
-class cPopulationEventexit_if_update_greater_than : public cPopulationEvent {
+class cEvent_exit_if_update_greater_than : public cPopulationEvent {
private:
int max_update;
public:
- cPopulationEventexit_if_update_greater_than(const cString& in_key, const cString& in_args):
+ cEvent_exit_if_update_greater_than(const cString& in_args):
cPopulationEvent("exit_if_update_greater_than", in_args) {
cString args(in_args);
@@ -186,11 +190,11 @@
**/
-class cPopulationEventexit_if_ave_lineage_label_smaller : public cPopulationEvent {
+class cEvent_exit_if_ave_lineage_label_smaller : public cPopulationEvent {
private:
double lineage_label_crit_value;
public:
- cPopulationEventexit_if_ave_lineage_label_smaller(const cString& in_key, const cString& in_args):
+ cEvent_exit_if_ave_lineage_label_smaller(const cString& in_args):
cPopulationEvent("exit_if_ave_lineage_label_smaller", in_args) {
cString args(in_args);
@@ -216,11 +220,11 @@
**/
-class cPopulationEventexit_if_ave_lineage_label_larger : public cPopulationEvent {
+class cEvent_exit_if_ave_lineage_label_larger : public cPopulationEvent {
private:
double lineage_label_crit_value;
public:
- cPopulationEventexit_if_ave_lineage_label_larger(const cString& in_key, const cString& in_args):
+ cEvent_exit_if_ave_lineage_label_larger(const cString& in_args):
cPopulationEvent("exit_if_ave_lineage_label_larger", in_args) {
cString args(in_args);
@@ -245,11 +249,11 @@
**/
-class cPopulationEventecho : public cPopulationEvent {
+class cEvent_echo : public cPopulationEvent {
private:
cString mesg;
public:
- cPopulationEventecho(const cString& in_key, const cString& in_args):
+ cEvent_echo(const cString& in_args):
cPopulationEvent("echo", in_args) {
cString args(in_args);
@@ -278,12 +282,12 @@
**/
-class cPopulationEventprint_data : public cPopulationEvent {
+class cEvent_print_data : public cPopulationEvent {
private:
cString filename;
cString format;
public:
- cPopulationEventprint_data(const cString& in_key, const cString& in_args):
+ cEvent_print_data(const cString& in_args):
cPopulationEvent("print_data", in_args) {
cString args(in_args);
@@ -307,11 +311,11 @@
**/
-class cPopulationEventprint_average_data : public cPopulationEvent {
+class cEvent_print_average_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_average_data(const cString& in_key, const cString& in_args):
+ cEvent_print_average_data(const cString& in_args):
cPopulationEvent("print_average_data", in_args) {
cString args(in_args);
@@ -334,11 +338,11 @@
**/
-class cPopulationEventprint_error_data : public cPopulationEvent {
+class cEvent_print_error_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_error_data(const cString& in_key, const cString& in_args):
+ cEvent_print_error_data(const cString& in_args):
cPopulationEvent("print_error_data", in_args) {
cString args(in_args);
@@ -361,11 +365,11 @@
**/
-class cPopulationEventprint_variance_data : public cPopulationEvent {
+class cEvent_print_variance_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_variance_data(const cString& in_key, const cString& in_args):
+ cEvent_print_variance_data(const cString& in_args):
cPopulationEvent("print_variance_data", in_args) {
cString args(in_args);
@@ -388,11 +392,11 @@
**/
-class cPopulationEventprint_dominant_data : public cPopulationEvent {
+class cEvent_print_dominant_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_dominant_data(const cString& in_key, const cString& in_args):
+ cEvent_print_dominant_data(const cString& in_args):
cPopulationEvent("print_dominant_data", in_args) {
cString args(in_args);
@@ -415,11 +419,11 @@
**/
-class cPopulationEventprint_stats_data : public cPopulationEvent {
+class cEvent_print_stats_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_stats_data(const cString& in_key, const cString& in_args):
+ cEvent_print_stats_data(const cString& in_args):
cPopulationEvent("print_stats_data", in_args) {
cString args(in_args);
@@ -442,11 +446,11 @@
**/
-class cPopulationEventprint_count_data : public cPopulationEvent {
+class cEvent_print_count_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_count_data(const cString& in_key, const cString& in_args):
+ cEvent_print_count_data(const cString& in_args):
cPopulationEvent("print_count_data", in_args) {
cString args(in_args);
@@ -469,11 +473,11 @@
**/
-class cPopulationEventprint_totals_data : public cPopulationEvent {
+class cEvent_print_totals_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_totals_data(const cString& in_key, const cString& in_args):
+ cEvent_print_totals_data(const cString& in_args):
cPopulationEvent("print_totals_data", in_args) {
cString args(in_args);
@@ -497,11 +501,11 @@
**/
-class cPopulationEventprint_tasks_data : public cPopulationEvent {
+class cEvent_print_tasks_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_tasks_data(const cString& in_key, const cString& in_args):
+ cEvent_print_tasks_data(const cString& in_args):
cPopulationEvent("print_tasks_data", in_args) {
cString args(in_args);
@@ -519,11 +523,11 @@
**/
-class cPopulationEventprint_tasks_exe_data : public cPopulationEvent {
+class cEvent_print_tasks_exe_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_tasks_exe_data(const cString& in_key, const cString& in_args):
+ cEvent_print_tasks_exe_data(const cString& in_args):
cPopulationEvent("print_tasks_exe_data", in_args) {
cString args(in_args);
@@ -541,11 +545,11 @@
**/
-class cPopulationEventprint_resource_data : public cPopulationEvent {
+class cEvent_print_resource_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_resource_data(const cString& in_key, const cString& in_args):
+ cEvent_print_resource_data(const cString& in_args):
cPopulationEvent("print_resource_data", in_args) {
cString args(in_args);
@@ -568,11 +572,11 @@
**/
-class cPopulationEventprint_time_data : public cPopulationEvent {
+class cEvent_print_time_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_time_data(const cString& in_key, const cString& in_args):
+ cEvent_print_time_data(const cString& in_args):
cPopulationEvent("print_time_data", in_args) {
cString args(in_args);
@@ -590,11 +594,11 @@
**/
-class cPopulationEventprint_mutation_data : public cPopulationEvent {
+class cEvent_print_mutation_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_mutation_data(const cString& in_key, const cString& in_args):
+ cEvent_print_mutation_data(const cString& in_args):
cPopulationEvent("print_mutation_data", in_args) {
cString args(in_args);
@@ -615,11 +619,11 @@
**/
-class cPopulationEventprint_mutation_rate_data : public cPopulationEvent {
+class cEvent_print_mutation_rate_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_mutation_rate_data(const cString& in_key, const cString& in_args):
+ cEvent_print_mutation_rate_data(const cString& in_args):
cPopulationEvent("print_mutation_rate_data", in_args) {
cString args(in_args);
@@ -640,11 +644,11 @@
**/
-class cPopulationEventprint_divide_mut_data : public cPopulationEvent {
+class cEvent_print_divide_mut_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_divide_mut_data(const cString& in_key, const cString& in_args):
+ cEvent_print_divide_mut_data(const cString& in_args):
cPopulationEvent("print_divide_mut_data", in_args) {
cString args(in_args);
@@ -667,11 +671,11 @@
**/
-class cPopulationEventprint_dom_parasite_data : public cPopulationEvent {
+class cEvent_print_dom_parasite_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_dom_parasite_data(const cString& in_key, const cString& in_args):
+ cEvent_print_dom_parasite_data(const cString& in_args):
cPopulationEvent("print_dom_parasite_data", in_args) {
cString args(in_args);
@@ -692,11 +696,11 @@
**/
-class cPopulationEventprint_instruction_data : public cPopulationEvent {
+class cEvent_print_instruction_data : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_instruction_data(const cString& in_key, const cString& in_args):
+ cEvent_print_instruction_data(const cString& in_args):
cPopulationEvent("print_instruction_data", in_args) {
cString args(in_args);
@@ -721,11 +725,11 @@
**/
-class cPopulationEventprint_instruction_abundance_histogram : public cPopulationEvent {
+class cEvent_print_instruction_abundance_histogram : public cPopulationEvent {
private:
cString filename;
public:
- cPopulationEventprint_instruction_abundance_histogram(const cString& in_key, const cString& in_args):
+ cEvent_print_instruction_abundance_histogram(const cString& in_args):
cPopulationEvent("print_instruction_abundance_histogram", in_args) {
cString args(in_args);
@@ -744,11 +748,11 @@
**/
-class cPopulationEventprint_depth_histogram : public cPopulationEvent {
+class cEvent_print_depth_histogram : public cPopulationEvent {
private:
cString filename;
public:
- cPopulationEventprint_depth_histogram(const cString& in_key, const cString& in_args):
+ cEvent_print_depth_histogram(const cString& in_args):
cPopulationEvent("print_depth_histogram", in_args) {
cString args(in_args);
@@ -772,11 +776,11 @@
**/
-class cPopulationEventprint_genotype_abundance_histogram : public cPopulationEvent {
+class cEvent_print_genotype_abundance_histogram : public cPopulationEvent {
private:
cString filename;
public:
- cPopulationEventprint_genotype_abundance_histogram(const cString& in_key, const cString& in_args):
+ cEvent_print_genotype_abundance_histogram(const cString& in_args):
cPopulationEvent("print_genotype_abundance_histogram", in_args) {
cString args(in_args);
@@ -800,11 +804,11 @@
**/
-class cPopulationEventprint_species_abundance_histogram : public cPopulationEvent {
+class cEvent_print_species_abundance_histogram : public cPopulationEvent {
private:
cString filename;
public:
- cPopulationEventprint_species_abundance_histogram(const cString& in_key, const cString& in_args):
+ cEvent_print_species_abundance_histogram(const cString& in_args):
cPopulationEvent("print_species_abundance_histogram", in_args) {
cString args(in_args);
@@ -823,12 +827,12 @@
**/
-class cPopulationEventprint_lineage_totals : public cPopulationEvent {
+class cEvent_print_lineage_totals : public cPopulationEvent {
private:
cString fname;
int verbose;
public:
- cPopulationEventprint_lineage_totals(const cString& in_key, const cString& in_args):
+ cEvent_print_lineage_totals(const cString& in_args):
cPopulationEvent("print_lineage_totals", in_args) {
cString args(in_args);
@@ -856,12 +860,12 @@
**/
-class cPopulationEventprint_lineage_counts : public cPopulationEvent {
+class cEvent_print_lineage_counts : public cPopulationEvent {
private:
cString fname;
int verbose;
public:
- cPopulationEventprint_lineage_counts(const cString& in_key, const cString& in_args):
+ cEvent_print_lineage_counts(const cString& in_args):
cPopulationEvent("print_lineage_counts", in_args) {
cString args(in_args);
@@ -901,11 +905,11 @@
**/
-class cPopulationEventprint_dom : public cPopulationEvent {
+class cEvent_print_dom : public cPopulationEvent {
private:
cString in_filename;
public:
- cPopulationEventprint_dom(const cString& in_key, const cString& in_args):
+ cEvent_print_dom(const cString& in_args):
cPopulationEvent("print_dom", in_args) {
cString args(in_args);
@@ -925,11 +929,11 @@
//midget
-class cPopulationEventparasite_debug : public cPopulationEvent {
+class cEvent_parasite_debug : public cPopulationEvent {
private:
cString in_filename;
public:
- cPopulationEventparasite_debug(const cString& in_key, const cString& in_args):
+ cEvent_parasite_debug(const cString& in_args):
cPopulationEvent("parasite_debug", in_args) {
cString args(in_args);
@@ -955,11 +959,11 @@
**/
-class cPopulationEventprint_dom_parasite : public cPopulationEvent {
+class cEvent_print_dom_parasite : public cPopulationEvent {
private:
cString in_filename;
public:
- cPopulationEventprint_dom_parasite(const cString& in_key, const cString& in_args):
+ cEvent_print_dom_parasite(const cString& in_args):
cPopulationEvent("print_dom_parasite", in_args) {
cString args(in_args);
@@ -982,11 +986,11 @@
**/
-class cPopulationEventprint_genotype_map : public cPopulationEvent {
+class cEvent_print_genotype_map : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_genotype_map(const cString& in_key, const cString& in_args):
+ cEvent_print_genotype_map(const cString& in_args):
cPopulationEvent("print_genotype_map", in_args) {
cString args(in_args);
@@ -1007,11 +1011,11 @@
**/
-class cPopulationEventprint_number_phenotypes : public cPopulationEvent {
+class cEvent_print_number_phenotypes : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_number_phenotypes(const cString& in_key, const cString& in_args):
+ cEvent_print_number_phenotypes(const cString& in_args):
cPopulationEvent("print_number_phenotypes", in_args) {
cString args(in_args);
@@ -1031,11 +1035,11 @@
**/
-class cPopulationEventprint_phenotype_status : public cPopulationEvent {
+class cEvent_print_phenotype_status : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventprint_phenotype_status(const cString& in_key, const cString& in_args):
+ cEvent_print_phenotype_status(const cString& in_args):
cPopulationEvent("print_phenotype_status", in_args) {
cString args(in_args);
@@ -1060,11 +1064,11 @@
**/
-class cPopulationEventsave_population : public cPopulationEvent {
+class cEvent_save_population : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventsave_population(const cString& in_key, const cString& in_args):
+ cEvent_save_population(const cString& in_args):
cPopulationEvent("save_population", in_args) {
cString args(in_args);
@@ -1092,11 +1096,11 @@
**/
-class cPopulationEventload_population : public cPopulationEvent {
+class cEvent_load_population : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventload_population(const cString& in_key, const cString& in_args):
+ cEvent_load_population(const cString& in_args):
cPopulationEvent("load_population", in_args) {
cString args(in_args);
@@ -1115,11 +1119,11 @@
**/
-class cPopulationEventsave_clone : public cPopulationEvent {
+class cEvent_save_clone : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventsave_clone(const cString& in_key, const cString& in_args):
+ cEvent_save_clone(const cString& in_args):
cPopulationEvent("save_clone", in_args) {
cString args(in_args);
@@ -1142,11 +1146,11 @@
**/
-class cPopulationEventload_clone : public cPopulationEvent {
+class cEvent_load_clone : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventload_clone(const cString& in_key, const cString& in_args):
+ cEvent_load_clone(const cString& in_args):
cPopulationEvent("load_clone", in_args) {
cString args(in_args);
@@ -1168,12 +1172,12 @@
**/
-class cPopulationEventload_dump_file : public cPopulationEvent {
+class cEvent_load_dump_file : public cPopulationEvent {
private:
cString fname;
int update;
public:
- cPopulationEventload_dump_file(const cString& in_key, const cString& in_args):
+ cEvent_load_dump_file(const cString& in_args):
cPopulationEvent("load_dump_file", in_args) {
cString args(in_args);
@@ -1199,11 +1203,11 @@
**/
-class cPopulationEventdump_pop : public cPopulationEvent {
+class cEvent_dump_pop : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventdump_pop(const cString& in_key, const cString& in_args):
+ cEvent_dump_pop(const cString& in_args):
cPopulationEvent("dump_pop", in_args) {
cString args(in_args);
@@ -1240,13 +1244,13 @@
**/
-class cPopulationEventprint_genotypes : public cPopulationEvent {
+class cEvent_print_genotypes : public cPopulationEvent {
private:
cString data_fields;
int historic;
cString fname;
public:
- cPopulationEventprint_genotypes(const cString& in_key, const cString& in_args):
+ cEvent_print_genotypes(const cString& in_args):
cPopulationEvent("print_genotypes", in_args) {
cString args(in_args);
@@ -1276,11 +1280,11 @@
**/
-class cPopulationEventdetail_pop : public cPopulationEvent {
+class cEvent_detail_pop : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventdetail_pop(const cString& in_key, const cString& in_args):
+ cEvent_detail_pop(const cString& in_args):
cPopulationEvent("detail_pop", in_args) {
cString args(in_args);
@@ -1309,11 +1313,11 @@
**/
-class cPopulationEventdetail_sex_pop : public cPopulationEvent {
+class cEvent_detail_sex_pop : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventdetail_sex_pop(const cString& in_key, const cString& in_args):
+ cEvent_detail_sex_pop(const cString& in_args):
cPopulationEvent("detail_sex_pop", in_args) {
cString args(in_args);
@@ -1341,11 +1345,11 @@
**/
-class cPopulationEventdetail_parasite_pop : public cPopulationEvent {
+class cEvent_detail_parasite_pop : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventdetail_parasite_pop(const cString& in_key, const cString& in_args):
+ cEvent_detail_parasite_pop(const cString& in_args):
cPopulationEvent("detail_parasite_pop", in_args) {
cString args(in_args);
@@ -1379,12 +1383,12 @@
**/
-class cPopulationEventdump_historic_pop : public cPopulationEvent {
+class cEvent_dump_historic_pop : public cPopulationEvent {
private:
int back_dist;
cString fname;
public:
- cPopulationEventdump_historic_pop(const cString& in_key, const cString& in_args):
+ cEvent_dump_historic_pop(const cString& in_args):
cPopulationEvent("dump_historic_pop", in_args) {
cString args(in_args);
@@ -1414,11 +1418,11 @@
**/
-class cPopulationEventdump_historic_sex_pop : public cPopulationEvent {
+class cEvent_dump_historic_sex_pop : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventdump_historic_sex_pop(const cString& in_key, const cString& in_args):
+ cEvent_dump_historic_sex_pop(const cString& in_args):
cPopulationEvent("dump_historic_sex_pop", in_args) {
cString args(in_args);
@@ -1442,11 +1446,11 @@
**/
-class cPopulationEventdump_memory : public cPopulationEvent {
+class cEvent_dump_memory : public cPopulationEvent {
private:
cString fname;
public:
- cPopulationEventdump_memory(const cString& in_key, const cString& in_args):
+ cEvent_dump_memory(const cString& in_args):
cPopulationEvent("dump_memory", in_args) {
cString args(in_args);
@@ -1484,7 +1488,7 @@
**/
-class cPopulationEventinject : public cPopulationEvent {
+class cEvent_inject : public cPopulationEvent {
private:
cString fname;
int cell_id;
@@ -1492,7 +1496,7 @@
int lineage_label;
double neutral_metric;
public:
- cPopulationEventinject(const cString& in_key, const cString& in_args):
+ cEvent_inject(const cString& in_args):
cPopulationEvent("inject", in_args) {
cString args(in_args);
@@ -1530,14 +1534,14 @@
**/
-class cPopulationEventinject_all : public cPopulationEvent {
+class cEvent_inject_all : public cPopulationEvent {
private:
cString fname;
double merit;
int lineage_label;
double neutral_metric;
public:
- cPopulationEventinject_all(const cString& in_key, const cString& in_args):
+ cEvent_inject_all(const cString& in_args):
cPopulationEvent("inject_all", in_args) {
cString args(in_args);
@@ -1586,7 +1590,7 @@
**/
-class cPopulationEventinject_range : public cPopulationEvent {
+class cEvent_inject_range : public cPopulationEvent {
private:
cString fname;
int start_cell;
@@ -1595,7 +1599,7 @@
int lineage_label;
double neutral_metric;
public:
- cPopulationEventinject_range(const cString& in_key, const cString& in_args):
+ cEvent_inject_range(const cString& in_args):
cPopulationEvent("inject_range", in_args) {
cString args(in_args);
@@ -1652,7 +1656,7 @@
**/
-class cPopulationEventinject_sequence : public cPopulationEvent {
+class cEvent_inject_sequence : public cPopulationEvent {
private:
cString seq;
int start_cell;
@@ -1661,7 +1665,7 @@
int lineage_label;
double neutral_metric;
public:
- cPopulationEventinject_sequence(const cString& in_key, const cString& in_args):
+ cEvent_inject_sequence(const cString& in_args):
cPopulationEvent("inject_sequence", in_args) {
cString args(in_args);
@@ -1711,7 +1715,7 @@
**/
-class cPopulationEventinject_random : public cPopulationEvent {
+class cEvent_inject_random : public cPopulationEvent {
private:
int length;
int cell_id;
@@ -1719,7 +1723,7 @@
int lineage_label;
double neutral_metric;
public:
- cPopulationEventinject_random(const cString& in_key, const cString& in_args):
+ cEvent_inject_random(const cString& in_args):
cPopulationEvent("inject_random", in_args) {
cString args(in_args);
@@ -1766,7 +1770,7 @@
**/
-class cPopulationEventinject_range_parasite : public cPopulationEvent {
+class cEvent_inject_range_parasite : public cPopulationEvent {
private:
cString fname_parasite;
int start_cell;
@@ -1776,7 +1780,7 @@
double neutral_metric;
int mem_space;
public:
- cPopulationEventinject_range_parasite(const cString& in_key, const cString& in_args):
+ cEvent_inject_range_parasite(const cString& in_args):
cPopulationEvent("inject_range_parasite", in_args) {
cString args(in_args);
@@ -1836,7 +1840,7 @@
**/
-class cPopulationEventinject_range_pair : public cPopulationEvent {
+class cEvent_inject_range_pair : public cPopulationEvent {
private:
cString fname;
cString fname_parasite;
@@ -1847,7 +1851,7 @@
double neutral_metric;
int mem_space;
public:
- cPopulationEventinject_range_pair(const cString& in_key, const cString& in_args):
+ cEvent_inject_range_pair(const cString& in_args):
cPopulationEvent("inject_range_pair", in_args) {
cString args(in_args);
@@ -1890,10 +1894,10 @@
**/
-class cPopulationEventzero_muts : public cPopulationEvent {
+class cEvent_zero_muts : public cPopulationEvent {
private:
public:
- cPopulationEventzero_muts(const cString& in_key, const cString& in_args):
+ cEvent_zero_muts(const cString& in_args):
cPopulationEvent("zero_muts", in_args) {
(void)in_args; }
///// zero_muts /////
@@ -1910,12 +1914,12 @@
**/
-class cPopulationEventmod_copy_mut : public cPopulationEvent {
+class cEvent_mod_copy_mut : public cPopulationEvent {
private:
double cmut_inc;
int cell;
public:
- cPopulationEventmod_copy_mut(const cString& in_key, const cString& in_args):
+ cEvent_mod_copy_mut(const cString& in_args):
cPopulationEvent("mod_copy_mut", in_args) {
cString args(in_args);
@@ -1942,12 +1946,12 @@
**/
-class cPopulationEventmod_div_mut : public cPopulationEvent {
+class cEvent_mod_div_mut : public cPopulationEvent {
private:
double dmut_inc;
int cell;
public:
- cPopulationEventmod_div_mut(const cString& in_key, const cString& in_args):
+ cEvent_mod_div_mut(const cString& in_args):
cPopulationEvent("mod_div_mut", in_args) {
cString args(in_args);
@@ -1974,13 +1978,13 @@
**/
-class cPopulationEventset_copy_mut : public cPopulationEvent {
+class cEvent_set_copy_mut : public cPopulationEvent {
private:
double cmut;
int start_cell;
int end_cell;
public:
- cPopulationEventset_copy_mut(const cString& in_key, const cString& in_args):
+ cEvent_set_copy_mut(const cString& in_args):
cPopulationEvent("set_copy_mut", in_args) {
cString args(in_args);
@@ -2012,12 +2016,12 @@
**/
-class cPopulationEventmod_point_mut : public cPopulationEvent {
+class cEvent_mod_point_mut : public cPopulationEvent {
private:
double pmut_inc;
int cell;
public:
- cPopulationEventmod_point_mut(const cString& in_key, const cString& in_args):
+ cEvent_mod_point_mut(const cString& in_args):
cPopulationEvent("mod_point_mut", in_args) {
cString args(in_args);
@@ -2044,12 +2048,12 @@
**/
-class cPopulationEventset_point_mut : public cPopulationEvent {
+class cEvent_set_point_mut : public cPopulationEvent {
private:
double pmut;
int cell;
public:
- cPopulationEventset_point_mut(const cString& in_key, const cString& in_args):
+ cEvent_set_point_mut(const cString& in_args):
cPopulationEvent("set_point_mut", in_args) {
cString args(in_args);
@@ -2075,11 +2079,11 @@
**/
-class cPopulationEventcalc_landscape : public cPopulationEvent {
+class cEvent_calc_landscape : public cPopulationEvent {
private:
int landscape_dist;
public:
- cPopulationEventcalc_landscape(const cString& in_key, const cString& in_args):
+ cEvent_calc_landscape(const cString& in_args):
cPopulationEvent("calc_landscape", in_args) {
cString args(in_args);
@@ -2099,11 +2103,11 @@
**/
-class cPopulationEventpredict_w_landscape : public cPopulationEvent {
+class cEvent_predict_w_landscape : public cPopulationEvent {
private:
cString datafile;
public:
- cPopulationEventpredict_w_landscape(const cString& in_key, const cString& in_args):
+ cEvent_predict_w_landscape(const cString& in_args):
cPopulationEvent("predict_w_landscape", in_args) {
cString args(in_args);
@@ -2124,11 +2128,11 @@
**/
-class cPopulationEventpredict_nu_landscape : public cPopulationEvent {
+class cEvent_predict_nu_landscape : public cPopulationEvent {
private:
cString datafile;
public:
- cPopulationEventpredict_nu_landscape(const cString& in_key, const cString& in_args):
+ cEvent_predict_nu_landscape(const cString& in_args):
cPopulationEvent("predict_nu_landscape", in_args) {
cString args(in_args);
@@ -2149,11 +2153,11 @@
**/
-class cPopulationEventsample_landscape : public cPopulationEvent {
+class cEvent_sample_landscape : public cPopulationEvent {
private:
int sample_size;
public:
- cPopulationEventsample_landscape(const cString& in_key, const cString& in_args):
+ cEvent_sample_landscape(const cString& in_args):
cPopulationEvent("sample_landscape", in_args) {
cString args(in_args);
@@ -2176,7 +2180,7 @@
**/
-class cPopulationEventrandom_landscape : public cPopulationEvent {
+class cEvent_random_landscape : public cPopulationEvent {
private:
int landscape_dist;
int sample_size;
@@ -2184,7 +2188,7 @@
int max_sample_size;
bool print_if_found;
public:
- cPopulationEventrandom_landscape(const cString& in_key, const cString& in_args):
+ cEvent_random_landscape(const cString& in_args):
cPopulationEvent("random_landscape", in_args) {
cString args(in_args);
@@ -2211,13 +2215,13 @@
**/
-class cPopulationEventanalyze_landscape : public cPopulationEvent {
+class cEvent_analyze_landscape : public cPopulationEvent {
private:
int sample_size;
int min_found;
int max_sample_size;
public:
- cPopulationEventanalyze_landscape(const cString& in_key, const cString& in_args):
+ cEvent_analyze_landscape(const cString& in_args):
cPopulationEvent("analyze_landscape", in_args) {
cString args(in_args);
@@ -2242,11 +2246,11 @@
**/
-class cPopulationEventpairtest_landscape : public cPopulationEvent {
+class cEvent_pairtest_landscape : public cPopulationEvent {
private:
int sample_size;
public:
- cPopulationEventpairtest_landscape(const cString& in_key, const cString& in_args):
+ cEvent_pairtest_landscape(const cString& in_args):
cPopulationEvent("pairtest_landscape", in_args) {
cString args(in_args);
@@ -2265,10 +2269,10 @@
**/
-class cPopulationEventtest_dom : public cPopulationEvent {
+class cEvent_test_dom : public cPopulationEvent {
private:
public:
- cPopulationEventtest_dom(const cString& in_key, const cString& in_args):
+ cEvent_test_dom(const cString& in_args):
cPopulationEvent("test_dom", in_args) {
(void)in_args; }
///// test_dom /////
@@ -2285,14 +2289,14 @@
**/
-class cPopulationEventanalyze_population : public cPopulationEvent {
+class cEvent_analyze_population : public cPopulationEvent {
private:
double sample_prob;
int landscape;
int save_genotype;
cString filename;
public:
- cPopulationEventanalyze_population(const cString& in_key, const cString& in_args):
+ cEvent_analyze_population(const cString& in_args):
cPopulationEvent("analyze_population", in_args) {
cString args(in_args);
@@ -2320,7 +2324,7 @@
**/
-class cPopulationEventprint_detailed_fitness_data : public cPopulationEvent {
+class cEvent_print_detailed_fitness_data : public cPopulationEvent {
private:
int save_max_f_genotype;
int print_fitness_histo;
@@ -2330,7 +2334,7 @@
cString filename2;
cString filename3;
public:
- cPopulationEventprint_detailed_fitness_data(const cString& in_key, const cString& in_args):
+ cEvent_print_detailed_fitness_data(const cString& in_args):
cPopulationEvent("print_detailed_fitness_data", in_args) {
cString args(in_args);
@@ -2361,12 +2365,12 @@
**/
-class cPopulationEventprint_genetic_distance_data : public cPopulationEvent {
+class cEvent_print_genetic_distance_data : public cPopulationEvent {
private:
cString creature_name;
cString filename;
public:
- cPopulationEventprint_genetic_distance_data(const cString& in_key, const cString& in_args):
+ cEvent_print_genetic_distance_data(const cString& in_args):
cPopulationEvent("print_genetic_distance_data", in_args) {
cString args(in_args);
@@ -2388,13 +2392,13 @@
**/
-class cPopulationEventgenetic_distance_pop_dump : public cPopulationEvent {
+class cEvent_genetic_distance_pop_dump : public cPopulationEvent {
private:
cString creature_name;
cString filename;
int save_genotype;
public:
- cPopulationEventgenetic_distance_pop_dump(const cString& in_key, const cString& in_args):
+ cEvent_genetic_distance_pop_dump(const cString& in_args):
cPopulationEvent("genetic_distance_pop_dump", in_args) {
cString args(in_args);
@@ -2422,11 +2426,11 @@
**/
-class cPopulationEventtask_snapshot : public cPopulationEvent {
+class cEvent_task_snapshot : public cPopulationEvent {
private:
cString filename;
public:
- cPopulationEventtask_snapshot(const cString& in_key, const cString& in_args):
+ cEvent_task_snapshot(const cString& in_args):
cPopulationEvent("task_snapshot", in_args) {
cString args(in_args);
@@ -2450,11 +2454,11 @@
**/
-class cPopulationEventprint_viable_tasks_data : public cPopulationEvent {
+class cEvent_print_viable_tasks_data : public cPopulationEvent {
private:
cString filename;
public:
- cPopulationEventprint_viable_tasks_data(const cString& in_key, const cString& in_args):
+ cEvent_print_viable_tasks_data(const cString& in_args):
cPopulationEvent("print_viable_tasks_data", in_args) {
cString args(in_args);
@@ -2478,11 +2482,11 @@
**/
-class cPopulationEventapocalypse : public cPopulationEvent {
+class cEvent_apocalypse : public cPopulationEvent {
private:
double kill_prob;
public:
- cPopulationEventapocalypse(const cString& in_key, const cString& in_args):
+ cEvent_apocalypse(const cString& in_args):
cPopulationEvent("apocalypse", in_args) {
cString args(in_args);
@@ -2510,14 +2514,14 @@
**/
-class cPopulationEventkill_rectangle : public cPopulationEvent {
+class cEvent_kill_rectangle : public cPopulationEvent {
private:
int cell_X1;
int cell_Y1;
int cell_X2;
int cell_Y2;
public:
- cPopulationEventkill_rectangle(const cString& in_key, const cString& in_args):
+ cEvent_kill_rectangle(const cString& in_args):
cPopulationEvent("kill_rectangle", in_args) {
cString args(in_args);
@@ -2587,11 +2591,11 @@
**/
-class cPopulationEventrate_kill : public cPopulationEvent {
+class cEvent_rate_kill : public cPopulationEvent {
private:
double kill_rate;
public:
- cPopulationEventrate_kill(const cString& in_key, const cString& in_args):
+ cEvent_rate_kill(const cString& in_args):
cPopulationEvent("rate_kill", in_args) {
cString args(in_args);
@@ -2631,12 +2635,12 @@
**/
-class cPopulationEventserial_transfer : public cPopulationEvent {
+class cEvent_serial_transfer : public cPopulationEvent {
private:
int transfer_size;
int ignore_deads;
public:
- cPopulationEventserial_transfer(const cString& in_key, const cString& in_args):
+ cEvent_serial_transfer(const cString& in_args):
cPopulationEvent("serial_transfer", in_args) {
cString args(in_args);
@@ -2656,10 +2660,10 @@
**/
-class cPopulationEventhillclimb : public cPopulationEvent {
+class cEvent_hillclimb : public cPopulationEvent {
private:
public:
- cPopulationEventhillclimb(const cString& in_key, const cString& in_args):
+ cEvent_hillclimb(const cString& in_args):
cPopulationEvent("hillclimb", in_args) {
(void)in_args; }
///// hillclimb /////
@@ -2677,10 +2681,10 @@
**/
-class cPopulationEventhillclimb_neut : public cPopulationEvent {
+class cEvent_hillclimb_neut : public cPopulationEvent {
private:
public:
- cPopulationEventhillclimb_neut(const cString& in_key, const cString& in_args):
+ cEvent_hillclimb_neut(const cString& in_args):
cPopulationEvent("hillclimb_neut", in_args) {
(void)in_args; }
///// hillclimb_neut /////
@@ -2698,10 +2702,10 @@
**/
-class cPopulationEventhillclimb_rand : public cPopulationEvent {
+class cEvent_hillclimb_rand : public cPopulationEvent {
private:
public:
- cPopulationEventhillclimb_rand(const cString& in_key, const cString& in_args):
+ cEvent_hillclimb_rand(const cString& in_args):
cPopulationEvent("hillclimb_rand", in_args) {
(void)in_args; }
///// hillclimb_rand /////
@@ -2726,11 +2730,11 @@
**/
-class cPopulationEventcompete_demes : public cPopulationEvent {
+class cEvent_compete_demes : public cPopulationEvent {
private:
int competition_type;
public:
- cPopulationEventcompete_demes(const cString& in_key, const cString& in_args):
+ cEvent_compete_demes(const cString& in_args):
cPopulationEvent("compete_demes", in_args) {
cString args(in_args);
@@ -2750,10 +2754,10 @@
**/
-class cPopulationEventreset_demes : public cPopulationEvent {
+class cEvent_reset_demes : public cPopulationEvent {
private:
public:
- cPopulationEventreset_demes(const cString& in_key, const cString& in_args):
+ cEvent_reset_demes(const cString& in_args):
cPopulationEvent("reset_demes", in_args) {
(void)in_args; }
///// reset_demes /////
@@ -2769,10 +2773,10 @@
**/
-class cPopulationEventprint_deme_stats : public cPopulationEvent {
+class cEvent_print_deme_stats : public cPopulationEvent {
private:
public:
- cPopulationEventprint_deme_stats(const cString& in_key, const cString& in_args):
+ cEvent_print_deme_stats(const cString& in_args):
cPopulationEvent("print_deme_stats", in_args) {
(void)in_args; }
///// print_deme_stats /////
@@ -2789,12 +2793,12 @@
**/
-class cPopulationEventcopy_deme : public cPopulationEvent {
+class cEvent_copy_deme : public cPopulationEvent {
private:
int deme1_id;
int deme2_id;
public:
- cPopulationEventcopy_deme(const cString& in_key, const cString& in_args):
+ cEvent_copy_deme(const cString& in_args):
cPopulationEvent("copy_deme", in_args) {
cString args(in_args);
@@ -2818,11 +2822,11 @@
**/
-class cPopulationEventcalc_consensus : public cPopulationEvent {
+class cEvent_calc_consensus : public cPopulationEvent {
private:
int lines_saved;
public:
- cPopulationEventcalc_consensus(const cString& in_key, const cString& in_args):
+ cEvent_calc_consensus(const cString& in_args):
cPopulationEvent("calc_consensus", in_args) {
cString args(in_args);
@@ -2840,12 +2844,12 @@
**/
-class cPopulationEventtest_size_change_robustness : public cPopulationEvent {
+class cEvent_test_size_change_robustness : public cPopulationEvent {
private:
int num_trials;
cString filename;
public:
- cPopulationEventtest_size_change_robustness(const cString& in_key, const cString& in_args):
+ cEvent_test_size_change_robustness(const cString& in_args):
cPopulationEvent("test_size_change_robustness", in_args) {
cString args(in_args);
@@ -2868,10 +2872,10 @@
**/
-class cPopulationEventtest_threads : public cPopulationEvent {
+class cEvent_test_threads : public cPopulationEvent {
private:
public:
- cPopulationEventtest_threads(const cString& in_key, const cString& in_args):
+ cEvent_test_threads(const cString& in_args):
cPopulationEvent("test_threads", in_args) {
(void)in_args; }
///// test_threads /////
@@ -2886,10 +2890,10 @@
**/
-class cPopulationEventprint_threads : public cPopulationEvent {
+class cEvent_print_threads : public cPopulationEvent {
private:
public:
- cPopulationEventprint_threads(const cString& in_key, const cString& in_args):
+ cEvent_print_threads(const cString& in_args):
cPopulationEvent("print_threads", in_args) {
(void)in_args; }
///// print_threads /////
@@ -2909,10 +2913,10 @@
**/
-class cPopulationEventdump_fitness_grid : public cPopulationEvent {
+class cEvent_dump_fitness_grid : public cPopulationEvent {
private:
public:
- cPopulationEventdump_fitness_grid(const cString& in_key, const cString& in_args):
+ cEvent_dump_fitness_grid(const cString& in_args):
cPopulationEvent("dump_fitness_grid", in_args) {
(void)in_args; }
///// dump_fitness_grid /////
@@ -2943,10 +2947,10 @@
**/
-class cPopulationEventdump_genotype_grid : public cPopulationEvent {
+class cEvent_dump_genotype_grid : public cPopulationEvent {
private:
public:
- cPopulationEventdump_genotype_grid(const cString& in_key, const cString& in_args):
+ cEvent_dump_genotype_grid(const cString& in_args):
cPopulationEvent("dump_genotype_grid", in_args) {
(void)in_args; }
///// dump_genotype_grid /////
@@ -2975,10 +2979,10 @@
**/
-class cPopulationEventdump_task_grid : public cPopulationEvent {
+class cEvent_dump_task_grid : public cPopulationEvent {
private:
public:
- cPopulationEventdump_task_grid(const cString& in_key, const cString& in_args):
+ cEvent_dump_task_grid(const cString& in_args):
cPopulationEvent("dump_task_grid", in_args) {
(void)in_args; }
///// dump_task_grid /////
@@ -3000,10 +3004,10 @@
**/
-class cPopulationEventdump_donor_grid : public cPopulationEvent {
+class cEvent_dump_donor_grid : public cPopulationEvent {
private:
public:
- cPopulationEventdump_donor_grid(const cString& in_key, const cString& in_args):
+ cEvent_dump_donor_grid(const cString& in_args):
cPopulationEvent("dump_donor_grid", in_args) {
(void)in_args; }
///// dump_donor_grid /////
@@ -3033,10 +3037,10 @@
**/
-class cPopulationEventdump_receiver_grid : public cPopulationEvent {
+class cEvent_dump_receiver_grid : public cPopulationEvent {
private:
public:
- cPopulationEventdump_receiver_grid(const cString& in_key, const cString& in_args):
+ cEvent_dump_receiver_grid(const cString& in_args):
cPopulationEvent("dump_receiver_grid", in_args) {
(void)in_args; }
///// dump_receiver_grid /////
@@ -3063,11 +3067,11 @@
**/
-class cPopulationEventprint_tree_depths : public cPopulationEvent {
+class cEvent_print_tree_depths : public cPopulationEvent {
private:
cString filename;
public:
- cPopulationEventprint_tree_depths(const cString& in_key, const cString& in_args):
+ cEvent_print_tree_depths(const cString& in_args):
cPopulationEvent("print_tree_depths", in_args) {
cString args(in_args);
@@ -3095,13 +3099,13 @@
**/
-class cPopulationEventsever_grid_col : public cPopulationEvent {
+class cEvent_sever_grid_col : public cPopulationEvent {
private:
int col_id;
int min_row;
int max_row;
public:
- cPopulationEventsever_grid_col(const cString& in_key, const cString& in_args):
+ cEvent_sever_grid_col(const cString& in_args):
cPopulationEvent("sever_grid_col", in_args) {
cString args(in_args);
@@ -3156,13 +3160,13 @@
**/
-class cPopulationEventsever_grid_row : public cPopulationEvent {
+class cEvent_sever_grid_row : public cPopulationEvent {
private:
int row_id;
int min_col;
int max_col;
public:
- cPopulationEventsever_grid_row(const cString& in_key, const cString& in_args):
+ cEvent_sever_grid_row(const cString& in_args):
cPopulationEvent("sever_grid_row", in_args) {
cString args(in_args);
@@ -3217,13 +3221,13 @@
**/
-class cPopulationEventjoin_grid_col : public cPopulationEvent {
+class cEvent_join_grid_col : public cPopulationEvent {
private:
int col_id;
int min_row;
int max_row;
public:
- cPopulationEventjoin_grid_col(const cString& in_key, const cString& in_args):
+ cEvent_join_grid_col(const cString& in_args):
cPopulationEvent("join_grid_col", in_args) {
cString args(in_args);
@@ -3282,13 +3286,13 @@
**/
-class cPopulationEventjoin_grid_row : public cPopulationEvent {
+class cEvent_join_grid_row : public cPopulationEvent {
private:
int row_id;
int min_col;
int max_col;
public:
- cPopulationEventjoin_grid_row(const cString& in_key, const cString& in_args):
+ cEvent_join_grid_row(const cString& in_args):
cPopulationEvent("join_grid_row", in_args) {
cString args(in_args);
@@ -3342,14 +3346,14 @@
**/
-class cPopulationEventconnect_cells : public cPopulationEvent {
+class cEvent_connect_cells : public cPopulationEvent {
private:
int cellA_x;
int cellA_y;
int cellB_x;
int cellB_y;
public:
- cPopulationEventconnect_cells(const cString& in_key, const cString& in_args):
+ cEvent_connect_cells(const cString& in_args):
cPopulationEvent("connect_cells", in_args) {
cString args(in_args);
@@ -3389,14 +3393,14 @@
**/
-class cPopulationEventdisconnect_cells : public cPopulationEvent {
+class cEvent_disconnect_cells : public cPopulationEvent {
private:
int cellA_x;
int cellA_y;
int cellB_x;
int cellB_y;
public:
- cPopulationEventdisconnect_cells(const cString& in_key, const cString& in_args):
+ cEvent_disconnect_cells(const cString& in_args):
cPopulationEvent("disconnect_cells", in_args) {
cString args(in_args);
@@ -3434,12 +3438,12 @@
**/
-class cPopulationEventinject_resource : public cPopulationEvent {
+class cEvent_inject_resource : public cPopulationEvent {
private:
cString res_name;
double res_count;
public:
- cPopulationEventinject_resource(const cString& in_key, const cString& in_args):
+ cEvent_inject_resource(const cString& in_args):
cPopulationEvent("inject_resource", in_args) {
cString args(in_args);
@@ -3461,12 +3465,12 @@
**/
-class cPopulationEventset_resource : public cPopulationEvent {
+class cEvent_set_resource : public cPopulationEvent {
private:
cString res_name;
double res_count;
public:
- cPopulationEventset_resource(const cString& in_key, const cString& in_args):
+ cEvent_set_resource(const cString& in_args):
cPopulationEvent("set_resource", in_args) {
cString args(in_args);
@@ -3491,12 +3495,12 @@
**/
-class cPopulationEventinject_scaled_resource : public cPopulationEvent {
+class cEvent_inject_scaled_resource : public cPopulationEvent {
private:
cString res_name;
double res_count;
public:
- cPopulationEventinject_scaled_resource(const cString& in_key, const cString& in_args):
+ cEvent_inject_scaled_resource(const cString& in_args):
cPopulationEvent("inject_scaled_resource", in_args) {
cString args(in_args);
@@ -3523,12 +3527,12 @@
**/
-class cPopulationEventoutflow_scaled_resource : public cPopulationEvent {
+class cEvent_outflow_scaled_resource : public cPopulationEvent {
private:
cString res_name;
double res_perc;
public:
- cPopulationEventoutflow_scaled_resource(const cString& in_key, const cString& in_args):
+ cEvent_outflow_scaled_resource(const cString& in_args):
cPopulationEvent("outflow_scaled_resource", in_args) {
cString args(in_args);
@@ -3560,12 +3564,12 @@
**/
-class cPopulationEventset_reaction_value : public cPopulationEvent {
+class cEvent_set_reaction_value : public cPopulationEvent {
private:
cString reaction_name;
double reaction_value;
public:
- cPopulationEventset_reaction_value(const cString& in_key, const cString& in_args):
+ cEvent_set_reaction_value(const cString& in_args):
cPopulationEvent("set_reaction_value", in_args) {
cString args(in_args);
@@ -3585,12 +3589,12 @@
**/
-class cPopulationEventset_reaction_value_mult : public cPopulationEvent {
+class cEvent_set_reaction_value_mult : public cPopulationEvent {
private:
cString reaction_name;
double value_mult;
public:
- cPopulationEventset_reaction_value_mult(const cString& in_key, const cString& in_args):
+ cEvent_set_reaction_value_mult(const cString& in_args):
cPopulationEvent("set_reaction_value_mult", in_args) {
cString args(in_args);
@@ -3603,121 +3607,121 @@
}
};
+}
/////////////////
-// cPopulationEventFactory
+// cEvent_Factory
/////////////////
cPopulationEventFactory::cPopulationEventFactory(cPopulation* pop) : m_population( pop )
{
- //"" :: cPopulationEventFactory::EVENT_NO_EVENT;
- Register<cPopulationEventexit>("exit");
- Register<cPopulationEventexit_if_generation_greater_than>("exit_if_generation_greater_than");
- Register<cPopulationEventexit_if_update_greater_than>("exit_if_update_greater_than");
- Register<cPopulationEventexit_if_ave_lineage_label_smaller>("exit_if_ave_lineage_label_smaller");
- Register<cPopulationEventexit_if_ave_lineage_label_larger>("exit_if_ave_lineage_label_larger");
- Register<cPopulationEventecho>("echo");
- Register<cPopulationEventprint_data>("print_data");
- Register<cPopulationEventprint_average_data>("print_average_data");
- Register<cPopulationEventprint_error_data>("print_error_data");
- Register<cPopulationEventprint_variance_data>("print_variance_data");
- Register<cPopulationEventprint_dominant_data>("print_dominant_data");
- Register<cPopulationEventprint_stats_data>("print_stats_data");
- Register<cPopulationEventprint_count_data>("print_count_data");
- Register<cPopulationEventprint_totals_data>("print_totals_data");
- Register<cPopulationEventprint_tasks_data>("print_tasks_data");
- Register<cPopulationEventprint_tasks_exe_data>("print_tasks_exe_data");
- Register<cPopulationEventprint_resource_data>("print_resource_data");
- Register<cPopulationEventprint_time_data>("print_time_data");
- Register<cPopulationEventprint_mutation_data>("print_mutation_data");
- Register<cPopulationEventprint_mutation_rate_data>("print_mutation_rate_data");
- Register<cPopulationEventprint_divide_mut_data>("print_divide_mut_data");
- Register<cPopulationEventprint_dom_parasite_data>("print_dom_parasite_data");
- Register<cPopulationEventprint_instruction_data>("print_instruction_data");
- Register<cPopulationEventprint_instruction_abundance_histogram>("print_instruction_abundance_histogram");
- Register<cPopulationEventprint_depth_histogram>("print_depth_histogram");
- Register<cPopulationEventprint_genotype_abundance_histogram>("print_genotype_abundance_histogram");
- Register<cPopulationEventprint_species_abundance_histogram>("print_species_abundance_histogram");
- Register<cPopulationEventprint_lineage_totals>("print_lineage_totals");
- Register<cPopulationEventprint_lineage_counts>("print_lineage_counts");
- Register<cPopulationEventprint_dom>("print_dom");
- Register<cPopulationEventparasite_debug>("parasite_debug");
- Register<cPopulationEventprint_dom_parasite>("print_dom_parasite");
- Register<cPopulationEventprint_genotype_map>("print_genotype_map");
- Register<cPopulationEventprint_number_phenotypes>("print_number_phenotypes");
- Register<cPopulationEventprint_phenotype_status>("print_phenotype_status");
- Register<cPopulationEventsave_population>("save_population");
- Register<cPopulationEventload_population>("load_population");
- Register<cPopulationEventsave_clone>("save_clone");
- Register<cPopulationEventload_clone>("load_clone");
- Register<cPopulationEventload_dump_file>("load_dump_file");
- Register<cPopulationEventdump_pop>("dump_pop");
- Register<cPopulationEventprint_genotypes>("print_genotypes");
- Register<cPopulationEventdetail_pop>("detail_pop");
- Register<cPopulationEventdetail_sex_pop>("detail_sex_pop");
- Register<cPopulationEventdetail_parasite_pop>("detail_parasite_pop");
- Register<cPopulationEventdump_historic_pop>("dump_historic_pop");
- Register<cPopulationEventdump_historic_sex_pop>("dump_historic_sex_pop");
- Register<cPopulationEventdump_memory>("dump_memory");
- Register<cPopulationEventinject>("inject");
- Register<cPopulationEventinject_all>("inject_all");
- Register<cPopulationEventinject_range>("inject_range");
- Register<cPopulationEventinject_sequence>("inject_sequence");
- Register<cPopulationEventinject_random>("inject_random");
- Register<cPopulationEventinject_range_parasite>("inject_range_parasite");
- Register<cPopulationEventinject_range_pair>("inject_range_pair");
- Register<cPopulationEventzero_muts>("zero_muts");
- Register<cPopulationEventmod_copy_mut>("mod_copy_mut");
- Register<cPopulationEventmod_div_mut>("mod_div_mut");
- Register<cPopulationEventset_copy_mut>("set_copy_mut");
- Register<cPopulationEventmod_point_mut>("mod_point_mut");
- Register<cPopulationEventset_point_mut>("set_point_mut");
- Register<cPopulationEventcalc_landscape>("calc_landscape");
- Register<cPopulationEventpredict_w_landscape>("predict_w_landscape");
- Register<cPopulationEventpredict_nu_landscape>("predict_nu_landscape");
- Register<cPopulationEventsample_landscape>("sample_landscape");
- Register<cPopulationEventrandom_landscape>("random_landscape");
- Register<cPopulationEventanalyze_landscape>("analyze_landscape");
- Register<cPopulationEventpairtest_landscape>("pairtest_landscape");
- Register<cPopulationEventtest_dom>("test_dom");
- Register<cPopulationEventanalyze_population>("analyze_population");
- Register<cPopulationEventprint_detailed_fitness_data>("print_detailed_fitness_data");
- Register<cPopulationEventprint_genetic_distance_data>("print_genetic_distance_data");
- Register<cPopulationEventgenetic_distance_pop_dump>("genetic_distance_pop_dump");
- Register<cPopulationEventtask_snapshot>("task_snapshot");
- Register<cPopulationEventprint_viable_tasks_data>("print_viable_tasks_data");
- Register<cPopulationEventapocalypse>("apocalypse");
- Register<cPopulationEventkill_rectangle>("kill_rectangle");
- Register<cPopulationEventrate_kill>("rate_kill");
- Register<cPopulationEventserial_transfer>("serial_transfer");
- Register<cPopulationEventhillclimb>("hillclimb");
- Register<cPopulationEventhillclimb_neut>("hillclimb_neut");
- Register<cPopulationEventhillclimb_rand>("hillclimb_rand");
- Register<cPopulationEventcompete_demes>("compete_demes");
- Register<cPopulationEventreset_demes>("reset_demes");
- Register<cPopulationEventprint_deme_stats>("print_deme_stats");
- Register<cPopulationEventcopy_deme>("copy_deme");
- Register<cPopulationEventcalc_consensus>("calc_consensus");
- Register<cPopulationEventtest_size_change_robustness>("test_size_change_robustness");
- Register<cPopulationEventtest_threads>("test_threads");
- Register<cPopulationEventprint_threads>("print_threads");
- Register<cPopulationEventdump_fitness_grid>("dump_fitness_grid");
- Register<cPopulationEventdump_genotype_grid>("dump_genotype_grid");
- Register<cPopulationEventdump_task_grid>("dump_task_grid");
- Register<cPopulationEventdump_donor_grid>("dump_donor_grid");
- Register<cPopulationEventdump_receiver_grid>("dump_receiver_grid");
- Register<cPopulationEventprint_tree_depths>("print_tree_depths");
- Register<cPopulationEventsever_grid_col>("sever_grid_col");
- Register<cPopulationEventsever_grid_row>("sever_grid_row");
- Register<cPopulationEventjoin_grid_col>("join_grid_col");
- Register<cPopulationEventjoin_grid_row>("join_grid_row");
- Register<cPopulationEventconnect_cells>("connect_cells");
- Register<cPopulationEventdisconnect_cells>("disconnect_cells");
- Register<cPopulationEventinject_resource>("inject_resource");
- Register<cPopulationEventset_resource>("set_resource");
- Register<cPopulationEventinject_scaled_resource>("inject_scaled_resource");
- Register<cPopulationEventoutflow_scaled_resource>("outflow_scaled_resource");
- Register<cPopulationEventset_reaction_value>("set_reaction_value");
- Register<cPopulationEventset_reaction_value_mult>("set_reaction_value_mult");
- //return cPopulationEventFactory::EVENT_undefined;
+ using namespace nPopulation;
+ Register<cEvent_exit>("exit");
+ Register<cEvent_exit_if_generation_greater_than>("exit_if_generation_greater_than");
+ Register<cEvent_exit_if_update_greater_than>("exit_if_update_greater_than");
+ Register<cEvent_exit_if_ave_lineage_label_smaller>("exit_if_ave_lineage_label_smaller");
+ Register<cEvent_exit_if_ave_lineage_label_larger>("exit_if_ave_lineage_label_larger");
+ Register<cEvent_echo>("echo");
+ Register<cEvent_print_data>("print_data");
+ Register<cEvent_print_average_data>("print_average_data");
+ Register<cEvent_print_error_data>("print_error_data");
+ Register<cEvent_print_variance_data>("print_variance_data");
+ Register<cEvent_print_dominant_data>("print_dominant_data");
+ Register<cEvent_print_stats_data>("print_stats_data");
+ Register<cEvent_print_count_data>("print_count_data");
+ Register<cEvent_print_totals_data>("print_totals_data");
+ Register<cEvent_print_tasks_data>("print_tasks_data");
+ Register<cEvent_print_tasks_exe_data>("print_tasks_exe_data");
+ Register<cEvent_print_resource_data>("print_resource_data");
+ Register<cEvent_print_time_data>("print_time_data");
+ Register<cEvent_print_mutation_data>("print_mutation_data");
+ Register<cEvent_print_mutation_rate_data>("print_mutation_rate_data");
+ Register<cEvent_print_divide_mut_data>("print_divide_mut_data");
+ Register<cEvent_print_dom_parasite_data>("print_dom_parasite_data");
+ Register<cEvent_print_instruction_data>("print_instruction_data");
+ Register<cEvent_print_instruction_abundance_histogram>("print_instruction_abundance_histogram");
+ Register<cEvent_print_depth_histogram>("print_depth_histogram");
+ Register<cEvent_print_genotype_abundance_histogram>("print_genotype_abundance_histogram");
+ Register<cEvent_print_species_abundance_histogram>("print_species_abundance_histogram");
+ Register<cEvent_print_lineage_totals>("print_lineage_totals");
+ Register<cEvent_print_lineage_counts>("print_lineage_counts");
+ Register<cEvent_print_dom>("print_dom");
+ Register<cEvent_parasite_debug>("parasite_debug");
+ Register<cEvent_print_dom_parasite>("print_dom_parasite");
+ Register<cEvent_print_genotype_map>("print_genotype_map");
+ Register<cEvent_print_number_phenotypes>("print_number_phenotypes");
+ Register<cEvent_print_phenotype_status>("print_phenotype_status");
+ Register<cEvent_save_population>("save_population");
+ Register<cEvent_load_population>("load_population");
+ Register<cEvent_save_clone>("save_clone");
+ Register<cEvent_load_clone>("load_clone");
+ Register<cEvent_load_dump_file>("load_dump_file");
+ Register<cEvent_dump_pop>("dump_pop");
+ Register<cEvent_print_genotypes>("print_genotypes");
+ Register<cEvent_detail_pop>("detail_pop");
+ Register<cEvent_detail_sex_pop>("detail_sex_pop");
+ Register<cEvent_detail_parasite_pop>("detail_parasite_pop");
+ Register<cEvent_dump_historic_pop>("dump_historic_pop");
+ Register<cEvent_dump_historic_sex_pop>("dump_historic_sex_pop");
+ Register<cEvent_dump_memory>("dump_memory");
+ Register<cEvent_inject>("inject");
+ Register<cEvent_inject_all>("inject_all");
+ Register<cEvent_inject_range>("inject_range");
+ Register<cEvent_inject_sequence>("inject_sequence");
+ Register<cEvent_inject_random>("inject_random");
+ Register<cEvent_inject_range_parasite>("inject_range_parasite");
+ Register<cEvent_inject_range_pair>("inject_range_pair");
+ Register<cEvent_zero_muts>("zero_muts");
+ Register<cEvent_mod_copy_mut>("mod_copy_mut");
+ Register<cEvent_mod_div_mut>("mod_div_mut");
+ Register<cEvent_set_copy_mut>("set_copy_mut");
+ Register<cEvent_mod_point_mut>("mod_point_mut");
+ Register<cEvent_set_point_mut>("set_point_mut");
+ Register<cEvent_calc_landscape>("calc_landscape");
+ Register<cEvent_predict_w_landscape>("predict_w_landscape");
+ Register<cEvent_predict_nu_landscape>("predict_nu_landscape");
+ Register<cEvent_sample_landscape>("sample_landscape");
+ Register<cEvent_random_landscape>("random_landscape");
+ Register<cEvent_analyze_landscape>("analyze_landscape");
+ Register<cEvent_pairtest_landscape>("pairtest_landscape");
+ Register<cEvent_test_dom>("test_dom");
+ Register<cEvent_analyze_population>("analyze_population");
+ Register<cEvent_print_detailed_fitness_data>("print_detailed_fitness_data");
+ Register<cEvent_print_genetic_distance_data>("print_genetic_distance_data");
+ Register<cEvent_genetic_distance_pop_dump>("genetic_distance_pop_dump");
+ Register<cEvent_task_snapshot>("task_snapshot");
+ Register<cEvent_print_viable_tasks_data>("print_viable_tasks_data");
+ Register<cEvent_apocalypse>("apocalypse");
+ Register<cEvent_kill_rectangle>("kill_rectangle");
+ Register<cEvent_rate_kill>("rate_kill");
+ Register<cEvent_serial_transfer>("serial_transfer");
+ Register<cEvent_hillclimb>("hillclimb");
+ Register<cEvent_hillclimb_neut>("hillclimb_neut");
+ Register<cEvent_hillclimb_rand>("hillclimb_rand");
+ Register<cEvent_compete_demes>("compete_demes");
+ Register<cEvent_reset_demes>("reset_demes");
+ Register<cEvent_print_deme_stats>("print_deme_stats");
+ Register<cEvent_copy_deme>("copy_deme");
+ Register<cEvent_calc_consensus>("calc_consensus");
+ Register<cEvent_test_size_change_robustness>("test_size_change_robustness");
+ Register<cEvent_test_threads>("test_threads");
+ Register<cEvent_print_threads>("print_threads");
+ Register<cEvent_dump_fitness_grid>("dump_fitness_grid");
+ Register<cEvent_dump_genotype_grid>("dump_genotype_grid");
+ Register<cEvent_dump_task_grid>("dump_task_grid");
+ Register<cEvent_dump_donor_grid>("dump_donor_grid");
+ Register<cEvent_dump_receiver_grid>("dump_receiver_grid");
+ Register<cEvent_print_tree_depths>("print_tree_depths");
+ Register<cEvent_sever_grid_col>("sever_grid_col");
+ Register<cEvent_sever_grid_row>("sever_grid_row");
+ Register<cEvent_join_grid_col>("join_grid_col");
+ Register<cEvent_join_grid_row>("join_grid_row");
+ Register<cEvent_connect_cells>("connect_cells");
+ Register<cEvent_disconnect_cells>("disconnect_cells");
+ Register<cEvent_inject_resource>("inject_resource");
+ Register<cEvent_set_resource>("set_resource");
+ Register<cEvent_inject_scaled_resource>("inject_scaled_resource");
+ Register<cEvent_outflow_scaled_resource>("outflow_scaled_resource");
+ Register<cEvent_set_reaction_value>("set_reaction_value");
+ Register<cEvent_set_reaction_value_mult>("set_reaction_value_mult");
}
Modified: branches/brysonda/source/event/population_event_factory.hh
===================================================================
--- branches/brysonda/source/event/population_event_factory.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/event/population_event_factory.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -19,7 +19,7 @@
class cPopulation;
class cString;
-class cPopulationEventFactory : public tObjectFactory<cEvent, const cString&> {
+class cPopulationEventFactory : public tObjectFactory<cEvent (const cString&)> {
private:
cPopulation *m_population;
public:
@@ -28,7 +28,7 @@
cEvent* Create(const cString& key, const cString& arg)
{
- cPopulationEvent* event = static_cast<cPopulationEvent*>(this->tObjectFactory<cEvent, const cString&>::Create(key, arg));
+ cPopulationEvent* event = static_cast<cPopulationEvent*>(this->tObjectFactory<cEvent (const cString&)>::Create(key, arg));
if( event != NULL ){
event->SetFactoryId( GetFactoryId() );
Modified: branches/brysonda/source/main/analyze.cc
===================================================================
--- branches/brysonda/source/main/analyze.cc 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/main/analyze.cc 2005-06-11 00:57:17 UTC (rev 203)
@@ -1941,10 +1941,9 @@
cAnalyzeGenotype * genotype = NULL;
while ((genotype = batch_it.Next()) != NULL) {
cLandscape landscape(genotype->GetGenome(), inst_set);
- if (num_test == 0) landscape.Process(dist);
- else int num_found =
- landscape.RandomProcess(num_test,dist,num_test,num_test*2);
-// fp << genotype->GetName() << " ";
+ if (num_test == 0) landscape.Process(dist);
+ else landscape.RandomProcess(num_test,dist,num_test,num_test*2);
+
landscape.PrintStats(fp);
}
}
@@ -4392,7 +4391,6 @@
for (int inst_num = 0; inst_num < num_insts; inst_num ++)
inst_stat(line_num, inst_num) = 0;
- int organism_index = 0;
int num_cpus = 0;
int actural_samples = 0;
while (genotype != NULL) {
Modified: branches/brysonda/source/main/genebank.cc
===================================================================
--- branches/brysonda/source/main/genebank.cc 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/main/genebank.cc 2005-06-11 00:57:17 UTC (rev 203)
@@ -787,7 +787,6 @@
bool cGenebank::OK()
{
bool ret_value = true;
- int i;
// Check components...
@@ -833,7 +832,7 @@
// Check the species for each genotype and place results in the species.
cGenotype * cur_gen = genotype_control->GetBest();
- for (i = 0; i < genotype_control->GetSize(); i++) {
+ for (int i = 0; i < genotype_control->GetSize(); i++) {
if (cur_gen->GetSpecies()) {
cur_gen->GetSpecies()->debug_num_genotypes++;
if (cur_gen->GetThreshold()) {
Modified: branches/brysonda/source/tools/message_display.hh
===================================================================
--- branches/brysonda/source/tools/message_display.hh 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/tools/message_display.hh 2005-06-11 00:57:17 UTC (rev 203)
@@ -25,6 +25,8 @@
class cMessageDisplay{
public:
+ virtual ~cMessageDisplay() { ; }
+
virtual void out(cString &final_msg){}
virtual void abort(){ abort(); }
};
Modified: branches/brysonda/source/tools/tObjectFactory.h
===================================================================
--- branches/brysonda/source/tools/tObjectFactory.h 2005-06-10 19:29:26 UTC (rev 202)
+++ branches/brysonda/source/tools/tObjectFactory.h 2005-06-11 00:57:17 UTC (rev 203)
@@ -16,26 +16,46 @@
class cString;
+template<typename CtorSignature> class tObjectFactory;
+
namespace nObjectFactory
{
- template<typename BaseType, typename ClassType, typename ArgType>
- BaseType* createObject(const cString& key, ArgType arg)
+ template<typename BaseType, typename ClassType>
+ BaseType* createObject()
{
- return new ClassType(key, arg);
+ return new ClassType();
}
+
+ template<typename BaseType, typename ClassType, typename Arg1Type>
+ BaseType* createObject(Arg1Type arg1)
+ {
+ return new ClassType(arg1);
+ }
+
+ template<typename BaseType, typename ClassType, typename Arg1Type, typename Arg2Type>
+ BaseType* createObject(Arg1Type arg1, Arg2Type arg2)
+ {
+ return new ClassType(arg1, arg2);
+ }
+
+ template<typename BaseType, typename ClassType, typename Arg1Type, typename Arg2Type, typename Arg3Type>
+ BaseType* createObject(Arg1Type arg1, Arg2Type arg2, Arg3Type arg3)
+ {
+ return new ClassType(arg1, arg2, arg3);
+ }
}
-template<typename BaseType, typename ArgType>
-class tObjectFactory
+template<typename BaseType>
+class tObjectFactory<BaseType ()>
{
protected:
- typedef BaseType* (*CreateObjectFunction)(const cString&, ArgType);
+ typedef BaseType* (*CreateObjectFunction)();
tDictionary<CreateObjectFunction> m_create_funcs;
int m_factory_id;
public:
- tObjectFactory() : m_factory_id(0) { ; }
+ tObjectFactory() : m_factory_id(0) { ; }
virtual ~tObjectFactory() { ; }
void SetFactoryId(int id) { m_factory_id = id; }
@@ -46,7 +66,7 @@
CreateObjectFunction func;
if (m_create_funcs.Find(key, func)) return false;
- m_create_funcs.Add(key, &nObjectFactory::createObject<BaseType, ClassType, ArgType>);
+ m_create_funcs.Add(key, &nObjectFactory::createObject<BaseType, ClassType>);
return true;
}
@@ -55,14 +75,53 @@
return (m_create_funcs.Remove(key) != NULL);
}
- virtual BaseType* Create(const cString& key, ArgType arg)
+ virtual BaseType* Create(const cString& key)
{
CreateObjectFunction func;
if (m_create_funcs.Find(key, func))
- return func(key, arg);
+ return func();
return NULL;
}
};
+template<typename BaseType, typename Arg1Type>
+class tObjectFactory<BaseType (Arg1Type)>
+{
+protected:
+ typedef BaseType* (*CreateObjectFunction)(Arg1Type);
+
+ tDictionary<CreateObjectFunction> m_create_funcs;
+ int m_factory_id;
+
+public:
+ tObjectFactory() : m_factory_id(0) { ; }
+ virtual ~tObjectFactory() { ; }
+
+ void SetFactoryId(int id) { m_factory_id = id; }
+ int GetFactoryId() { return m_factory_id; }
+
+ template<typename ClassType> bool Register(const cString& key)
+ {
+ CreateObjectFunction func;
+ if (m_create_funcs.Find(key, func)) return false;
+
+ m_create_funcs.Add(key, &nObjectFactory::createObject<BaseType, ClassType, Arg1Type>);
+ return true;
+ }
+
+ bool Unregister(const cString& key)
+ {
+ return (m_create_funcs.Remove(key) != NULL);
+ }
+
+ virtual BaseType* Create(const cString& key, Arg1Type arg1)
+ {
+ CreateObjectFunction func;
+ if (m_create_funcs.Find(key, func))
+ return func(arg1);
+
+ return NULL;
+ }
+};
#endif
More information about the Avida-cvs
mailing list