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_attribute.hxx>
24 #include <ary/idl/ik_attribute.hxx>
25
26
27 // NOT FULLY DECLARED SERVICES
28 #include <cosv/tpl/processor.hxx>
29 #include <ary/getncast.hxx>
30 #include <sci_impl.hxx>
31
32
33 namespace ary
34 {
35 namespace idl
36 {
37
38
Attribute(const String & i_sName,Ce_id i_nService,Ce_id i_nModule,Type_id i_nType,bool i_bReadonly,bool i_bBound)39 Attribute::Attribute( const String & i_sName,
40 Ce_id i_nService,
41 Ce_id i_nModule,
42 Type_id i_nType,
43 bool i_bReadonly,
44 bool i_bBound )
45 : sName(i_sName),
46 nOwner(i_nService),
47 nNameRoom(i_nModule),
48 nType(i_nType),
49 aGetExceptions(),
50 aSetExceptions(),
51 bReadonly(i_bReadonly),
52 bBound(i_bBound)
53 {
54 }
55
~Attribute()56 Attribute::~Attribute()
57 {
58 }
59
60
61 void
do_Accept(csv::ProcessorIfc & io_processor) const62 Attribute::do_Accept(csv::ProcessorIfc & io_processor) const
63 {
64 csv::CheckedCall(io_processor,*this);
65 }
66
67 ClassId
get_AryClass() const68 Attribute::get_AryClass() const
69 {
70 return class_id;
71 }
72
73 const String &
inq_LocalName() const74 Attribute::inq_LocalName() const
75 {
76 return sName;
77 }
78
79 Ce_id
inq_NameRoom() const80 Attribute::inq_NameRoom() const
81 {
82 return nNameRoom;
83 }
84
85 Ce_id
inq_Owner() const86 Attribute::inq_Owner() const
87 {
88 return nOwner;
89 }
90
91 E_SightLevel
inq_SightLevel() const92 Attribute::inq_SightLevel() const
93 {
94 return sl_Member;
95 }
96
97 namespace ifc_attribute
98 {
99
100 inline const Attribute &
attribute_cast(const CodeEntity & i_ce)101 attribute_cast( const CodeEntity & i_ce )
102 {
103 csv_assert( is_type<Attribute>(i_ce) );
104 return static_cast< const Attribute& >(i_ce);
105 }
106
107 bool
HasAnyStereotype(const CodeEntity & i_ce)108 attr::HasAnyStereotype( const CodeEntity & i_ce )
109 {
110 const Attribute & rAttr = attribute_cast(i_ce);
111 return rAttr.bReadonly OR rAttr.bBound;
112 }
113
114 bool
IsReadOnly(const CodeEntity & i_ce)115 attr::IsReadOnly( const CodeEntity & i_ce )
116 {
117 return attribute_cast(i_ce).bReadonly;
118 }
119
120 bool
IsBound(const CodeEntity & i_ce)121 attr::IsBound( const CodeEntity & i_ce )
122 {
123 return attribute_cast(i_ce).bBound;
124 }
125
126 Type_id
Type(const CodeEntity & i_ce)127 attr::Type( const CodeEntity & i_ce )
128 {
129 return attribute_cast(i_ce).nType;
130 }
131
132 void
Get_GetExceptions(Dyn_TypeIterator & o_result,const CodeEntity & i_ce)133 attr::Get_GetExceptions( Dyn_TypeIterator & o_result,
134 const CodeEntity & i_ce )
135 {
136 o_result
137 = new SCI_Vector<Type_id>( attribute_cast(i_ce).aGetExceptions );
138 }
139
140 void
Get_SetExceptions(Dyn_TypeIterator & o_result,const CodeEntity & i_ce)141 attr::Get_SetExceptions( Dyn_TypeIterator & o_result,
142 const CodeEntity & i_ce )
143 {
144 o_result
145 = new SCI_Vector<Type_id>( attribute_cast(i_ce).aSetExceptions );
146 }
147
148
149 } // namespace ifc_attribute
150
151
152 } // namespace idl
153 } // namespace ary
154