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 2017/11/24 11:27:30 UTC
[1/2] celix git commit: CELIX-417: Refactors CMake usage for example
embedded, dm and dm_cxx
Repository: celix
Updated Branches:
refs/heads/feature/CELIX-417-cmake-refactor 486d4f0d5 -> 1836cf841
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase3/src/phase3_cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/src/phase3_cmp.h b/examples/dm_example/phase3/src/phase3_cmp.h
new file mode 100644
index 0000000..9c63845
--- /dev/null
+++ b/examples/dm_example/phase3/src/phase3_cmp.h
@@ -0,0 +1,45 @@
+/**
+ *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.
+ */
+/*
+ * publisher.h
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef PHASE3_CMP_H
+#define PHASE3_CMP_H
+
+#include "phase2.h"
+
+typedef struct phase3_cmp_struct phase3_cmp_t;
+
+phase3_cmp_t *phase3_create();
+int phase3_init(phase3_cmp_t *cmp);
+int phase3_start(phase3_cmp_t *cmp);
+int phase3_stop(phase3_cmp_t *cmp);
+int phase3_deinit(phase3_cmp_t *cmp);
+void phase3_destroy(phase3_cmp_t *cmp);
+
+int phase3_addPhase2(phase3_cmp_t *cmp, const phase2_t* phase2);
+int phase3_removePhase2(phase3_cmp_t *cmp, const phase2_t* phase2);
+
+
+#endif //PHASE3_CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/services/phase1.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/services/phase1.h b/examples/dm_example/services/phase1.h
deleted file mode 100644
index 04e9da7..0000000
--- a/examples/dm_example/services/phase1.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.h
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PHASE1_H_
-#define PHASE1_H_
-
-#define PHASE1_NAME "PHASE1"
-#define PHASE1_VERSION "1.2.2.0"
-#define PHASE1_RANGE_ALL "[1.2.2.0,4.5.6.x)"
-#define PHASE1_RANGE_EXACT "[1.2.2.0,1.2.2.0]"
-
-
-
-struct phase1_struct {
- void *handle;
- int (*getData)(void *handle, unsigned int *data);
-};
-
-typedef struct phase1_struct phase1_t;
-
-#endif /* PHASE1_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/services/phase2.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/services/phase2.h b/examples/dm_example/services/phase2.h
deleted file mode 100644
index 2f4df86..0000000
--- a/examples/dm_example/services/phase2.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.h
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PHASE2_H
-#define PHASE2_H
-
-#define PHASE2_NAME "PHASE2"
-#define PHASE2_VERSION "1.0.0.0"
-
-struct phase2_struct {
- void *handle;
- void (*getData)(void *handle, double *data);
-};
-
-typedef struct phase2_struct phase2_t;
-
-
-#endif /* PHASE2_H */
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/CMakeLists.txt b/examples/dm_example_cxx/CMakeLists.txt
index 012f706..9ef4c1e 100644
--- a/examples/dm_example_cxx/CMakeLists.txt
+++ b/examples/dm_example_cxx/CMakeLists.txt
@@ -15,17 +15,11 @@
# specific language governing permissions and limitations
# under the License.
if (BUILD_DEPENDENCY_MANAGER_CXX)
- include_directories(
- ${PROJECT_SOURCE_DIR}/dependency_manager/public/include
- ${PROJECT_SOURCE_DIR}/dependency_manager_cxx/include
- ${PROJECT_SOURCE_DIR}/utils/public/include
- ${PROJECT_SOURCE_DIR}/log_service/public/include
- api
- )
+
+ add_subdirectory(api)
add_subdirectory(phase1)
- add_subdirectory(phase2a)
- add_subdirectory(phase2b)
+ add_subdirectory(phase2)
add_subdirectory(phase3)
add_subdirectory(phase3_locking)
@@ -40,11 +34,11 @@ if (BUILD_DEPENDENCY_MANAGER_CXX)
Celix::log_service
Celix::log_writer_stdout
- phase1_cxx
- phase2a_cxx
- phase2b_cxx
- phase3_cxx
- phase3_locking_cxx
+ dm_example_cxx_phase1
+ dm_example_cxx_phase2a
+ dm_example_cxx_phase2b
+ dm_example_cxx_phase3
+ dm_example_cxx_phase3_locking
PROPERTIES
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
)
@@ -61,11 +55,11 @@ if (BUILD_DEPENDENCY_MANAGER_CXX)
Celix::log_service
Celix::log_writer_stdout
- phase1_cxx
- phase2a_cxx
- phase2b_cxx
- phase3_cxx
- phase3_locking_cxx
+ dm_example_cxx_phase1
+ dm_example_cxx_phase2a
+ dm_example_cxx_phase2b
+ dm_example_cxx_phase3
+ dm_example_cxx_phase3_locking
PROPERTIES
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
)
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/api/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/api/CMakeLists.txt b/examples/dm_example_cxx/api/CMakeLists.txt
new file mode 100644
index 0000000..d1d07d5
--- /dev/null
+++ b/examples/dm_example_cxx/api/CMakeLists.txt
@@ -0,0 +1,19 @@
+# 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.
+
+add_library(dm_example_cxx_api INTERFACE)
+target_include_directories(dm_example_cxx_api INTERFACE include)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/api/IName.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/api/IName.h b/examples/dm_example_cxx/api/IName.h
deleted file mode 100644
index 89edb19..0000000
--- a/examples/dm_example_cxx/api/IName.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_INAME_H
-#define CELIX_INAME_H
-
-#define INAME_VERSION "1.0.0"
-
-#include <string>
-
-namespace srv {
- namespace info {
- class IName {
- protected:
- IName() = default;
- ~IName() = default;
- public:
- virtual std::string getName() = 0;
- };
- }
-}
-
-#endif //CELIX_INAME_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/api/IPhase1.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/api/IPhase1.h b/examples/dm_example_cxx/api/IPhase1.h
deleted file mode 100644
index d75b3e1..0000000
--- a/examples/dm_example_cxx/api/IPhase1.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE1_H
-#define CELIX_PHASE1_H
-
-#define IPHASE1_VERSION "1.0.0"
-
-class IPhase1 {
-protected:
- IPhase1() = default;
- ~IPhase1() = default;
-public:
- virtual int getData() = 0;
-};
-
-#endif //CELIX_PHASE1_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/api/IPhase2.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/api/IPhase2.h b/examples/dm_example_cxx/api/IPhase2.h
deleted file mode 100644
index 20e3774..0000000
--- a/examples/dm_example_cxx/api/IPhase2.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE2_H
-#define CELIX_PHASE2_H
-
-#define IPHASE2_VERSION "1.0.0"
-
-class IPhase2 {
-protected:
- IPhase2() = default;
- ~IPhase2() = default;
-public:
- virtual double getData() = 0;
-};
-
-#endif //CELIX_PHASE2_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/api/include/IName.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/api/include/IName.h b/examples/dm_example_cxx/api/include/IName.h
new file mode 100644
index 0000000..89edb19
--- /dev/null
+++ b/examples/dm_example_cxx/api/include/IName.h
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_INAME_H
+#define CELIX_INAME_H
+
+#define INAME_VERSION "1.0.0"
+
+#include <string>
+
+namespace srv {
+ namespace info {
+ class IName {
+ protected:
+ IName() = default;
+ ~IName() = default;
+ public:
+ virtual std::string getName() = 0;
+ };
+ }
+}
+
+#endif //CELIX_INAME_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/api/include/IPhase1.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/api/include/IPhase1.h b/examples/dm_example_cxx/api/include/IPhase1.h
new file mode 100644
index 0000000..d75b3e1
--- /dev/null
+++ b/examples/dm_example_cxx/api/include/IPhase1.h
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE1_H
+#define CELIX_PHASE1_H
+
+#define IPHASE1_VERSION "1.0.0"
+
+class IPhase1 {
+protected:
+ IPhase1() = default;
+ ~IPhase1() = default;
+public:
+ virtual int getData() = 0;
+};
+
+#endif //CELIX_PHASE1_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/api/include/IPhase2.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/api/include/IPhase2.h b/examples/dm_example_cxx/api/include/IPhase2.h
new file mode 100644
index 0000000..20e3774
--- /dev/null
+++ b/examples/dm_example_cxx/api/include/IPhase2.h
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE2_H
+#define CELIX_PHASE2_H
+
+#define IPHASE2_VERSION "1.0.0"
+
+class IPhase2 {
+protected:
+ IPhase2() = default;
+ ~IPhase2() = default;
+public:
+ virtual double getData() = 0;
+};
+
+#endif //CELIX_PHASE2_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase1/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase1/CMakeLists.txt b/examples/dm_example_cxx/phase1/CMakeLists.txt
index 62b1658..0832816 100644
--- a/examples/dm_example_cxx/phase1/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase1/CMakeLists.txt
@@ -15,28 +15,23 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(
- include
- ../api
-)
-
-add_bundle(phase1_cxx
+add_bundle(dm_example_cxx_phase1
SYMBOLIC_NAME phase1_cxx
VERSION 0.0.1
SOURCES
src/Phase1Activator.cc
src/Phase1Cmp.cc
)
-
-target_compile_options(phase1_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
+target_include_directories(dm_example_cxx_phase1 PRIVATE src)
+target_link_libraries(dm_example_cxx_phase1 PRIVATE dm_example_cxx_api Celix::shell_api)
IF(APPLE)
- target_link_libraries(phase1_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static Celix::shell_api)
+ target_link_libraries(dm_example_cxx_phase1 PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase1_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive Celix::shell_api)
+ target_link_libraries(dm_example_cxx_phase1 PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase1_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive Celix::shell_api)
+ target_link_libraries(dm_example_cxx_phase1 PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase1/include/Phase1Activator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase1/include/Phase1Activator.h b/examples/dm_example_cxx/phase1/include/Phase1Activator.h
deleted file mode 100644
index 37b25e3..0000000
--- a/examples/dm_example_cxx/phase1/include/Phase1Activator.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE1ACTIVATOR_H
-#define CELIX_PHASE1ACTIVATOR_H
-
-#include "celix/dm/DmActivator.h"
-#include "command.h"
-
-using namespace celix::dm;
-
-class Phase1Activator : public DmActivator {
- command_service_t cmd {nullptr, nullptr};
-public:
- Phase1Activator(DependencyManager& mng) : DmActivator(mng) {}
- virtual void init();
- virtual void deinit();
-};
-
-#endif //CELIX_PHASE1ACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase1/include/Phase1Cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase1/include/Phase1Cmp.h b/examples/dm_example_cxx/phase1/include/Phase1Cmp.h
deleted file mode 100644
index f475c41..0000000
--- a/examples/dm_example_cxx/phase1/include/Phase1Cmp.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE1CMP_H
-#define CELIX_PHASE1CMP_H
-
-#include "IPhase1.h"
-#include "IName.h"
-#include <stdint.h>
-#include <stdio.h>
-
-class Phase1Cmp : public srv::info::IName, public IPhase1 {
- uint32_t counter = 0;
-public:
- Phase1Cmp() = default;
- virtual ~Phase1Cmp() = default;
-
- void init();
- void start();
- void stop();
- void deinit();
-
- int getData() override; //implements IPhase1
- int infoCmd(char* line, FILE *out, FILE* err); //implements cmd service
- std::string getName() override;
-};
-
-#endif //CELIX_PHASE1CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase1/src/Phase1Activator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase1/src/Phase1Activator.h b/examples/dm_example_cxx/phase1/src/Phase1Activator.h
new file mode 100644
index 0000000..37b25e3
--- /dev/null
+++ b/examples/dm_example_cxx/phase1/src/Phase1Activator.h
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE1ACTIVATOR_H
+#define CELIX_PHASE1ACTIVATOR_H
+
+#include "celix/dm/DmActivator.h"
+#include "command.h"
+
+using namespace celix::dm;
+
+class Phase1Activator : public DmActivator {
+ command_service_t cmd {nullptr, nullptr};
+public:
+ Phase1Activator(DependencyManager& mng) : DmActivator(mng) {}
+ virtual void init();
+ virtual void deinit();
+};
+
+#endif //CELIX_PHASE1ACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase1/src/Phase1Cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase1/src/Phase1Cmp.h b/examples/dm_example_cxx/phase1/src/Phase1Cmp.h
new file mode 100644
index 0000000..f475c41
--- /dev/null
+++ b/examples/dm_example_cxx/phase1/src/Phase1Cmp.h
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE1CMP_H
+#define CELIX_PHASE1CMP_H
+
+#include "IPhase1.h"
+#include "IName.h"
+#include <stdint.h>
+#include <stdio.h>
+
+class Phase1Cmp : public srv::info::IName, public IPhase1 {
+ uint32_t counter = 0;
+public:
+ Phase1Cmp() = default;
+ virtual ~Phase1Cmp() = default;
+
+ void init();
+ void start();
+ void stop();
+ void deinit();
+
+ int getData() override; //implements IPhase1
+ int infoCmd(char* line, FILE *out, FILE* err); //implements cmd service
+ std::string getName() override;
+};
+
+#endif //CELIX_PHASE1CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/CMakeLists.txt b/examples/dm_example_cxx/phase2/CMakeLists.txt
new file mode 100644
index 0000000..66f4ddd
--- /dev/null
+++ b/examples/dm_example_cxx/phase2/CMakeLists.txt
@@ -0,0 +1,51 @@
+# 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.
+
+add_bundle(dm_example_cxx_phase2a
+ SYMBOLIC_NAME phase2a_cxx
+ VERSION 0.0.1
+ SOURCES
+ src/Phase2aActivator.cc
+ src/Phase2aCmp.cc
+)
+target_include_directories(dm_example_cxx_phase2a PRIVATE src)
+target_link_libraries(dm_example_cxx_phase2a PRIVATE Celix::log_service_api dm_example_cxx_api)
+
+add_bundle(dm_example_cxx_phase2b
+ SYMBOLIC_NAME phase2b_cxx
+ VERSION 0.0.1
+ SOURCES
+ src/Phase2bActivator.cc
+ src/Phase2bCmp.cc
+ )
+target_include_directories(dm_example_cxx_phase2b PRIVATE src)
+target_link_libraries(dm_example_cxx_phase2b PRIVATE Celix::log_service_api dm_example_cxx_api)
+
+IF(APPLE)
+ target_link_libraries(dm_example_cxx_phase2a PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
+ target_link_libraries(dm_example_cxx_phase2b PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
+else()
+ if(ENABLE_ADDRESS_SANITIZER)
+ #With asan there can be undefined symbols
+ target_link_libraries(dm_example_cxx_phase2a PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_cxx_phase2b PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
+ else()
+ target_link_libraries(dm_example_cxx_phase2a PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_cxx_phase2b PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
+
+ endif()
+endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/include/Phase2Activator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/include/Phase2Activator.h b/examples/dm_example_cxx/phase2/include/Phase2Activator.h
deleted file mode 100644
index 069b2ae..0000000
--- a/examples/dm_example_cxx/phase2/include/Phase2Activator.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE2AACTIVATOR_H
-#define CELIX_PHASE2AACTIVATOR_H
-
-#include "celix/dm/DmActivator.h"
-
-using namespace celix::dm;
-
-class Phase2Activator : public DmActivator {
-public:
- Phase2Activator(DependencyManager& mng) : DmActivator(mng) {}
- virtual void init();
- virtual void deinit();
-};
-
-#endif //CELIX_PHASE2AACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/include/Phase2Cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/include/Phase2Cmp.h b/examples/dm_example_cxx/phase2/include/Phase2Cmp.h
deleted file mode 100644
index 87b6e8e..0000000
--- a/examples/dm_example_cxx/phase2/include/Phase2Cmp.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE2CMP_H
-#define CELIX_PHASE2CMP_H
-
-#include "IName.h"
-#include "IPhase1.h"
-#include "IPhase2.h"
-#include <stdint.h>
-#include <stdio.h>
-#include <thread>
-#include <iostream>
-
-extern "C" {
-#include "log_service.h"
-};
-
-class Phase2Cmp : public IPhase2 {
-public:
- Phase2Cmp() = default;
- virtual ~Phase2Cmp() { std::cout << "Destroying Phase2\n"; };
-
- Phase2Cmp(Phase2Cmp&& other) noexcept;
- Phase2Cmp& operator=(Phase2Cmp&&) = default;
-
- Phase2Cmp(const Phase2Cmp& other) = delete;
- Phase2Cmp operator=(const Phase2Cmp&) = delete;
-
- void setPhase1(IPhase1* phase); //injector used by dependency manager
- void setName(srv::info::IName* name) { std::cout << "Setting IName with name: " << (name != nullptr ? name->getName() : "null") << std::endl; }
- void setLogService(const log_service_t* logSrv);
-
- double getData() override; //implements IPhase2
-private:
- IPhase1* phase1 {nullptr};
- const log_service_t* logSrv {nullptr};
-};
-
-#endif //CELIX_PHASE2CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/src/Phase2Activator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/src/Phase2Activator.h b/examples/dm_example_cxx/phase2/src/Phase2Activator.h
new file mode 100644
index 0000000..069b2ae
--- /dev/null
+++ b/examples/dm_example_cxx/phase2/src/Phase2Activator.h
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE2AACTIVATOR_H
+#define CELIX_PHASE2AACTIVATOR_H
+
+#include "celix/dm/DmActivator.h"
+
+using namespace celix::dm;
+
+class Phase2Activator : public DmActivator {
+public:
+ Phase2Activator(DependencyManager& mng) : DmActivator(mng) {}
+ virtual void init();
+ virtual void deinit();
+};
+
+#endif //CELIX_PHASE2AACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/src/Phase2Cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/src/Phase2Cmp.h b/examples/dm_example_cxx/phase2/src/Phase2Cmp.h
new file mode 100644
index 0000000..87b6e8e
--- /dev/null
+++ b/examples/dm_example_cxx/phase2/src/Phase2Cmp.h
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE2CMP_H
+#define CELIX_PHASE2CMP_H
+
+#include "IName.h"
+#include "IPhase1.h"
+#include "IPhase2.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <thread>
+#include <iostream>
+
+extern "C" {
+#include "log_service.h"
+};
+
+class Phase2Cmp : public IPhase2 {
+public:
+ Phase2Cmp() = default;
+ virtual ~Phase2Cmp() { std::cout << "Destroying Phase2\n"; };
+
+ Phase2Cmp(Phase2Cmp&& other) noexcept;
+ Phase2Cmp& operator=(Phase2Cmp&&) = default;
+
+ Phase2Cmp(const Phase2Cmp& other) = delete;
+ Phase2Cmp operator=(const Phase2Cmp&) = delete;
+
+ void setPhase1(IPhase1* phase); //injector used by dependency manager
+ void setName(srv::info::IName* name) { std::cout << "Setting IName with name: " << (name != nullptr ? name->getName() : "null") << std::endl; }
+ void setLogService(const log_service_t* logSrv);
+
+ double getData() override; //implements IPhase2
+private:
+ IPhase1* phase1 {nullptr};
+ const log_service_t* logSrv {nullptr};
+};
+
+#endif //CELIX_PHASE2CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/src/Phase2aActivator.cc b/examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
new file mode 100644
index 0000000..e33ae0e
--- /dev/null
+++ b/examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
@@ -0,0 +1,57 @@
+/**
+ * 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.
+ */
+
+#include <IName.h>
+#include "Phase2Cmp.h"
+#include "Phase2Activator.h"
+#include "log_service.h"
+
+using namespace celix::dm;
+
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+ return new Phase2Activator(mng);
+}
+
+
+void Phase2Activator::init() {
+
+ Properties props {};
+ props["name"] = "phase2a";
+
+ Component<Phase2Cmp>& cmp = mng.createComponent<Phase2Cmp>()
+ .setInstance(Phase2Cmp())
+ .addInterface<IPhase2>(IPHASE2_VERSION, props);
+
+ cmp.createServiceDependency<IPhase1>()
+ .setRequired(true)
+ .setCallbacks(&Phase2Cmp::setPhase1);
+
+ cmp.createServiceDependency<srv::info::IName>()
+ .setVersionRange("[1.0.0,2)")
+ .setCallbacks(&Phase2Cmp::setName);
+
+ cmp.createCServiceDependency<log_service_t>(OSGI_LOGSERVICE_NAME)
+ .setRequired(false)
+ .setCallbacks(&Phase2Cmp::setLogService);
+}
+
+void Phase2Activator::deinit() {
+
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/src/Phase2aCmp.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/src/Phase2aCmp.cc b/examples/dm_example_cxx/phase2/src/Phase2aCmp.cc
new file mode 100644
index 0000000..4f68679
--- /dev/null
+++ b/examples/dm_example_cxx/phase2/src/Phase2aCmp.cc
@@ -0,0 +1,45 @@
+/**
+ * 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.
+ */
+
+#include "Phase2Cmp.h"
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+
+Phase2Cmp::Phase2Cmp(Phase2Cmp&& other) noexcept : phase1(other.phase1), logSrv{other.logSrv} {
+ std::cout << "Move constructor Phase2aCmp called\n";
+ other.phase1 = nullptr;
+ other.logSrv = nullptr;
+}
+
+void Phase2Cmp::setPhase1(IPhase1* phase1) {
+ std::cout << "setting phase1 for phase2\n";
+ this->phase1 = phase1;
+}
+
+void Phase2Cmp::setLogService(const log_service_t* logSrv) {
+ this->logSrv = logSrv;
+}
+
+double Phase2Cmp::getData() {
+ if (this->logSrv != NULL) {
+ this->logSrv->log(this->logSrv->logger, OSGI_LOGSERVICE_DEBUG, (char *) "getting data from phase2cmp A\n");
+ }
+ return phase1->getData() * 42.0;
+};
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/src/Phase2bActivator.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/src/Phase2bActivator.cc b/examples/dm_example_cxx/phase2/src/Phase2bActivator.cc
new file mode 100644
index 0000000..4fba8c0
--- /dev/null
+++ b/examples/dm_example_cxx/phase2/src/Phase2bActivator.cc
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+
+#include "Phase2Cmp.h"
+#include "Phase2Activator.h"
+#include "log_service.h"
+
+using namespace celix::dm;
+
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+ return new Phase2Activator(mng);
+}
+
+void Phase2Activator::init() {
+
+ Properties props {};
+ props["name"] = "phase2b";
+
+ Component<Phase2Cmp>& cmp = mng.createComponent<Phase2Cmp>()
+ .addInterface<IPhase2>(IPHASE2_VERSION, props);
+
+ cmp.createServiceDependency<IPhase1>()
+ .setRequired(true)
+ .setCallbacks(&Phase2Cmp::setPhase1);
+
+ cmp.createCServiceDependency<log_service_t>(OSGI_LOGSERVICE_NAME)
+ .setRequired(false)
+ .setCallbacks(&Phase2Cmp::setLogService);
+}
+
+void Phase2Activator::deinit() {
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2/src/Phase2bCmp.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2/src/Phase2bCmp.cc b/examples/dm_example_cxx/phase2/src/Phase2bCmp.cc
new file mode 100644
index 0000000..2f420a0
--- /dev/null
+++ b/examples/dm_example_cxx/phase2/src/Phase2bCmp.cc
@@ -0,0 +1,45 @@
+/**
+ * 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.
+ */
+
+#include "Phase2Cmp.h"
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+
+Phase2Cmp::Phase2Cmp(Phase2Cmp&& other) noexcept : phase1(other.phase1), logSrv{other.logSrv} {
+ std::cout << "Move constructor Phase2bCmp called\n";
+ other.phase1 = nullptr;
+ other.logSrv = nullptr;
+}
+
+void Phase2Cmp::setPhase1(IPhase1* phase1) {
+ std::cout << "setting phase1 for phase2\n";
+ this->phase1 = phase1;
+}
+
+void Phase2Cmp::setLogService(const log_service_t* logSrv) {
+ this->logSrv = logSrv;
+}
+
+double Phase2Cmp::getData() {
+ if (this->logSrv != NULL) {
+ this->logSrv->log(this->logSrv->logger, OSGI_LOGSERVICE_DEBUG, (char *) "getting data from phase2cmp B\n");
+ }
+ return phase1->getData() * 24.0;
+};
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2a/CMakeLists.txt b/examples/dm_example_cxx/phase2a/CMakeLists.txt
deleted file mode 100644
index 4e2e673..0000000
--- a/examples/dm_example_cxx/phase2a/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# 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.
-add_bundle(phase2a_cxx
- SYMBOLIC_NAME phase2a_cxx
- VERSION 0.0.1
- SOURCES
- src/Phase2aActivator.cc
- src/Phase2aCmp.cc
-)
-
-target_include_directories(phase2a_cxx PRIVATE
- ../phase2/include
- ../api
-)
-
-target_link_libraries(phase2a_cxx PRIVATE Celix::log_service_api)
-
-IF(APPLE)
- target_link_libraries(phase2a_cxx PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
-else()
- if(ENABLE_ADDRESS_SANITIZER)
- #With asan there can be undefined symbols
- target_link_libraries(phase2a_cxx PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
- else()
- target_link_libraries(phase2a_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
- endif()
-endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2a/src/Phase2aActivator.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2a/src/Phase2aActivator.cc b/examples/dm_example_cxx/phase2a/src/Phase2aActivator.cc
deleted file mode 100644
index e33ae0e..0000000
--- a/examples/dm_example_cxx/phase2a/src/Phase2aActivator.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.
- */
-
-#include <IName.h>
-#include "Phase2Cmp.h"
-#include "Phase2Activator.h"
-#include "log_service.h"
-
-using namespace celix::dm;
-
-
-DmActivator* DmActivator::create(DependencyManager& mng) {
- return new Phase2Activator(mng);
-}
-
-
-void Phase2Activator::init() {
-
- Properties props {};
- props["name"] = "phase2a";
-
- Component<Phase2Cmp>& cmp = mng.createComponent<Phase2Cmp>()
- .setInstance(Phase2Cmp())
- .addInterface<IPhase2>(IPHASE2_VERSION, props);
-
- cmp.createServiceDependency<IPhase1>()
- .setRequired(true)
- .setCallbacks(&Phase2Cmp::setPhase1);
-
- cmp.createServiceDependency<srv::info::IName>()
- .setVersionRange("[1.0.0,2)")
- .setCallbacks(&Phase2Cmp::setName);
-
- cmp.createCServiceDependency<log_service_t>(OSGI_LOGSERVICE_NAME)
- .setRequired(false)
- .setCallbacks(&Phase2Cmp::setLogService);
-}
-
-void Phase2Activator::deinit() {
-
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2a/src/Phase2aCmp.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2a/src/Phase2aCmp.cc b/examples/dm_example_cxx/phase2a/src/Phase2aCmp.cc
deleted file mode 100644
index 4f68679..0000000
--- a/examples/dm_example_cxx/phase2a/src/Phase2aCmp.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.
- */
-
-#include "Phase2Cmp.h"
-#include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
-
-Phase2Cmp::Phase2Cmp(Phase2Cmp&& other) noexcept : phase1(other.phase1), logSrv{other.logSrv} {
- std::cout << "Move constructor Phase2aCmp called\n";
- other.phase1 = nullptr;
- other.logSrv = nullptr;
-}
-
-void Phase2Cmp::setPhase1(IPhase1* phase1) {
- std::cout << "setting phase1 for phase2\n";
- this->phase1 = phase1;
-}
-
-void Phase2Cmp::setLogService(const log_service_t* logSrv) {
- this->logSrv = logSrv;
-}
-
-double Phase2Cmp::getData() {
- if (this->logSrv != NULL) {
- this->logSrv->log(this->logSrv->logger, OSGI_LOGSERVICE_DEBUG, (char *) "getting data from phase2cmp A\n");
- }
- return phase1->getData() * 42.0;
-};
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2b/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2b/CMakeLists.txt b/examples/dm_example_cxx/phase2b/CMakeLists.txt
deleted file mode 100644
index cfbda7c..0000000
--- a/examples/dm_example_cxx/phase2b/CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-# 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.
-
-add_bundle(phase2b_cxx
- SYMBOLIC_NAME phase2b_cxx
- VERSION 0.0.1
- SOURCES
- src/Phase2bActivator.cc
- src/Phase2bCmp.cc
-)
-target_link_libraries(phase2b_cxx PRIVATE Celix::log_service_api)
-target_include_directories(phase2b_cxx PRIVATE ../api ../phase2/include)
-
-
-
-IF(APPLE)
- target_link_libraries(phase2b_cxx PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
-else()
- if(ENABLE_ADDRESS_SANITIZER)
- #With asan there can be undefined symbols
- target_link_libraries(phase2b_cxx PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
- else()
- target_link_libraries(phase2b_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
- endif()
-endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2b/src/Phase2bActivator.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2b/src/Phase2bActivator.cc b/examples/dm_example_cxx/phase2b/src/Phase2bActivator.cc
deleted file mode 100644
index 4fba8c0..0000000
--- a/examples/dm_example_cxx/phase2b/src/Phase2bActivator.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-
-#include "Phase2Cmp.h"
-#include "Phase2Activator.h"
-#include "log_service.h"
-
-using namespace celix::dm;
-
-
-DmActivator* DmActivator::create(DependencyManager& mng) {
- return new Phase2Activator(mng);
-}
-
-void Phase2Activator::init() {
-
- Properties props {};
- props["name"] = "phase2b";
-
- Component<Phase2Cmp>& cmp = mng.createComponent<Phase2Cmp>()
- .addInterface<IPhase2>(IPHASE2_VERSION, props);
-
- cmp.createServiceDependency<IPhase1>()
- .setRequired(true)
- .setCallbacks(&Phase2Cmp::setPhase1);
-
- cmp.createCServiceDependency<log_service_t>(OSGI_LOGSERVICE_NAME)
- .setRequired(false)
- .setCallbacks(&Phase2Cmp::setLogService);
-}
-
-void Phase2Activator::deinit() {
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase2b/src/Phase2bCmp.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2b/src/Phase2bCmp.cc b/examples/dm_example_cxx/phase2b/src/Phase2bCmp.cc
deleted file mode 100644
index 2f420a0..0000000
--- a/examples/dm_example_cxx/phase2b/src/Phase2bCmp.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.
- */
-
-#include "Phase2Cmp.h"
-#include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
-
-Phase2Cmp::Phase2Cmp(Phase2Cmp&& other) noexcept : phase1(other.phase1), logSrv{other.logSrv} {
- std::cout << "Move constructor Phase2bCmp called\n";
- other.phase1 = nullptr;
- other.logSrv = nullptr;
-}
-
-void Phase2Cmp::setPhase1(IPhase1* phase1) {
- std::cout << "setting phase1 for phase2\n";
- this->phase1 = phase1;
-}
-
-void Phase2Cmp::setLogService(const log_service_t* logSrv) {
- this->logSrv = logSrv;
-}
-
-double Phase2Cmp::getData() {
- if (this->logSrv != NULL) {
- this->logSrv->log(this->logSrv->logger, OSGI_LOGSERVICE_DEBUG, (char *) "getting data from phase2cmp B\n");
- }
- return phase1->getData() * 24.0;
-};
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/CMakeLists.txt b/examples/dm_example_cxx/phase3/CMakeLists.txt
index a0f6973..2a62cbb 100644
--- a/examples/dm_example_cxx/phase3/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase3/CMakeLists.txt
@@ -15,12 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(
- include
- ../api
-)
-
-add_bundle(phase3_cxx
+add_bundle(dm_example_cxx_phase3
SYMBOLIC_NAME phase3_cxx
VERSION 0.0.1
SOURCES
@@ -28,16 +23,16 @@ add_bundle(phase3_cxx
src/Phase3BaseActivator.cc
src/Phase3Cmp.cc
)
-
-target_compile_options(phase3_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
+target_include_directories(dm_example_cxx_phase3 PRIVATE src)
+target_link_libraries(dm_example_cxx_phase3 PRIVATE dm_example_cxx_api)
IF(APPLE)
- target_link_libraries(phase3_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(dm_example_cxx_phase3 PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase3_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_cxx_phase3 PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase3_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_cxx_phase3 PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3/include/Phase3Activator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/include/Phase3Activator.h b/examples/dm_example_cxx/phase3/include/Phase3Activator.h
deleted file mode 100644
index e02cd61..0000000
--- a/examples/dm_example_cxx/phase3/include/Phase3Activator.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE3ACTIVATOR_H
-#define CELIX_PHASE3ACTIVATOR_H
-
-#include "Phase3BaseActivator.h"
-
-using namespace celix::dm;
-
-class Phase3Activator : public Phase3BaseActivator {
-public:
- Phase3Activator(DependencyManager& mng) : Phase3BaseActivator(mng) {}
- virtual void init();
-};
-
-#endif //CELIX_PHASE2AACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3/include/Phase3BaseActivator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/include/Phase3BaseActivator.h b/examples/dm_example_cxx/phase3/include/Phase3BaseActivator.h
deleted file mode 100644
index 0f3d813..0000000
--- a/examples/dm_example_cxx/phase3/include/Phase3BaseActivator.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE3BASEACTIVATOR_H
-#define CELIX_PHASE3BASEACTIVATOR_H
-
-#include "celix/dm/DmActivator.h"
-
-using namespace celix::dm;
-
-class Phase3BaseActivator : public DmActivator {
-public:
- Phase3BaseActivator(DependencyManager& mng) : DmActivator(mng), cmp(mng.createComponent<Phase3Cmp>()) {}
- void init();
-protected:
- celix::dm::Component<Phase3Cmp>& cmp;
-};
-
-#endif //CELIX_PHASE3BASEACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/include/Phase3Cmp.h b/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
deleted file mode 100644
index 8b7e974..0000000
--- a/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE3CMP_H
-#define CELIX_PHASE3CMP_H
-
-#include "IPhase1.h"
-#include "IPhase2.h"
-#include <stdint.h>
-#include <stdio.h>
-#include <thread>
-#include <iostream>
-#include <list>
-#include "celix/dm/Properties.h"
-
-class Phase3Cmp {
- std::map<IPhase2*,celix::dm::Properties> phases {};
- bool running {false};
- std::thread pollThread {};
-public:
- Phase3Cmp() { std::cout << "Constructing Phase3Cmp\n"; }
- virtual ~Phase3Cmp() = default;
-
- void start();
- void stop();
-
- void poll();
-
- void addPhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
- void removePhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
- void setPhase2a(IPhase2* phase);
-};
-
-#endif //CELIX_PHASE3CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3/src/Phase3Activator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3Activator.h b/examples/dm_example_cxx/phase3/src/Phase3Activator.h
new file mode 100644
index 0000000..e02cd61
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/src/Phase3Activator.h
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE3ACTIVATOR_H
+#define CELIX_PHASE3ACTIVATOR_H
+
+#include "Phase3BaseActivator.h"
+
+using namespace celix::dm;
+
+class Phase3Activator : public Phase3BaseActivator {
+public:
+ Phase3Activator(DependencyManager& mng) : Phase3BaseActivator(mng) {}
+ virtual void init();
+};
+
+#endif //CELIX_PHASE2AACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h b/examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
new file mode 100644
index 0000000..0f3d813
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE3BASEACTIVATOR_H
+#define CELIX_PHASE3BASEACTIVATOR_H
+
+#include "celix/dm/DmActivator.h"
+
+using namespace celix::dm;
+
+class Phase3BaseActivator : public DmActivator {
+public:
+ Phase3BaseActivator(DependencyManager& mng) : DmActivator(mng), cmp(mng.createComponent<Phase3Cmp>()) {}
+ void init();
+protected:
+ celix::dm::Component<Phase3Cmp>& cmp;
+};
+
+#endif //CELIX_PHASE3BASEACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3/src/Phase3Cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3Cmp.h b/examples/dm_example_cxx/phase3/src/Phase3Cmp.h
new file mode 100644
index 0000000..8b7e974
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/src/Phase3Cmp.h
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE3CMP_H
+#define CELIX_PHASE3CMP_H
+
+#include "IPhase1.h"
+#include "IPhase2.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <thread>
+#include <iostream>
+#include <list>
+#include "celix/dm/Properties.h"
+
+class Phase3Cmp {
+ std::map<IPhase2*,celix::dm::Properties> phases {};
+ bool running {false};
+ std::thread pollThread {};
+public:
+ Phase3Cmp() { std::cout << "Constructing Phase3Cmp\n"; }
+ virtual ~Phase3Cmp() = default;
+
+ void start();
+ void stop();
+
+ void poll();
+
+ void addPhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
+ void removePhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
+ void setPhase2a(IPhase2* phase);
+};
+
+#endif //CELIX_PHASE3CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/CMakeLists.txt b/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
index 956f6e1..2ea1eb4 100644
--- a/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
@@ -15,28 +15,24 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(
- include
- ../api
-)
-add_bundle(phase3_locking_cxx
+add_bundle(dm_example_cxx_phase3_locking
SYMBOLIC_NAME phase3_locking_cxx
VERSION 0.0.1
SOURCES
src/Phase3LockingActivator.cc
src/Phase3LockingCmp.cc
)
-
-target_compile_options(phase3_locking_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
+target_include_directories(dm_example_cxx_phase3_locking PRIVATE src)
+target_link_libraries(dm_example_cxx_phase3_locking PRIVATE dm_example_cxx_api)
IF(APPLE)
- target_link_libraries(phase3_locking_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(dm_example_cxx_phase3_locking PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase3_locking_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_cxx_phase3_locking PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase3_locking_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_cxx_phase3_locking PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
deleted file mode 100644
index 78d1748..0000000
--- a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE3LOCKINGACTIVATOR_H
-#define CELIX_PHASE3LOCKINGACTIVATOR_H
-
-#include "celix/dm/DmActivator.h"
-
-using namespace celix::dm;
-
-class Phase3LockingActivator : public DmActivator {
-public:
- Phase3LockingActivator(DependencyManager& mng) : DmActivator(mng) {}
- virtual void init();
-};
-
-#endif //CELIX_PHASE3LOCKINGAACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
deleted file mode 100644
index 678fa80..0000000
--- a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef CELIX_PHASE3LOCKINGCMP_H
-#define CELIX_PHASE3LOCKINGCMP_H
-
-#include "IPhase2.h"
-#include <stdint.h>
-#include <stdio.h>
-#include <thread>
-#include <iostream>
-#include <mutex>
-#include <map>
-#include "celix/dm/Properties.h"
-
-class Phase3LockingCmp {
- std::map<IPhase2*,celix::dm::Properties> phases {};
- bool running {false};
- std::thread pollThread {};
- std::mutex mutex {};
-public:
- Phase3LockingCmp() = default;
- virtual ~Phase3LockingCmp() = default;
-
- void start();
- void stop();
-
- void poll();
-
- void addPhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
- void removePhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
-};
-
-#endif //CELIX_PHASE3LOCKINGCMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h
new file mode 100644
index 0000000..78d1748
--- /dev/null
+++ b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE3LOCKINGACTIVATOR_H
+#define CELIX_PHASE3LOCKINGACTIVATOR_H
+
+#include "celix/dm/DmActivator.h"
+
+using namespace celix::dm;
+
+class Phase3LockingActivator : public DmActivator {
+public:
+ Phase3LockingActivator(DependencyManager& mng) : DmActivator(mng) {}
+ virtual void init();
+};
+
+#endif //CELIX_PHASE3LOCKINGAACTIVATOR_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.h b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.h
new file mode 100644
index 0000000..678fa80
--- /dev/null
+++ b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.h
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE3LOCKINGCMP_H
+#define CELIX_PHASE3LOCKINGCMP_H
+
+#include "IPhase2.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <thread>
+#include <iostream>
+#include <mutex>
+#include <map>
+#include "celix/dm/Properties.h"
+
+class Phase3LockingCmp {
+ std::map<IPhase2*,celix::dm::Properties> phases {};
+ bool running {false};
+ std::thread pollThread {};
+ std::mutex mutex {};
+public:
+ Phase3LockingCmp() = default;
+ virtual ~Phase3LockingCmp() = default;
+
+ void start();
+ void stop();
+
+ void poll();
+
+ void addPhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
+ void removePhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
+};
+
+#endif //CELIX_PHASE3LOCKINGCMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/embedding/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/embedding/CMakeLists.txt b/examples/embedding/CMakeLists.txt
index e39433a..9c96948 100644
--- a/examples/embedding/CMakeLists.txt
+++ b/examples/embedding/CMakeLists.txt
@@ -17,5 +17,4 @@
add_executable(embedding private/src/main)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
target_link_libraries(embedding Celix::framework )
\ No newline at end of file
[2/2] celix git commit: CELIX-417: Refactors CMake usage for example
embedded, dm and dm_cxx
Posted by pn...@apache.org.
CELIX-417: Refactors CMake usage for example embedded, dm and dm_cxx
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/1836cf84
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/1836cf84
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/1836cf84
Branch: refs/heads/feature/CELIX-417-cmake-refactor
Commit: 1836cf84110367ae052f0fb5cbb3eb859d540275
Parents: 486d4f0
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Fri Nov 24 12:27:20 2017 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Fri Nov 24 12:27:20 2017 +0100
----------------------------------------------------------------------
examples/dm_example/CMakeLists.txt | 31 +++--
examples/dm_example/api/CMakeLists.txt | 19 +++
examples/dm_example/api/include/phase1.h | 44 +++++++
examples/dm_example/api/include/phase2.h | 41 +++++++
examples/dm_example/phase1/CMakeLists.txt | 18 ++-
.../phase1/private/include/phase1_cmp.h | 43 -------
.../phase1/private/src/phase1_activator.c | 85 --------------
.../dm_example/phase1/private/src/phase1_cmp.c | 99 ----------------
.../dm_example/phase1/src/phase1_activator.c | 85 ++++++++++++++
examples/dm_example/phase1/src/phase1_cmp.c | 99 ++++++++++++++++
examples/dm_example/phase1/src/phase1_cmp.h | 43 +++++++
examples/dm_example/phase2a/CMakeLists.txt | 19 ++-
.../phase2a/private/include/phase2a_cmp.h | 46 --------
.../phase2a/private/src/phase2a_activator.c | 95 ---------------
.../phase2a/private/src/phase2a_cmp.c | 116 -------------------
.../dm_example/phase2a/src/phase2a_activator.c | 95 +++++++++++++++
examples/dm_example/phase2a/src/phase2a_cmp.c | 116 +++++++++++++++++++
examples/dm_example/phase2a/src/phase2a_cmp.h | 46 ++++++++
examples/dm_example/phase2b/CMakeLists.txt | 21 ++--
.../phase2b/private/include/phase2b_cmp.h | 46 --------
.../phase2b/private/src/phase2b_activator.c | 95 ---------------
.../phase2b/private/src/phase2b_cmp.c | 115 ------------------
.../dm_example/phase2b/src/phase2b_activator.c | 95 +++++++++++++++
examples/dm_example/phase2b/src/phase2b_cmp.c | 115 ++++++++++++++++++
examples/dm_example/phase2b/src/phase2b_cmp.h | 46 ++++++++
examples/dm_example/phase3/CMakeLists.txt | 21 ++--
.../phase3/private/include/phase3_cmp.h | 45 -------
.../phase3/private/src/phase3_activator.c | 84 --------------
.../dm_example/phase3/private/src/phase3_cmp.c | 116 -------------------
.../dm_example/phase3/src/phase3_activator.c | 84 ++++++++++++++
examples/dm_example/phase3/src/phase3_cmp.c | 116 +++++++++++++++++++
examples/dm_example/phase3/src/phase3_cmp.h | 45 +++++++
examples/dm_example/services/phase1.h | 44 -------
examples/dm_example/services/phase2.h | 41 -------
examples/dm_example_cxx/CMakeLists.txt | 32 +++--
examples/dm_example_cxx/api/CMakeLists.txt | 19 +++
examples/dm_example_cxx/api/IName.h | 39 -------
examples/dm_example_cxx/api/IPhase1.h | 33 ------
examples/dm_example_cxx/api/IPhase2.h | 33 ------
examples/dm_example_cxx/api/include/IName.h | 39 +++++++
examples/dm_example_cxx/api/include/IPhase1.h | 33 ++++++
examples/dm_example_cxx/api/include/IPhase2.h | 33 ++++++
examples/dm_example_cxx/phase1/CMakeLists.txt | 17 +--
.../phase1/include/Phase1Activator.h | 36 ------
.../dm_example_cxx/phase1/include/Phase1Cmp.h | 44 -------
.../dm_example_cxx/phase1/src/Phase1Activator.h | 36 ++++++
examples/dm_example_cxx/phase1/src/Phase1Cmp.h | 44 +++++++
examples/dm_example_cxx/phase2/CMakeLists.txt | 51 ++++++++
.../phase2/include/Phase2Activator.h | 34 ------
.../dm_example_cxx/phase2/include/Phase2Cmp.h | 56 ---------
.../dm_example_cxx/phase2/src/Phase2Activator.h | 34 ++++++
examples/dm_example_cxx/phase2/src/Phase2Cmp.h | 56 +++++++++
.../phase2/src/Phase2aActivator.cc | 57 +++++++++
.../dm_example_cxx/phase2/src/Phase2aCmp.cc | 45 +++++++
.../phase2/src/Phase2bActivator.cc | 50 ++++++++
.../dm_example_cxx/phase2/src/Phase2bCmp.cc | 45 +++++++
examples/dm_example_cxx/phase2a/CMakeLists.txt | 41 -------
.../phase2a/src/Phase2aActivator.cc | 57 ---------
.../dm_example_cxx/phase2a/src/Phase2aCmp.cc | 45 -------
examples/dm_example_cxx/phase2b/CMakeLists.txt | 39 -------
.../phase2b/src/Phase2bActivator.cc | 50 --------
.../dm_example_cxx/phase2b/src/Phase2bCmp.cc | 45 -------
examples/dm_example_cxx/phase3/CMakeLists.txt | 17 +--
.../phase3/include/Phase3Activator.h | 33 ------
.../phase3/include/Phase3BaseActivator.h | 35 ------
.../dm_example_cxx/phase3/include/Phase3Cmp.h | 50 --------
.../dm_example_cxx/phase3/src/Phase3Activator.h | 33 ++++++
.../phase3/src/Phase3BaseActivator.h | 35 ++++++
examples/dm_example_cxx/phase3/src/Phase3Cmp.h | 50 ++++++++
.../phase3_locking/CMakeLists.txt | 16 +--
.../include/Phase3LockingActivator.h | 33 ------
.../phase3_locking/include/Phase3LockingCmp.h | 50 --------
.../phase3_locking/src/Phase3LockingActivator.h | 33 ++++++
.../phase3_locking/src/Phase3LockingCmp.h | 50 ++++++++
examples/embedding/CMakeLists.txt | 1 -
75 files changed, 1909 insertions(+), 1939 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/CMakeLists.txt b/examples/dm_example/CMakeLists.txt
index 9a9e69b..2cef7ec 100644
--- a/examples/dm_example/CMakeLists.txt
+++ b/examples/dm_example/CMakeLists.txt
@@ -15,11 +15,8 @@
# specific language governing permissions and limitations
# under the License.
if (BUILD_DEPENDENCY_MANAGER)
- include_directories(
- ${PROJECT_SOURCE_DIR}/dependency_manager/public/include
- ${PROJECT_SOURCE_DIR}/utils/public/include
- services
- )
+
+ add_subdirectory(api)
add_subdirectory(phase1)
add_subdirectory(phase2a)
@@ -32,11 +29,11 @@ if (BUILD_DEPENDENCY_MANAGER)
BUNDLES
Celix::shell
Celix::shell_tui
- dm_shell
- phase1
- phase2a
- phase2b
- phase3
+ Celix::dm_shell
+ dm_example_phase1
+ dm_example_phase2a
+ dm_example_phase2b
+ dm_example_phase3
PROPERTIES
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
)
@@ -53,13 +50,13 @@ if (BUILD_DEPENDENCY_MANAGER)
FROM dmbase
GROUP examples
BUNDLES
- ${CELIX_SHELL_BUNDLE}
- ${CELIX_SHELL_TUI_BUNDLE}
- dm_shell
- phase1
- phase2a
- phase2b
- phase3
+ Celix::shell
+ Celix::shell_tui
+ Celix::dm_shell
+ dm_example_phase1
+ dm_example_phase2a
+ dm_example_phase2b
+ dm_example_phase3
PROPERTIES
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
)
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/api/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/api/CMakeLists.txt b/examples/dm_example/api/CMakeLists.txt
new file mode 100644
index 0000000..900c8fb
--- /dev/null
+++ b/examples/dm_example/api/CMakeLists.txt
@@ -0,0 +1,19 @@
+# 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.
+
+add_library(dm_example_api INTERFACE)
+target_include_directories(dm_example_api INTERFACE include)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/api/include/phase1.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/api/include/phase1.h b/examples/dm_example/api/include/phase1.h
new file mode 100644
index 0000000..04e9da7
--- /dev/null
+++ b/examples/dm_example/api/include/phase1.h
@@ -0,0 +1,44 @@
+/**
+ *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.
+ */
+/*
+ * publisher.h
+ *
+ * \date Aug 23, 2010
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef PHASE1_H_
+#define PHASE1_H_
+
+#define PHASE1_NAME "PHASE1"
+#define PHASE1_VERSION "1.2.2.0"
+#define PHASE1_RANGE_ALL "[1.2.2.0,4.5.6.x)"
+#define PHASE1_RANGE_EXACT "[1.2.2.0,1.2.2.0]"
+
+
+
+struct phase1_struct {
+ void *handle;
+ int (*getData)(void *handle, unsigned int *data);
+};
+
+typedef struct phase1_struct phase1_t;
+
+#endif /* PHASE1_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/api/include/phase2.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/api/include/phase2.h b/examples/dm_example/api/include/phase2.h
new file mode 100644
index 0000000..2f4df86
--- /dev/null
+++ b/examples/dm_example/api/include/phase2.h
@@ -0,0 +1,41 @@
+/**
+ *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.
+ */
+/*
+ * publisher.h
+ *
+ * \date Aug 23, 2010
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef PHASE2_H
+#define PHASE2_H
+
+#define PHASE2_NAME "PHASE2"
+#define PHASE2_VERSION "1.0.0.0"
+
+struct phase2_struct {
+ void *handle;
+ void (*getData)(void *handle, double *data);
+};
+
+typedef struct phase2_struct phase2_t;
+
+
+#endif /* PHASE2_H */
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase1/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/CMakeLists.txt b/examples/dm_example/phase1/CMakeLists.txt
index 6299688..5263bab 100644
--- a/examples/dm_example/phase1/CMakeLists.txt
+++ b/examples/dm_example/phase1/CMakeLists.txt
@@ -15,26 +15,24 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(
- private/include
- ../services
-)
-add_bundle(phase1
+add_bundle(dm_example_phase1
SYMBOLIC_NAME phase1
VERSION 0.0.1
SOURCES
- private/src/phase1_activator
- private/src/phase1_cmp.c
+ src/phase1_activator
+ src/phase1_cmp.c
)
+target_include_directories(dm_example_phase1 PRIVATE src)
+target_link_libraries(dm_example_phase1 PRIVATE dm_example_api)
IF(APPLE)
- target_link_libraries(phase1 PRIVATE -Wl,-all_load dependency_manager_static)
+ target_link_libraries(dm_example_phase1 PRIVATE -Wl,-all_load Celix::dependency_manager_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase1 PRIVATE -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_phase1 PRIVATE -Wl,--whole-archive Celix::dependency_manager_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase1 PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_phase1 PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase1/private/include/phase1_cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/private/include/phase1_cmp.h b/examples/dm_example/phase1/private/include/phase1_cmp.h
deleted file mode 100644
index 5715f6e..0000000
--- a/examples/dm_example/phase1/private/include/phase1_cmp.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.h
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PHASE1_CMP_H
-#define PHASE1_CMP_H
-
-
-typedef struct phase1_cmp_struct phase1_cmp_t;
-
-phase1_cmp_t *phase1_create(void);
-int phase1_init(phase1_cmp_t *cmp);
-int phase1_start(phase1_cmp_t *cmp);
-int phase1_stop(phase1_cmp_t *cmp);
-int phase1_deinit(phase1_cmp_t *cmp);
-void phase1_destroy(phase1_cmp_t *cmp);
-
-int phase1_getData(phase1_cmp_t *cmp, unsigned int *data);
-
-
-#endif //PHASE1_CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase1/private/src/phase1_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/private/src/phase1_activator.c b/examples/dm_example/phase1/private/src/phase1_activator.c
deleted file mode 100644
index 783e642..0000000
--- a/examples/dm_example/phase1/private/src/phase1_activator.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- *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.
- */
-/*
- * activator.c
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <phase1_cmp.h>
-
-#include "bundle_activator.h"
-#include "dm_activator.h"
-
-#include "phase1.h"
-
-struct phase1_activator_struct {
- phase1_cmp_t *phase1Cmp;
- phase1_t phase1Serv;
-};
-
-celix_status_t dm_create(bundle_context_pt context, void **userData) {
- printf("PHASE1: dm_create\n");
- *userData = calloc(1, sizeof(struct phase1_activator_struct));
- return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
-}
-
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("PHASE1: dm_init\n");
- celix_status_t status = CELIX_SUCCESS;
-
-
- struct phase1_activator_struct *act = (struct phase1_activator_struct *)userData;
-
- act->phase1Cmp = phase1_create();
- if (act->phase1Cmp != NULL) {
-
- act->phase1Serv.handle = act->phase1Cmp;
- act->phase1Serv.getData = (void *)phase1_getData;
-
- properties_pt props = properties_create();
- properties_set(props, "id", "phase1");
-
- dm_component_pt cmp;
- component_create(context, "PHASE1_PROCESSING_COMPONENT", &cmp);
- component_setImplementation(cmp, act->phase1Cmp);
- component_setCallbacksSafe(cmp, phase1_cmp_t *, phase1_init, phase1_start, phase1_stop, phase1_deinit);
- component_addInterface(cmp, PHASE1_NAME, PHASE1_VERSION, &act->phase1Serv, props);
-
- dependencyManager_add(manager, cmp);
- } else {
- status = CELIX_ENOMEM;
- }
-
- return status;
-}
-
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("PHASE1: dm-destroy\n");
-
- struct phase1_activator_struct *act = (struct phase1_activator_struct *)userData;
- if (act->phase1Cmp != NULL) {
- phase1_destroy(act->phase1Cmp);
- }
- free(act);
-
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase1/private/src/phase1_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/private/src/phase1_cmp.c b/examples/dm_example/phase1/private/src/phase1_cmp.c
deleted file mode 100644
index 75de182..0000000
--- a/examples/dm_example/phase1/private/src/phase1_cmp.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.c
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-
-#include "celix_threads.h"
-#include "phase1_cmp.h"
-
-#define SLEEPTIME 1000
-
-struct phase1_cmp_struct {
- celix_thread_t thread;
- bool running;
- unsigned int counter;
-};
-
-static void *phase1_thread(void *data);
-
-phase1_cmp_t *phase1_create(void) {
- phase1_cmp_t *cmp = calloc(1, sizeof(*cmp));
- if (cmp != NULL) {
- cmp->counter = 0;
- cmp->running = false;
- }
- return cmp;
-}
-
-int phase1_init(phase1_cmp_t *cmp) {
- printf("init phase1\n");
- return 0;
-}
-
-int phase1_start(phase1_cmp_t *cmp) {
- printf("start phase1\n");
- cmp->running = true;
- celixThread_create(&cmp->thread, NULL, phase1_thread, cmp);
- return 0;
-}
-
-int phase1_stop(phase1_cmp_t *cmp) {
- printf("stop phase1\n");
- cmp->running = false;
- celixThread_kill(cmp->thread, SIGUSR1);
- celixThread_join(cmp->thread, NULL);
- return 0;
-}
-
-int phase1_deinit(phase1_cmp_t *cmp) {
- printf("deinit phase1\n");
- return 0;
-}
-
-void phase1_destroy(phase1_cmp_t *cmp) {
- free(cmp);
- printf("destroy phase1\n");
-}
-
-static void *phase1_thread(void *data) {
- phase1_cmp_t *cmp = data;
-
- while (cmp->running) {
- cmp->counter += 1;
- usleep(SLEEPTIME);
- }
-
- celixThread_exit(NULL);
- return NULL;
-}
-
-int phase1_getData(phase1_cmp_t *cmp, unsigned int *data) {
- *data = cmp->counter;
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase1/src/phase1_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/src/phase1_activator.c b/examples/dm_example/phase1/src/phase1_activator.c
new file mode 100644
index 0000000..783e642
--- /dev/null
+++ b/examples/dm_example/phase1/src/phase1_activator.c
@@ -0,0 +1,85 @@
+/**
+ *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.
+ */
+/*
+ * activator.c
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <phase1_cmp.h>
+
+#include "bundle_activator.h"
+#include "dm_activator.h"
+
+#include "phase1.h"
+
+struct phase1_activator_struct {
+ phase1_cmp_t *phase1Cmp;
+ phase1_t phase1Serv;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+ printf("PHASE1: dm_create\n");
+ *userData = calloc(1, sizeof(struct phase1_activator_struct));
+ return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
+}
+
+celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+ printf("PHASE1: dm_init\n");
+ celix_status_t status = CELIX_SUCCESS;
+
+
+ struct phase1_activator_struct *act = (struct phase1_activator_struct *)userData;
+
+ act->phase1Cmp = phase1_create();
+ if (act->phase1Cmp != NULL) {
+
+ act->phase1Serv.handle = act->phase1Cmp;
+ act->phase1Serv.getData = (void *)phase1_getData;
+
+ properties_pt props = properties_create();
+ properties_set(props, "id", "phase1");
+
+ dm_component_pt cmp;
+ component_create(context, "PHASE1_PROCESSING_COMPONENT", &cmp);
+ component_setImplementation(cmp, act->phase1Cmp);
+ component_setCallbacksSafe(cmp, phase1_cmp_t *, phase1_init, phase1_start, phase1_stop, phase1_deinit);
+ component_addInterface(cmp, PHASE1_NAME, PHASE1_VERSION, &act->phase1Serv, props);
+
+ dependencyManager_add(manager, cmp);
+ } else {
+ status = CELIX_ENOMEM;
+ }
+
+ return status;
+}
+
+celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+ printf("PHASE1: dm-destroy\n");
+
+ struct phase1_activator_struct *act = (struct phase1_activator_struct *)userData;
+ if (act->phase1Cmp != NULL) {
+ phase1_destroy(act->phase1Cmp);
+ }
+ free(act);
+
+ return CELIX_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase1/src/phase1_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/src/phase1_cmp.c b/examples/dm_example/phase1/src/phase1_cmp.c
new file mode 100644
index 0000000..75de182
--- /dev/null
+++ b/examples/dm_example/phase1/src/phase1_cmp.c
@@ -0,0 +1,99 @@
+/**
+ *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.
+ */
+/*
+ * publisher.c
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+
+#include "celix_threads.h"
+#include "phase1_cmp.h"
+
+#define SLEEPTIME 1000
+
+struct phase1_cmp_struct {
+ celix_thread_t thread;
+ bool running;
+ unsigned int counter;
+};
+
+static void *phase1_thread(void *data);
+
+phase1_cmp_t *phase1_create(void) {
+ phase1_cmp_t *cmp = calloc(1, sizeof(*cmp));
+ if (cmp != NULL) {
+ cmp->counter = 0;
+ cmp->running = false;
+ }
+ return cmp;
+}
+
+int phase1_init(phase1_cmp_t *cmp) {
+ printf("init phase1\n");
+ return 0;
+}
+
+int phase1_start(phase1_cmp_t *cmp) {
+ printf("start phase1\n");
+ cmp->running = true;
+ celixThread_create(&cmp->thread, NULL, phase1_thread, cmp);
+ return 0;
+}
+
+int phase1_stop(phase1_cmp_t *cmp) {
+ printf("stop phase1\n");
+ cmp->running = false;
+ celixThread_kill(cmp->thread, SIGUSR1);
+ celixThread_join(cmp->thread, NULL);
+ return 0;
+}
+
+int phase1_deinit(phase1_cmp_t *cmp) {
+ printf("deinit phase1\n");
+ return 0;
+}
+
+void phase1_destroy(phase1_cmp_t *cmp) {
+ free(cmp);
+ printf("destroy phase1\n");
+}
+
+static void *phase1_thread(void *data) {
+ phase1_cmp_t *cmp = data;
+
+ while (cmp->running) {
+ cmp->counter += 1;
+ usleep(SLEEPTIME);
+ }
+
+ celixThread_exit(NULL);
+ return NULL;
+}
+
+int phase1_getData(phase1_cmp_t *cmp, unsigned int *data) {
+ *data = cmp->counter;
+ return 0;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase1/src/phase1_cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/src/phase1_cmp.h b/examples/dm_example/phase1/src/phase1_cmp.h
new file mode 100644
index 0000000..5715f6e
--- /dev/null
+++ b/examples/dm_example/phase1/src/phase1_cmp.h
@@ -0,0 +1,43 @@
+/**
+ *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.
+ */
+/*
+ * publisher.h
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef PHASE1_CMP_H
+#define PHASE1_CMP_H
+
+
+typedef struct phase1_cmp_struct phase1_cmp_t;
+
+phase1_cmp_t *phase1_create(void);
+int phase1_init(phase1_cmp_t *cmp);
+int phase1_start(phase1_cmp_t *cmp);
+int phase1_stop(phase1_cmp_t *cmp);
+int phase1_deinit(phase1_cmp_t *cmp);
+void phase1_destroy(phase1_cmp_t *cmp);
+
+int phase1_getData(phase1_cmp_t *cmp, unsigned int *data);
+
+
+#endif //PHASE1_CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/CMakeLists.txt b/examples/dm_example/phase2a/CMakeLists.txt
index d8f9165..cda4971 100644
--- a/examples/dm_example/phase2a/CMakeLists.txt
+++ b/examples/dm_example/phase2a/CMakeLists.txt
@@ -15,26 +15,23 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(
- private/include
- ../services
-)
-
-add_bundle(phase2a
+add_bundle(dm_example_phase2a
SYMBOLIC_NAME phase2a
VERSION 0.0.1
SOURCES
- private/src/phase2a_activator
- private/src/phase2a_cmp
+ src/phase2a_activator
+ src/phase2a_cmp
)
+target_include_directories(dm_example_phase2a PRIVATE src)
+target_link_libraries(dm_example_phase2a PRIVATE dm_example_api)
IF(APPLE)
- target_link_libraries(phase2a PRIVATE -Wl,-all_load dependency_manager_static)
+ target_link_libraries(dm_example_phase2a PRIVATE -Wl,-all_load Celix::dependency_manager_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase2a PRIVATE -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_phase2a PRIVATE -Wl,--whole-archive Celix::dependency_manager_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase2a PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_phase2a PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_static -Wl,--no-whole-archive)
endif()
ENDIF()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2a/private/include/phase2a_cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/private/include/phase2a_cmp.h b/examples/dm_example/phase2a/private/include/phase2a_cmp.h
deleted file mode 100644
index 060b23d..0000000
--- a/examples/dm_example/phase2a/private/include/phase2a_cmp.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.h
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PHASE2A_CMP_H
-#define PHASE2A_CMP_H
-
-#include "phase1.h"
-
-typedef struct phase2a_cmp_struct phase2a_cmp_t;
-
-phase2a_cmp_t *phase2a_create(void);
-int phase2a_init(phase2a_cmp_t *cmp);
-int phase2a_start(phase2a_cmp_t *cmp);
-int phase2a_stop(phase2a_cmp_t *cmp);
-int phase2a_deinit(phase2a_cmp_t *cmp);
-void phase2a_destroy(phase2a_cmp_t *cmp);
-
-int phase2a_setPhase1(phase2a_cmp_t *cmp, const phase1_t* phase1);
-
-int phase2a_getData(phase2a_cmp_t *cmp, double *data);
-
-
-#endif //PHASE2A_CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2a/private/src/phase2a_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/private/src/phase2a_activator.c b/examples/dm_example/phase2a/private/src/phase2a_activator.c
deleted file mode 100644
index 6416c68..0000000
--- a/examples/dm_example/phase2a/private/src/phase2a_activator.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- *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.
- */
-/*
- * activator.c
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <phase2a_cmp.h>
-
-#include "bundle_activator.h"
-#include "dm_activator.h"
-
-#include "phase1.h"
-#include "phase2.h"
-#include "phase2a_cmp.h"
-
-struct phase2a_activator_struct {
- phase2a_cmp_t *phase2aCmp;
- phase2_t phase2Serv;
-};
-
-celix_status_t dm_create(bundle_context_pt context, void **userData) {
- printf("phase2a: dm_create\n");
- *userData = calloc(1, sizeof(struct phase2a_activator_struct));
- return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
-}
-
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("phase2a: dm_init\n");
- celix_status_t status = CELIX_SUCCESS;
-
- struct phase2a_activator_struct *act = (struct phase2a_activator_struct *)userData;
-
- act->phase2aCmp = phase2a_create();
- if (act->phase2aCmp != NULL) {
-
- act->phase2Serv.handle = act->phase2aCmp;
- act->phase2Serv.getData = (void *)phase2a_getData;
-
- properties_pt props = properties_create();
- properties_set(props, "id", "phase2a");
-
- dm_component_pt cmp;
- component_create(context, "PHASE2A_PROCESSING_COMPONENT", &cmp);
- component_setImplementation(cmp, act->phase2aCmp);
- component_setCallbacksSafe(cmp, phase2a_cmp_t *, phase2a_init, phase2a_start, phase2a_stop, phase2a_deinit);
- component_addInterface(cmp, PHASE2_NAME, PHASE2_VERSION, &act->phase2Serv, props);
-
-
- dm_service_dependency_pt dep;
- serviceDependency_create(&dep);
- serviceDependency_setService(dep, PHASE1_NAME, PHASE1_RANGE_ALL, NULL);
- serviceDependency_setCallbacksSafe(dep, phase2a_cmp_t*, const phase1_t*, phase2a_setPhase1, NULL, NULL, NULL, NULL);
- serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
- serviceDependency_setRequired(dep, true);
- component_addServiceDependency(cmp, dep);
-
- dependencyManager_add(manager, cmp);
- } else {
- status = CELIX_ENOMEM;
- }
-
- return status;
-}
-
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("phase2a: dm-destroy\n");
-
- struct phase2a_activator_struct *act = (struct phase2a_activator_struct *)userData;
- if (act->phase2aCmp != NULL) {
- phase2a_destroy(act->phase2aCmp);
- }
- free(act);
-
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2a/private/src/phase2a_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/private/src/phase2a_cmp.c b/examples/dm_example/phase2a/private/src/phase2a_cmp.c
deleted file mode 100644
index d115b69..0000000
--- a/examples/dm_example/phase2a/private/src/phase2a_cmp.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.c
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-
-#include "celix_threads.h"
-#include "phase2a_cmp.h"
-
-#define SLEEPTIME 2000000
-
-struct phase2a_cmp_struct {
- celix_thread_t thread;
- bool running;
- double currentValue;
- celix_thread_mutex_t mutex;
- const phase1_t* phase1Serv;
-};
-
-static void *phase2a_thread(void *data);
-
-phase2a_cmp_t *phase2a_create(void) {
- phase2a_cmp_t *cmp = calloc(1, sizeof(*cmp));
- if (cmp != NULL) {
- cmp->currentValue = 0.0;
- cmp->running = false;
- celixThreadMutex_create(&cmp->mutex, NULL);
- }
- return cmp;
-}
-
-int phase2a_init(phase2a_cmp_t *cmp) {
- printf("init phase2a\n");
- return 0;
-}
-
-int phase2a_start(phase2a_cmp_t *cmp) {
- printf("start phase2a\n");
- cmp->running = true;
- celixThread_create(&cmp->thread, NULL, phase2a_thread, cmp);
- return 0;
-}
-
-int phase2a_stop(phase2a_cmp_t *cmp) {
- printf("stop phase2a\n");
- cmp->running = false;
- celixThread_kill(cmp->thread, SIGUSR1);
- celixThread_join(cmp->thread, NULL);
- return 0;
-}
-
-int phase2a_deinit(phase2a_cmp_t *cmp) {
- printf("deinit phase2a\n");
- return 0;
-}
-
-void phase2a_destroy(phase2a_cmp_t *cmp) {
- celixThreadMutex_destroy(&cmp->mutex);
- free(cmp);
- printf("destroy phase2a\n");
-}
-
-int phase2a_setPhase1(phase2a_cmp_t *cmp, const phase1_t* phase1) {
- printf("phase2a_setPhase1 called!\n\n");
- celixThreadMutex_lock(&cmp->mutex);
- cmp->phase1Serv = phase1;
- celixThreadMutex_unlock(&cmp->mutex);
- return 0;
-}
-
-static void *phase2a_thread(void *data) {
- phase2a_cmp_t *cmp = data;
- unsigned int counter;
-
- while (cmp->running) {
- celixThreadMutex_lock(&cmp->mutex);
- if (cmp->phase1Serv != NULL) {
- cmp->phase1Serv->getData(cmp->phase1Serv->handle, &counter);
- cmp->currentValue = 1.0 / counter;
- }
- celixThreadMutex_unlock(&cmp->mutex);
- usleep(SLEEPTIME);
- }
-
- celixThread_exit(NULL);
- return NULL;
-}
-
-int phase2a_getData(phase2a_cmp_t *cmp, double *data) {
- *data = cmp->currentValue;
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2a/src/phase2a_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/src/phase2a_activator.c b/examples/dm_example/phase2a/src/phase2a_activator.c
new file mode 100644
index 0000000..6416c68
--- /dev/null
+++ b/examples/dm_example/phase2a/src/phase2a_activator.c
@@ -0,0 +1,95 @@
+/**
+ *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.
+ */
+/*
+ * activator.c
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <phase2a_cmp.h>
+
+#include "bundle_activator.h"
+#include "dm_activator.h"
+
+#include "phase1.h"
+#include "phase2.h"
+#include "phase2a_cmp.h"
+
+struct phase2a_activator_struct {
+ phase2a_cmp_t *phase2aCmp;
+ phase2_t phase2Serv;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+ printf("phase2a: dm_create\n");
+ *userData = calloc(1, sizeof(struct phase2a_activator_struct));
+ return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
+}
+
+celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+ printf("phase2a: dm_init\n");
+ celix_status_t status = CELIX_SUCCESS;
+
+ struct phase2a_activator_struct *act = (struct phase2a_activator_struct *)userData;
+
+ act->phase2aCmp = phase2a_create();
+ if (act->phase2aCmp != NULL) {
+
+ act->phase2Serv.handle = act->phase2aCmp;
+ act->phase2Serv.getData = (void *)phase2a_getData;
+
+ properties_pt props = properties_create();
+ properties_set(props, "id", "phase2a");
+
+ dm_component_pt cmp;
+ component_create(context, "PHASE2A_PROCESSING_COMPONENT", &cmp);
+ component_setImplementation(cmp, act->phase2aCmp);
+ component_setCallbacksSafe(cmp, phase2a_cmp_t *, phase2a_init, phase2a_start, phase2a_stop, phase2a_deinit);
+ component_addInterface(cmp, PHASE2_NAME, PHASE2_VERSION, &act->phase2Serv, props);
+
+
+ dm_service_dependency_pt dep;
+ serviceDependency_create(&dep);
+ serviceDependency_setService(dep, PHASE1_NAME, PHASE1_RANGE_ALL, NULL);
+ serviceDependency_setCallbacksSafe(dep, phase2a_cmp_t*, const phase1_t*, phase2a_setPhase1, NULL, NULL, NULL, NULL);
+ serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
+ serviceDependency_setRequired(dep, true);
+ component_addServiceDependency(cmp, dep);
+
+ dependencyManager_add(manager, cmp);
+ } else {
+ status = CELIX_ENOMEM;
+ }
+
+ return status;
+}
+
+celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+ printf("phase2a: dm-destroy\n");
+
+ struct phase2a_activator_struct *act = (struct phase2a_activator_struct *)userData;
+ if (act->phase2aCmp != NULL) {
+ phase2a_destroy(act->phase2aCmp);
+ }
+ free(act);
+
+ return CELIX_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2a/src/phase2a_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/src/phase2a_cmp.c b/examples/dm_example/phase2a/src/phase2a_cmp.c
new file mode 100644
index 0000000..d115b69
--- /dev/null
+++ b/examples/dm_example/phase2a/src/phase2a_cmp.c
@@ -0,0 +1,116 @@
+/**
+ *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.
+ */
+/*
+ * publisher.c
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include "celix_threads.h"
+#include "phase2a_cmp.h"
+
+#define SLEEPTIME 2000000
+
+struct phase2a_cmp_struct {
+ celix_thread_t thread;
+ bool running;
+ double currentValue;
+ celix_thread_mutex_t mutex;
+ const phase1_t* phase1Serv;
+};
+
+static void *phase2a_thread(void *data);
+
+phase2a_cmp_t *phase2a_create(void) {
+ phase2a_cmp_t *cmp = calloc(1, sizeof(*cmp));
+ if (cmp != NULL) {
+ cmp->currentValue = 0.0;
+ cmp->running = false;
+ celixThreadMutex_create(&cmp->mutex, NULL);
+ }
+ return cmp;
+}
+
+int phase2a_init(phase2a_cmp_t *cmp) {
+ printf("init phase2a\n");
+ return 0;
+}
+
+int phase2a_start(phase2a_cmp_t *cmp) {
+ printf("start phase2a\n");
+ cmp->running = true;
+ celixThread_create(&cmp->thread, NULL, phase2a_thread, cmp);
+ return 0;
+}
+
+int phase2a_stop(phase2a_cmp_t *cmp) {
+ printf("stop phase2a\n");
+ cmp->running = false;
+ celixThread_kill(cmp->thread, SIGUSR1);
+ celixThread_join(cmp->thread, NULL);
+ return 0;
+}
+
+int phase2a_deinit(phase2a_cmp_t *cmp) {
+ printf("deinit phase2a\n");
+ return 0;
+}
+
+void phase2a_destroy(phase2a_cmp_t *cmp) {
+ celixThreadMutex_destroy(&cmp->mutex);
+ free(cmp);
+ printf("destroy phase2a\n");
+}
+
+int phase2a_setPhase1(phase2a_cmp_t *cmp, const phase1_t* phase1) {
+ printf("phase2a_setPhase1 called!\n\n");
+ celixThreadMutex_lock(&cmp->mutex);
+ cmp->phase1Serv = phase1;
+ celixThreadMutex_unlock(&cmp->mutex);
+ return 0;
+}
+
+static void *phase2a_thread(void *data) {
+ phase2a_cmp_t *cmp = data;
+ unsigned int counter;
+
+ while (cmp->running) {
+ celixThreadMutex_lock(&cmp->mutex);
+ if (cmp->phase1Serv != NULL) {
+ cmp->phase1Serv->getData(cmp->phase1Serv->handle, &counter);
+ cmp->currentValue = 1.0 / counter;
+ }
+ celixThreadMutex_unlock(&cmp->mutex);
+ usleep(SLEEPTIME);
+ }
+
+ celixThread_exit(NULL);
+ return NULL;
+}
+
+int phase2a_getData(phase2a_cmp_t *cmp, double *data) {
+ *data = cmp->currentValue;
+ return 0;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2a/src/phase2a_cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/src/phase2a_cmp.h b/examples/dm_example/phase2a/src/phase2a_cmp.h
new file mode 100644
index 0000000..060b23d
--- /dev/null
+++ b/examples/dm_example/phase2a/src/phase2a_cmp.h
@@ -0,0 +1,46 @@
+/**
+ *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.
+ */
+/*
+ * publisher.h
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef PHASE2A_CMP_H
+#define PHASE2A_CMP_H
+
+#include "phase1.h"
+
+typedef struct phase2a_cmp_struct phase2a_cmp_t;
+
+phase2a_cmp_t *phase2a_create(void);
+int phase2a_init(phase2a_cmp_t *cmp);
+int phase2a_start(phase2a_cmp_t *cmp);
+int phase2a_stop(phase2a_cmp_t *cmp);
+int phase2a_deinit(phase2a_cmp_t *cmp);
+void phase2a_destroy(phase2a_cmp_t *cmp);
+
+int phase2a_setPhase1(phase2a_cmp_t *cmp, const phase1_t* phase1);
+
+int phase2a_getData(phase2a_cmp_t *cmp, double *data);
+
+
+#endif //PHASE2A_CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2b/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/CMakeLists.txt b/examples/dm_example/phase2b/CMakeLists.txt
index a65b422..9afb6c7 100644
--- a/examples/dm_example/phase2b/CMakeLists.txt
+++ b/examples/dm_example/phase2b/CMakeLists.txt
@@ -15,28 +15,23 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(
- private/include
- ../services
-)
-
-add_bundle(phase2b
+add_bundle(dm_example_phase2b
SYMBOLIC_NAME phase2b
VERSION 0.0.1
SOURCES
- private/src/phase2b_activator
- private/src/phase2b_cmp
+ src/phase2b_activator
+ src/phase2b_cmp
)
-
-#bundle_private_libs(phase2b dependency_manager)
+target_include_directories(dm_example_phase2b PRIVATE src)
+target_link_libraries(dm_example_phase2b PRIVATE dm_example_api)
IF(APPLE)
- target_link_libraries(phase2b PRIVATE -Wl,-all_load dependency_manager_static)
+ target_link_libraries(dm_example_phase2b PRIVATE -Wl,-all_load Celix::dependency_manager_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase2b PRIVATE -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_phase2b PRIVATE -Wl,--whole-archive Celix::dependency_manager_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase2b PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_phase2b PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_static -Wl,--no-whole-archive)
endif()
ENDIF()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2b/private/include/phase2b_cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/private/include/phase2b_cmp.h b/examples/dm_example/phase2b/private/include/phase2b_cmp.h
deleted file mode 100644
index 7ae0358..0000000
--- a/examples/dm_example/phase2b/private/include/phase2b_cmp.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.h
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PHASE2B_CMP_H
-#define PHASE2B_CMP_H
-
-#include "phase1.h"
-
-typedef struct phase2b_cmp_struct phase2b_cmp_t;
-
-phase2b_cmp_t *phase2b_create(void);
-int phase2b_init(phase2b_cmp_t *cmp);
-int phase2b_start(phase2b_cmp_t *cmp);
-int phase2b_stop(phase2b_cmp_t *cmp);
-int phase2b_deinit(phase2b_cmp_t *cmp);
-void phase2b_destroy(phase2b_cmp_t *cmp);
-
-int phase2b_setPhase1(phase2b_cmp_t *cmp, const phase1_t* phase1);
-
-int phase2b_getData(phase2b_cmp_t *cmp, double *data);
-
-
-#endif //PHASE2B_CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2b/private/src/phase2b_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/private/src/phase2b_activator.c b/examples/dm_example/phase2b/private/src/phase2b_activator.c
deleted file mode 100644
index c7692d4..0000000
--- a/examples/dm_example/phase2b/private/src/phase2b_activator.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- *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.
- */
-/*
- * activator.c
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <phase2b_cmp.h>
-
-#include "bundle_activator.h"
-#include "dm_activator.h"
-
-#include "phase1.h"
-#include "phase2.h"
-#include "phase2b_cmp.h"
-
-struct phase2b_activator_struct {
- phase2b_cmp_t *phase2bCmp;
- phase2_t phase2Serv;
-};
-
-celix_status_t dm_create(bundle_context_pt context, void **userData) {
- printf("phase2b: dm_create\n");
- *userData = calloc(1, sizeof(struct phase2b_activator_struct));
- return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
-}
-
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("phase2b: dm_init\n");
- celix_status_t status = CELIX_SUCCESS;
-
- struct phase2b_activator_struct *act = (struct phase2b_activator_struct *)userData;
-
- act->phase2bCmp = phase2b_create();
- if (act->phase2bCmp != NULL) {
-
- act->phase2Serv.handle = act->phase2bCmp;
- act->phase2Serv.getData = (void *)phase2b_getData;
-
- properties_pt props = properties_create();
- properties_set(props, "id", "phase2b");
-
- dm_component_pt cmp;
- component_create(context, "PHASE2B_PROCESSING_COMPONENT", &cmp);
- component_setImplementation(cmp, act->phase2bCmp);
- component_setCallbacksSafe(cmp, phase2b_cmp_t *, phase2b_init, phase2b_start, phase2b_stop, phase2b_deinit);
- component_addInterface(cmp, PHASE2_NAME, PHASE2_VERSION, &act->phase2Serv, props);
-
-
- dm_service_dependency_pt dep;
- serviceDependency_create(&dep);
- serviceDependency_setService(dep, PHASE1_NAME, PHASE1_RANGE_EXACT, NULL);
- serviceDependency_setCallbacksSafe(dep, phase2b_cmp_t*, const phase1_t*, phase2b_setPhase1, NULL, NULL, NULL, NULL);
- serviceDependency_setRequired(dep, true);
- serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
- component_addServiceDependency(cmp, dep);
-
- dependencyManager_add(manager, cmp);
- } else {
- status = CELIX_ENOMEM;
- }
-
- return status;
-}
-
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("phase2b: dm-destroy\n");
-
- struct phase2b_activator_struct *act = (struct phase2b_activator_struct *)userData;
- if (act->phase2bCmp != NULL) {
- phase2b_destroy(act->phase2bCmp);
- }
- free(act);
-
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2b/private/src/phase2b_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/private/src/phase2b_cmp.c b/examples/dm_example/phase2b/private/src/phase2b_cmp.c
deleted file mode 100644
index a74dcfa..0000000
--- a/examples/dm_example/phase2b/private/src/phase2b_cmp.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.c
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-
-#include "celix_threads.h"
-#include "phase2b_cmp.h"
-
-#define SLEEPTIME 2000000
-
-struct phase2b_cmp_struct {
- celix_thread_t thread;
- bool running;
- double currentValue;
- celix_thread_mutex_t mutex;
- const phase1_t* phase1Serv;
-};
-
-static void *phase2b_thread(void *data);
-
-phase2b_cmp_t *phase2b_create(void) {
- phase2b_cmp_t *cmp = calloc(1, sizeof(*cmp));
- if (cmp != NULL) {
- cmp->currentValue = 0.0;
- cmp->running = false;
- celixThreadMutex_create(&cmp->mutex, NULL);
- }
- return cmp;
-}
-
-int phase2b_init(phase2b_cmp_t *cmp) {
- printf("init phase2b\n");
- return 0;
-}
-
-int phase2b_start(phase2b_cmp_t *cmp) {
- printf("start phase2b\n");
- cmp->running = true;
- celixThread_create(&cmp->thread, NULL, phase2b_thread, cmp);
- return 0;
-}
-
-int phase2b_stop(phase2b_cmp_t *cmp) {
- printf("stop phase2b\n");
- cmp->running = false;
- celixThread_kill(cmp->thread, SIGUSR1);
- celixThread_join(cmp->thread, NULL);
- return 0;
-}
-
-int phase2b_deinit(phase2b_cmp_t *cmp) {
- printf("deinit phase2b\n");
- return 0;
-}
-
-void phase2b_destroy(phase2b_cmp_t *cmp) {
- celixThreadMutex_destroy(&cmp->mutex);
- free(cmp);
- printf("destroy phase2b\n");
-}
-
-int phase2b_setPhase1(phase2b_cmp_t *cmp, const phase1_t* phase1) {
- celixThreadMutex_lock(&cmp->mutex);
- cmp->phase1Serv = phase1;
- celixThreadMutex_unlock(&cmp->mutex);
- return 0;
-}
-
-static void *phase2b_thread(void *data) {
- phase2b_cmp_t *cmp = data;
- unsigned int counter;
-
- while (cmp->running) {
- celixThreadMutex_lock(&cmp->mutex);
- if (cmp->phase1Serv != NULL) {
- cmp->phase1Serv->getData(cmp->phase1Serv->handle, &counter);
- cmp->currentValue = counter / 1000;
- }
- celixThreadMutex_unlock(&cmp->mutex);
- usleep(SLEEPTIME);
- }
-
- celixThread_exit(NULL);
- return NULL;
-}
-
-int phase2b_getData(phase2b_cmp_t *cmp, double *data) {
- *data = cmp->currentValue;
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2b/src/phase2b_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/src/phase2b_activator.c b/examples/dm_example/phase2b/src/phase2b_activator.c
new file mode 100644
index 0000000..c7692d4
--- /dev/null
+++ b/examples/dm_example/phase2b/src/phase2b_activator.c
@@ -0,0 +1,95 @@
+/**
+ *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.
+ */
+/*
+ * activator.c
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <phase2b_cmp.h>
+
+#include "bundle_activator.h"
+#include "dm_activator.h"
+
+#include "phase1.h"
+#include "phase2.h"
+#include "phase2b_cmp.h"
+
+struct phase2b_activator_struct {
+ phase2b_cmp_t *phase2bCmp;
+ phase2_t phase2Serv;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+ printf("phase2b: dm_create\n");
+ *userData = calloc(1, sizeof(struct phase2b_activator_struct));
+ return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
+}
+
+celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+ printf("phase2b: dm_init\n");
+ celix_status_t status = CELIX_SUCCESS;
+
+ struct phase2b_activator_struct *act = (struct phase2b_activator_struct *)userData;
+
+ act->phase2bCmp = phase2b_create();
+ if (act->phase2bCmp != NULL) {
+
+ act->phase2Serv.handle = act->phase2bCmp;
+ act->phase2Serv.getData = (void *)phase2b_getData;
+
+ properties_pt props = properties_create();
+ properties_set(props, "id", "phase2b");
+
+ dm_component_pt cmp;
+ component_create(context, "PHASE2B_PROCESSING_COMPONENT", &cmp);
+ component_setImplementation(cmp, act->phase2bCmp);
+ component_setCallbacksSafe(cmp, phase2b_cmp_t *, phase2b_init, phase2b_start, phase2b_stop, phase2b_deinit);
+ component_addInterface(cmp, PHASE2_NAME, PHASE2_VERSION, &act->phase2Serv, props);
+
+
+ dm_service_dependency_pt dep;
+ serviceDependency_create(&dep);
+ serviceDependency_setService(dep, PHASE1_NAME, PHASE1_RANGE_EXACT, NULL);
+ serviceDependency_setCallbacksSafe(dep, phase2b_cmp_t*, const phase1_t*, phase2b_setPhase1, NULL, NULL, NULL, NULL);
+ serviceDependency_setRequired(dep, true);
+ serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
+ component_addServiceDependency(cmp, dep);
+
+ dependencyManager_add(manager, cmp);
+ } else {
+ status = CELIX_ENOMEM;
+ }
+
+ return status;
+}
+
+celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+ printf("phase2b: dm-destroy\n");
+
+ struct phase2b_activator_struct *act = (struct phase2b_activator_struct *)userData;
+ if (act->phase2bCmp != NULL) {
+ phase2b_destroy(act->phase2bCmp);
+ }
+ free(act);
+
+ return CELIX_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2b/src/phase2b_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/src/phase2b_cmp.c b/examples/dm_example/phase2b/src/phase2b_cmp.c
new file mode 100644
index 0000000..a74dcfa
--- /dev/null
+++ b/examples/dm_example/phase2b/src/phase2b_cmp.c
@@ -0,0 +1,115 @@
+/**
+ *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.
+ */
+/*
+ * publisher.c
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include "celix_threads.h"
+#include "phase2b_cmp.h"
+
+#define SLEEPTIME 2000000
+
+struct phase2b_cmp_struct {
+ celix_thread_t thread;
+ bool running;
+ double currentValue;
+ celix_thread_mutex_t mutex;
+ const phase1_t* phase1Serv;
+};
+
+static void *phase2b_thread(void *data);
+
+phase2b_cmp_t *phase2b_create(void) {
+ phase2b_cmp_t *cmp = calloc(1, sizeof(*cmp));
+ if (cmp != NULL) {
+ cmp->currentValue = 0.0;
+ cmp->running = false;
+ celixThreadMutex_create(&cmp->mutex, NULL);
+ }
+ return cmp;
+}
+
+int phase2b_init(phase2b_cmp_t *cmp) {
+ printf("init phase2b\n");
+ return 0;
+}
+
+int phase2b_start(phase2b_cmp_t *cmp) {
+ printf("start phase2b\n");
+ cmp->running = true;
+ celixThread_create(&cmp->thread, NULL, phase2b_thread, cmp);
+ return 0;
+}
+
+int phase2b_stop(phase2b_cmp_t *cmp) {
+ printf("stop phase2b\n");
+ cmp->running = false;
+ celixThread_kill(cmp->thread, SIGUSR1);
+ celixThread_join(cmp->thread, NULL);
+ return 0;
+}
+
+int phase2b_deinit(phase2b_cmp_t *cmp) {
+ printf("deinit phase2b\n");
+ return 0;
+}
+
+void phase2b_destroy(phase2b_cmp_t *cmp) {
+ celixThreadMutex_destroy(&cmp->mutex);
+ free(cmp);
+ printf("destroy phase2b\n");
+}
+
+int phase2b_setPhase1(phase2b_cmp_t *cmp, const phase1_t* phase1) {
+ celixThreadMutex_lock(&cmp->mutex);
+ cmp->phase1Serv = phase1;
+ celixThreadMutex_unlock(&cmp->mutex);
+ return 0;
+}
+
+static void *phase2b_thread(void *data) {
+ phase2b_cmp_t *cmp = data;
+ unsigned int counter;
+
+ while (cmp->running) {
+ celixThreadMutex_lock(&cmp->mutex);
+ if (cmp->phase1Serv != NULL) {
+ cmp->phase1Serv->getData(cmp->phase1Serv->handle, &counter);
+ cmp->currentValue = counter / 1000;
+ }
+ celixThreadMutex_unlock(&cmp->mutex);
+ usleep(SLEEPTIME);
+ }
+
+ celixThread_exit(NULL);
+ return NULL;
+}
+
+int phase2b_getData(phase2b_cmp_t *cmp, double *data) {
+ *data = cmp->currentValue;
+ return 0;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase2b/src/phase2b_cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/src/phase2b_cmp.h b/examples/dm_example/phase2b/src/phase2b_cmp.h
new file mode 100644
index 0000000..7ae0358
--- /dev/null
+++ b/examples/dm_example/phase2b/src/phase2b_cmp.h
@@ -0,0 +1,46 @@
+/**
+ *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.
+ */
+/*
+ * publisher.h
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef PHASE2B_CMP_H
+#define PHASE2B_CMP_H
+
+#include "phase1.h"
+
+typedef struct phase2b_cmp_struct phase2b_cmp_t;
+
+phase2b_cmp_t *phase2b_create(void);
+int phase2b_init(phase2b_cmp_t *cmp);
+int phase2b_start(phase2b_cmp_t *cmp);
+int phase2b_stop(phase2b_cmp_t *cmp);
+int phase2b_deinit(phase2b_cmp_t *cmp);
+void phase2b_destroy(phase2b_cmp_t *cmp);
+
+int phase2b_setPhase1(phase2b_cmp_t *cmp, const phase1_t* phase1);
+
+int phase2b_getData(phase2b_cmp_t *cmp, double *data);
+
+
+#endif //PHASE2B_CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/CMakeLists.txt b/examples/dm_example/phase3/CMakeLists.txt
index 9547e04..1784057 100644
--- a/examples/dm_example/phase3/CMakeLists.txt
+++ b/examples/dm_example/phase3/CMakeLists.txt
@@ -15,28 +15,23 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(
- private/include
- ../services
-)
-
-add_bundle(phase3
+add_bundle(dm_example_phase3
SYMBOLIC_NAME phase3
VERSION 0.0.1
SOURCES
- private/src/phase3_activator
- private/src/phase3_cmp
+ src/phase3_activator
+ src/phase3_cmp
)
-
-#bundle_private_libs(phase3 dependency_manager)
+target_include_directories(dm_example_phase3 PRIVATE src)
+target_link_libraries(dm_example_phase3 PRIVATE dm_example_api)
IF(APPLE)
- target_link_libraries(phase3 PRIVATE -Wl,-all_load dependency_manager_static)
+ target_link_libraries(dm_example_phase3 PRIVATE -Wl,-all_load dependency_manager_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase3 PRIVATE -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_phase3 PRIVATE -Wl,--whole-archive Celix::dependency_manager_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase3 PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
+ target_link_libraries(dm_example_phase3 PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_static -Wl,--no-whole-archive)
endif()
ENDIF()
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase3/private/include/phase3_cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/private/include/phase3_cmp.h b/examples/dm_example/phase3/private/include/phase3_cmp.h
deleted file mode 100644
index 9c63845..0000000
--- a/examples/dm_example/phase3/private/include/phase3_cmp.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.h
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PHASE3_CMP_H
-#define PHASE3_CMP_H
-
-#include "phase2.h"
-
-typedef struct phase3_cmp_struct phase3_cmp_t;
-
-phase3_cmp_t *phase3_create();
-int phase3_init(phase3_cmp_t *cmp);
-int phase3_start(phase3_cmp_t *cmp);
-int phase3_stop(phase3_cmp_t *cmp);
-int phase3_deinit(phase3_cmp_t *cmp);
-void phase3_destroy(phase3_cmp_t *cmp);
-
-int phase3_addPhase2(phase3_cmp_t *cmp, const phase2_t* phase2);
-int phase3_removePhase2(phase3_cmp_t *cmp, const phase2_t* phase2);
-
-
-#endif //PHASE3_CMP_H
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase3/private/src/phase3_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/private/src/phase3_activator.c b/examples/dm_example/phase3/private/src/phase3_activator.c
deleted file mode 100644
index 64b7a0b..0000000
--- a/examples/dm_example/phase3/private/src/phase3_activator.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- *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.
- */
-/*
- * activator.c
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-#include "dm_activator.h"
-
-#include "phase2.h"
-#include "phase3_cmp.h"
-
-struct phase3_activator_struct {
- phase3_cmp_t *phase3Cmp;
-};
-
-celix_status_t dm_create(bundle_context_pt context, void **userData) {
- printf("phase3: dm_create\n");
- *userData = calloc(1, sizeof(struct phase3_activator_struct));
- return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
-}
-
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("phase3: dm_init\n");
- celix_status_t status = CELIX_SUCCESS;
-
- struct phase3_activator_struct *act = (struct phase3_activator_struct *)userData;
-
- act->phase3Cmp = phase3_create();
- if (act->phase3Cmp != NULL) {
-
- dm_component_pt cmp;
- component_create(context, "PHASE3_PROCESSING_COMPONENT", &cmp);
- component_setImplementation(cmp, act->phase3Cmp);
- component_setCallbacksSafe(cmp, phase3_cmp_t *, phase3_init, phase3_start, phase3_stop, phase3_deinit);
-
- dm_service_dependency_pt dep;
- serviceDependency_create(&dep);
- serviceDependency_setService(dep, PHASE2_NAME, NULL, NULL);
- serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND); //SUSPEND Strategy is default
- serviceDependency_setCallbacksSafe(dep, phase3_cmp_t*, const phase2_t*, NULL, phase3_addPhase2, NULL, phase3_removePhase2, NULL);
- serviceDependency_setRequired(dep, true);
- component_addServiceDependency(cmp, dep);
-
- dependencyManager_add(manager, cmp);
- } else {
- status = CELIX_ENOMEM;
- }
-
- return status;
-}
-
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("phase3: dm-destroy\n");
-
- struct phase3_activator_struct *act = (struct phase3_activator_struct *)userData;
- if (act->phase3Cmp != NULL) {
- phase3_destroy(act->phase3Cmp);
- }
- free(act);
-
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase3/private/src/phase3_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/private/src/phase3_cmp.c b/examples/dm_example/phase3/private/src/phase3_cmp.c
deleted file mode 100644
index 47cb720..0000000
--- a/examples/dm_example/phase3/private/src/phase3_cmp.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- *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.
- */
-/*
- * publisher.c
- *
- * \date Oct 29, 2015
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-
-#include "array_list.h"
-#include "celix_threads.h"
-#include "phase3_cmp.h"
-
-#define SLEEPTIME 2000000
-
-struct phase3_cmp_struct {
- celix_thread_t thread;
- bool running;
- double currentValue;
- array_list_pt phase2Services; //phase2_t *
-};
-
-static void *phase3_thread(void *data);
-
-phase3_cmp_t *phase3_create() {
- phase3_cmp_t *cmp = calloc(1, sizeof(*cmp));
- if (cmp != NULL) {
- cmp->currentValue = 0.0;
- cmp->running = false;
- arrayList_create(&cmp->phase2Services);
- }
- return cmp;
-}
-
-int phase3_init(phase3_cmp_t *cmp) {
- printf("init phase3\n");
- return 0;
-}
-
-int phase3_start(phase3_cmp_t *cmp) {
- printf("start phase3\n");
- cmp->running = true;
- celixThread_create(&cmp->thread, NULL, phase3_thread, cmp);
- return 0;
-}
-
-int phase3_stop(phase3_cmp_t *cmp) {
- printf("stop phase3\n");
- cmp->running = false;
- celixThread_kill(cmp->thread, SIGUSR1);
- celixThread_join(cmp->thread, NULL);
- return 0;
-}
-
-int phase3_deinit(phase3_cmp_t *cmp) {
- printf("deinit phase3\n");
- return 0;
-}
-
-void phase3_destroy(phase3_cmp_t *cmp) {
- arrayList_destroy(cmp->phase2Services);
- free(cmp);
- printf("destroy phase3\n");
-}
-
-int phase3_addPhase2(phase3_cmp_t *cmp, const phase2_t* phase2) {
- arrayList_add(cmp->phase2Services, (void*)phase2);
- return 0;
-}
-
-int phase3_removePhase2(phase3_cmp_t *cmp, const phase2_t *phase2) {
- arrayList_removeElement(cmp->phase2Services, (void*)phase2);
- return 0;
-}
-
-
-static void *phase3_thread(void *data) {
- phase3_cmp_t *cmp = data;
- int size;
- int i;
- double value;
-
- while (cmp->running) {
- size = arrayList_size(cmp->phase2Services);
- for (i = 0; i < size; i += 1) {
- const phase2_t* serv = arrayList_get(cmp->phase2Services, i);
- serv->getData(serv->handle, &value);
- printf("PHASE3: Data from %p is %f\n", serv, value);
- }
- usleep(SLEEPTIME);
- }
-
- celixThread_exit(NULL);
- return NULL;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase3/src/phase3_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/src/phase3_activator.c b/examples/dm_example/phase3/src/phase3_activator.c
new file mode 100644
index 0000000..64b7a0b
--- /dev/null
+++ b/examples/dm_example/phase3/src/phase3_activator.c
@@ -0,0 +1,84 @@
+/**
+ *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.
+ */
+/*
+ * activator.c
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+
+#include "bundle_activator.h"
+#include "dm_activator.h"
+
+#include "phase2.h"
+#include "phase3_cmp.h"
+
+struct phase3_activator_struct {
+ phase3_cmp_t *phase3Cmp;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+ printf("phase3: dm_create\n");
+ *userData = calloc(1, sizeof(struct phase3_activator_struct));
+ return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
+}
+
+celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+ printf("phase3: dm_init\n");
+ celix_status_t status = CELIX_SUCCESS;
+
+ struct phase3_activator_struct *act = (struct phase3_activator_struct *)userData;
+
+ act->phase3Cmp = phase3_create();
+ if (act->phase3Cmp != NULL) {
+
+ dm_component_pt cmp;
+ component_create(context, "PHASE3_PROCESSING_COMPONENT", &cmp);
+ component_setImplementation(cmp, act->phase3Cmp);
+ component_setCallbacksSafe(cmp, phase3_cmp_t *, phase3_init, phase3_start, phase3_stop, phase3_deinit);
+
+ dm_service_dependency_pt dep;
+ serviceDependency_create(&dep);
+ serviceDependency_setService(dep, PHASE2_NAME, NULL, NULL);
+ serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND); //SUSPEND Strategy is default
+ serviceDependency_setCallbacksSafe(dep, phase3_cmp_t*, const phase2_t*, NULL, phase3_addPhase2, NULL, phase3_removePhase2, NULL);
+ serviceDependency_setRequired(dep, true);
+ component_addServiceDependency(cmp, dep);
+
+ dependencyManager_add(manager, cmp);
+ } else {
+ status = CELIX_ENOMEM;
+ }
+
+ return status;
+}
+
+celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+ printf("phase3: dm-destroy\n");
+
+ struct phase3_activator_struct *act = (struct phase3_activator_struct *)userData;
+ if (act->phase3Cmp != NULL) {
+ phase3_destroy(act->phase3Cmp);
+ }
+ free(act);
+
+ return CELIX_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/1836cf84/examples/dm_example/phase3/src/phase3_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/src/phase3_cmp.c b/examples/dm_example/phase3/src/phase3_cmp.c
new file mode 100644
index 0000000..47cb720
--- /dev/null
+++ b/examples/dm_example/phase3/src/phase3_cmp.c
@@ -0,0 +1,116 @@
+/**
+ *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.
+ */
+/*
+ * publisher.c
+ *
+ * \date Oct 29, 2015
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include "array_list.h"
+#include "celix_threads.h"
+#include "phase3_cmp.h"
+
+#define SLEEPTIME 2000000
+
+struct phase3_cmp_struct {
+ celix_thread_t thread;
+ bool running;
+ double currentValue;
+ array_list_pt phase2Services; //phase2_t *
+};
+
+static void *phase3_thread(void *data);
+
+phase3_cmp_t *phase3_create() {
+ phase3_cmp_t *cmp = calloc(1, sizeof(*cmp));
+ if (cmp != NULL) {
+ cmp->currentValue = 0.0;
+ cmp->running = false;
+ arrayList_create(&cmp->phase2Services);
+ }
+ return cmp;
+}
+
+int phase3_init(phase3_cmp_t *cmp) {
+ printf("init phase3\n");
+ return 0;
+}
+
+int phase3_start(phase3_cmp_t *cmp) {
+ printf("start phase3\n");
+ cmp->running = true;
+ celixThread_create(&cmp->thread, NULL, phase3_thread, cmp);
+ return 0;
+}
+
+int phase3_stop(phase3_cmp_t *cmp) {
+ printf("stop phase3\n");
+ cmp->running = false;
+ celixThread_kill(cmp->thread, SIGUSR1);
+ celixThread_join(cmp->thread, NULL);
+ return 0;
+}
+
+int phase3_deinit(phase3_cmp_t *cmp) {
+ printf("deinit phase3\n");
+ return 0;
+}
+
+void phase3_destroy(phase3_cmp_t *cmp) {
+ arrayList_destroy(cmp->phase2Services);
+ free(cmp);
+ printf("destroy phase3\n");
+}
+
+int phase3_addPhase2(phase3_cmp_t *cmp, const phase2_t* phase2) {
+ arrayList_add(cmp->phase2Services, (void*)phase2);
+ return 0;
+}
+
+int phase3_removePhase2(phase3_cmp_t *cmp, const phase2_t *phase2) {
+ arrayList_removeElement(cmp->phase2Services, (void*)phase2);
+ return 0;
+}
+
+
+static void *phase3_thread(void *data) {
+ phase3_cmp_t *cmp = data;
+ int size;
+ int i;
+ double value;
+
+ while (cmp->running) {
+ size = arrayList_size(cmp->phase2Services);
+ for (i = 0; i < size; i += 1) {
+ const phase2_t* serv = arrayList_get(cmp->phase2Services, i);
+ serv->getData(serv->handle, &value);
+ printf("PHASE3: Data from %p is %f\n", serv, value);
+ }
+ usleep(SLEEPTIME);
+ }
+
+ celixThread_exit(NULL);
+ return NULL;
+}