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 #310: Adds initial impl for the C++ headers only wrappers
Date Sun, 21 Feb 2021 20:00:23 GMT

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



##########
File path: libs/framework/include/celix/BundleContext.h
##########
@@ -0,0 +1,580 @@
+/*
+ * 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 <memory>
+#include <mutex>
+#include <thread>
+#include <cstdarg>
+
+#include "celix_bundle_context.h"
+
+#include "celix/ServiceRegistrationBuilder.h"
+#include "celix/UseServiceBuilder.h"
+#include "celix/TrackerBuilders.h"
+#include "celix/Bundle.h"
+#include "celix/Framework.h"
+
+#include "celix/dm/DependencyManager.h" //TODO, TBD include or forward declaration?
+
+namespace celix {
+
+    /**
+     * @brief The bundle context is used to interact with the Celix framework.
+     *
+     * The bundle context represent a bundle and can be used to:
+     *  - Register, use and track services
+     *  - Install, start, stop and uninstall bundles (runtime)
+     *  - log on framework level
+     *  - Access bundles
+     *  - Get config properties
+     *
+     * @note Thread safe.
+     */
+    class BundleContext {

Review comment:
       One of the nice thinks about the builder api is that you can combine a lot functionality
in a single builder (very concise). 
   For service registration the sync and async API is combined in a single builder. 
   
   The default for BundleContext::registerService is to register and unregister the service
async.
   This is possible because registerService used a std::shared_ptr for the service so it can
keep the service "alive" until async unregistration is completed. 
   https://github.com/apache/celix/blob/feature/cxx_headers/libs/framework/include/celix/BundleContext.h#L72
   
   https://github.com/apache/celix/blob/feature/cxx_headers/libs/framework/include/celix/ServiceRegistrationBuilder.h#L144
   https://github.com/apache/celix/blob/feature/cxx_headers/libs/framework/include/celix/ServiceRegistrationBuilder.h#L167




----------------------------------------------------------------
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