00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _OPENCITY_MESSAGE_H_
00023 #define _OPENCITY_MESSAGE_H_ 1
00024
00025 #include "any.h"
00026
00027 #include <vector>
00028 #include <list>
00029 #include <string>
00030 #include <ostream>
00031
00032
00033 class Agent;
00034
00035
00039 class Message
00040 {
00041 public:
00042 typedef enum {
00043 MSG_UNDEFINED = 0,
00044 MSG_NEW_DEMONSTRATOR,
00045 MSG_NEW_ROBBER,
00046 MSG_KILL_AGENT,
00047 MSG_AGENT_DIE
00048 } Message_t;
00049
00050 Message();
00051 Message(Message_t type, Agent *sender=NULL);
00052 Message& operator<< (int value);
00053 Message& operator<< (unsigned int value);
00054 Message& operator<< (double value);
00055 Message& operator<< (const std::string& value);
00056
00057 Message_t getType() const;
00058 Agent* getSender() const;
00059 Message& setSender(Agent* sender);
00060 unsigned int size() const;
00061 Any& operator[] (unsigned int index);
00062 const Any& operator[] (unsigned int index) const;
00063
00064 friend std::ostream& operator<<(std::ostream& os, const Message& msg);
00065
00066 private:
00067 Agent* m_sender;
00068 Message_t m_type;
00069 std::vector<Any> arguments;
00070 };
00071
00072 #endif
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105