Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
usServiceRegistration.h
Go to the documentation of this file.
1 /*============================================================================
2 
3  Library: CppMicroServices
4 
5  Copyright (c) German Cancer Research Center (DKFZ)
6  All rights reserved.
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  https://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 ============================================================================*/
21 
22 #ifndef USSERVICEREGISTRATION_H
23 #define USSERVICEREGISTRATION_H
24 
26 
28 
47 template<class I1, class I2 = void, class I3 = void>
49 {
50 
51 public:
52 
59  {
60  }
61 
63 
76  {
77  return this->ServiceRegistrationBase::GetReference(us_service_interface_iid<I1>());
78  }
80  {
81  return this->ServiceRegistrationBase::GetReference(us_service_interface_iid<I2>());
82  }
84  {
85  return this->ServiceRegistrationBase::GetReference(us_service_interface_iid<I3>());
86  }
88 
89  using ServiceRegistrationBase::operator=;
90 
91 
92 private:
93 
94  friend class ModuleContext;
95 
98  {
99  }
100 
101 };
102 
104 template<class I1, class I2>
105 class ServiceRegistration<I1, I2, void> : public ServiceRegistrationBase
106 {
107 
108 public:
109 
110  ServiceRegistration() : ServiceRegistrationBase()
111  {
112  }
113 
114  ServiceReference<I1> GetReference(InterfaceType<I1>) const
115  {
116  return ServiceReference<I1>(this->ServiceRegistrationBase::GetReference(us_service_interface_iid<I1>()));
117  }
118 
119  ServiceReference<I2> GetReference(InterfaceType<I2>) const
120  {
121  return ServiceReference<I2>(this->ServiceRegistrationBase::GetReference(us_service_interface_iid<I2>()));
122  }
123 
124  using ServiceRegistrationBase::operator=;
125 
126 
127 private:
128 
129  friend class ModuleContext;
130 
131  ServiceRegistration(const ServiceRegistrationBase& base)
132  : ServiceRegistrationBase(base)
133  {
134  }
135 
136 };
137 
138 template<class I1>
139 class ServiceRegistration<I1, void, void> : public ServiceRegistrationBase
140 {
141 
142 public:
143 
144  ServiceRegistration() : ServiceRegistrationBase()
145  {
146  }
147 
148  ServiceReference<I1> GetReference() const
149  {
150  return this->GetReference(InterfaceType<I1>());
151  }
152 
153  ServiceReference<I1> GetReference(InterfaceType<I1>) const
154  {
155  return ServiceReference<I1>(this->ServiceRegistrationBase::GetReference(us_service_interface_iid<I1>()));
156  }
157 
158  using ServiceRegistrationBase::operator=;
159 
160 private:
161 
162  friend class ModuleContext;
163 
164  ServiceRegistration(const ServiceRegistrationBase& base)
165  : ServiceRegistrationBase(base)
166  {
167  }
168 
169 };
170 
171 template<>
172 class ServiceRegistration<void, void, void> : public ServiceRegistrationBase
173 {
174 public:
175 
181  ServiceRegistration() : ServiceRegistrationBase()
182  {
183  }
184 
185  ServiceRegistration(const ServiceRegistrationBase& base)
186  : ServiceRegistrationBase(base)
187  {
188  }
189 
190  using ServiceRegistrationBase::operator=;
191 };
193 
200 
202 
203 #endif // USSERVICEREGISTRATION_H
usServiceRegistrationBase.h
ModuleContext
Definition: usModuleContext.h:91
us::ServiceRegistrationBase
Definition: usServiceRegistrationBase.h:56
us::ServiceRegistrationU
ServiceRegistration< void > ServiceRegistrationU
Definition: usServiceRegistration.h:199
us::ServiceRegistration::GetReference
ServiceReference< I3 > GetReference(InterfaceType< I3 >) const
Definition: usServiceRegistration.h:83
us::ServiceReference
Definition: usModule.h:40
US_BEGIN_NAMESPACE
#define US_BEGIN_NAMESPACE
Definition: usGlobalConfig.h:76
us::InterfaceType
Definition: usServiceInterface.h:120
US_END_NAMESPACE
#define US_END_NAMESPACE
Definition: usGlobalConfig.h:77
us::ServiceRegistration
Definition: usServiceRegistration.h:48
us::ServiceRegistration::GetReference
ServiceReference< I2 > GetReference(InterfaceType< I2 >) const
Definition: usServiceRegistration.h:79
us::ServiceRegistration::ServiceRegistration
ServiceRegistration()
Definition: usServiceRegistration.h:58
us::ServiceRegistration::GetReference
ServiceReference< I1 > GetReference(InterfaceType< I1 >) const
Definition: usServiceRegistration.h:75