Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 1 | #ifndef T_MAP_H |
| 2 | #define T_MAP_H |
| 3 | |
Mark Slee | 4f8da1d | 2006-10-12 02:47:27 +0000 | [diff] [blame] | 4 | #include "t_container.h" |
| 5 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 6 | /** |
| 7 | * A map is a lightweight container type that just wraps another two data |
| 8 | * types. |
| 9 | * |
| 10 | * @author Mark Slee <mcslee@facebook.com> |
| 11 | */ |
Mark Slee | 4f8da1d | 2006-10-12 02:47:27 +0000 | [diff] [blame] | 12 | class t_map : public t_container { |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 13 | public: |
| 14 | t_map(t_type* key_type, t_type* val_type) : |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 15 | key_type_(key_type), |
| 16 | val_type_(val_type) {} |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 17 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 18 | t_type* get_key_type() const { |
| 19 | return key_type_; |
| 20 | } |
| 21 | |
| 22 | t_type* get_val_type() const { |
| 23 | return val_type_; |
| 24 | } |
| 25 | |
| 26 | bool is_map() const { |
| 27 | return true; |
| 28 | } |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 29 | |
| 30 | private: |
| 31 | t_type* key_type_; |
| 32 | t_type* val_type_; |
| 33 | }; |
| 34 | |
| 35 | #endif |