RepastHPC  2.3.1
AgentStatus.h
1 /*
2  *Repast for High Performance Computing (Repast HPC)
3  *
4  * Copyright (c) 2010 Argonne National Laboratory
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with
8  * or without modification, are permitted provided that the following
9  * conditions are met:
10  *
11  * Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * Neither the name of the Argonne National Laboratory nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TRUSTEES OR
26  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * AgentStatus.h
35  *
36  * Created on: Aug 19, 2010
37  * Author: nick
38  */
39 
40 #ifndef AGENTSTATUS_H_
41 #define AGENTSTATUS_H_
42 
43 #include <boost/serialization/access.hpp>
44 #include "AgentId.h"
45 
46 namespace repast {
47 
52 class AgentStatus {
53 
54  friend bool operator<(const AgentStatus &one, const AgentStatus &two);
55 
56 public:
57 
61  enum Status {
62  REMOVED, MOVED
63  };
64 
69  }
70 
76  AgentStatus(AgentId id);
77 
87  AgentStatus(AgentId old, AgentId newId);
88 
94  Status getStatus() const {
95  return _status;
96  }
97 
103  const AgentId& getId() const {
104  return _oldId;
105  }
106 
114  const AgentId& getOldId() const {
115  return _oldId;
116  }
117 
125  const AgentId& getNewId() const {
126  return _newId;
127  }
128 
129 private:
130  friend class boost::serialization::access;
131 
132  AgentId _oldId, _newId;
133  Status _status;
134 
135  template<class Archive>
136  void serialize(Archive& ar, const unsigned int version) {
137  ar & _oldId;
138  ar & _newId;
139  ar & _status;
140  }
141 };
142 
146 bool operator<(const AgentStatus &one, const AgentStatus &two);
147 
148 
149 }
150 
151 #endif /* AGENTSTATUS_H_ */
repast::AgentStatus
Encapsulates the status (moved or removed) of agent in order to synchronize that status across proces...
Definition: AgentStatus.h:52
repast::AgentStatus::getId
const AgentId & getId() const
Gets the id of the agent that this is the status for.
Definition: AgentStatus.h:103
repast::AgentId
Agent identity information.
Definition: AgentId.h:60
repast::AgentStatus::getOldId
const AgentId & getOldId() const
Gets the old id of the agent that this is the status for, if this contains an old and updated AgentId...
Definition: AgentStatus.h:114
repast::AgentStatus::AgentStatus
AgentStatus()
No-arg constructor for serialization.
Definition: AgentStatus.h:68
repast::AgentStatus::getStatus
Status getStatus() const
Gets the status.
Definition: AgentStatus.h:94
repast::AgentStatus::getNewId
const AgentId & getNewId() const
Gets the new updated id of the agent that this is the status for, if this contains an old and updated...
Definition: AgentStatus.h:125
repast::AgentStatus::Status
Status
Enum indicating the status of th agent.
Definition: AgentStatus.h:61
repast::AgentStatus::operator<
friend bool operator<(const AgentStatus &one, const AgentStatus &two)
Comparison operator that can be used in sorts, etc.
Definition: AgentStatus.cpp:56