40 #ifndef AGENTREQUEST_H_
41 #define AGENTREQUEST_H_
44 #include <boost/serialization/access.hpp>
45 #include <boost/serialization/vector.hpp>
62 friend class boost::serialization::access;
71 std::vector<AgentId> requestedAgents_;
72 std::vector<AgentId> cancellations_;
74 template<
class Archive>
75 void serialize(Archive& ar,
const unsigned int version) {
78 ar & requestedAgents_;
85 source(-1), target(-1) {
137 return requestedAgents_;
147 return cancellations_;
162 bool remove(
const AgentId&
id,
bool removeAllInstances =
true);
244 return requestedAgents_.size() + cancellations_.size();
254 return requestedAgents_.size();
264 return cancellations_.size();
323 std::ostream& operator<<(std::ostream& os,
const AgentRequest& request);
void addAll(const AgentRequest &req)
Adds all the agent ids (both requests and cancellations) in req to this AgentRequest.
Definition: AgentRequest.cpp:112
int requestCountCancellations() const
Gets the number of agents requested, counting only the cancellations and not the requests.
Definition: AgentRequest.h:263
int requestCount() const
Gets the number agents requested.
Definition: AgentRequest.h:243
void addAllRequests(const AgentRequest &req)
Adds all the agent ids in req to this request, including only the ids that are requests and not those...
Definition: AgentRequest.cpp:117
Agent identity information.
Definition: AgentId.h:60
void targetsOfRequests(std::set< int > &targets)
Puts the targets of all the requests into the set, including only the requests and not the cancellati...
Definition: AgentRequest.cpp:130
Importer that maintains a map of agents being sent from each sending process and a count of the numbe...
Definition: AgentImporterExporter.h:510
int requestCountRequested() const
Gets the number of agents requested, counting only the requests and not the cancellations.
Definition: AgentRequest.h:253
void addAllCancellations(const AgentRequest &req)
Adds all the agent ids in req to this request, including only the ids that are cancellations and not ...
Definition: AgentRequest.cpp:121
void targetsOfCancellations(std::set< int > &targets)
Puts the targets of all the requests into the set, including only the requests and not the cancellati...
Definition: AgentRequest.cpp:138
friend std::ostream & operator<<(std::ostream &os, const AgentRequest &request)
Prints the specified AgentRequest to the specified ostream.
Definition: AgentRequest.cpp:147
Importer that maintains a set of agents being sent from each sending process.
Definition: AgentImporterExporter.h:458
bool removeCancellation(const AgentId &id, bool removeAllInstances=true)
Definition: AgentRequest.cpp:98
Encapsulates a request made by one process for agents in another.
Definition: AgentRequest.h:59
Importer that maintains a list of the agents being sent from each sending process.
Definition: AgentImporterExporter.h:400
void addRequest(const AgentId &id)
Adds the specified agent to the collection agents being requested.
Definition: AgentRequest.cpp:56
bool remove(const AgentId &id, bool removeAllInstances=true)
Removes the specified id from the lists of requested agents, including both requests and cancellation...
Definition: AgentRequest.cpp:76
int targetProcess() const
If the requested agent ids are all on the same process then target process will identify that process...
Definition: AgentRequest.h:314
const std::vector< AgentId > & cancellations() const
Gets a reference to the vector of cancellations.
Definition: AgentRequest.h:146
bool removeRequest(const AgentId &id, bool removeAllInstances=true)
Definition: AgentRequest.cpp:83
bool contains(const AgentId &id)
Returns true if this AgentRequest contains a request for the specified id (either a request or a canc...
Definition: AgentRequest.cpp:64
bool containsInRequests(const AgentId &id)
Returns true if the list of requests contains the specified id (the list of cancellations is ignored)
Definition: AgentRequest.cpp:68
bool containsInCancellations(const AgentId &id)
Returns true if the list of cancellations contains the specified id (the list of requests is ignored)
Definition: AgentRequest.cpp:72
int sourceProcess() const
Gets the source process of these requests, that is, the process making the request.
Definition: AgentRequest.h:305
const std::vector< AgentId > & requestedAgents() const
Gets a reference to the vector of requested agents.
Definition: AgentRequest.h:136
void addCancellation(const AgentId &id)
Adds the specified agent to the collection of agents for which a previous request is being cancelled.
Definition: AgentRequest.cpp:60
void targets(std::set< int > &targets)
Puts the targets of all the requests into the set.
Definition: AgentRequest.cpp:125