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_constant.hxx>
24 
25 
26 // NOT FULLY DECLARED SERVICES
27 #include <cosv/tpl/processor.hxx>
28 #include <ary/idl/ik_constant.hxx>
29 
30 
31 namespace ary
32 {
33 namespace idl
34 {
35 
Constant(const String & i_sName,Ce_id i_nOwner,Ce_id i_nNameRoom,Type_id i_nType,const String & i_sInitValue)36 Constant::Constant( const String &      i_sName,
37                     Ce_id               i_nOwner,
38                     Ce_id               i_nNameRoom,
39                     Type_id             i_nType,
40                     const String &      i_sInitValue )
41     :   sName(i_sName),
42         nNameRoom(i_nNameRoom),
43         nOwner(i_nOwner),
44         nType(i_nType),
45         sInitValue(i_sInitValue)
46 {
47 }
48 
~Constant()49 Constant::~Constant()
50 {
51 }
52 
53 void
do_Accept(csv::ProcessorIfc & io_processor) const54 Constant::do_Accept( csv::ProcessorIfc & io_processor ) const
55 {
56     csv::CheckedCall(io_processor, *this);
57 }
58 
59 
60 ClassId
get_AryClass() const61 Constant::get_AryClass() const
62 {
63     return class_id;
64 }
65 
66 const String &
inq_LocalName() const67 Constant::inq_LocalName() const
68 {
69     return sName;
70 }
71 
72 Ce_id
inq_NameRoom() const73 Constant::inq_NameRoom() const
74 {
75     return nNameRoom;
76 }
77 
78 Ce_id
inq_Owner() const79 Constant::inq_Owner() const
80 {
81     return nOwner;
82 }
83 
84 E_SightLevel
inq_SightLevel() const85 Constant::inq_SightLevel() const
86 {
87     return sl_Member;
88 }
89 
90 
91 namespace ifc_constant
92 {
93 
94 inline const Constant &
constant_cast(const CodeEntity & i_ce)95 constant_cast( const CodeEntity &  i_ce )
96 {
97     csv_assert( i_ce.AryClass() == Constant::class_id );
98 	return static_cast< const Constant& >(i_ce);
99 }
100 
101 Type_id
Type(const CodeEntity & i_ce)102 attr::Type( const CodeEntity & i_ce )
103 {
104     return constant_cast(i_ce).nType;
105 }
106 
107 const String &
Value(const CodeEntity & i_ce)108 attr::Value( const CodeEntity & i_ce )
109 {
110     return constant_cast(i_ce).sInitValue;
111 }
112 
113 } // namespace ifc_constant
114 
115 
116 }   //  namespace   idl
117 }   //  namespace   ary
118