[Avida-SVN] r1991 - branches/uml/source/main

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Thu Aug 23 09:36:25 PDT 2007


Author: dknoester
Date: 2007-08-23 12:36:25 -0400 (Thu, 23 Aug 2007)
New Revision: 1991

Modified:
   branches/uml/source/main/cAvidaConfig.h
   branches/uml/source/main/cOrganism.cc
   branches/uml/source/main/cUMLModel.cc
   branches/uml/source/main/cUMLModel.h
Log:
Added config option for seed-model.cfg.

Modified: branches/uml/source/main/cAvidaConfig.h
===================================================================
--- branches/uml/source/main/cAvidaConfig.h	2007-08-23 16:27:18 UTC (rev 1990)
+++ branches/uml/source/main/cAvidaConfig.h	2007-08-23 16:36:25 UTC (rev 1991)
@@ -205,6 +205,7 @@
   CONFIG_ADD_VAR(ANALYZE_FILE, cString, "analyze.cfg", "File used for analysis mode");
   CONFIG_ADD_VAR(ENVIRONMENT_FILE, cString, "environment.cfg", "File that describes the environment");
   CONFIG_ADD_VAR(START_CREATURE, cString, "default-classic.org", "Organism to seed the soup");
+  CONFIG_ADD_VAR(SEED_MODEL, cString, "seed-model.cfg", "UML configuration file.");
   
   CONFIG_ADD_GROUP(DEME_GROUP, "Demes and Germlines");
   CONFIG_ADD_VAR(NUM_DEMES, int, 1, "Number of independent groups in the population.");

Modified: branches/uml/source/main/cOrganism.cc
===================================================================
--- branches/uml/source/main/cOrganism.cc	2007-08-23 16:27:18 UTC (rev 1990)
+++ branches/uml/source/main/cOrganism.cc	2007-08-23 16:36:25 UTC (rev 1991)
@@ -71,6 +71,7 @@
   , m_state_diag(0)
   , m_orig_state_index(0)
   , m_dest_state_index(0)
+  , m_model((const char*)world->GetConfig().SEED_MODEL.Get())
 {
   // Initialization of structures...
   m_hardware = m_world->GetHardwareManager().Create(this);
@@ -91,10 +92,6 @@
   
   if (m_world->GetConfig().NET_ENABLED.Get()) m_net = new cNetSupport();
   m_id = m_world->GetStats().GetTotCreatures();
-
-  m_orig_state_index = 0;
-  m_dest_state_index = 0;
-  m_parent_xmi = "";
 }
 
 

Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc	2007-08-23 16:27:18 UTC (rev 1990)
+++ branches/uml/source/main/cUMLModel.cc	2007-08-23 16:36:25 UTC (rev 1991)
@@ -67,7 +67,8 @@
 It is not robust. It will not understand things unless you 
 follow the *very* specific file format."
 */
-void seed_diagrams(std::vector<cUMLStateDiagram>& state_diagrams,
+void seed_diagrams(const char* seed_model,
+                   std::vector<cUMLStateDiagram>& state_diagrams,
                    std::vector<scenario_info>& scenarios,
                    int& hydra_mode) {
   std::string data, line; // or maybe stringstream? (strstream?)
@@ -78,7 +79,7 @@
 	std::string tr_l, tr_o, gu, act, temp;
 	int trig_i, guard_i, act_i, orig_i, dest_i;
 	std::ifstream infile;
-	infile.open("seed-model.cfg");
+	infile.open(seed_model);
 	assert(infile.is_open());
 	scenario_info s;
 	std::string path_step;
@@ -170,9 +171,9 @@
 int cUMLModel::_cfg_hydra_mode;
 
 
-cUMLModel::cUMLModel() {
+cUMLModel::cUMLModel(const char* seed_model) {
   if(!_cfgLoaded) {
-    seed_diagrams(_cfg_state_diagrams, _cfg_scenarios, _cfg_hydra_mode);
+    seed_diagrams(seed_model, _cfg_state_diagrams, _cfg_scenarios, _cfg_hydra_mode);
     _cfgLoaded = true;
   }
   

Modified: branches/uml/source/main/cUMLModel.h
===================================================================
--- branches/uml/source/main/cUMLModel.h	2007-08-23 16:27:18 UTC (rev 1990)
+++ branches/uml/source/main/cUMLModel.h	2007-08-23 16:36:25 UTC (rev 1991)
@@ -28,7 +28,7 @@
 class cUMLModel { 
 public:
   //! Constructor that loads state diagram and scenario information from seed-model.cfg.
-	cUMLModel();
+	cUMLModel(const char* seed_model);
 	~cUMLModel();
 	
 	// Used to check if the diagrams satisfy the specified scenarios




More information about the Avida-cvs mailing list