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_function.hxx>
24
25
26 // NOT FULLY DECLARED SERVICES
27 #include <cosv/tpl/processor.hxx>
28 #include <sci_impl.hxx>
29
30
31
32 namespace ary
33 {
34 namespace idl
35 {
36
Function(const String & i_sName,Ce_id i_nOwner,Ce_id i_nNameRoom,Type_id i_nReturnType,bool i_bOneWay)37 Function::Function( const String & i_sName,
38 Ce_id i_nOwner,
39 Ce_id i_nNameRoom,
40 Type_id i_nReturnType,
41 bool i_bOneWay )
42 : sName(i_sName),
43 nOwner(i_nOwner),
44 nNameRoom(i_nNameRoom),
45 nReturnType(i_nReturnType),
46 aParameters(),
47 aExceptions(),
48 bOneWay(i_bOneWay),
49 bEllipse(false)
50 {
51 }
52
Function(const String & i_sName,Ce_id i_nOwner,Ce_id i_nNameRoom)53 Function::Function( const String & i_sName,
54 Ce_id i_nOwner,
55 Ce_id i_nNameRoom )
56 : sName(i_sName),
57 nOwner(i_nOwner),
58 nNameRoom(i_nNameRoom),
59 nReturnType(0),
60 aParameters(),
61 aExceptions(),
62 bOneWay(false),
63 bEllipse(false)
64 {
65 }
66
~Function()67 Function::~Function()
68 {
69 }
70
71 void
do_Accept(csv::ProcessorIfc & io_processor) const72 Function::do_Accept( csv::ProcessorIfc & io_processor ) const
73 {
74 csv::CheckedCall(io_processor, *this);
75 }
76
77 ClassId
get_AryClass() const78 Function::get_AryClass() const
79 {
80 return class_id;
81 }
82
83 const String &
inq_LocalName() const84 Function::inq_LocalName() const
85 {
86 return sName;
87 }
88
89 Ce_id
inq_NameRoom() const90 Function::inq_NameRoom() const
91 {
92 return nNameRoom;
93 }
94
95 Ce_id
inq_Owner() const96 Function::inq_Owner() const
97 {
98 return nOwner;
99 }
100
101 E_SightLevel
inq_SightLevel() const102 Function::inq_SightLevel() const
103 {
104 return sl_Member;
105 }
106
107
108 namespace ifc_function
109 {
110
111 inline const Function &
function_cast(const CodeEntity & i_ce)112 function_cast( const CodeEntity & i_ce )
113 {
114 csv_assert( i_ce.AryClass() == Function::class_id );
115 return static_cast< const Function& >(i_ce);
116 }
117
118 Type_id
ReturnType(const CodeEntity & i_ce)119 attr::ReturnType( const CodeEntity & i_ce )
120 {
121 return function_cast(i_ce).nReturnType;
122 }
123
124 bool
IsOneway(const CodeEntity & i_ce)125 attr::IsOneway( const CodeEntity & i_ce )
126 {
127 return function_cast(i_ce).bOneWay;
128 }
129
130 bool
HasEllipse(const CodeEntity & i_ce)131 attr::HasEllipse( const CodeEntity & i_ce )
132 {
133 return function_cast(i_ce).bEllipse;
134 }
135
136 void
Get_Parameters(Dyn_StdConstIterator<ary::idl::Parameter> & o_result,const CodeEntity & i_ce)137 attr::Get_Parameters( Dyn_StdConstIterator<ary::idl::Parameter> & o_result,
138 const CodeEntity & i_ce )
139 {
140 o_result
141 = new SCI_Vector<Parameter>( function_cast(i_ce).aParameters );
142 }
143
144 void
Get_Exceptions(Dyn_TypeIterator & o_result,const CodeEntity & i_ce)145 attr::Get_Exceptions( Dyn_TypeIterator & o_result,
146 const CodeEntity & i_ce )
147 {
148 o_result
149 = new SCI_Vector<Type_id>( function_cast(i_ce).aExceptions );
150 }
151
152
153
154
155
156 } // namespace ifc_function
157
158 } // namespace idl
159 } // namespace ary
160