From 21e8b7f6f0a182f67899c5cd3689a5e646d8ed4a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 8 Mar 2012 00:55:06 -0600 Subject: Added nail_down() for pinning market value exprs --- src/commodity.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/commodity.cc') diff --git a/src/commodity.cc b/src/commodity.cc index 24d54695..dd1b2743 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -217,6 +217,15 @@ commodity_t::check_for_updated_price(const optional& point, return point; } +commodity_t& commodity_t::nail_down(const expr_t& expr) +{ + annotation_t new_details; + new_details.value_expr = expr; + commodity_t * new_comm = + commodity_pool_t::current_pool->find_or_create(symbol(), new_details); + return *new_comm; +} + commodity_t::operator bool() const { return this != pool().null_commodity; -- cgit v1.2.3