diff options
author | Luciano Wolf <luciano.wolf@openbossa.org> | 2009-11-27 17:17:08 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-11-27 19:03:31 -0300 |
commit | 5d2e5cd85ec6950f5bb848fe08e66cd8520cf29d (patch) | |
tree | 7e77367d82d4be2128b7ddd80c25476c44f74bae /tests/libsample/blackbox.h | |
parent | 62de488a772ad9369887fcb4482df149b7c49b94 (diff) |
Use map instead of list inside BlackBox class.
Now keepObjectType/keepPoint and retrieveObjectType/retrievePoint
uses a ticket to get the object from a map. It's a way better than
lists.
Diffstat (limited to 'tests/libsample/blackbox.h')
-rw-r--r-- | tests/libsample/blackbox.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/tests/libsample/blackbox.h b/tests/libsample/blackbox.h index 136be3008..c683c82d5 100644 --- a/tests/libsample/blackbox.h +++ b/tests/libsample/blackbox.h @@ -36,33 +36,34 @@ #define BLACKBOX_H #include "libsamplemacros.h" -#include <list> +#include <map> #include "objecttype.h" #include "point.h" class LIBSAMPLE_API BlackBox { public: - typedef std::list<ObjectType*> ObjectTypeList; - typedef std::list<Point*> PointList; + typedef std::map<int, ObjectType*> ObjectTypeMap; + typedef std::map<int, Point*> PointMap; - BlackBox() {} + BlackBox() { m_ticket = -1;} ~BlackBox(); - void keepObjectType(ObjectType* object); - ObjectType* retrieveObjectType(ObjectType* object); - void disposeObjectType(ObjectType* object); + int keepObjectType(ObjectType* object); + ObjectType* retrieveObjectType(int ticket); + void disposeObjectType(int ticket); - void keepPoint(Point* point); - Point* retrievePoint(Point* point); - void disposePoint(Point* point); + int keepPoint(Point* point); + Point* retrievePoint(int ticket); + void disposePoint(int ticket); - ObjectTypeList objects() { return m_objects; } - PointList points() { return m_points; } + ObjectTypeMap objects() { return m_objects; } + PointMap points() { return m_points; } private: - ObjectTypeList m_objects; - PointList m_points; + ObjectTypeMap m_objects; + PointMap m_points; + int m_ticket; }; #endif // BLACKBOX_H |