xref: /aoo41x/main/autodoc/source/ary/idl/i_service.cxx (revision d291ea28)
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_service.hxx>
24 
25 
26 // NOT FULLY DECLARED SERVICES
27 #include <cosv/tpl/processor.hxx>
28 #include <ary/idl/ik_service.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 
Service(const String & i_sName,Ce_id i_nOwner)39 Service::Service( const String &      i_sName,
40                   Ce_id               i_nOwner )
41     :   sName(i_sName),
42         nOwner(i_nOwner),
43         aIncludedServices(),
44         aSupportedInterfaces(),
45         aProperties()
46 {
47 }
48 
~Service()49 Service::~Service()
50 {
51     for ( RelationList::iterator it = aIncludedServices.begin();
52           it != aIncludedServices.end();
53           ++it )
54     {
55         delete (*it).Info();
56     }
57 
58     for ( RelationList::iterator it = aSupportedInterfaces.begin();
59           it != aSupportedInterfaces.end();
60           ++it )
61     {
62         delete (*it).Info();
63     }
64 }
65 
66 void
Get_SupportedInterfaces(Dyn_StdConstIterator<CommentedRelation> & o_rResult) const67 Service::Get_SupportedInterfaces( Dyn_StdConstIterator<CommentedRelation> & o_rResult ) const
68 {
69     o_rResult = new SCI_Vector<CommentedRelation>(aSupportedInterfaces);
70 }
71 
72 void
Get_IncludedServices(Dyn_StdConstIterator<CommentedRelation> & o_rResult) const73 Service::Get_IncludedServices( Dyn_StdConstIterator<CommentedRelation> & o_rResult ) const
74 {
75     o_rResult = new SCI_Vector<CommentedRelation>(aIncludedServices);
76 }
77 
78 void
do_Accept(csv::ProcessorIfc & io_processor) const79 Service::do_Accept( csv::ProcessorIfc & io_processor ) const
80 {
81     csv::CheckedCall(io_processor, *this);
82 }
83 
84 ClassId
get_AryClass() const85 Service::get_AryClass() const
86 {
87     return class_id;
88 }
89 
90 const String &
inq_LocalName() const91 Service::inq_LocalName() const
92 {
93     return sName;
94 }
95 
96 Ce_id
inq_NameRoom() const97 Service::inq_NameRoom() const
98 {
99     return nOwner;
100 }
101 
102 Ce_id
inq_Owner() const103 Service::inq_Owner() const
104 {
105     return nOwner;
106 }
107 
108 E_SightLevel
inq_SightLevel() const109 Service::inq_SightLevel() const
110 {
111     return sl_File;
112 }
113 
114 
115 namespace ifc_service
116 {
117 
118 inline const Service &
service_cast(const CodeEntity & i_ce)119 service_cast( const CodeEntity &  i_ce )
120 {
121     csv_assert( i_ce.AryClass() == Service::class_id );
122 	return static_cast< const Service& >(i_ce);
123 }
124 
125 void
Get_IncludedServices(Dyn_StdConstIterator<CommentedRelation> & o_result,const CodeEntity & i_ce)126 attr::Get_IncludedServices( Dyn_StdConstIterator<CommentedRelation> & o_result,
127                             const CodeEntity &						  i_ce )
128 {
129     o_result = new SCI_Vector<CommentedRelation>( service_cast(i_ce).aIncludedServices );
130 }
131 
132 void
Get_ExportedInterfaces(Dyn_StdConstIterator<CommentedRelation> & o_result,const CodeEntity & i_ce)133 attr::Get_ExportedInterfaces( Dyn_StdConstIterator<CommentedRelation> & o_result,
134                               const CodeEntity &							i_ce )
135 {
136     o_result = new SCI_Vector<CommentedRelation>( service_cast(i_ce).aSupportedInterfaces );
137 }
138 
139 void
Get_Properties(Dyn_CeIterator & o_result,const CodeEntity & i_ce)140 attr::Get_Properties( Dyn_CeIterator &    o_result,
141                       const CodeEntity &  i_ce )
142 {
143     o_result = new SCI_Vector<Ce_id>( service_cast(i_ce).aProperties );
144 }
145 
146 void
Get_IncludingServices(Dyn_CeIterator & o_result,const CodeEntity & i_ce)147 xref::Get_IncludingServices( Dyn_CeIterator &    o_result,
148                              const CodeEntity &  i_ce )
149 {
150     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(service_2s_IncludingServices));
151 }
152 
153 void
Get_InstantiatingSingletons(Dyn_CeIterator & o_result,const CodeEntity & i_ce)154 xref::Get_InstantiatingSingletons( Dyn_CeIterator &    o_result,
155                                    const CodeEntity &  i_ce )
156 {
157     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(service_2s_InstantiatingSingletons));
158 }
159 
160 
161 } // namespace ifc_service
162 
163 
164 }   //  namespace   idl
165 }   //  namespace   ary
166