Apache Celix  2.4.0
Apache Celix is a framework for C, C++14 and C++17 to develop dynamic modular software applications using component and in-process service-oriented programming.
ProvidedService.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #pragma once
21 
22 #include <string>
23 #include <memory>
24 
25 #include "celix/dm/Properties.h"
26 
27 namespace celix { namespace dm {
28 
30  public:
31  BaseProvidedService(celix_dm_component_t* _cmp, std::string svcName, std::shared_ptr<void> svc, bool _cppService);
32 
37 
38  const std::string& getName() const;
39  const std::string& getVersion() const;
40  bool isCppService() const;
41  void* getService() const;
42  const celix::dm::Properties& getProperties() const;
43 
44  void runBuild();
45  void wait() const;
46  protected:
47  celix_dm_component_t* cCmp;
48  std::string svcName;
49  std::shared_ptr<void> svc;
50  bool cppService;
51  std::string svcVersion{};
53  bool provideAddedToCmp{false};
54  };
55 
56  template<typename T, typename I>
58  public:
59  ProvidedService(celix_dm_component_t* _cmp, std::string svcName, std::shared_ptr<I> svc, bool _cppService);
60 
64  ProvidedService<T,I>& setVersion(std::string v);
65 
70 
75  template<typename U>
76  ProvidedService<T,I>& addProperty(const std::string& key, const U& value);
77 
81  ProvidedService<T,I>& addProperty(const std::string& key, const char* value);
82 
86  ProvidedService<T,I>& addProperty(const std::string& key, const std::string& value);
87 
97 
103  };
104 
105 }}
106 
celix::dm::ProvidedService
Definition: ProvidedService.h:57
celix::dm::BaseProvidedService::cppService
bool cppService
Definition: ProvidedService.h:50
celix::dm::ProvidedService::setVersion
ProvidedService< T, I > & setVersion(std::string v)
Definition: ProvidedService_Impl.h:71
celix::dm::BaseProvidedService
Definition: ProvidedService.h:29
celix::dm::BaseProvidedService::operator=
BaseProvidedService & operator=(BaseProvidedService &&)=delete
celix::dm::BaseProvidedService::svcName
std::string svcName
Definition: ProvidedService.h:48
celix::dm::ProvidedService::ProvidedService
ProvidedService(celix_dm_component_t *_cmp, std::string svcName, std::shared_ptr< I > svc, bool _cppService)
Definition: ProvidedService_Impl.h:103
celix
Definition: Bundle.h:27
celix::dm::BaseProvidedService::provideAddedToCmp
bool provideAddedToCmp
Definition: ProvidedService.h:53
Properties.h
celix::dm::BaseProvidedService::wait
void wait() const
Definition: ProvidedService_Impl.h:56
celix::dm::BaseProvidedService::svc
std::shared_ptr< void > svc
Definition: ProvidedService.h:49
celix::dm::BaseProvidedService::getVersion
const std::string & getVersion() const
Definition: ProvidedService_Impl.h:26
celix::dm::BaseProvidedService::svcVersion
std::string svcVersion
Definition: ProvidedService.h:51
celix::dm::ProvidedService::buildAsync
ProvidedService< T, I > & buildAsync()
Definition: ProvidedService_Impl.h:97
celix::dm::ProvidedService::build
ProvidedService< T, I > & build()
Definition: ProvidedService_Impl.h:90
celix::dm::BaseProvidedService::properties
celix::dm::Properties properties
Definition: ProvidedService.h:52
celix::dm::BaseProvidedService::getName
const std::string & getName() const
Definition: ProvidedService_Impl.h:22
celix::dm::BaseProvidedService::BaseProvidedService
BaseProvidedService(celix_dm_component_t *_cmp, std::string svcName, std::shared_ptr< void > svc, bool _cppService)
Definition: ProvidedService_Impl.h:20
celix::dm::BaseProvidedService::cCmp
celix_dm_component_t * cCmp
Definition: ProvidedService.h:47
ProvidedService_Impl.h
celix::dm::BaseProvidedService::runBuild
void runBuild()
Definition: ProvidedService_Impl.h:42
celix::dm::Properties
celix::Properties Properties
Definition: Properties.h:25
celix::dm::ProvidedService::addProperty
ProvidedService< T, I > & addProperty(const std::string &key, const U &value)
celix::dm::ProvidedService::setProperties
ProvidedService< T, I > & setProperties(celix::dm::Properties)
Definition: ProvidedService_Impl.h:77
celix::dm::BaseProvidedService::getProperties
const celix::dm::Properties & getProperties() const
Definition: ProvidedService_Impl.h:38
celix::dm::BaseProvidedService::isCppService
bool isCppService() const
Definition: ProvidedService_Impl.h:30
celix::dm::BaseProvidedService::getService
void * getService() const
Definition: ProvidedService_Impl.h:34