2fdb4f1ad3391326c19dc3d324a3651b0bcb103e
[mussa.git] / alg / annotation_colors.hpp
1 #ifndef ANNOTATION_COLOR_H
2 #define ANNOTATION_COLOR_H
3
4 #include <map>
5 #include <string>
6
7 #include "alg/color.hpp"
8 #include "alg/sequence.hpp"
9
10 struct DefaultColorMap;
11 struct DefaultColorMap
12 {
13   typedef std::map<std::string, DefaultColorMap> color_map_type;
14   typedef color_map_type::iterator iterator;
15   typedef color_map_type::const_iterator const_iterator;
16   DefaultColorMap();
17   //! initialize color map with a default color
18   DefaultColorMap(const Color &);
19   DefaultColorMap(const color_map_type&);
20   DefaultColorMap(const DefaultColorMap&);
21
22   Color defaultColor;
23   //! color map
24   color_map_type cm;
25 };
26
27 class AnnotationColors
28 {
29 public:
30   AnnotationColors();
31   AnnotationColors(const AnnotationColors &);
32
33   // clear all the contents of our mappers
34   void clear();
35   //! set default color
36   void setColor(Color &);
37   //! retreive default color
38   Color color();
39
40   //! add default color for a particular type
41   void appendTypeColor(const std::string &, const Color &);
42   //! get default color for a type
43   Color typeColor(const std::string &);
44   //! remove a type (and all of its instances)
45   void erase(const std::string &);
46
47   //! add default color for a particular type
48   void appendInstanceColor(const std::string &type, 
49                            const std::string &instance, 
50                            const Color &);
51   //! get color for a particular type
52   Color instanceColor(const std::string &type, 
53                       const std::string &instance);
54   //! remove an instance of particular type
55   void erase(const std::string &type, const std::string& instance);
56
57   //! lookup an annotation color
58   Color lookup(const annot &) const;
59   Color lookup(const std::string &, const std::string &) const;
60 private:
61   // nested maps, with default?
62   DefaultColorMap root_map;
63 };
64 #endif