1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #include <precomp.h>
23 #include <ary/idl/i_typedef.hxx>
24 #include <ary/idl/ik_typedef.hxx>
25
26
27 // NOT FULLY DECLARED SERVICES
28 #include <cosv/tpl/processor.hxx>
29 #include <sci_impl.hxx>
30 #include "i2s_calculator.hxx"
31
32
33 namespace ary
34 {
35 namespace idl
36 {
37
38
Typedef(const String & i_sName,Ce_id i_nOwner,Type_id i_nDefiningType)39 Typedef::Typedef( const String & i_sName,
40 Ce_id i_nOwner,
41 Type_id i_nDefiningType )
42 : sName(i_sName),
43 nOwner(i_nOwner),
44 nDefiningType(i_nDefiningType)
45 {
46 }
47
~Typedef()48 Typedef::~Typedef()
49 {
50 }
51
52 void
do_Accept(csv::ProcessorIfc & io_processor) const53 Typedef::do_Accept( csv::ProcessorIfc & io_processor ) const
54 {
55 csv::CheckedCall(io_processor, *this);
56 }
57
58 ClassId
get_AryClass() const59 Typedef::get_AryClass() const
60 {
61 return class_id;
62 }
63
64 const String &
inq_LocalName() const65 Typedef::inq_LocalName() const
66 {
67 return sName;
68 }
69
70 Ce_id
inq_NameRoom() const71 Typedef::inq_NameRoom() const
72 {
73 return nOwner;
74 }
75
76 Ce_id
inq_Owner() const77 Typedef::inq_Owner() const
78 {
79 return nOwner;
80 }
81
82 E_SightLevel
inq_SightLevel() const83 Typedef::inq_SightLevel() const
84 {
85 return sl_File;
86 }
87
88
89 namespace ifc_typedef
90 {
91
92 inline const Typedef &
typedef_cast(const CodeEntity & i_ce)93 typedef_cast( const CodeEntity & i_ce )
94 {
95 csv_assert( i_ce.AryClass() == Typedef::class_id );
96 return static_cast< const Typedef& >(i_ce);
97 }
98
99 Type_id
DefiningType(const CodeEntity & i_ce)100 attr::DefiningType( const CodeEntity & i_ce )
101 {
102 return typedef_cast(i_ce).nDefiningType;
103 }
104
105
106 void
Get_SynonymTypedefs(Dyn_CeIterator & o_result,const CodeEntity & i_ce)107 xref::Get_SynonymTypedefs( Dyn_CeIterator & o_result,
108 const CodeEntity & i_ce )
109 {
110 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(typedef_2s_SynonymTypedefs));
111 }
112
113 void
Get_AsReturns(Dyn_CeIterator & o_result,const CodeEntity & i_ce)114 xref::Get_AsReturns( Dyn_CeIterator & o_result,
115 const CodeEntity & i_ce )
116 {
117 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(typedef_2s_AsReturns));
118 }
119
120 void
Get_AsParameters(Dyn_CeIterator & o_result,const CodeEntity & i_ce)121 xref::Get_AsParameters( Dyn_CeIterator & o_result,
122 const CodeEntity & i_ce )
123 {
124 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(typedef_2s_AsParameters));
125 }
126
127 void
Get_AsDataTypes(Dyn_CeIterator & o_result,const CodeEntity & i_ce)128 xref::Get_AsDataTypes( Dyn_CeIterator & o_result,
129 const CodeEntity & i_ce )
130 {
131 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(typedef_2s_AsDataTypes));
132 }
133
134 } // namespace ifc_typedef
135
136
137
138 } // namespace idl
139 } // namespace ary
140