#include "Order.h" #include #include unsigned int Order::defaultMaxValidity = 20; Order::Order( Investor* investor, Stock* stock, double price, long amount, unsigned int validity ) : investor_( investor), stock_( stock ), price_( price ), amount_( amount ), validity_( validity ) { } Order::~Order() { } void Order::dump( double price, long amount ) { assert ( amount <= amount_ ); // cout << "order executed (" << amount << "/" << amount_ << ")" << endl; amount_ -= amount; } double Order::cost() const { return amount_ * price_; } void Order::notify() { validity_ --; } bool Order::expired() const { assert( validity_ >= 0 ); // if ( validity_ == 0 ) // cout << "order expired" << endl; return validity_ == 0; }