5 * Created by Alyssa Milburn on Wed 26 Apr 2006.
6 * Copyright (c) 2006 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef _HISTORYMANAGER_H
21 #define _HISTORYMANAGER_H
27 #include <boost/weak_ptr.hpp>
29 using boost::shared_ptr
;
30 using boost::weak_ptr
;
35 std::string photo
; // TODO: correct?
36 std::string monikers
[2];
37 std::string networkid
;
38 unsigned int timestamp
;
41 std::string worldname
;
42 std::string worldmoniker
;
43 unsigned int worldtick
;
44 historyevent(unsigned int eno
, class CreatureAgent
* = 0);
47 enum monikerstatus
{ referenced
= 1, creature
= 2, borncreature
= 3, exported
= 4, dead
= 5, deadandkilled
= 6, unreferenced
= 7 };
55 weak_ptr
<genomeFile
> genome
;
57 std::vector
<historyevent
> events
;
63 unsigned int no_crossover_points
, no_point_mutations
;
65 void init(std::string
, shared_ptr
<genomeFile
>);
66 historyevent
&addEvent(unsigned int event
, std::string moniker1
= "", std::string moniker2
= "");
67 void moveToAgent(AgentRef a
);
68 void moveToCreature(AgentRef c
);
71 monikerstatus
getStatus();
74 class historyManager
{
76 std::map
<std::string
, monikerData
> monikers
;
79 std::string
newMoniker(shared_ptr
<genomeFile
>);
80 bool hasMoniker(std::string
);
81 monikerData
&getMoniker(std::string
);
82 std::string
findMoniker(shared_ptr
<genomeFile
>);
83 std::string
findMoniker(AgentRef
);
84 void delMoniker(std::string
);