GAMS  1.4.0
AuctionBid.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_AUCTIONS_AUCTION_BID_H_
55 #define _GAMS_AUCTIONS_AUCTION_BID_H_
56 
57 #include <string>
58 #include <vector>
59 
60 #include "madara/knowledge/KnowledgeRecord.h"
61 
62 #include "gams/GamsExport.h"
63 
64 namespace gams
65 {
66  namespace auctions
67  {
72  {
73  public:
74 
78  bool operator<(const AuctionBid & rhs) const;
79 
83  bool operator==(const AuctionBid & rhs) const;
84 
88  bool operator>(const AuctionBid & rhs) const;
89 
91  std::string bidder;
92 
94  madara::knowledge::KnowledgeRecord amount;
95  };
96 
101  {
102  public:
108  bool operator()(const AuctionBid & lhs, const AuctionBid &rhs) const;
109  };
110 
115  {
116  public:
122  bool operator()(const AuctionBid & lhs, const AuctionBid &rhs) const;
123  };
124 
126  typedef std::vector <AuctionBid> AuctionBids;
127 
140  void strip_prefix_fast(const std::string & prefix, AuctionBids & bids);
141 
150  void strip_prefix_safe(const std::string & prefix, AuctionBids & bids);
151 
158 
165 
166  } // end namespace auctions
167 } // end namespace gams
168 
169 #include "AuctionBid.inl"
170 
171 #endif // _GAMS_AUCTIONS_AUCTION_BID_H_
#define GAMS_EXPORT
Definition: GamsExport.h:20
Comparator for sorting bids in ascending order(least to greatest)
Definition: AuctionBid.h:101
bool operator()(const AuctionBid &lhs, const AuctionBid &rhs) const
Comparison for sorting.
Comparator for sorting bids in descending order(greater to least)
Definition: AuctionBid.h:115
bool operator()(const AuctionBid &lhs, const AuctionBid &rhs) const
Comparison for sorting.
Auction bidding instance.
Definition: AuctionBid.h:72
bool operator==(const AuctionBid &rhs) const
Compares for bid equality.
bool operator<(const AuctionBid &rhs) const
Compares for bid less than.
std::string bidder
the id of the bidder(e.g., "agent.0")
Definition: AuctionBid.h:91
bool operator>(const AuctionBid &rhs) const
Compares for bid greater than.
madara::knowledge::KnowledgeRecord amount
the amount of the bid(e.g., 2.50)
Definition: AuctionBid.h:94
std::vector< AuctionBid > AuctionBids
convenience typedef for vector fo AuctionBid
Definition: AuctionBid.h:126
void sort_descending(AuctionBids &bids)
Convenience function for sorting bids in descending order, using the AuctionBidDescending comparator.
void strip_prefix_fast(const std::string &prefix, AuctionBids &bids)
Strips bids' bidder of an auction prefix for convenience(unsafe).
void sort_ascending(AuctionBids &bids)
Convenience function for sorting bids in ascending order, using the AuctionBidAscending comparator.
void strip_prefix_safe(const std::string &prefix, AuctionBids &bids)
Strips bids' bidder of an auction prefix for convenience.
Contains all GAMS-related tools, classes and code.