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