You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2016/10/26 12:15:45 UTC

[22/50] [abbrv] celix git commit: CELIX-368: Some small updates for the documentation

CELIX-368: Some small updates for the documentation


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/ab630819
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/ab630819
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/ab630819

Branch: refs/heads/master
Commit: ab630819e02dd92b15d4d767f02296d54d25190c
Parents: 4930483
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Fri Oct 7 20:23:42 2016 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Fri Oct 7 20:23:42 2016 +0200

----------------------------------------------------------------------
 CMakeLists.txt                                  |  7 +++++-
 .../getting_started/using_services_with_c.md    |  2 +-
 .../getting_started/using_services_with_cxx.md  | 25 ++++++++++----------
 .../bar/private/src/BarActivator.cc             |  1 -
 .../services_example_cxx/baz/private/src/Baz.cc |  4 ++--
 5 files changed, 21 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/ab630819/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 421a042..d8dba55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,9 +16,11 @@
 # under the License.
 
 cmake_minimum_required (VERSION 3.2)
+cmake_policy(SET CMP0012 NEW)
+cmake_policy(SET CMP0042 NEW)
+
 project (Celix C CXX)
 
-cmake_policy(SET CMP0012 NEW)
 include(GNUInstallDirs)                                                                                                                                                                             
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
@@ -47,6 +49,9 @@ ENDIF()
 IF(WIN32)
 	SET(CMAKE_C_FLAGS "-D_CRT_SECURE_NO_WARNINGS ${CMAKE_C_FLAGS}")
 ENDIF()
+IF(APPLE)
+    set(CMAKE_MACOSX_RPATH 1)
+ENDIF()
 
 # Set version for the framework package/release
 SET(CELIX_MAJOR "1")

http://git-wip-us.apache.org/repos/asf/celix/blob/ab630819/documents/getting_started/using_services_with_c.md
----------------------------------------------------------------------
diff --git a/documents/getting_started/using_services_with_c.md b/documents/getting_started/using_services_with_c.md
index 37592a1..45f60bb 100644
--- a/documents/getting_started/using_services_with_c.md
+++ b/documents/getting_started/using_services_with_c.md
@@ -581,7 +581,7 @@ celix_status_t dm_destroy(void *userData, bundle_context_pt context, dm_dependen
  
 As you may notice, the Foo1 example uses locks. 
 In principle, locking is necessary in order to ensure coherence in case service dependencies are removed/added/changed; on the other hands, locking increases latency and, when misused, can lead to poor performance. 
-For this reason, the serviceDependecy interface gives the possibility to choose between a locking and suspend (a non-locking) strategy through the serviceDependency_setStrategy function, as is used in the Foo2 example.
+For this reason, the serviceDependency interface gives the possibility to choose between a locking and suspend (a non-locking) strategy through the serviceDependency_setStrategy function, as is used in the Foo2 example.
 
 The locking strategy `DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING` notifies the component in case the dependencies' set changes (e.g. a dependency is added/removed): the component is responsible for protecting via locks the dependencies' list and check (always under lock) if the service he's depending on is still available.
 The suspend or non-locking strategy `DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND` (default when no strategy is explicitly set) reliefs the programmer from dealing with service dependencies' consistency issues: in case this strategy is adopted, the component is stopped and restarted (i.e. temporarily suspended) upon service dependencies' changes.

http://git-wip-us.apache.org/repos/asf/celix/blob/ab630819/documents/getting_started/using_services_with_cxx.md
----------------------------------------------------------------------
diff --git a/documents/getting_started/using_services_with_cxx.md b/documents/getting_started/using_services_with_cxx.md
index 2a9ad97..df88075 100644
--- a/documents/getting_started/using_services_with_cxx.md
+++ b/documents/getting_started/using_services_with_cxx.md
@@ -7,7 +7,7 @@ This example gives an overview for providing and using C and C++ services with A
 ## Services
 
 ### C++ Services
-TO start of, C++ service in Celix are just (abstract) classes. 
+To start of, C++ service in Celix are just (abstract) classes. 
 
 In the following example there also a projected default constructor to ensure no instantiation of the service is possible:
 ```C++
@@ -130,12 +130,12 @@ The complete example can be found [here](../../examples/services_example_cxx).
 
 The Bar example is a simple component providing the C `example` service and C++ `IAnotherExample` service.
  
-Note that the Bar component is just a plain old C++ object and does need to implement any specific Celix interfaces. 
+Note that the `Bar` component is just a plain old C++ object and does need to implement any specific Celix interfaces. 
 
-The BarActivator is the entry point for a C++ bundle. It must implement the DmActivator::create method which the C++ Dependency manager will call. 
-It should also override the DmActivator::init to be able to declaratively program components and their provided service and service dependencies.
+The `BarActivator` is the entry point for a C++ bundle. It must implement the `DmActivator::create` method so that C++ Dependency manager can create a instance `DmActivator` without needing to known the subclass. 
+It should also override the `DmActivator::init` to be able to declaratively program components and their provided service and service dependencies.
 
-The C++ Dependency Manager can use C++ member function pointers to control the component lifecycle (init, start, stop and deinit)  
+The C++ Dependency Manager can use C++ member function pointers to control the component lifecycle (`init`, `start`, `stop` and `deinit`)  
 
 ```C++
 //Bar.h
@@ -229,7 +229,6 @@ DmActivator* DmActivator::create(DependencyManager& mng) {
 
 void BarActivator::init() {
     std::shared_ptr<Bar> bar = std::shared_ptr<Bar>{new Bar{}};
-    std::cout << "bar pointer is " << bar.get() << "\n";
 
     Properties props;
     props["meta.info.key"] = "meta.info.value";
@@ -252,7 +251,7 @@ void BarActivator::init() {
 
 ### Foo Example
 
-The Foo example has a dependency to the C++ and C services provider by the Bar component. Note that it depends on the services and not directly on the Bar component.
+The `Foo` example has a dependency to the C++ and C services provider by the `Bar` component. Note that it depends on the services and not directly on the Bar component.
 
 ```C++
 //Foo.h
@@ -378,8 +377,8 @@ void FooActivator::init() {
 
 ### Baz Example
 
-The Baz example has a dependency to the C++ and C services provider by the Bar component, 
-but uses the add / remove callbacks instead of set and us result is able to depend on multiple instance of a declared service dependencies.
+The `Baz` example has a dependency to the C++ and C services provider by the `Bar` component, 
+but uses the add / remove callbacks instead of set and as result is able to depend on multiple instance of a declared service dependencies.
 
 
 ```C++
@@ -484,8 +483,8 @@ void Baz::poll() {
         //c++ service required -> if component started always available
 
         {
-            int index = 0;
             std::lock_guard<std::mutex> lock(this->lock_for_examples);
+            int index = 0;
             for (IAnotherExample *e : this->examples) {
                 r1 = e->method(3, r1);
                 std::cout << "Result IAnotherExample " << index++ << " is " << r1 << "\n";
@@ -494,8 +493,8 @@ void Baz::poll() {
 
 
         {
-            int index = 0;
             std::lock_guard<std::mutex> lock(this->lock_for_cExamples);
+            int index = 0;
             for (const example_t *e : this->cExamples) {
                 double out;
                 e->method(e->handle, 4, r2, &out);
@@ -541,9 +540,9 @@ void BazActivator::init() {
 
 ## Locking and Suspending
  
-As you may notice, the Baz example uses locks 
+As you may notice, the Baz example uses locks.
 In principle, locking is necessary in order to ensure coherence in case service dependencies are removed/added/changed; on the other hands, locking increases latency and, when misused, can lead to poor performance. 
-For this reason, the serviceDependecy interface gives the possibility to choose between a locking and suspend (a non-locking) strategy through the serviceDependency_setStrategy function, as is used in the Foo2 example.
+For this reason, the serviceDependency interface gives the possibility to choose between a locking and suspend (a non-locking) strategy through the serviceDependency_setStrategy function, as is used in the Foo2 example.
 
 The locking strategy `DependencyUpdateStrategy::locking` notifies the component in case the dependencies' set changes (e.g. a dependency is added/removed): the component is responsible for protecting via locks the dependencies' list and check (always under lock) if the service he's depending on is still available.
 The suspend or non-locking strategy `DependencyUpdateStrategy::suspend` (default when no strategy is explicitly set) reliefs the programmer from dealing with service dependencies' consistency issues: in case this strategy is adopted, the component is stopped and restarted (i.e. temporarily suspended) upon service dependencies' changes.

http://git-wip-us.apache.org/repos/asf/celix/blob/ab630819/examples/services_example_cxx/bar/private/src/BarActivator.cc
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/bar/private/src/BarActivator.cc b/examples/services_example_cxx/bar/private/src/BarActivator.cc
index 93b72be..eeb128d 100644
--- a/examples/services_example_cxx/bar/private/src/BarActivator.cc
+++ b/examples/services_example_cxx/bar/private/src/BarActivator.cc
@@ -28,7 +28,6 @@ DmActivator* DmActivator::create(DependencyManager& mng) {
 
 void BarActivator::init() {
     std::shared_ptr<Bar> bar = std::shared_ptr<Bar>{new Bar{}};
-    std::cout << "bar pointer is " << bar.get() << "\n";
 
     Properties props;
     props["meta.info.key"] = "meta.info.value";

http://git-wip-us.apache.org/repos/asf/celix/blob/ab630819/examples/services_example_cxx/baz/private/src/Baz.cc
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/baz/private/src/Baz.cc b/examples/services_example_cxx/baz/private/src/Baz.cc
index 1b5f39e..bf258fb 100644
--- a/examples/services_example_cxx/baz/private/src/Baz.cc
+++ b/examples/services_example_cxx/baz/private/src/Baz.cc
@@ -59,8 +59,8 @@ void Baz::poll() {
         //c++ service required -> if component started always available
 
         {
-            int index = 0;
             std::lock_guard<std::mutex> lock(this->lock_for_examples);
+            int index = 0;
             for (IAnotherExample *e : this->examples) {
                 r1 = e->method(3, r1);
                 std::cout << "Result IAnotherExample " << index++ << " is " << r1 << "\n";
@@ -69,8 +69,8 @@ void Baz::poll() {
 
 
         {
-            int index = 0;
             std::lock_guard<std::mutex> lock(this->lock_for_cExamples);
+            int index = 0;
             for (const example_t *e : this->cExamples) {
                 double out;
                 e->method(e->handle, 4, r2, &out);