celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] pnoltes commented on a change in pull request #293: Feature/add build to svc dep creation
Date Wed, 16 Dec 2020 15:55:32 GMT

pnoltes commented on a change in pull request #293:
URL: https://github.com/apache/celix/pull/293#discussion_r544413458



##########
File path: libs/framework/include/celix/dm/ProvidedService.h
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <string>
+#include <memory>
+
+#include "celix_api.h"
+#include "celix/dm/Properties.h"
+
+namespace celix { namespace dm {
+
+    class BaseProvidedService {
+    public:
+        BaseProvidedService(celix_dm_component_t* _cmp, std::string svcName, void* svc, bool
_cppService);
+
+        BaseProvidedService(BaseProvidedService&&) = delete;
+        BaseProvidedService& operator=(BaseProvidedService&&) = delete;
+        BaseProvidedService(const BaseProvidedService&) = delete;
+        BaseProvidedService& operator=(const BaseProvidedService&) = delete;
+
+        const std::string& getName() const;
+        const std::string& getVersion() const;
+        bool isCppService() const;
+        void* getService() const;
+        const celix::dm::Properties& getProperties() const;
+
+        void runBuild();
+    protected:
+        celix_dm_component_t* cCmp;
+        std::string svcName;
+        void* svcPointer;
+        bool cppService;
+        std::string svcVersion{};
+        celix::dm::Properties properties{};
+        bool provideAddedToCmp{false};
+    };
+
+    template<typename T, typename I>
+    class ProvidedService : public BaseProvidedService {
+    public:
+        ProvidedService(celix_dm_component_t* _cmp, std::string svcName, I* svc, bool _cppService);
+
+        /**
+         * Set the version of the interface
+         */
+        ProvidedService<T,I>& setVersion(std::string v);
+
+        /**
+         * Set the properties of the interface. Note this will reset the already set / added
properties
+         */
+        ProvidedService<T,I>& setProperties(celix::dm::Properties);
+
+        /**
+         * Add a single property to the service properties.

Review comment:
       done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message