[Avida-SVN] r2345 - in branches/uml/source: actions main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Tue Feb 19 10:33:44 PST 2008


Author: hjg
Date: 2008-02-19 13:33:44 -0500 (Tue, 19 Feb 2008)
New Revision: 2345

Modified:
   branches/uml/source/actions/DriverActions.cc
   branches/uml/source/main/cStats.h
Log:
enabled exit after a number of properties generated.

Modified: branches/uml/source/actions/DriverActions.cc
===================================================================
--- branches/uml/source/actions/DriverActions.cc	2008-02-19 16:08:42 UTC (rev 2344)
+++ branches/uml/source/actions/DriverActions.cc	2008-02-19 18:33:44 UTC (rev 2345)
@@ -81,11 +81,34 @@
 };
 
 
+class cActionExitPropertyGeneratedGreater : public cAction
+{
+private:
+  double m_threshold;
+public:
+  cActionExitPropertyGeneratedGreater(cWorld* world, const cString& args) : cAction(world, args), m_threshold(0.0)
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_threshold = largs.PopWord().AsDouble();
+  }
+  
+  static const cString GetDescription() { return "Arguments: <double "; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+	if (m_world->GetStats().getPropTotal() > m_threshold ) {
+		m_world->GetDriver().SetDone();
+    }
+  }
+};
+
+
 void RegisterDriverActions(cActionLibrary* action_lib)
 {
   action_lib->Register<cActionExit>("Exit");
   action_lib->Register<cActionExitAveLineageLabelGreater>("ExitAveLineageLabelGreater");
   action_lib->Register<cActionExitAveLineageLabelLess>("ExitAveLineageLabelLess");
+  action_lib->Register<cActionExitPropertyGeneratedGreater>("ExitPropGeneratedGreater");
 
   // @DMB - The following actions are DEPRECATED aliases - These will be removed in 2.7.
   action_lib->Register<cActionExit>("exit");

Modified: branches/uml/source/main/cStats.h
===================================================================
--- branches/uml/source/main/cStats.h	2008-02-19 16:08:42 UTC (rev 2344)
+++ branches/uml/source/main/cStats.h	2008-02-19 18:33:44 UTC (rev 2345)
@@ -703,6 +703,7 @@
   void respPropSuccess(int x) {m_respPropertySuccess =x; }
   void respPropFailure(int x) {m_respPropertyFailure =x;}
   void respPropTotal(int x)  {m_respPropertyTotal =x;}
+  int getPropTotal () { return m_propertyTotal; }
 
   
   




More information about the Avida-cvs mailing list