[avida-cvs] avida CVS commits: /current/source/event population_event_factory.cc population_event_factory.hh

kaben avida-cvs at alife.org
Thu Oct 16 02:35:38 PDT 2003


kaben		Wed Oct 15 18:35:38 2003 EDT

  Modified files:              
    /avida/current/source/event	population_event_factory.cc 
                               	population_event_factory.hh 
  Log:
  Replaced accidentally clobbered file source/event/population_event_factory.cc.
  
Index: avida/current/source/event/population_event_factory.cc
diff -u avida/current/source/event/population_event_factory.cc:1.8 avida/current/source/event/population_event_factory.cc:1.9
--- avida/current/source/event/population_event_factory.cc:1.8	Wed Oct 15 17:45:16 2003
+++ avida/current/source/event/population_event_factory.cc	Wed Oct 15 18:35:37 2003
@@ -1,56 +1,101 @@
-#ifndef AVIDA_EVENT_FACTORY_HH
-#define AVIDA_EVENT_FACTORY_HH
 
-#ifndef DEFS_HH
-#include "../defs.hh"
-#endif
+#include <fstream>
 
-#ifndef EVENT_FACTORY_HH
-#include "./event_factory.hh"
-#endif
+#include "population_event_factory.hh"
 
-#ifndef EVENT_HH
-#include "./event.hh"
-#endif
 
-class cPopulation;
+#include <ctype.h>           // for isdigit
 
-class cPopulationEvent : public cEvent {
-private:
-  // not implemented. prevents inadvertend wrong instantiation.
-  cPopulationEvent();
-  cPopulationEvent( const cPopulationEvent & );
-  const cPopulationEvent& operator=( cPopulationEvent & );
+#include "../tools/string_util.hh"
 
-  
-protected:
-  cPopulation *population;
-  
-public:
-  cPopulationEvent(const cString & name, const cString & args);
+#include "../main/analyze_util.hh"
+#include "../main/avida.hh"
+#include "../main/config.hh"
+#include "../main/genebank.hh"
+#include "../main/genotype.hh"
+#include "../cpu/hardware_method.hh"
+#include "../main/inject_genebank.hh"
+#include "../main/inject_genotype.hh"
+#include "../main/inst_util.hh"
+#include "../main/landscape.hh"
+#include "../main/lineage_control.hh"
+#include "../main/organism.hh"
+#include "../main/phenotype.hh"
+#include "../main/population.hh"
+#include "../main/population_cell.hh"
+#include "../main/stats.hh"
+#include "../main/tasks.hh"
 
-  void SetPopulation( cPopulation *pop ){ population = pop; }
-};
+#include "../cpu/test_cpu.hh"
+#include "../cpu/test_util.hh"
 
+#include "../viewers/symbol_util.hh"
 
-class cPopulationEventFactory : public cEventFactory {
-private:
-  cPopulation *m_population;
 
+using namespace std;
 
-public:
-  // event enums
-#include "../event/cPopulation_enums_auto.ci"
 
-  cPopulationEventFactory( cPopulation *pop );
-  ~cPopulationEventFactory();
+/////////////////
+// cAvidaEvent
+/////////////////
 
-  int EventNameToEnum(const cString & name) const;
-  cEvent * ConstructEvent(int event_enum, const cString & args );
-};
+cPopulationEvent::cPopulationEvent(const cString & name, const cString & args):
+   cEvent(name, args)
+{
+}
 
 
-#endif
+/////////////////
+//  events derived from cPopulationEvent (autogenerated code)
+/////////////////
+
+// The Process() functions
+using namespace std;
+#include "cPopulation_process_auto.ci"
+
+// EventNameToEnum()
+#include "cPopulation_name2enum_auto.ci"
+
+
+/////////////////
+// cPopulationEventFactory
+/////////////////
+
+cPopulationEventFactory::cPopulationEventFactory( cPopulation *pop ) 
+  : m_population( pop )
+{
+}
+
+cPopulationEventFactory::~cPopulationEventFactory()
+{
+}
+
+//******* construction of events **********//
+cEvent *
+cPopulationEventFactory::ConstructEvent( int event_enum,
+				    const cString & arg_list )
+{
+  cPopulationEvent *event = NULL;
+
+  switch (event_enum){
+
+#include "cPopulation_construct_event_auto.ci"
+
+    default:
+      event = NULL;
+      break;
+  }
+
+  if( event != NULL ){
+    // Have to setup the base class variables
+    event->SetFactoryId( GetFactoryId() );
+
+    assert( m_population != NULL );
+    event->SetPopulation( m_population );
+  }
+  return event;
+}
+
 
 
 
Index: avida/current/source/event/population_event_factory.hh
diff -u avida/current/source/event/population_event_factory.hh:1.2 avida/current/source/event/population_event_factory.hh:1.3
--- avida/current/source/event/population_event_factory.hh:1.2	Wed Oct 15 17:45:16 2003
+++ avida/current/source/event/population_event_factory.hh	Wed Oct 15 18:35:38 2003
@@ -40,7 +40,7 @@
 
 public:
   // event enums
-#include "../event/cPopulation_enums_auto.ci"
+#include "cPopulation_enums_auto.ci"
 
   cPopulationEventFactory( cPopulation *pop );
   ~cPopulationEventFactory();






More information about the Avida-cvs mailing list