45 #include <boost/serialization/access.hpp>
46 #include <boost/mpi.hpp>
65 friend class boost::serialization::access;
68 int id_, startProc_, agentType_, currentProc_;
71 template<
class Archive>
72 void serialize(Archive& ar,
const unsigned int version) {
163 std::ostream& operator<<(std::ostream& os,
const AgentId&
id);
168 bool operator==(
const AgentId &one,
const AgentId &two);
173 bool operator!=(
const AgentId &one,
const AgentId &two);
179 bool operator<(
const AgentId &one,
const AgentId &two);
186 std::size_t operator()(
const AgentId&
id)
const {
187 return id.hashcode();
195 template<
typename AgentType>
197 std::size_t operator()(
const AgentType* agent)
const {
198 return agent->getId().hashcode();
243 bool operator()(
const boost::shared_ptr<T>& ptr) {
244 return ptr->getId().agentType() == _typeId;
247 bool operator()(
const T* agent) {
248 return agent->getId().agentType() == _typeId;
268 bool operator()(
const boost::shared_ptr<T>& ptr) {
269 return ptr->getId().agentType() != _typeId;
272 bool operator()(
const T* agent) {
273 return agent->getId().agentType() != _typeId;
friend bool operator==(const AgentId &one, const AgentId &two)
Equality operator.
Definition: AgentId.cpp:57
virtual AgentId & getId()=0
Gets the AgentId for this Agent.
friend bool operator<(const AgentId &one, const AgentId &two)
A comparison operator for use with std::set.
Definition: AgentId.cpp:65
Agent identity information.
Definition: AgentId.h:60
int id() const
Gets the id component of this AgentId.
Definition: AgentId.h:106
Struct that allows filtering by !(Agent Type)
Definition: AgentId.h:257
Struct that allows filtering by Agent Type.
Definition: AgentId.h:232
int currentRank() const
Gets the current process rank of this AgentId.
Definition: AgentId.h:135
Interface for agent classes.
Definition: AgentId.h:206
std::size_t hashcode() const
Gets the hashcode for this AgentId.
Definition: AgentId.h:155
int agentType() const
Gets the agent type component of this AgentId.
Definition: AgentId.h:124
AgentId()
No-arg constructor necessary for serialization.
Definition: AgentId.h:85
operator() implementation that returns the hashcode of an agent via its AgentId.
Definition: AgentId.h:196
int startingRank() const
Gets the starting rank component of this AgentId.
Definition: AgentId.h:115
friend std::ostream & operator<<(std::ostream &os, const AgentId &id)
Writes the agent id to the ostream.
Definition: AgentId.cpp:74
operator() implementation that returns the hashcode of an AgentId.
Definition: AgentId.h:185
void currentRank(int val)
Sets the current process rank of this AgentId.
Definition: AgentId.h:146