1 /*
2  *  cOrgMessage.h
3  *  Avida
4  *
5  *  Called "org_message.hh" prior to 12/5/05.
6  *  Copyright 2005-2006 Michigan State University. All rights reserved.
7  *  Copyright 1993-2003 California Institute of Technology.
8  *
9  *
10  *  This file is part of Avida.
11  *
12  *  Avida is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
13  *  as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
14  *
15  *  Avida is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU Lesser General Public License along with Avida.
19  *  If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 #ifndef cOrgMessage_h
23 #define cOrgMessage_h
24 
25 class cOrganism;
26 
27 /*! This class encapsulates two unsigned integers that are sent as a "message"
28 between connected organisms within an Avida population.  The label and data fields
29 are these two integers, while the sending and receiving organisms are represented by
30 pointers.
31 
32 \todo Extend to support a varying number of bytes.
33 */
34 class cOrgMessage
35 {
36 public:
37   //! Default constructor.
38   cOrgMessage();
39 
40   //! Constructor that takes a pointer to the sending organism.
41   cOrgMessage(cOrganism* sender, int messageType = 0);
42 
GetSender()43   cOrganism* GetSender() const { return m_pSender; }
GetReceiver()44   cOrganism* GetReceiver() const { return m_pReceiver; }
45   void SetReceiver(cOrganism* recvr);
46 
GetData()47   unsigned int GetData() const { return m_data; }
GetLabel()48   unsigned int GetLabel() const { return m_label; }
49 
SetData(unsigned int data)50   void SetData(unsigned int data) { m_data = data; }
SetLabel(unsigned int label)51   void SetLabel(unsigned int label) { m_label = label; }
52 
GetSenderCellID()53   int GetSenderCellID() const { return m_senderCellID; }
GetSenderOrgID()54   int GetSenderOrgID() const { return m_senderOrgID; }
55 
GetReceiverCellID()56   int GetReceiverCellID() const { return m_receiverCellID; }
GetReceiverOrgID()57   int GetReceiverOrgID() const { return m_receiverOrgID; }
58 
SetTransCellID(int transCellID)59   void SetTransCellID(int transCellID) { m_transCellID = transCellID; } // @JJB**
GetTransCellID()60   int GetTransCellID() const { return m_transCellID; }
61 
GetMessageType()62   int GetMessageType() const { return m_messageType; }
63 
64 private:
65   cOrganism* m_pSender;
66   cOrganism* m_pReceiver;
67   int m_messageType;
68   unsigned int m_data;
69   unsigned int m_label;
70 
71   //! ID of the organism that sent this message
72   int m_senderOrgID;
73 
74   //! ID of the cell that the sending organism occupied when this message was sent
75   int m_senderCellID;
76 
77   //! ID of the organism that received this message
78   int m_receiverOrgID;
79 
80   //! ID of the cell that the receiving organism occupied when this message was sent
81   int m_receiverCellID;
82 
83   // ID of the intermediate transmission cell for avatars @JJB**
84   int m_transCellID;
85 };
86 
87 
88 #endif
89