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 2018/01/30 19:30:12 UTC
[28/54] [abbrv] celix git commit: CELIX-417: Refactors CMake usage
for example embedded, dm and dm_cxx
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