This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to refs/heads/develop by this push:
new 76c503c CELIX-461: Refactors hello world cxx example
76c503c is described below
commit 76c503c1bca719a6b1033af378d7e9183dc386f8
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sat Apr 27 16:49:59 2019 +0200
CELIX-461: Refactors hello world cxx example
---
.../celix-examples/hello_world_cxx/src/BundleActivator.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/examples/celix-examples/hello_world_cxx/src/BundleActivator.cc
b/examples/celix-examples/hello_world_cxx/src/BundleActivator.cc
index f8b2c1c..2d83bdc 100644
--- a/examples/celix-examples/hello_world_cxx/src/BundleActivator.cc
+++ b/examples/celix-examples/hello_world_cxx/src/BundleActivator.cc
@@ -27,17 +27,17 @@ namespace /*anon*/ {
class BundleActivator {
public:
BundleActivator(std::shared_ptr<celix::dm::DependencyManager> _mng) :
mng{_mng} {
- celix_bundle_context_t *ctx = mng->bundleContext();
- celix_bundle_t *bnd = celix_bundleContext_getBundle(ctx);
- bndId = celix_bundle_getId(bnd);
- std::cout << "Hello world from C++ bundle with id " << bndId <<
std::endl;
+ std::cout << "Hello world from C++ bundle with id " << bndId() <<
std::endl;
}
~BundleActivator() {
- std::cout << "Goodbye world from C++ bundle with id " << bndId <<
std::endl;
+ std::cout << "Goodbye world from C++ bundle with id " << bndId()
<< std::endl;
}
private:
+ long bndId() const {
+ return
celix_bundle_getId(celix_bundleContext_getBundle(mng->bundleContext()));
+ }
+
std::shared_ptr<celix::dm::DependencyManager> mng;
- long bndId;
};
}