33 // base class and an associated tag type. Tags are small non-negative
34 // integer values uniquely associated with distinct classes in the
35 // hierarchy. A tag type is often an enum type.
36 //
37 // The concrete class specifies the concrete tag.
38 //
39 // The tag set specifies the set of classes in the derivation
40 // sequence. Classes in the derivation sequence add their associated
41 // tag during construction. Given the tag associated with a class, an
42 // object is an instance of that class if the tag is included in the
43 // object's set of recorded tags.
44 //
45 // A tag T is present in a tag set if the T'th bit of the tag set is
46 // one.
47 //
48 // Note: The representation of a tag set being uintx sets an upper
49 // bound on the size of a class hierarchy this utility can be used
50 // with.
51 template<typename T, typename TagType>
52 class FakeRttiSupport VALUE_OBJ_CLASS_SPEC {
53 public:
54 // Construct with the indicated concrete tag, and include the
55 // concrete tag in the associated tag set.
56 explicit FakeRttiSupport(TagType concrete_tag) :
57 _tag_set(tag_bit(concrete_tag)), _concrete_tag(concrete_tag) { }
58
59 // Construct with the indicated concrete tag and tag set.
60 // Note: This constructor is public only to allow clients to set up
61 // "unusual" (or perhaps buggy) fake RTTI configurations.
62 FakeRttiSupport(TagType concrete_tag, uintx tag_set) :
63 _tag_set(tag_set), _concrete_tag(validate_tag(concrete_tag)) { }
64
65 // Get the concrete tag.
66 TagType concrete_tag() const { return _concrete_tag; }
67
68 // Test whether tag is in the tag set.
69 bool has_tag(TagType tag) const {
70 return (_tag_set & tag_bit(tag)) != 0;
71 }
72
|
33 // base class and an associated tag type. Tags are small non-negative
34 // integer values uniquely associated with distinct classes in the
35 // hierarchy. A tag type is often an enum type.
36 //
37 // The concrete class specifies the concrete tag.
38 //
39 // The tag set specifies the set of classes in the derivation
40 // sequence. Classes in the derivation sequence add their associated
41 // tag during construction. Given the tag associated with a class, an
42 // object is an instance of that class if the tag is included in the
43 // object's set of recorded tags.
44 //
45 // A tag T is present in a tag set if the T'th bit of the tag set is
46 // one.
47 //
48 // Note: The representation of a tag set being uintx sets an upper
49 // bound on the size of a class hierarchy this utility can be used
50 // with.
51 template<typename T, typename TagType>
52 class FakeRttiSupport VALUE_OBJ_CLASS_SPEC {
53 friend class VMStructs;
54 public:
55 // Construct with the indicated concrete tag, and include the
56 // concrete tag in the associated tag set.
57 explicit FakeRttiSupport(TagType concrete_tag) :
58 _tag_set(tag_bit(concrete_tag)), _concrete_tag(concrete_tag) { }
59
60 // Construct with the indicated concrete tag and tag set.
61 // Note: This constructor is public only to allow clients to set up
62 // "unusual" (or perhaps buggy) fake RTTI configurations.
63 FakeRttiSupport(TagType concrete_tag, uintx tag_set) :
64 _tag_set(tag_set), _concrete_tag(validate_tag(concrete_tag)) { }
65
66 // Get the concrete tag.
67 TagType concrete_tag() const { return _concrete_tag; }
68
69 // Test whether tag is in the tag set.
70 bool has_tag(TagType tag) const {
71 return (_tag_set & tag_bit(tag)) != 0;
72 }
73
|