4 #include "mathed/math_data.h"
5 #include "insets/insetbase.h"
8 #include <boost/assert.hpp>
12 void lyxbreaker(void const * data, const char * hint, int size);
19 Point(int x, int y) : x_(x), y_(y)
21 BOOST_ASSERT(x > -3000);
22 BOOST_ASSERT(x < 4000);
23 BOOST_ASSERT(y > -3000);
24 BOOST_ASSERT(y < 4000);
31 template <class T> class CoordCacheBase {
38 void add(T const * thing, int x, int y)
40 data_[thing] = Point(x, y);
43 int x(T const * thing) const
46 return data_.find(thing)->second.x_;
49 int y(T const * thing) const
52 return data_.find(thing)->second.y_;
55 Point xy(T const * thing) const
58 return data_.find(thing)->second;
61 bool has(T const * thing) const
63 return data_.find(thing) != data_.end();
66 // T * find(int x, int y) const
73 friend class CoordCache;
75 void check(T const * thing, char const * hint) const
78 lyxbreaker(thing, hint, data_.size());
83 typedef std::map<T const *, Point> cache_type;
92 CoordCacheBase<MathArray> arrays_;
93 CoordCacheBase<InsetBase> insets_;
96 extern CoordCache theCoords;