From 97dbf379d5e44c80c748483a688502b1cec8f075 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 5 Mar 2012 17:50:17 -0600 Subject: Rewrote the way annotated commodities are managed The new scheme should be much more efficient, and allows for future growth of what annotations may appear on a commodity. --- src/py_commodity.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/py_commodity.cc') diff --git a/src/py_commodity.cc b/src/py_commodity.cc index b5230850..25e5b918 100644 --- a/src/py_commodity.cc +++ b/src/py_commodity.cc @@ -115,7 +115,7 @@ namespace { (string("Could not find commodity ") + symbol).c_str()); throw_error_already_set(); } - return (*i).second; + return (*i).second.get(); } python::list py_pool_keys(commodity_pool_t& pool) { @@ -168,13 +168,15 @@ namespace { py_pool_commodities_values_begin(commodity_pool_t& pool) { return make_transform_iterator (pool.commodities.begin(), - bind(&commodity_pool_t::commodities_map::value_type::second, _1)); + bind(&shared_ptr::get, + bind(&commodity_pool_t::commodities_map::value_type::second, _1))); } commodities_map_seconds_iterator py_pool_commodities_values_end(commodity_pool_t& pool) { return make_transform_iterator (pool.commodities.end(), - bind(&commodity_pool_t::commodities_map::value_type::second, _1)); + bind(&shared_ptr::get, + bind(&commodity_pool_t::commodities_map::value_type::second, _1))); } void py_add_price_2(commodity_t& commodity, @@ -267,8 +269,6 @@ void export_commodity() make_getter(&commodity_pool_t::get_commodity_quote), make_setter(&commodity_pool_t::get_commodity_quote)) - .def("make_qualified_name", &commodity_pool_t::make_qualified_name) - .def("create", py_create_1, return_internal_reference<>()) .def("create", py_create_2, return_internal_reference<>()) @@ -359,7 +359,6 @@ void export_commodity() .add_property("base_symbol", &commodity_t::base_symbol) .add_property("symbol", &commodity_t::symbol) - .add_property("mapping_key", &commodity_t::mapping_key) .add_property("name", &commodity_t::name, &commodity_t::set_name) .add_property("note", &commodity_t::note, &commodity_t::set_note) -- cgit v1.2.3