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_struct.hxx>
24 #include <ary/idl/ik_struct.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
Struct(const String & i_sName,Ce_id i_nOwner,Type_id i_nBase,const String & i_sTemplateParameter,Type_id i_nTemplateParameterType)38 Struct::Struct( const String & i_sName,
39 Ce_id i_nOwner,
40 Type_id i_nBase,
41 const String & i_sTemplateParameter,
42 Type_id i_nTemplateParameterType )
43 : sName(i_sName),
44 nOwner(i_nOwner),
45 nBase(i_nBase),
46 sTemplateParameter(i_sTemplateParameter),
47 nTemplateParameterType(i_nTemplateParameterType),
48 aElements()
49 {
50 }
51
~Struct()52 Struct::~Struct()
53 {
54 }
55
56 void
do_Accept(csv::ProcessorIfc & io_processor) const57 Struct::do_Accept( csv::ProcessorIfc & io_processor ) const
58 {
59 csv::CheckedCall(io_processor, *this);
60 }
61
62 ClassId
get_AryClass() const63 Struct::get_AryClass() const
64 {
65 return class_id;
66 }
67
68 const String &
inq_LocalName() const69 Struct::inq_LocalName() const
70 {
71 return sName;
72 }
73
74 Ce_id
inq_NameRoom() const75 Struct::inq_NameRoom() const
76 {
77 return nOwner;
78 }
79
80 Ce_id
inq_Owner() const81 Struct::inq_Owner() const
82 {
83 return nOwner;
84 }
85
86 E_SightLevel
inq_SightLevel() const87 Struct::inq_SightLevel() const
88 {
89 return sl_File;
90 }
91
92
93 namespace ifc_struct
94 {
95
96 inline const Struct &
struct_cast(const CodeEntity & i_ce)97 struct_cast( const CodeEntity & i_ce )
98 {
99 csv_assert( i_ce.AryClass() == Struct::class_id );
100 return static_cast< const Struct& >(i_ce);
101 }
102
103 Type_id
Base(const CodeEntity & i_ce)104 attr::Base( const CodeEntity & i_ce )
105 {
106 return struct_cast(i_ce).nBase;
107 }
108
109 void
Get_Elements(Dyn_CeIterator & o_result,const CodeEntity & i_ce)110 attr::Get_Elements( Dyn_CeIterator & o_result,
111 const CodeEntity & i_ce )
112 {
113 o_result = new SCI_Vector<Ce_id>( struct_cast(i_ce).aElements );
114 }
115
116
117 void
Get_Derivations(Dyn_CeIterator & o_result,const CodeEntity & i_ce)118 xref::Get_Derivations( Dyn_CeIterator & o_result,
119 const CodeEntity & i_ce )
120 {
121 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_Derivations));
122 }
123
124 void
Get_SynonymTypedefs(Dyn_CeIterator & o_result,const CodeEntity & i_ce)125 xref::Get_SynonymTypedefs( Dyn_CeIterator & o_result,
126 const CodeEntity & i_ce )
127 {
128 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_SynonymTypedefs));
129 }
130
131 void
Get_AsReturns(Dyn_CeIterator & o_result,const CodeEntity & i_ce)132 xref::Get_AsReturns( Dyn_CeIterator & o_result,
133 const CodeEntity & i_ce )
134 {
135 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsReturns));
136 }
137
138 void
Get_AsParameters(Dyn_CeIterator & o_result,const CodeEntity & i_ce)139 xref::Get_AsParameters( Dyn_CeIterator & o_result,
140 const CodeEntity & i_ce )
141 {
142 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsParameters));
143 }
144
145 void
Get_AsDataTypes(Dyn_CeIterator & o_result,const CodeEntity & i_ce)146 xref::Get_AsDataTypes( Dyn_CeIterator & o_result,
147 const CodeEntity & i_ce )
148 {
149 o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsDataTypes));
150 }
151
152 } // namespace ifc_struct
153
154
155
156 } // namespace idl
157 } // namespace ary
158