summaryrefslogtreecommitdiff
path: root/modules/CIAO/tools/Config_Handlers/XSCRT/ExtendedTypeInfo.ipp
blob: 6c4fba2cf8884b162e583e408d7c32269b23c86e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// file      : XSCRT/ExtendedTypeInfo.ipp
// author    : Boris Kolpackov <boris@dre.vanderbilt.edu>
// cvs-id    : $Id$


/*
 *  @@HACK: Visual Studio.
 *  I think the return value for operator== for type_info
 *  in VC7 (perhaps others) is int when is should be bool.
 *  This causes a warning about converting the return value from
 *  int to bool.
 */
#ifdef _MSC_VER
# pragma warning( disable: 4800 )
#endif

namespace XSCRT
{
  // TypeId
  //
  //
  inline
  TypeId::
  TypeId (std::type_info const& tid)
      : tid_ (&tid)
  {
  }

  inline
  bool TypeId::
  operator == (TypeId const& other) const
  {
    return *tid_ == *other.tid_;
  }

  inline
  bool TypeId::
  operator != (TypeId const& other) const
  {
    return *tid_ != *other.tid_;
  }

  inline
  bool TypeId::
  operator < (TypeId const& other) const
  {
    return tid_->before (*other.tid_);
  }


  // ExtendedTypeInfo::BaseInfo
  //
  //

  inline
  ExtendedTypeInfo::BaseInfo::
  BaseInfo (Access::Value access, bool virtual_base, TypeId const& tid)
      : tid_ (tid),
        ti_ (0),
        virtual_base_ (virtual_base),
        access_ (access)
  {
  }

  inline
  ExtendedTypeInfo const& ExtendedTypeInfo::BaseInfo::
  type_info () const
  {
    if (ti_ == 0) ti_ = &(extended_type_info (tid_));

    return *ti_;
  }


  inline
  ExtendedTypeInfo::Access::Value ExtendedTypeInfo::BaseInfo::
  access () const
  {
    return access_;
  }

  inline
  bool ExtendedTypeInfo::BaseInfo::
  virtual_base () const
  {
    return virtual_base_;
  }


  // ExtendedTypeInfo
  //
  //
  inline
  ExtendedTypeInfo::
  ExtendedTypeInfo (TypeId const& tid)
      : tid_ (tid)
  {
  }

  inline
  TypeId ExtendedTypeInfo::
  type_id () const
  {
    return tid_;
  }

  inline
  ExtendedTypeInfo::BaseIterator ExtendedTypeInfo::
  begin_base () const
  {
    return base_.begin ();
  }


  inline
  ExtendedTypeInfo::BaseIterator ExtendedTypeInfo::
  end_base () const
  {
    return base_.end ();
  }

  inline
  void ExtendedTypeInfo::
  add_base (Access::Value access, bool virtual_base, TypeId const& tid)
  {
    base_.push_back (BaseInfo (access, virtual_base, tid));
  }

  // ExtendedTypeInfoMap
  //
  //

  inline
  ExtendedTypeInfoMap&
  extended_type_info_map ()
  {
    static ExtendedTypeInfoMap extended_type_info_map_;

    return extended_type_info_map_;
  }
}