[Avida-SVN] r1748 - in development: Avida.xcodeproj source/analyze source/targets/viewer-text source/viewer-core

ofria at myxo.css.msu.edu ofria at myxo.css.msu.edu
Thu Jul 5 07:40:07 PDT 2007


Author: ofria
Date: 2007-07-05 10:40:07 -0400 (Thu, 05 Jul 2007)
New Revision: 1748

Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/analyze/cAnalyze.cc
   development/source/targets/viewer-text/cDriver_TextViewer.cc
   development/source/targets/viewer-text/cDriver_TextViewer.h
   development/source/viewer-core/cCoreView_Info.cc
   development/source/viewer-core/cCoreView_Info.h
Log:
More work on building core viewer and updating text viewer...


Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2007-07-03 18:05:02 UTC (rev 1747)
+++ development/Avida.xcodeproj/project.pbxproj	2007-07-05 14:40:07 UTC (rev 1748)
@@ -23,6 +23,9 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
+		56F555E50C3B402A00E2E929 /* cDriver_TextViewer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 56F555DF0C3B402A00E2E929 /* cDriver_TextViewer.cc */; };
+		56F555E60C3B402A00E2E929 /* cTextViewerManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 56F555E10C3B402A00E2E929 /* cTextViewerManager.cc */; };
+		56F555E70C3B402A00E2E929 /* viewer-text.cc in Sources */ = {isa = PBXBuildFile; fileRef = 56F555E40C3B402A00E2E929 /* viewer-text.cc */; };
 		700E2996085A1F6000CF158A /* avida in CopyFiles */ = {isa = PBXBuildFile; fileRef = DCC3164D07626CF3008F7A48 /* avida */; };
 		700E2B87085DE54400CF158A /* avida-viewer in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700E2B83085DE50C00CF158A /* avida-viewer */; };
 		7023EC3A0C0A431B00362B9C /* avida.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3109C0762539E008F7A48 /* avida.cc */; };
@@ -201,6 +204,20 @@
 /* End PBXBuildRule section */
 
 /* Begin PBXContainerItemProxy section */
+		56F555DA0C3B36FC00E2E929 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = DCC30C4D0762532C008F7A48 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 7023EC320C0A426900362B9C /* avida-core */;
+			remoteInfo = "avida-core";
+		};
+		56F555DC0C3B370100E2E929 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = DCC30C4D0762532C008F7A48 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 70AA941809D486AE006A24C8 /* tcmalloc */;
+			remoteInfo = tcmalloc;
+		};
 		7023ECA60C0A436000362B9C /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = DCC30C4D0762532C008F7A48 /* Project object */;
@@ -330,6 +347,16 @@
 		423335880BC067E3000DF681 /* cHardwareGX.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cHardwareGX.cc; sourceTree = "<group>"; };
 		423335890BC067E3000DF681 /* cHardwareGX.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cHardwareGX.h; sourceTree = "<group>"; };
 		42490EFE0BE2472800318058 /* cGermline.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cGermline.h; sourceTree = "<group>"; };
+		565121C60C3B055F009CBD3F /* cCoreView_Info.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cCoreView_Info.cc; sourceTree = "<group>"; };
+		565121C70C3B055F009CBD3F /* cCoreView_Info.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cCoreView_Info.h; sourceTree = "<group>"; };
+		565121C80C3B055F009CBD3F /* LAYOUT */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = LAYOUT; sourceTree = "<group>"; };
+		56F555D00C3B364E00E2E929 /* New Text Viewer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = "New Text Viewer"; path = "build/Development/New Text Viewer"; sourceTree = "<group>"; };
+		56F555DF0C3B402A00E2E929 /* cDriver_TextViewer.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cDriver_TextViewer.cc; sourceTree = "<group>"; };
+		56F555E00C3B402A00E2E929 /* cDriver_TextViewer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cDriver_TextViewer.h; sourceTree = "<group>"; };
+		56F555E10C3B402A00E2E929 /* cTextViewerManager.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTextViewerManager.cc; sourceTree = "<group>"; };
+		56F555E20C3B402A00E2E929 /* cTextViewerManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTextViewerManager.h; sourceTree = "<group>"; };
+		56F555E30C3B402A00E2E929 /* LAYOUT */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = LAYOUT; sourceTree = "<group>"; };
+		56F555E40C3B402A00E2E929 /* viewer-text.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "viewer-text.cc"; sourceTree = "<group>"; };
 		7005A70109BA0FA90007E16E /* cTestCPUInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cTestCPUInterface.h; sourceTree = "<group>"; };
 		7005A70209BA0FA90007E16E /* cTestCPUInterface.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cTestCPUInterface.cc; sourceTree = "<group>"; };
 		7005A70909BA0FBE0007E16E /* cOrgInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cOrgInterface.h; sourceTree = "<group>"; };
@@ -793,6 +820,13 @@
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
+		56F555CE0C3B364E00E2E929 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		700E2B6C085DE50C00CF158A /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
@@ -845,6 +879,30 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		565121C50C3B055F009CBD3F /* viewer-core */ = {
+			isa = PBXGroup;
+			children = (
+				565121C60C3B055F009CBD3F /* cCoreView_Info.cc */,
+				565121C70C3B055F009CBD3F /* cCoreView_Info.h */,
+				565121C80C3B055F009CBD3F /* LAYOUT */,
+			);
+			path = "viewer-core";
+			sourceTree = "<group>";
+		};
+		56F555DE0C3B402A00E2E929 /* viewer-text */ = {
+			isa = PBXGroup;
+			children = (
+				56F555DF0C3B402A00E2E929 /* cDriver_TextViewer.cc */,
+				56F555E00C3B402A00E2E929 /* cDriver_TextViewer.h */,
+				56F555E10C3B402A00E2E929 /* cTextViewerManager.cc */,
+				56F555E20C3B402A00E2E929 /* cTextViewerManager.h */,
+				56F555E30C3B402A00E2E929 /* LAYOUT */,
+				56F555E40C3B402A00E2E929 /* viewer-text.cc */,
+			);
+			name = "viewer-text";
+			path = "source/targets/viewer-text";
+			sourceTree = "<group>";
+		};
 		701D9115094B770B008B845F /* drivers */ = {
 			isa = PBXGroup;
 			children = (
@@ -1196,6 +1254,7 @@
 		DCC30C490762532C008F7A48 = {
 			isa = PBXGroup;
 			children = (
+				56F555DE0C3B402A00E2E929 /* viewer-text */,
 				DCC30C670762539A008F7A48 /* Main Source */,
 				70920C1A0A9CCE2C00757CDB /* Documentation */,
 				707AF2D209EE8501001AEA89 /* Support */,
@@ -1209,6 +1268,7 @@
 		DCC30C670762539A008F7A48 /* Main Source */ = {
 			isa = PBXGroup;
 			children = (
+				565121C50C3B055F009CBD3F /* viewer-core */,
 				707AEEEE09E80699001AEA89 /* actions */,
 				70422A1B091B141000A5E67F /* analyze */,
 				70F7D8C8092546DC009E311D /* classification */,
@@ -1517,6 +1577,7 @@
 				70AA941909D486AE006A24C8 /* libtcmalloc.a */,
 				70B6514C0BEA6FAD002472ED /* unit-tests */,
 				7023EC330C0A426900362B9C /* libavida-core.a */,
+				56F555D00C3B364E00E2E929 /* New Text Viewer */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -1541,6 +1602,24 @@
 /* End PBXHeadersBuildPhase section */
 
 /* Begin PBXNativeTarget section */
+		56F555CF0C3B364E00E2E929 /* New Text Viewer */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 56F555D40C3B36AD00E2E929 /* Build configuration list for PBXNativeTarget "New Text Viewer" */;
+			buildPhases = (
+				56F555CD0C3B364E00E2E929 /* Sources */,
+				56F555CE0C3B364E00E2E929 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				56F555DB0C3B36FC00E2E929 /* PBXTargetDependency */,
+				56F555DD0C3B370100E2E929 /* PBXTargetDependency */,
+			);
+			name = "New Text Viewer";
+			productName = "New Text Viewer";
+			productReference = 56F555D00C3B364E00E2E929 /* New Text Viewer */;
+			productType = "com.apple.product-type.tool";
+		};
 		700E2AF3085DE50C00CF158A /* avida-viewer */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = 700E2B7E085DE50C00CF158A /* Build configuration list for PBXNativeTarget "avida-viewer" */;
@@ -1669,6 +1748,7 @@
 				7023EC320C0A426900362B9C /* avida-core */,
 				70AA941809D486AE006A24C8 /* tcmalloc */,
 				70B6514B0BEA6FAD002472ED /* unit-tests */,
+				56F555CF0C3B364E00E2E929 /* New Text Viewer */,
 			);
 		};
 /* End PBXProject section */
@@ -1690,6 +1770,16 @@
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
+		56F555CD0C3B364E00E2E929 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				56F555E50C3B402A00E2E929 /* cDriver_TextViewer.cc in Sources */,
+				56F555E60C3B402A00E2E929 /* cTextViewerManager.cc in Sources */,
+				56F555E70C3B402A00E2E929 /* viewer-text.cc in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		700E2AF4085DE50C00CF158A /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
@@ -1872,6 +1962,16 @@
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXTargetDependency section */
+		56F555DB0C3B36FC00E2E929 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 7023EC320C0A426900362B9C /* avida-core */;
+			targetProxy = 56F555DA0C3B36FC00E2E929 /* PBXContainerItemProxy */;
+		};
+		56F555DD0C3B370100E2E929 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 70AA941809D486AE006A24C8 /* tcmalloc */;
+			targetProxy = 56F555DC0C3B370100E2E929 /* PBXContainerItemProxy */;
+		};
 		7023ECA70C0A436000362B9C /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
 			target = 7023EC320C0A426900362B9C /* avida-core */;
@@ -1920,6 +2020,72 @@
 /* End PBXTargetDependency section */
 
 /* Begin XCBuildConfiguration section */
+		56F555D50C3B36AD00E2E929 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = "$(HOME)/bin";
+				PREBINDING = NO;
+				PRODUCT_NAME = "New Text Viewer";
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		56F555D60C3B36AD00E2E929 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = "$(HOME)/bin";
+				PREBINDING = NO;
+				PRODUCT_NAME = "New Text Viewer";
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		56F555D70C3B36AD00E2E929 /* Deployment-G5 */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = "$(HOME)/bin";
+				PREBINDING = NO;
+				PRODUCT_NAME = "New Text Viewer";
+				ZERO_LINK = YES;
+			};
+			name = "Deployment-G5";
+		};
+		56F555D80C3B36AD00E2E929 /* Deployment-Universal */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = "$(HOME)/bin";
+				PREBINDING = NO;
+				PRODUCT_NAME = "New Text Viewer";
+				ZERO_LINK = YES;
+			};
+			name = "Deployment-Universal";
+		};
+		56F555D90C3B36AD00E2E929 /* Profile */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = "$(HOME)/bin";
+				PREBINDING = NO;
+				PRODUCT_NAME = "New Text Viewer";
+				ZERO_LINK = YES;
+			};
+			name = Profile;
+		};
 		700E2B7F085DE50C00CF158A /* Development */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
@@ -2471,6 +2637,18 @@
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
+		56F555D40C3B36AD00E2E929 /* Build configuration list for PBXNativeTarget "New Text Viewer" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				56F555D50C3B36AD00E2E929 /* Development */,
+				56F555D60C3B36AD00E2E929 /* Deployment */,
+				56F555D70C3B36AD00E2E929 /* Deployment-G5 */,
+				56F555D80C3B36AD00E2E929 /* Deployment-Universal */,
+				56F555D90C3B36AD00E2E929 /* Profile */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Deployment;
+		};
 		700E2B7E085DE50C00CF158A /* Build configuration list for PBXNativeTarget "avida-viewer" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (

Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc	2007-07-03 18:05:02 UTC (rev 1747)
+++ development/source/analyze/cAnalyze.cc	2007-07-05 14:40:07 UTC (rev 1748)
@@ -7918,6 +7918,8 @@
     return COMPARE_RESULT_POS;
   }
 
+  assert(false);  // One of the other options should have been chosen.
+  return 0;
 }
 
 

Modified: development/source/targets/viewer-text/cDriver_TextViewer.cc
===================================================================
--- development/source/targets/viewer-text/cDriver_TextViewer.cc	2007-07-03 18:05:02 UTC (rev 1747)
+++ development/source/targets/viewer-text/cDriver_TextViewer.cc	2007-07-05 14:40:07 UTC (rev 1748)
@@ -44,13 +44,12 @@
 
 using namespace std;
 
-
 cDriver_TextViewer::cDriver_TextViewer(cWorld* world)
-  : m_world(world), m_done(false)
+  : m_world(world), m_info(m_world->GetPopulation(), 12), m_done(false)
 {
   // Setup the initial view mode (loaded from avida.cfg)
-  SetViewMode(world->GetConfig().VIEW_MODE.Get());
-
+//  SetViewMode(world->GetConfig().VIEW_MODE.Get());
+    
   cDriverManager::Register(static_cast<cAvidaDriver*>(this));
   world->SetDriver(this);
 }
@@ -106,18 +105,18 @@
     
 
     // Are we stepping through an organism?
-    if (m_view.GetStepOrganism() != -1) {  // Yes we are!
+    if (m_info.GetStepOrganism() != -1) {  // Yes we are!
                                             // Keep the viewer informed about the organism we are stepping through...
       for (int i = 0; i < UD_size; i++) {
         const int next_id = population.ScheduleOrganism();
-        if (next_id == m_view.GetStepOrganism()) {
-          m_view.NotifyUpdate();
-          m_view.NewUpdate();
+        if (next_id == m_info.GetStepOrganism()) {
+          NotifyUpdate();
+//          m_view.NewUpdate();
           
           // This is needed to have the top bar drawn properly; I'm not sure why...
           static bool first_update = true;
           if (first_update) {
-            m_view.Refresh();
+//            Refresh();
             first_update = false;
           }
         }
@@ -134,14 +133,14 @@
     
     
     // Setup the viewer for the new update.
-    if (m_view.GetStepOrganism() == -1) {
-      m_view.NotifyUpdate();
-      m_view.NewUpdate();
+    if (m_info.GetStepOrganism() == -1) {
+      NotifyUpdate();
+//      NewUpdate();
       
       // This is needed to have the top bar drawn properly; I'm not sure why...
       static bool first_update = true;
       if (first_update) {
-        m_view.Refresh();
+//        Refresh();
         first_update = false;
       }
     }
@@ -164,70 +163,88 @@
 
 void cDriver_TextViewer::SignalBreakpoint()
 {
-  m_view.DoBreakpoint();
+//  m_view.DoBreakpoint();
 }
 
 
 void cDriver_TextViewer::Flush()
 {
-  // @CAO -- this is currently inefficient!
-
-  // Pull everything from the streams and put it into strings.
-  cString out_string(out_stream.str().c_str());
-  cString err_string(err_stream.str().c_str());
-
-  // Clear the streams.
-  out_stream.str("");
-  err_stream.str("");
-
-  // Split it into lines.
-  cStringList out_list(out_string, '\n');
-  cStringList err_list(err_string, '\n');
-  const int new_line_count = out_list.GetSize() + err_list.GetSize();
-
+  cStringList & out_list = m_info.GetOutList();
+  cStringList & err_list = m_info.GetErrList();
+  
   // And notify the output...
   while (out_list.GetSize() > 0) {
-    m_view.NotifyOutput(out_list.Pop());
+    NotifyOutput(out_list.Pop());
   }
 
   while (err_list.GetSize() > 0) {
     cString cur_string(err_list.Pop());
-    cur_string.Insert("! ");
-    m_view.NotifyOutput(cur_string);
+    // cur_string.Insert("! ");
+    NotifyWarning(cur_string);
   }
-
-  if (new_line_count > 0) m_view.NotifyOutput("");
 }
 
 
 bool cDriver_TextViewer::ProcessKeypress(int keypress)
 {
-  return m_view.ProcessKeypress(keypress);
+//  return m_view.ProcessKeypress(keypress);
+  return false;
 }
 
 
 void cDriver_TextViewer::RaiseException(const cString& in_string)
 {
-  m_view.NotifyError(in_string);
+  NotifyWarning(in_string);
 }
 
 void cDriver_TextViewer::RaiseFatalException(int exit_code, const cString& in_string)
 {
-  m_view.NotifyError(in_string);
+  NotifyError(in_string);
   exit(exit_code);
 }
 
+void cDriver_TextViewer::NotifyUpdate()
+{
+  // @CAO What should happen on an update?
+  // Update bar at top of screen
+  // Update current view
+  // Check for Inputs...
+}
+
 void cDriver_TextViewer::NotifyComment(const cString& in_string)
 {
-  m_view.NotifyComment(in_string);
+  // @CAO Do anything special if we know its just a normal comment?
+  Notify(in_string);
 }
 
 void cDriver_TextViewer::NotifyWarning(const cString& in_string)
 {
-  m_view.NotifyWarning(in_string);
+  cString out_string(in_string);
+  out_string.Insert("Warning: ");
+  Notify(out_string);
 }
 
+void cDriver_TextViewer::NotifyError(const cString& in_string)
+{
+  cString out_string(in_string);
+  out_string.Insert("Error: ");
+  Notify(out_string);
+  ExitTextViewer(1);
+}
 
+void cDriver_TextViewer::NotifyOutput(const cString& in_string)
+{
+  // @CAO Do anything special if we know its from cout/cerr?
+  Notify(in_string);
+}
+
+void cDriver_TextViewer::Notify(const cString& in_string)
+{
+  // @CAO We need to display this!
+}
+
+
+
 void ExitTextViewer(int exit_code)
 {
   signal(SIGINT, SIG_IGN);           // Ignore all future interupts.

Modified: development/source/targets/viewer-text/cDriver_TextViewer.h
===================================================================
--- development/source/targets/viewer-text/cDriver_TextViewer.h	2007-07-03 18:05:02 UTC (rev 1747)
+++ development/source/targets/viewer-text/cDriver_TextViewer.h	2007-07-05 14:40:07 UTC (rev 1748)
@@ -47,7 +47,7 @@
 class cDriver_TextViewer : public cAvidaDriver, public cWorldDriver {
 private:
   cWorld* m_world;
-  cCoreView_Info info;
+  cCoreView_Info m_info;
 
   bool m_done;                 // This is set to true when run should finish.
 
@@ -69,8 +69,12 @@
   void RaiseFatalException(int exit_code, const cString& in_string);
   
   // Notifications
+  void NotifyUpdate();
   void NotifyComment(const cString& in_string);
   void NotifyWarning(const cString& in_string);
+  void NotifyError(const cString& in_string);
+  void NotifyOutput(const cString& in_string);
+  void Notify(const cString& in_string);
 
   // Tests
   bool IsInteractive() { return true; }

Modified: development/source/viewer-core/cCoreView_Info.cc
===================================================================
--- development/source/viewer-core/cCoreView_Info.cc	2007-07-03 18:05:02 UTC (rev 1747)
+++ development/source/viewer-core/cCoreView_Info.cc	2007-07-05 14:40:07 UTC (rev 1748)
@@ -15,3 +15,18 @@
 cCoreView_Info::~cCoreView_Info()
 {
 }
+
+///////////////////////
+// Helper Methods...
+
+void cCoreView_Info::FlushOut()
+{
+  cout_list.Load(out_stream.str().c_str(), '\n');  // Load the stored stream...
+  out_stream.str("");  // Clear the streams.
+}
+
+void cCoreView_Info::FlushErr()
+{
+  cerr_list.Load(err_stream.str().c_str(), '\n');  // Load the stored stream...
+  err_stream.str("");  // Clear the streams.
+}

Modified: development/source/viewer-core/cCoreView_Info.h
===================================================================
--- development/source/viewer-core/cCoreView_Info.h	2007-07-03 18:05:02 UTC (rev 1747)
+++ development/source/viewer-core/cCoreView_Info.h	2007-07-05 14:40:07 UTC (rev 1748)
@@ -6,8 +6,9 @@
 // all of the sections of the viewer.
 
 #include <iostream>
-#include<sstream>
+#include <sstream>
 
+#include "cStringList.h"
 #include "tList.h"
 
 class cPopulation;
@@ -20,6 +21,10 @@
   // Setup streams to capture stdin and stdout so we can control them as needed.
   std::stringstream out_stream;
   std::stringstream err_stream;
+  
+  // And string lists to convert outputs to for easier management.
+  cStringList cout_list;
+  cStringList cerr_list;
 
   // Constant Inforation setup by specific viewer.
   const int m_total_colors;
@@ -29,6 +34,10 @@
   int m_pause_level;
   int m_step_organism;
 
+  // Helper Methods
+  void FlushOut();  // Move stored cout to string list 'out_list'
+  void FlushErr();  // Move stored cerr to string list 'err_list'
+  
 public:
   // Constant Information across all viewers.
   enum ePause { PAUSE_ON, PAUSE_OFF, PAUSE_ADVANCE_INST, PAUSE_ADVANCE_UPDATE, PAUSE_ADVANCE_DIVIDE };
@@ -38,13 +47,18 @@
   ~cCoreView_Info();
 
   cPopulation & GetPopulation() { return m_population; }
+  const cPopulation & GetPopulation() const { return m_population; }
 
   // Accessors for variable information
-  int GetPauseLevel() { return m_pause_level; }
-  int GetStepOrganism() { return m_step_organism; }
+  int GetPauseLevel() const { return m_pause_level; }
+  int GetStepOrganism() const { return m_step_organism; }
 
   void SetPauseLevel(int in_level) { m_pause_level = in_level; }
   void SetStepOrganism(int in_id) { m_step_organism = in_id; }
+
+  // Special accessors...
+  cStringList & GetOutList() { FlushOut(); return cout_list; }
+  cStringList & GetErrList() { FlushErr(); return cerr_list; }
 };
 
 #endif




More information about the Avida-cvs mailing list