[Avida-SVN] r2957 - in development: . Avida.xcodeproj source/main

connel42 at myxo.css.msu.edu connel42 at myxo.css.msu.edu
Thu Nov 20 15:15:17 PST 2008


Author: connel42
Date: 2008-11-20 18:15:16 -0500 (Thu, 20 Nov 2008)
New Revision: 2957

Added:
   development/source/main/cOrgMessage.cc
Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/CMakeLists.txt
   development/source/main/cOrgMessage.h
Log:
* split messaging into a .c and .h files

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2008-11-20 20:24:09 UTC (rev 2956)
+++ development/Avida.xcodeproj/project.pbxproj	2008-11-20 23:15:16 UTC (rev 2957)
@@ -213,6 +213,7 @@
 		B4FA258A0C5EB65E0086D4B5 /* cPlasticPhenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = B4FA25810C5EB6510086D4B5 /* cPlasticPhenotype.cc */; };
 		B4FA25A90C5EB7880086D4B5 /* cPhenPlastGenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = B4FA259E0C5EB7600086D4B5 /* cPhenPlastGenotype.cc */; };
 		B516AF840C91E2D400023D53 /* cDemeCellEvent.cc in Sources */ = {isa = PBXBuildFile; fileRef = B516AF790C91E24600023D53 /* cDemeCellEvent.cc */; };
+		D7FB16D60ED62684002E939E /* cOrgMessage.cc in Sources */ = {isa = PBXBuildFile; fileRef = D7FB16D50ED62684002E939E /* cOrgMessage.cc */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXBuildRule section */
@@ -871,6 +872,7 @@
 		B4FA259E0C5EB7600086D4B5 /* cPhenPlastGenotype.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cPhenPlastGenotype.cc; sourceTree = "<group>"; };
 		B516AF790C91E24600023D53 /* cDemeCellEvent.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = cDemeCellEvent.cc; path = source/main/cDemeCellEvent.cc; sourceTree = SOURCE_ROOT; };
 		B516AF7A0C91E24600023D53 /* cDemeCellEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = cDemeCellEvent.h; path = source/main/cDemeCellEvent.h; sourceTree = SOURCE_ROOT; };
+		D7FB16D50ED62684002E939E /* cOrgMessage.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cOrgMessage.cc; sourceTree = "<group>"; };
 		DCC30FCF0762539D008F7A48 /* Doxyfile */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; };
 		DCC3109C0762539E008F7A48 /* avida.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = avida.cc; sourceTree = "<group>"; };
 		DCC31547076253A4008F7A48 /* cCycleCheck.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cCycleCheck.cc; sourceTree = "<group>"; };
@@ -1444,6 +1446,7 @@
 				709A1EE90EB6C42D006090AF /* cOrgMovementPredicate.h */,
 				709A1EEA0EB6C42D006090AF /* cResourceHistory.cc */,
 				B4FA259E0C5EB7600086D4B5 /* cPhenPlastGenotype.cc */,
+				D7FB16D50ED62684002E939E /* cOrgMessage.cc */,
 				B4FA25800C5EB6510086D4B5 /* cPhenPlastGenotype.h */,
 				B4FA25810C5EB6510086D4B5 /* cPlasticPhenotype.cc */,
 				B4FA25820C5EB6510086D4B5 /* cPlasticPhenotype.h */,
@@ -2070,6 +2073,7 @@
 				709A1EEC0EB6C42D006090AF /* cResourceHistory.cc in Sources */,
 				70E60C4B0EC0088300718740 /* cGenotypeBatch.cc in Sources */,
 				70211A5E0ECBD531004A293A /* cRCObject.cc in Sources */,
+				D7FB16D60ED62684002E939E /* cOrgMessage.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: development/CMakeLists.txt
===================================================================
--- development/CMakeLists.txt	2008-11-20 20:24:09 UTC (rev 2956)
+++ development/CMakeLists.txt	2008-11-20 23:15:16 UTC (rev 2957)
@@ -234,6 +234,7 @@
   ${MAIN_DIR}/cMutationRates.cc
   ${MAIN_DIR}/cMxCodeArray.cc
   ${MAIN_DIR}/cOrganism.cc
+  ${MAIN_DIR}/cOrgMessage.cc
   ${MAIN_DIR}/cPhenotype.cc
   ${MAIN_DIR}/cPhenPlastGenotype.cc
   ${MAIN_DIR}/cPlasticPhenotype.cc

Added: development/source/main/cOrgMessage.cc
===================================================================
--- development/source/main/cOrgMessage.cc	                        (rev 0)
+++ development/source/main/cOrgMessage.cc	2008-11-20 23:15:16 UTC (rev 2957)
@@ -0,0 +1,47 @@
+/*
+ *  cOrgMessage.cc
+ *  Avida
+ *
+ *  Copyright 1999-2008 Michigan State University. All rights reserved.
+ *  Copyright 1993-2003 California Institute of Technology.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+ 
+#include "cOrgMessage.h"
+#include "cOrganism.h"
+
+cOrgMessage::cOrgMessage(cOrganism* sender) 
+	: m_pSender(sender), m_pReceiver(0), m_data(0), m_label(0),
+	m_receiverOrgID(0), m_receiverCellID(0)
+{
+    assert(m_pSender);
+	m_senderCellID = sender->GetCellID();
+	m_senderOrgID = sender->GetID();
+}
+
+void cOrgMessage::SetReceiver(cOrganism *recvr)
+{
+	m_pReceiver = recvr;
+	if (recvr) {
+		m_receiverOrgID = recvr->GetID();
+		m_receiverCellID = recvr->GetCellID();
+	} else {
+		m_receiverOrgID = 0;
+		m_receiverCellID = 0; // should this be -1?
+	}
+}

Modified: development/source/main/cOrgMessage.h
===================================================================
--- development/source/main/cOrgMessage.h	2008-11-20 20:24:09 UTC (rev 2956)
+++ development/source/main/cOrgMessage.h	2008-11-20 23:15:16 UTC (rev 2957)
@@ -27,7 +27,6 @@
 
 class cOrganism;
 
-
 /*! This class encapsulates two unsigned integers that are sent as a "message"
 between connected organisms within an Avida population.  The label and data fields
 are these two integers, while the sending and receiving organisms are represented by
@@ -39,14 +38,11 @@
 {
 public:
   //! Constructor that takes a pointer to the sending organism.
-  cOrgMessage(cOrganism* sender) : m_pSender(sender), m_pReceiver(0), m_data(0), m_label(0) 
-  {
-    assert(m_pSender);
-  }
+  cOrgMessage(cOrganism* sender);
   
   cOrganism* GetSender() const { return m_pSender; }
   cOrganism* GetReceiver() const { return m_pReceiver; }
-  void SetReceiver(cOrganism* recvr) { m_pReceiver = recvr; }
+  void SetReceiver(cOrganism* recvr);
   
   unsigned int GetData() const { return m_data; }
   unsigned int GetLabel() const { return m_label; }
@@ -54,9 +50,16 @@
   void SetData(unsigned int data) { m_data = data; }
   void SetLabel(unsigned int label) { m_label = label; }
 
+  int GetSenderCellID() const { return m_senderCellID; }
+  int GetSenderOrgID() const { return m_senderOrgID; }
+
+  int GetReceiverCellID() const { return m_receiverCellID; }
+  int GetReceiverOrgID() const { return m_receiverOrgID; }
+
 private:
   //! Default constructor is only used internally, to support message predicates.
-  cOrgMessage() : m_pSender(0), m_pReceiver(0), m_data(0), m_label(0)
+  cOrgMessage() : m_pSender(0), m_pReceiver(0), m_data(0), m_label(0), m_senderOrgID(0),
+	  m_senderCellID(0), m_receiverOrgID(0), m_receiverCellID(0)
   {
   }
   
@@ -64,6 +67,18 @@
   cOrganism* m_pReceiver;
   unsigned int m_data;
   unsigned int m_label;
+
+  //! ID of the organism that sent this message
+  int m_senderOrgID;
+
+  //! ID of the cell that the sending organism occupied when this message was sent
+  int m_senderCellID;
+
+  //! ID of the organism that received this message
+  int m_receiverOrgID;
+
+  //! ID of the cell that the receiving organism occupied when this message was sent
+  int m_receiverCellID;
 };
 
 




More information about the Avida-cvs mailing list