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_interface.hxx>
24 
25 
26 // NOT FULLY DECLARED SERVICES
27 #include <cosv/tpl/processor.hxx>
28 #include <ary/idl/ik_interface.hxx>
29 #include <ary/doc/d_oldidldocu.hxx>
30 #include <sci_impl.hxx>
31 #include "i2s_calculator.hxx"
32 
33 
34 namespace ary
35 {
36 namespace idl
37 {
38 
39 
40 class Interface_2s
41 {
42 };
43 
44 
Interface(const String & i_sName,Ce_id i_nOwner)45 Interface::Interface( const String &      i_sName,
46                       Ce_id               i_nOwner )
47     :   sName(i_sName),
48         nOwner(i_nOwner),
49         aBases(),
50         aFunctions(),
51         aAttributes(),
52         p2s()
53 {
54 }
55 
~Interface()56 Interface::~Interface()
57 {
58     for ( RelationList::iterator it = aBases.begin();
59           it != aBases.end();
60           ++it )
61     {
62         delete (*it).Info();
63     }
64 }
65 
66 void
do_Accept(csv::ProcessorIfc & io_processor) const67 Interface::do_Accept( csv::ProcessorIfc & io_processor ) const
68 {
69     csv::CheckedCall(io_processor, *this);
70 }
71 
72 ClassId
get_AryClass() const73 Interface::get_AryClass() const
74 {
75     return class_id;
76 }
77 
78 const String &
inq_LocalName() const79 Interface::inq_LocalName() const
80 {
81     return sName;
82 }
83 
84 Ce_id
inq_NameRoom() const85 Interface::inq_NameRoom() const
86 {
87     return nOwner;
88 }
89 
90 Ce_id
inq_Owner() const91 Interface::inq_Owner() const
92 {
93     return nOwner;
94 }
95 
96 E_SightLevel
inq_SightLevel() const97 Interface::inq_SightLevel() const
98 {
99     return sl_File;
100 }
101 
102 
103 namespace ifc_interface
104 {
105 
106 inline const Interface &
interface_cast(const CodeEntity & i_ce)107 interface_cast( const CodeEntity &  i_ce )
108 {
109     csv_assert( i_ce.AryClass() == Interface::class_id );
110     return static_cast< const Interface& >(i_ce);
111 }
112 
113 void
Get_Bases(Dyn_StdConstIterator<CommentedRelation> & o_result,const CodeEntity & i_ce)114 attr::Get_Bases( Dyn_StdConstIterator<CommentedRelation> &     o_result,
115                  const CodeEntity &                             i_ce )
116 {
117     o_result = new SCI_Vector<CommentedRelation>(interface_cast(i_ce).aBases);
118 }
119 
120 void
Get_Functions(Dyn_CeIterator & o_result,const CodeEntity & i_ce)121 attr::Get_Functions( Dyn_CeIterator &    o_result,
122                      const CodeEntity &  i_ce )
123 {
124     o_result = new SCI_Vector<Ce_id>(interface_cast(i_ce).aFunctions);
125 }
126 
127 void
Get_Attributes(Dyn_CeIterator & o_result,const CodeEntity & i_ce)128 attr::Get_Attributes( Dyn_CeIterator &    o_result,
129                       const CodeEntity &  i_ce )
130 {
131     o_result = new SCI_Vector<Ce_id>(interface_cast(i_ce).aAttributes);
132 }
133 
134 void
Get_Derivations(Dyn_CeIterator & o_result,const CodeEntity & i_ce)135 xref::Get_Derivations( Dyn_CeIterator &    o_result,
136                         const CodeEntity &  i_ce )
137 {
138     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_Derivations));
139 }
140 
141 void
Get_SynonymTypedefs(Dyn_CeIterator & o_result,const CodeEntity & i_ce)142 xref::Get_SynonymTypedefs( Dyn_CeIterator &    o_result,
143                            const CodeEntity &  i_ce )
144 {
145     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_SynonymTypedefs));
146 }
147 
148 void
Get_ExportingServices(Dyn_CeIterator & o_result,const CodeEntity & i_ce)149 xref::Get_ExportingServices( Dyn_CeIterator &    o_result,
150                              const CodeEntity &  i_ce )
151 {
152     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_ExportingServices));
153 }
154 
155 void
Get_ExportingSingletons(Dyn_CeIterator & o_result,const CodeEntity & i_ce)156 xref::Get_ExportingSingletons( Dyn_CeIterator &    o_result,
157 							   const CodeEntity &  i_ce )
158 {
159     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_ExportingSingletons));
160 }
161 
162 void
Get_AsReturns(Dyn_CeIterator & o_result,const CodeEntity & i_ce)163 xref::Get_AsReturns( Dyn_CeIterator &    o_result,
164                      const CodeEntity &  i_ce )
165 {
166     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_AsReturns));
167 }
168 
169 void
Get_AsParameters(Dyn_CeIterator & o_result,const CodeEntity & i_ce)170 xref::Get_AsParameters( Dyn_CeIterator &    o_result,
171                         const CodeEntity &  i_ce )
172 {
173     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_AsParameters));
174 }
175 
176 void
Get_AsDataTypes(Dyn_CeIterator & o_result,const CodeEntity & i_ce)177 xref::Get_AsDataTypes( Dyn_CeIterator &    o_result,
178                        const CodeEntity &  i_ce )
179 {
180     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_AsDataTypes));
181 }
182 
183 
184 
185 
186 }   // namespace ifc_interface
187 
188 
189 }   //  namespace   idl
190 }   //  namespace   ary
191