From 8a25ac88edece21b1e4ba3948225a7f59b9ac1e9 Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Tue, 14 May 2024 17:41:37 -0500 Subject: [PATCH] bids can have optional info on package type --- src/bid.h | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/bid.h b/src/bid.h index 1403e1849d..e5cede4798 100644 --- a/src/bid.h +++ b/src/bid.h @@ -6,6 +6,7 @@ #include #include "request.h" +#include "package.h" namespace cyclus { @@ -51,23 +52,26 @@ template class Bid { offer, Trader* bidder, typename BidPortfolio::Ptr portfolio, - bool exclusive = false) { + bool exclusive = false, + Package::Ptr package = Package::unpackaged()) { return Create(request, offer, bidder, portfolio, exclusive, - std::numeric_limits::quiet_NaN()); + std::numeric_limits::quiet_NaN(), package); } /// @brief a factory method for a bid for a bid without a portfolio /// @warning this factory should generally only be used for testing inline static Bid* Create(Request* request, boost::shared_ptr offer, Trader* bidder, bool exclusive, - double preference) { - return new Bid(request, offer, bidder, exclusive, preference); + double preference, + Package::Ptr package = Package::unpackaged()) { + return new Bid(request, offer, bidder, exclusive, preference, package); } /// @brief a factory method for a bid for a bid without a portfolio /// @warning this factory should generally only be used for testing inline static Bid* Create(Request* request, boost::shared_ptr offer, - Trader* bidder, bool exclusive = false) { + Trader* bidder, bool exclusive = false, + Package::Ptr package = Package::unpackaged()) { return Create(request, offer, bidder, exclusive, - std::numeric_limits::quiet_NaN()); + std::numeric_limits::quiet_NaN(), package); } /// @return the request being responded to @@ -91,38 +95,45 @@ template class Bid { private: /// @brief constructors are private to require use of factory methods Bid(Request* request, boost::shared_ptr offer, Trader* bidder, - bool exclusive, double preference) + bool exclusive, double preference, + Package::Ptr package = Package::unpackaged()) : request_(request), offer_(offer), bidder_(bidder), exclusive_(exclusive), - preference_(preference) {} + preference_(preference), + package_(package) {} /// @brief constructors are private to require use of factory methods Bid(Request* request, boost::shared_ptr offer, Trader* bidder, - bool exclusive = false) + bool exclusive = false, Package::Ptr package = Package::unpackaged()) : request_(request), offer_(offer), bidder_(bidder), exclusive_(exclusive), - preference_(std::numeric_limits::quiet_NaN()) {} + preference_(std::numeric_limits::quiet_NaN()), + package_(package) {} Bid(Request* request, boost::shared_ptr offer, Trader* bidder, - typename BidPortfolio::Ptr portfolio, bool exclusive, double preference) + typename BidPortfolio::Ptr portfolio, bool exclusive, double preference, + Package::Ptr package = Package::unpackaged()) : request_(request), offer_(offer), bidder_(bidder), portfolio_(portfolio), exclusive_(exclusive), - preference_(preference) {} + preference_(preference), + package_(package) {} Bid(Request* request, boost::shared_ptr offer, Trader* bidder, - typename BidPortfolio::Ptr portfolio, bool exclusive = false) + typename BidPortfolio::Ptr portfolio, bool exclusive = false, + Package::Ptr package = Package::unpackaged()) : request_(request), offer_(offer), bidder_(bidder), portfolio_(portfolio), exclusive_(exclusive), - preference_(std::numeric_limits::quiet_NaN()) {} + preference_(std::numeric_limits::quiet_NaN()), + package_(package) {} Request* request_; boost::shared_ptr offer_; @@ -130,6 +141,7 @@ template class Bid { boost::weak_ptr> portfolio_; bool exclusive_; double preference_; + Package::Ptr package_; }; } // namespace cyclus