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_singleton.hxx>
24 
25 
26 // NOT FULLY DECLARED SERVICES
27 #include <cosv/tpl/processor.hxx>
28 #include <ary/idl/ik_singleton.hxx>
29 #include <sci_impl.hxx>
30 
31 
32 namespace ary
33 {
34 namespace idl
35 {
36 
Singleton(const String & i_sName,Ce_id i_nOwner)37 Singleton::Singleton( const String &      i_sName,
38                   Ce_id               i_nOwner )
39     :   sName(i_sName),
40         nOwner(i_nOwner),
41         nService()
42 {
43 }
44 
~Singleton()45 Singleton::~Singleton()
46 {
47 }
48 
49 void
do_Accept(csv::ProcessorIfc & io_processor) const50 Singleton::do_Accept( csv::ProcessorIfc & io_processor ) const
51 {
52     csv::CheckedCall(io_processor, *this);
53 }
54 
55 ClassId
get_AryClass() const56 Singleton::get_AryClass() const
57 {
58     return class_id;
59 }
60 
61 const String &
inq_LocalName() const62 Singleton::inq_LocalName() const
63 {
64     return sName;
65 }
66 
67 Ce_id
inq_NameRoom() const68 Singleton::inq_NameRoom() const
69 {
70     return nOwner;
71 }
72 
73 Ce_id
inq_Owner() const74 Singleton::inq_Owner() const
75 {
76     return nOwner;
77 }
78 
79 E_SightLevel
inq_SightLevel() const80 Singleton::inq_SightLevel() const
81 {
82     return sl_File;
83 }
84 
85 
86 namespace ifc_singleton
87 {
88 
89 inline const Singleton &
singleton_cast(const CodeEntity & i_ce)90 singleton_cast( const CodeEntity &  i_ce )
91 {
92     csv_assert( i_ce.AryClass() == Singleton::class_id );
93 	return static_cast< const Singleton& >(i_ce);
94 }
95 
96 Type_id
AssociatedService(const CodeEntity & i_ce)97 attr::AssociatedService( const CodeEntity & i_ce )
98 {
99     return singleton_cast(i_ce).nService;
100 }
101 
102 } // namespace ifc_singleton
103 
104 
105 }   //  namespace   idl
106 }   //  namespace   ary
107