summaryrefslogtreecommitdiff
path: root/src/history.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-05-20 15:03:22 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-05-20 15:03:22 -0500
commita9bdcc33013b5e1e76571ee1104bd8c7f278e775 (patch)
tree5c71b678e8180cc49dd6a8ad7bc27ce1abaf24ad /src/history.h
parent1b83c684fbb88b40a4b3b7114a9116b0e582bc67 (diff)
downloadfork-ledger-a9bdcc33013b5e1e76571ee1104bd8c7f278e775.tar.gz
fork-ledger-a9bdcc33013b5e1e76571ee1104bd8c7f278e775.tar.bz2
fork-ledger-a9bdcc33013b5e1e76571ee1104bd8c7f278e775.zip
Work around collision between Format's put & Graph
Diffstat (limited to 'src/history.h')
-rw-r--r--src/history.h48
1 files changed, 4 insertions, 44 deletions
diff --git a/src/history.h b/src/history.h
index af0d90f9..4362c9f9 100644
--- a/src/history.h
+++ b/src/history.h
@@ -49,57 +49,17 @@
#include "amount.h"
#include "commodity.h"
-namespace boost {
- enum edge_price_point_t { edge_price_point };
- enum edge_price_ratio_t { edge_price_ratio };
- BOOST_INSTALL_PROPERTY(edge, price_point);
- BOOST_INSTALL_PROPERTY(edge, price_ratio);
-}
-
namespace ledger {
typedef std::map<datetime_t, amount_t> price_map_t;
+class commodity_history_impl_t;
class commodity_history_t : public noncopyable
{
-public:
- typedef adjacency_list
- <vecS, // Store all edges in a vector
- vecS, // Store all vertices in a vector
- undirectedS, // Relations are both ways
-
- // All vertices are commodities
- property<vertex_name_t, const commodity_t *,
- property<vertex_index_t, std::size_t> >,
-
- // All edges are weights computed as the absolute difference between
- // the reference time of a search and a known price point. A
- // filtered_graph is used to select the recent price point to the
- // reference time before performing the search.
- property<edge_weight_t, long,
- property<edge_price_ratio_t, price_map_t,
- property<edge_price_point_t, price_point_t> > >,
-
- // Graph itself has a std::string name
- property<graph_name_t, std::string>
- > Graph;
+ unique_ptr<commodity_history_impl_t> p_impl;
- Graph price_graph;
-
- typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor;
- typedef graph_traits<Graph>::edge_descriptor edge_descriptor;
-
- typedef property_map<Graph, vertex_name_t>::type NameMap;
- typedef property_map<Graph, edge_weight_t>::type EdgeWeightMap;
- typedef property_map<Graph, edge_price_point_t>::type PricePointMap;
- typedef property_map<Graph, edge_price_ratio_t>::type PriceRatioMap;
-
- PricePointMap pricemap;
- PriceRatioMap ratiomap;
-
- commodity_history_t()
- : pricemap(get(edge_price_point, price_graph)),
- ratiomap(get(edge_price_ratio, price_graph)) {}
+public:
+ commodity_history_t();
void add_commodity(commodity_t& comm);