blob: adf0a56cf67d2858768afcda6b5a6ae7be6a2897 [file] [log] [blame]
Mark Sleee9ce01c2007-05-16 02:29:53 +00001// Copyright (c) 2006- Facebook
2// Distributed under the Thrift Software License
3//
4// See accompanying file LICENSE or visit the Thrift site at:
5// http://developers.facebook.com/thrift/
6
Mark Sleee8540632006-05-30 09:24:40 +00007#ifndef T_SET_H
8#define T_SET_H
9
Mark Slee4f8da1d2006-10-12 02:47:27 +000010#include "t_container.h"
Mark Sleee8540632006-05-30 09:24:40 +000011
Mark Sleef5377b32006-10-10 01:42:59 +000012/**
13 * A set is a lightweight container type that just wraps another data type.
14 *
Mark Sleef5377b32006-10-10 01:42:59 +000015 */
Mark Slee4f8da1d2006-10-12 02:47:27 +000016class t_set : public t_container {
Mark Sleee8540632006-05-30 09:24:40 +000017 public:
Mark Sleef5377b32006-10-10 01:42:59 +000018 t_set(t_type* elem_type) :
19 elem_type_(elem_type) {}
Mark Sleee8540632006-05-30 09:24:40 +000020
Mark Sleef5377b32006-10-10 01:42:59 +000021 t_type* get_elem_type() const {
22 return elem_type_;
23 }
24
25 bool is_set() const {
26 return true;
27 }
Mark Sleee8540632006-05-30 09:24:40 +000028
David Reiss18bf22d2007-08-28 20:49:17 +000029 virtual std::string get_fingerprint_material() const {
30 return "set<" + elem_type_->get_fingerprint_material() + ">";
31 }
32
David Reiss9885c682007-08-30 23:12:37 +000033 virtual void generate_fingerprint() {
34 t_type::generate_fingerprint();
35 elem_type_->generate_fingerprint();
36 }
37
Mark Sleee8540632006-05-30 09:24:40 +000038 private:
39 t_type* elem_type_;
40};
41
42#endif