Giter Club home page Giter Club logo

cppmicroservices / cppmicroservices Goto Github PK

View Code? Open in Web Editor NEW
785.0 67.0 247.0 25.76 MB

An OSGi-like C++ dynamic module system and service registry

Home Page: http://cppmicroservices.org

License: Apache License 2.0

C++ 93.44% CSS 0.04% CMake 5.59% Shell 0.07% Scheme 0.01% HTML 0.20% Python 0.53% JavaScript 0.10% Batchfile 0.04% PowerShell 0.01%
c-plus-plus osgi microservice component-architecture boost c cpp cpp17 cross-platform microservices

cppmicroservices's Introduction

Continuous Integration Status

Branch +

+
GCC 7.5.0 and 9.4.0 ---------------------------+ Clang 9.0 ---------------------------+ Xcode 13.2 ---------------------------+ Xcode 13.4 Visual Studio 2019 --------------------------------------+ Visual Studio 2022 --------------------------------------+ MinGW-w64 --------------------------------------+

----------------------------------------+

----------------------------------------+

----------------------------------------+
master BuildAndTestNix(master) BuildAndTestWindows(master) Code Coverage Status
development BuildAndTestNix BuildAndTestWindows Code Coverage Status (development)

Coverity Scan Build Status

Performance Status

C++ Micro Services

Documentation Status (stable) Documentation Status (development)

Download

Introduction

The C++ Micro Services project is a collection of components for building modular and dynamic service-oriented applications. It is based on OSGi, but tailored to support native cross-platform solutions.

Proper usage of C++ Micro Services patterns and concepts leads to systems with one or more of the following properties:

  • Re-use of software components
  • Loose coupling between service providers and consumers
  • Separation of concerns, based on a service-oriented design
  • Clean APIs based on service interfaces
  • Extensible and reconfigurable systems

Requirements

None, except a recent enough C++ compiler. All third-party library dependencies are included and mostly used for implementation details.

Supported Platforms

The library makes use of C++17 language and library features and compiles on many different platforms.

Recommended absolute minimum required compiler versions:

  • GCC 7.5.0
  • Clang 9.0
  • Clang from Xcode 10.0 (not tested)
  • Visual Studio 2017 (MSVC++ 15.0) (not tested)

Not all of the absolute minimum compiler versions are tested (as noted). We test and recommend the following compilers:

  • GCC 11.3.0
  • Clang 11.0
  • Clang from Xcode 13.2 and 13.4
  • Visual Studio 2019 and 2022

Recommended minimum required CMake version:

  • CMake 3.17.0

For all CI builds through GitHub Actions, the CMake version (and version of other provided software) we use is determined by the software provided on the GitHub-hosted runners.

For information about the specific versions of software the runners use, please see the following resources:

Below is a list of tested compiler/OS combinations:

  • GCC 7.5.0 (Ubuntu 20.04)
  • GCC 11.3.0 (Ubuntu 22.04)
  • Clang 11.0.0 (Ubuntu 20.04)
  • Apple Clang 13.0.0.13000029, Xcode 13.2.0 (OS X 11.7.6)
  • Apple Clang 14.0.0.14000029, Xcode 13.4.0 (OS X 12.6.5)
  • Visual Studio 2019
  • Visual Studio 2022
  • MinGW-w64

The C++ Micro Services project was initially developed at the German Cancer Research Center. Its source code is hosted as a GitHub Project. See the COPYRIGHT file in the top-level directory for detailed copyright information.

This project is licensed under the Apache License v2.0.

Code of Conduct

CppMicroServices.org welcomes developers with different backgrounds and a broad range of experience. A diverse and inclusive community will create more great ideas, provide more unique perspectives, and produce more outstanding code. Our aim is to make the CppMicroServices community welcoming to everyone.

To provide clarity of what is expected of our members, CppMicroServices has adopted the code of conduct defined by contributor-covenant.org. This document is used across many open source communities, and we believe it articulates our values well.

Please refer to the Code of Conduct <code-of-conduct> for further details.

Quick Start

Start by cloning the project repository. It is important to note that since the project utilizes git submodules, you must clone the repository with the --recursive flag. This will also clone the submodules and place them in their respective directories. For further reading about how git submodules work and how to clone them into an already existing repository on your disk, please see Git's documentation.

Essentially, the C++ Micro Services library provides you with a powerful dynamic service registry on top of a managed lifecycle. The framework manages, among other things, logical units of modularity called bundles that are contained in shared or static libraries. Each bundle within a library has an associated cppmicroservices::BundleContext object, through which the service registry is accessed.

To query the registry for a service object implementing one or more specific interfaces, the code would look like this:

#include "cppmicroservices/BundleContext.h"
#include "SomeInterface.h"

using namespace cppmicroservices;

void UseService(BundleContext context)
{
  auto serviceRef = context.GetServiceReference<SomeInterface>();
  if (serviceRef)
  {
    auto service = context.GetService(serviceRef);
    if (service) { /* do something */ }
  }
}

Registering a service object against a certain interface looks like this:

#include "cppmicroservices/BundleContext.h"
#include "SomeInterface.h"

using namespace cppmicroservices;

void RegisterSomeService(BundleContext context, const std::shared_ptr<SomeInterface>& service)
{
  context.RegisterService<SomeInterface>(service);
}

The OSGi service model additionally allows to annotate services with properties and using these properties during service look-ups. It also allows to track the life-cycle of service objects. Please see the Documentation for more examples and tutorials and the API reference. There is also a blog post about OSGi Lite for C++.

Git Branch Conventions

The Git repository contains two eternal branches, master and development. The master branch contains production quality code and its HEAD points to the latest released version. The development branch is the default branch and contains the current state of development. Pull requests by default target the development branch. See the CONTRIBUTING <contributing> file for details about the contribution process.

Git Hooks General Information

The CppMicroServices repository defines its git hooks in the .githooks directory. This directory is set as the directory for git hooks via executing git config core.hooksPath <path> in our CMakeLists.txt file.

Git Hooks Failure Help

If the clang-format pre-commit hook fails because clang-format is not installed, please install it and put it on the path. Similarly, if git-clang-format is not installed, do the same. git-clang-format comes with the LLVM distribution of clang-format.

If this is not feasible for you, you can specify --no-verify when committing your changes. This is heavily discouraged and you must provide a justification as to why you are unable to format your commit.

We reserve the right to reject any pull requests that are not properly formatted and do not have a valid justification specified.

cppmicroservices's People

Contributors

aadityap-mathworks avatar achristoforides avatar ameya7295 avatar antiexe avatar at3103 avatar brianweed avatar burgch avatar bwestcot avatar carneyweb avatar cjgoch avatar cnd avatar csol314 avatar dingxiangfei2009 avatar gulfmaan avatar insi-eb avatar jeeyuen-rick avatar jeffdiclemente avatar karthikreddy09 avatar kevinleemw avatar kkumar45 avatar ksubramz avatar moraaljj avatar mrlegowatch avatar mw-cwilcox avatar pelliott-mathworks avatar saschazelzer avatar shane-riley avatar shivamnegi avatar tcormackmw avatar thrtouati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cppmicroservices's Issues

CppMicroServices fails to build using GCC 4.9.3 on Linux 64-bit

CppMicroServices 2.1.0 fails to build using GCC 4.9.3 with C++11 (-std=c++11).
The build error would also occur in the latest development branch as well.

It appears that the build error occurs due a combination of factors:

  1. Both the std C++ header and the tr1 header for functional are found by the cmake build script (i.e. both US_HAVE_FUNCTIONAL_H and US_HAVE_TR1_FUNCTIONAL_H are defined).
  2. usListenerFunctor_p.h is coded to include the tr1 header (if found) before it tries to include the std C++ header
  3. the cmake buid script only defines US_HAVE_STD_FUNCTION and as a result, #define US_FUNCTION_TYPE std::function is used.

I have not looked into this further and I can only assume that in prior GCC versions, std::function and std::tr1::function were equivalent (since we can build CppMicroServices with GCC 4.7.2 using C++11).

Modifying usListenerFunctor_p.h to order the defines as such fixes the build error:

#ifdef US_HAVE_FUNCTIONAL_H
  #include <functional>
#elif defined(US_HAVE_TR1_FUNCTIONAL_H)
  #include <tr1/functional>
#endif

#ifdef US_HAVE_STD_FUNCTION
  #define US_FUNCTION_TYPE std::function
#elif defined(US_HAVE_TR1_FUNCTION)
  #define US_FUNCTION_TYPE std::tr1::function
#endif

Another approach would be to combine the two sets of #ifdefs in a nested fashion.

#if defined (US_HAVE_FUNCTIONAL_H)
  #include <functional>
  #ifdef US_HAVE_STD_FUNCTION
    #define US_FUNCTION_TYPE std::function
  #endif
#elif defined(US_HAVE_TR1_FUNCTIONAL_H)
  #include <tr1/functional>
  #ifdef US_HAVE_TR1_FUNCTION
    #define US_FUNCTION_TYPE std::tr1::function
  #endif
#else
#error Can't find a functional implementation
#endif

Snippet of build output

[ 14%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceHooks.cpp.o
cd /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src && /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/bin/g++   -DCppMicroServices_EXPORTS -DUS_FORCE_MODULE_INIT -O2 -pipe -pthread -fPIC  -std=c++11  -Werror -Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo -fdiagnostics-show-option -fstack-protector-all -fvisibility=hidden -fvisibility-inlines-hidden -O2 -pipe -pthread -fPIC  -std=c++11  -D_FORTIFY_SOURCE=2 -fPIC -I/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include -I/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/util -I/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service -I/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/module    -o CMakeFiles/CppMicroServices.dir/service/usServiceHooks.cpp.o -c /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:33: error: ‘function’ in namespace ‘std’ does not name a template type
   #define US_FUNCTION_TYPE std::function
                                 ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:49:3: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
   US_MODULE_LISTENER_FUNCTOR ModuleListenerMemberFunctor(X* x, void (X::*memFn)(const US_PREPEND_NAMESPACE(ModuleEvent)))
   ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:28: error: ‘function’ is not a member of ‘std’
   #define US_FUNCTION_TYPE std::function
                            ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:52:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
   struct ModuleListenerCompare : std::binary_function<std::pair<US_MODULE_LISTENER_FUNCTOR, void*>,
                                                                 ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:28: note: suggested alternative:
   #define US_FUNCTION_TYPE std::function
                            ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:52:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
   struct ModuleListenerCompare : std::binary_function<std::pair<US_MODULE_LISTENER_FUNCTOR, void*>,
                                                                 ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:33:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/tr1/functional:1592:11: note:   ‘std::tr1::function’
     class function;
           ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:28: error: ‘function’ is not a member of ‘std’
   #define US_FUNCTION_TYPE std::function
                            ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:52:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
   struct ModuleListenerCompare : std::binary_function<std::pair<US_MODULE_LISTENER_FUNCTOR, void*>,
                                                                 ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:28: note: suggested alternative:
   #define US_FUNCTION_TYPE std::function
                            ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:52:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
   struct ModuleListenerCompare : std::binary_function<std::pair<US_MODULE_LISTENER_FUNCTOR, void*>,
                                                                 ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:33:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/tr1/functional:1592:11: note:   ‘std::tr1::function’
     class function;
           ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:99: error: wrong number of template arguments (1, should be 2)
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                                                                                   ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:52:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
   struct ModuleListenerCompare : std::binary_function<std::pair<US_MODULE_LISTENER_FUNCTOR, void*>,
                                                                 ^
In file included from /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/bits/stl_algobase.h:64:0,
                 from /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/bits/stl_tree.h:61,
                 from /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/map:60,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:26,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/bits/stl_pair.h:96:12: error: provided for ‘template<class _T1, class _T2> struct std::pair’
     struct pair
            ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:52:98: error: wrong number of template arguments (2, should be 3)
   struct ModuleListenerCompare : std::binary_function<std::pair<US_MODULE_LISTENER_FUNCTOR, void*>,
                                                                                                  ^
In file included from /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/bits/stl_tree.h:63:0,
                 from /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/map:60,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:26,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/bits/stl_function.h:118:12: error: provided for ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’
     struct binary_function
            ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:28: error: ‘function’ is not a member of ‘std’
   #define US_FUNCTION_TYPE std::function
                            ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
                                                       std::pair<US_MODULE_LISTENER_FUNCTOR, void*>, bool>
                                                                 ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:28: note: suggested alternative:
   #define US_FUNCTION_TYPE std::function
                            ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
                                                       std::pair<US_MODULE_LISTENER_FUNCTOR, void*>, bool>
                                                                 ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:33:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/tr1/functional:1592:11: note:   ‘std::tr1::function’
     class function;
           ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:28: error: ‘function’ is not a member of ‘std’
   #define US_FUNCTION_TYPE std::function
                            ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
                                                       std::pair<US_MODULE_LISTENER_FUNCTOR, void*>, bool>
                                                                 ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:39:28: note: suggested alternative:
   #define US_FUNCTION_TYPE std::function
                            ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:36: note: in expansion of macro ‘US_FUNCTION_TYPE’
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                    ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
                                                       std::pair<US_MODULE_LISTENER_FUNCTOR, void*>, bool>
                                                                 ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:33:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/tr1/functional:1592:11: note:   ‘std::tr1::function’
     class function;
           ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:44:99: error: wrong number of template arguments (1, should be 2)
 #define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
                                                                                                   ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:65: note: in expansion of macro ‘US_MODULE_LISTENER_FUNCTOR’
                                                       std::pair<US_MODULE_LISTENER_FUNCTOR, void*>, bool>
                                                                 ^
In file included from /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/bits/stl_algobase.h:64:0,
                 from /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/bits/stl_tree.h:61,
                 from /mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/map:60,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:26,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/hub/3rdparty/internal/1304863/glnxa64/gcc-4.9.3/include/c++/4.9.3/bits/stl_pair.h:96:12: error: provided for ‘template<class _T1, class _T2> struct std::pair’
     struct pair
            ^
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usModuleContext.h:27:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.tpp:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTrackerPrivate.h:170,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.tpp:23,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:598,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:93: error: expected class-name before ‘void’
                                                       std::pair<US_MODULE_LISTENER_FUNCTOR, void*>, bool>
                                                                                             ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:93: error: expected ‘{’ before ‘void’
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:98: error: expected unqualified-id before ‘>’ token
                                                       std::pair<US_MODULE_LISTENER_FUNCTOR, void*>, bool>
                                                                                                  ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usListenerFunctors_p.h:53:98: error: expected initializer before ‘>’ token
In file included from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usServiceInterface.h:26:0,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceReference.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceTracker.h:28,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks_p.h:25,
                 from /mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:22:
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/include/usConfig.h:106:29: error: expected ‘}’ at end of input
   # define US_END_NAMESPACE }
                             ^
/mathworks/devel/sandbox/jdicleme/3p-tmw/3p/derived/glnxa64/CppMicroServices/src/service/usServiceHooks.cpp:283:1: note: in expansion of macro ‘US_END_NAMESPACE’
 US_END_NAMESPACE
 ^

Use C++11 features

Investigate the possible usage of C++11 language and library features and their implications on the minimal required compiler versions.

Features to consider:

  • unordered_set / map
  • function (and binders)
  • shared_ptr / unique_ptr
  • concurrency

Rework static module system

Static modules have currently some issues:

  • Executables linking static modules are not properly initialized and their resources are not available.
  • They share one module context with the importing module (or the CppMicroServices library in a complete static set-up) which leads to different runtime behaviour.
  • The macros for module initialization are somewhat complicated due to the current system

Support last modified time for embedded resources

Embedded resources represented as ModuleResource objects should support last modified time data. This would be the last modified time of the file on the file system which is embedded into the module.

Rename 'REGISTERED' macro

Hi, I got wxwidgets running as a cppmicroservices module, but while getting it to work, I encountered this issue:

...cppmicroservices\core\include\usServiceEvent.h(29): fatal error C1189: #error :
The REGISTERED preprocessor define clashes with the ServiceEvent::REGISTERED enum type. Try to reorder your includes, compile with WIN32_LEAN_AND_MEAN, or undef the REGISTERED macro befor including this header. 
[C:\Users\Azriel\dev\bii\sl_desktop_demo_wx\bii\build\azriel_sl_desktop_demo_wx\azriel_sl_desktop_demo_wx_test_main.vcxproj]

If my includes have an #undef in the following order, the compilation succeeds:

#include "fenix/wxwidgets/wx/wxprec.h"
#ifndef WX_PRECOMP
    #include "fenix/wxwidgets/wx/wx.h"
#endif
#undef REGISTERED

#include <azriel/cppmicroservices/core/include/usModuleRegistry.h>

I just noticed, there's a typo: befor.

I can make a PR, but what should I call the macro? US_REGISTERED has a double meaning.

Let the framework handle the bundle.name property

Currently, the module.name property is required to be present in a custom manifest.json file. The MODULE_NAME define contains this information but it is not recorded in the compiled object anymore (it was recorded in the deprecated ModuleInfo object previously).

It would be nice to not require a custom manifest.json file and record the module name in the meta data automatically.

Extend module life-cycle states

The work related to issue #15 allows the retrieval of module properties without loading the module's shared library. This leads to new module life-cycle states, e.g. to be able to access a module's properties, it must first be installed into the system to be known to other modules.

Use managed pointers for services, modules and the framework

With the newly introduced life-cycle of the framework itself and its associated modules, a Module* could outlive its association with the framework.

A Framework* instance could be shared between different parties.

Service instances currently need to be managed by the registering party. Using shared pointer semantics could ease memory management and keep track of used "handles" from modules within other modules and make ungetService calls superfluous.

Change System Bundle ID to 0

The OSGi spec says that the system bundle should have an ID of 0.
Currently, the CppMicroServices bundle sets its ID to 1.

Success of the usModuleResourceTest depends on line ending convention

In the current implementation the test tests the number of characters in the file. It is assumed, that there is one line ending character on linux and two on windows.

The assumption is usually correct, however the test might fail if git is used for the administration of the test data and the "autocrlf" option is incorrectly set.

Proper configuration is:

Windows: true
Linux: input

I will add a comment to the test linking to this issue in order to document this behaviour.

Use JSON format in Any::ToString()

The Any class has a generic ToString() method. It should use a standard notation for printing its value. JSON is a good fit for this purpose.

Output exception details (if available) for troubleshooting

In some cases where a try{} catch{} block is used to call module code and output error text, there is a separate catch for std::exception type to allow printing the exception what() message. In other cases, only a catch-all ... is used.

The specific one I ran into is in src/service/usServiceListeners.cpp within ServiceListeners::ServiceChanged.

Resource compiler not found error

If the CppMicroServices code is included and configured within a larger project, the usResourceCompiler target is sometimes not handled correctly.

Comparison of service listener objects is buggy on VS 2008

For Visual Studio 2008, a custom functor implementation is used for service listener objects (instead of std::(tr1)::function). The target() method returns different values for different service listener objects pointing to the same member function, which leads to mismatches when removing a previously registered member function from the listener registry.

usResourceCompiler needs a verbose option

In the current implementation the only way to see some output in the terminal when the resource compiler is run, is by rebuilding the tool with preprocessor flag DEBUG_TRACE set. A command line option "-v" would be helpful.

Build fails on Windows with VS 2012 RC due to CreateMutex

Hi,

CppMicroServices builds for me under MinGW, but fails to compile under VS 2012 RC with the platform SDK v7. The build fails when it hits ::CreateMutex. It builds if I use xxxW version, ::CreateMutexW, instead. I'm guessing MinGW defines a CreateMutex macro and the Platform SDK doesn't, but my knowledge of the Windows APIs is minimal.

Possible multithreading dead locks in CppMicroServices

We used Valgrind Helgrind (http://valgrind.org/docs/manual/hg-manual.html ) to check thread safety in our code written so far. Among the reports generated by Helgrind on the unit-test executables of multiple modules, we see many instances of possible deadlocks related to libCppMicroServices. These are situations in which two threads acquire the same two mutex locks, but in opposite orders, i.e., a scenario that can potentially lead to dead locks if the relative timing of the two threads is interleaved in an unfortunate way. There are many instances of this error (thousands), but the copied error message below, in blue, is a representative sample.

As you can see, one thread acquires the two locks in the order of 0xEB58B68 and 0xEB33860, but another thread acquires the locks in the opposite order.

Observed (incorrect) order is: acquisition of lock at 0xEB58B68
==21976== at 0x4C2BAF5: pthread_mutex_lock (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==21976== by 0x860C804: us::ServiceReferenceBasePrivate::GetService(us::Module_) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bi
n/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x861ADBF: us::ModuleContext::GetService(us::ServiceReferenceBase const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/mat
lab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x432469: TestActivator::serviceProviderRegistered() (usModuleContext.h:615)
==21976== by 0x6CD5281: CppUnit::TestCaseMethodFunctor::operator()() const (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)
==21976== by 0x6CCB07E: CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)
==21976== by 0x6CD23F9: CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)
==21976== by 0x6CDB254: CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test_, std::string const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)
==21976== by 0x6CD5001: CppUnit::TestCase::run(CppUnit::TestResult_) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)
==21976== by 0x6CD55E2: CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult_) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)
==21976== by 0x6CD54F5: CppUnit::TestComposite::run(CppUnit::TestResult_) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)
==21976== by 0x6CD55E2: CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult_) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)
==21976==
==21976== followed by a later acquisition of lock at 0xEB33860
==21976== at 0x4C2BAF5: pthread_mutex_lock (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==21976== by 0x8613AC4: us::ServiceRegistry::Get(us::ModulePrivate_, std::string const&) const (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x861AD36: us::ModuleContext::GetServiceReference(std::string const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x65AD2E4: us::ServiceReferenceconnector::configuration::Configuration us::ModuleContext::GetServiceReferenceconnector::configuration::Configuration() (usModuleContext.h:534)
==21976== by 0x65AD38C: connector::us_common::Dependencyconnector::configuration::Configuration::get(us::ModuleContext_) (Utils.hpp:138)
==21976== by 0x65AE056: connector::us_common::ServiceConstructor1<connector::configuration::ConfigurationServiceProviderImpl, connector::us_common::Dependencyconnector::configuration::Configuration, connector::common::ConnectorLifecycle>::make(us::ModuleContext_) (Utils.hpp:540)
==21976== by 0x65AE143: connector::us_common::ServiceFactoryHelper<connector::us_common::ServiceConstructor1<connector::configuration::ConfigurationServiceProviderImpl, connector::us_common::Dependencyconnector::configuration::Configuration, connector::common::ConnectorLifecycle>, connector::us_common::MakeInterfaceMap1<connector::configuration::ConfigurationServiceProviderImpl, connector::ServiceProvider> >::GetService(us::Module_, us::ServiceRegistrationBase const&) (Utils.hpp:442)
==21976== by 0x860B326: us::ServiceReferenceBasePrivate::GetServiceFromFactory(us::Module_, us::ServiceFactory_, bool) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x860C896: us::ServiceReferenceBasePrivate::GetService(us::Module*) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x861ADBF: us::ModuleContext::GetService(us::ServiceReferenceBase const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x432469: TestActivator::serviceProviderRegistered() (usModuleContext.h:615)
==21976== by 0x6CD5281: CppUnit::TestCaseMethodFunctor::operator()() const (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libcppunit-1.12.so.1.0.0)

==21976== Required order was established by acquisition of lock at 0xEB33860
==21976== at 0x4C2BAF5: pthread_mutex_lock (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==21976== by 0x8614297: us::ServiceRegistry::RegisterService(us::ModulePrivate_, std::map<std::string, void_, std::lessstd::string, std::allocator<std::pair<std::string const, void*> > > const&, std::unordered_map<std::string, us::Any, std::hashstd::string, std::equal_to<std::
string>, std::allocator<std::pair<std::string const, us::Any> > > const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x861ACB9: us::ModuleContext::RegisterService(std::map<std::string, void*, std::lessstd::string, std::allocator<std::pair<std::string const, void*> > > const&, std::unordered_map<std::string, us::Any, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, us::Any> > > const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so
.2.1.0)
==21976== by 0x65A865D: connector::us_common::Registration<connector::us_common::ServiceFactoryConstructor<connector::us_common::ServiceConstructor1<connector::configuration::ConfigurationServiceProviderImpl, connector::us_common::Dependencyconnector::configuration::Configuration, connector::common::ConnectorLifecycle>, connector::us_common::MakeInterfaceMap1connector::configuration::ConfigurationServiceProviderImpl,connector::ServiceProvider >, connector::us_common::MakeInterfaceMap1<us::ServiceFactory, connector::ServiceProvider> >::start(us::ModuleContext_) (Utils.hpp:412)
==21976== by 0x65A8D78: std::mem_fun1_t<void, connector::us_common::WatchableDependencyconnector::Connector, us::ServiceEvent>::operator()(connector::us_common::WatchableDependencyconnector::Connector_, us::ServiceEvent) const (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libmwconnectorconfigurationactivator.so)
==21976== by 0x65A8DD4: std::Function_handler<void ()(us::ServiceEvent const&), std::binder1st<std::mem_fun1_t<void, connector::us_common::WatchableDependencyconnector::Connector, us::ServiceEvent> > >::M_invoke(std::Any_data const&, us::ServiceEvent const&) (binders.h:120)
==21976== by 0x8601FBA: us::ServiceListeners::ServiceChanged(std::unordered_set<us::ServiceListenerEntry, std::hashus::ServiceListenerEntry, std::equal_tous::ServiceListenerEntry, std::allocatorus::ServiceListenerEntry >&, us::ServiceEvent const&, std::unordered_set<us::ServiceListenerEntry, std::hashus::ServiceListenerEntry, std::equal_tous::ServiceListenerEntry, std::allocatorus::ServiceListenerEntry >&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x86021D7: us::ServiceListeners::ServiceChanged(std::unordered_set<us::ServiceListenerEntry, std::hashus::ServiceListenerEntry, std::equal_tous::ServiceListenerEntry, std::allocatorus::ServiceListenerEntry >&, us::ServiceEvent const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x86146AB: us::ServiceRegistry::RegisterService(us::ModulePrivate
, std::map<std::string, void
, std::lessstd::string, std::allocator<std::pair<std::string const, void*> > > const&, std::unordered_map<std::string, us::Any, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, us::Any> > > const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x861ACB9: us::ModuleContext::RegisterService(std::map<std::string, void*, std::lessstd::string, std::allocator<std::pair<std::string const, void*> > > const&, std::unordered_map<std::string, us::Any, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, us::Any> > > const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x430B98: us::ServiceRegistration<connector::Connector, void, void> us::ModuleContext::RegisterServiceconnector::Connector(connector::Connector
, std::unordered_map<std::string, us::Any, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, us::Any> > > const&) (usModuleContext.h:235)
==21976== by 0x43131D: TestActivator::setUp() (TestActivator.cpp:55)
==21976==
==21976== followed by a later acquisition of lock at 0xEB58B68
==21976== at 0x4C2BAF5: pthread_mutex_lock (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==21976== by 0x86099A6: us::ServiceReferenceBase::GetProperty(std::string const&) const (in/mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x8609CC6: us::ServiceReferenceBase::operator<(us::ServiceReferenceBase const&) const (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x861555A: __gnu_cxx::_normal_iterator<us::ServiceRegistrationBase, std::vector<us::ServiceRegistrationBase, std::allocatorus::ServiceRegistrationBase > > std::lower_bound<__gnu_cxx::__normal_iterator<us::ServiceRegistrationBase*, std::vector<us::ServiceRegistrationBase, std::allocatorus::ServiceRegistrationBase > >, us::ServiceRegistrationBase>(__gnu_cxx::__normal_iterator<us::ServiceRegistrationBase*, std::vector<us::ServiceRegistrationBase, std::allocatorus::ServiceRegistrationBase > >, gnu_cxx::normal_iterator<us::ServiceRegistrationBase*, std::vector<us::ServiceRegistrationBase, std::allocatorus::ServiceRegistrationBase > >, us::ServiceRegistrationBase const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x861448C: us::ServiceRegistry::RegisterService(us::ModulePrivate
, std::map<std::string, void
, std::lessstd::string, std::allocator<std::pair<std::string const, void*> > > const&, std::unordered_map<std::string, us::Any, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, us::Any> > > const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x861ACB9: us::ModuleContext::RegisterService(std::map<std::string, void*, std::lessstd::string, std::allocator<std::pair<std::string const,void*> > > const&, std::unordered_map<std::string, us::Any, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, us::Any> > > const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x65A865D: connector::us_common::Registration<connector::us_common::ServiceFactoryConstructor<connector::us_common::ServiceConstructor1<connector::configuration::ConfigurationServiceProviderImpl, connector::us_common::Dependencyconnector::configuration::Configuration, connector::common::ConnectorLifecycle>, connector::us_common::MakeInterfaceMap1<connector::configuration::ConfigurationServiceProviderImpl, connector::ServiceProvider> >, connector::us_common::MakeInterfaceMap1<us::ServiceFactory, connector::ServiceProvider> >::start(us::ModuleContext
) (Utils.hpp:412)
==21976== by 0x65A8D78: std::mem_fun1_t<void, connector::us_common::WatchableDependencyconnector::Connector, us::ServiceEvent>::operator()(connector::us_common::WatchableDependencyconnector::Connector
, us::ServiceEvent) const (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libmwconnectorconfigurationactivator.so)
==21976== by 0x65A8DD4: std::_Function_handler<void ()(us::ServiceEvent const&), std::binder1st<std::mem_fun1_t<void, connector::us_common::WatchableDependencyconnector::Connector, us::ServiceEvent> > >::M_invoke(std::Any_data const&, us::ServiceEvent const&) (binders.h:120)
==21976== by 0x8601FBA: us::ServiceListeners::ServiceChanged(std::unordered_set<us::ServiceListenerEntry, std::hashus::ServiceListenerEntry, std::equal_tous::ServiceListenerEntry, std::allocatorus::ServiceListenerEntry >&, us::ServiceEvent const&, std::unordered_set<us::ServiceListenerEntry, std::hashus::ServiceListenerEntry, std::equal_tous::ServiceListenerEntry, std::allocatorus::ServiceListenerEntry >&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x86021D7: us::ServiceListeners::ServiceChanged(std::unordered_set<us::ServiceListenerEntry, std::hashus::ServiceListenerEntry, std::equal_tous::ServiceListenerEntry, std::allocatorus::ServiceListenerEntry >&, us::ServiceEvent const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)
==21976== by 0x86146AB: us::ServiceRegistry::RegisterService(us::ModulePrivate
, std::map<std::string, void
, std::lessstd::string, std::allocator<std::pair<std::string const, void*> > > const&, std::unordered_map<std::string, us::Any, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, us::Any> > > const&) (in /mathworks/devel/sbs/36/scai.Bwitcpp.j265545/matlab/bin/glnxa64/libCppMicroServices.so.2.1.0)

Segmentation error after unloading module

Follow up of code on forum http://forum.cppmicroservices.org/viewtopic.php?id=6

I now try to unload libA and check that there are no service references available.

During the call to GetModuleContext()->GetServiceReference("foo"), the program crashes.

The output ends with:

crash?
get service ref foo for module MainModule = 0 refs
Segmentation error

This happens during the call to GetServiceReference(), and the debug trace shows there are now 0 refs (compared to 1 before unloading). The earlier code shows the module as unloaded.

 libA.Unload();

  cout << "After unload" << endl;

  for (auto it = modules.begin(); it != modules.end(); ++it) {
        cout << (*it)->GetName() << endl;
    }

    moduleA = ModuleRegistry::GetModule("DictionaryServiceModule");

    if (moduleA) {

        cout << moduleA->IsLoaded() << endl;
    } else {
        cout << "errrrrrrror" << endl;
    }

    refs = GetModuleContext()->GetServiceReferences("");
    for (auto it = refs.begin(); it != refs.end(); ++it) {
        cout << (*it).GetProperty(ServiceConstants::OBJECTCLASS()) << endl;
    }

  cout<< "crash?"<<endl;

    //![GetDictionaryService]
    dictionaryServiceRef =
            GetModuleContext()->GetServiceReference("foo");
    if (dictionaryServiceRef) {
        DictionaryService* dictionaryService = (DictionaryService*) GetModuleContext()->GetService(dictionaryServiceRef);
        if (dictionaryService) {
            std::cout << "Dictionary contains 'Tutorial': "
                    << dictionaryService->checkWord("Tutorial") << std::endl;
        }
    }


    return 0;

Some public/installed headers appear to be unintentional, and some #include non-installed headers

At least five installed headers with the suffix "Private" or "_p", that #include non-installed headers (found under core/src), and therefore can't be used by a client. The specific headers are: usBundleHooks_p.h, usBundlePrivate.h, usFrameworkPrivate.h, usServiceHooks_p.h and usServiseListenerHook_p.h. None of these installed headers appear to be required by any other installed headers. There may be additional private headers being installed as well, which probably shouldn't be installed, to prevent any confusion or inadvertent use by clients.

Build fails on Ubuntu 12.04

I'm trying to build CppMicroServices very naively. Here's the full log with error:

make clean && make
[ 1%] Building CXX object src/CMakeFiles/CppMicroServices.dir/util/usAny.cpp.o
[ 3%] Building CXX object src/CMakeFiles/CppMicroServices.dir/util/usThreads.cpp.o
[ 5%] Building CXX object src/CMakeFiles/CppMicroServices.dir/util/usUtils.cpp.o
[ 7%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usLDAPExpr.cpp.o
[ 9%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usLDAPFilter.cpp.o
[ 11%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceException.cpp.o
[ 13%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceEvent.cpp.o
[ 15%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceListenerEntry.cpp.o
[ 17%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceListeners.cpp.o
[ 19%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceProperties.cpp.o
[ 21%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceReference.cpp.o
[ 23%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceReferencePrivate.cpp.o
[ 25%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceRegistration.cpp.o
[ 27%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceRegistrationPrivate.cpp.o
[ 29%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceRegistry.cpp.o
[ 31%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usCoreModuleContext.cpp.o
[ 33%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleContext.cpp.o
[ 35%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModule.cpp.o
[ 37%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleEvent.cpp.o
[ 39%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleInfo.cpp.o
[ 41%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModulePrivate.cpp.o
[ 43%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleRegistry.cpp.o
[ 45%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleUtils.cpp.o
[ 47%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleVersion.cpp.o
[ 49%] Building CXX object src/CMakeFiles/CppMicroServices.dir/CppMicroServices_init.cpp.o
Linking CXX shared library ../lib/libCppMicroServices.so
[ 49%] Built target CppMicroServices
[ 50%] Building CXX object test/modules/libA/CMakeFiles/TestModuleA.dir/usTestModuleA.cpp.o
In file included from /home/simon/Workspace/Misc/CppMicroServices/include/usSharedData.h:32:0,
from /home/simon/Workspace/Misc/CppMicroServices/include/usServiceEvent.h:25,
from /home/simon/Workspace/Misc/CppMicroServices/include/usUtils_p.h:90,
from /home/simon/Workspace/Misc/CppMicroServices/include/usModuleContext.h:25,
from /home/simon/Workspace/Misc/CppMicroServices/test/modules/libA/usTestModuleA.cpp:25:
/home/simon/Workspace/Misc/CppMicroServices/include/usAtomicInt_p.h:27:25: erreur fatale: usThreads_p.h : Aucun fichier ou dossier de ce type
compilation terminée.
make[2]: *** [test/modules/libA/CMakeFiles/TestModuleA.dir/usTestModuleA.cpp.o] Erreur 1
make[1]: *** [test/modules/libA/CMakeFiles/TestModuleA.dir/all] Erreur 2
make: *** [all] Erreur 2

Fails on: usThreads_p.h: No such file or folder.

The file is in src/util/ and properly found at earlier stages of the build, but not found when trying to build the TestModule.

I'm using CMake 2.8.7 and G++ 4.6.3.

Using US_DECLARE_SERVICE_INTERFACE with Qt does not work

The US_DECLARE_SERVICE_INTERFACE was meant to work like the Q_DECLARE_INTERFACE macro if Qt headers are available. However, this never fully worked because moc needs an explicit Q_DECLARE_INTERFACE statement when parsing the Q_INTERFACES macro in a QObject derived class.

usUtils.cpp - Crash can occur if FormatMessage(...) fails

In us::GetLastErrorStr(), the buffer 'lpMsgBuf' returned from FormatMessage(...) is used without checking the return code of FormatMessage(...).
A crash can occur if FormatMessage(...) fails (i.e. lpMsgBuf will be uninitialized).

This error was found using VS 2013 code analysis.

Switch to using OSGi nomenclature

We want to be consistent with OSGi in every way which makes sense in the native C++ world. One of these ways is nomenclature/terminology.

All terminology within CppMicroServices (code and documentation) should be changed to use OSGi nomenclature, where applicable.

Some examples:

CppMicroServices 2.1.0 terminology OSGi terminology
us::Module::Start() us::Bundle::Start()
us::Module::Stop() us::Bundle::Stop()
us::ModuleActivator::Load() us::BundleActivator::Start()
us::ModuleActivator::UnLoad() us::BundleActivator::Stop()
us::ModuleContext::InstallBundle(...) us::BundleContext::InstallBundle(...)

*See jeffidiclemente#1 for historical information.

unit test failures on Mac OS X 10.10.4/Xcode 6.4

Two unit tests fail (usBundleManifestTest and usLDAPFilterTest ) due to what appears to be how Apple clang handles comparing types.

It appears that Apple clang compares the object addresses and not the string representaiton of the type.

Re-organize public header files

In anticipation of new modules in the source code, the public header files should be re-organized.

  • Core headers will be located under include/us
  • Other module headers will be located under include/<module>

All header files will be stripped of the "us" prefix and the us namespace will not be optional / changeable any more.

Header files also must not depend on configured information.

Make ModuleInfo private

The ModuleInfo class is a public class to support the GetModuleContext() function. With recent changes, it should now be possible to not rely on this class in the GetModuleContext() function and maybe remove / refactor it.

See also jeffdiclemente#4.

Make log levels configurable

Log levels should be configurable. Further, all output during static initialization should be removed because there is no way disable it from depending modules.

build error on linux 64-bit (development branch)

On the development branch I ran into a build error when building with US_BUILD_SHARED_LIBS:BOOL=OFF using GCC 4.7.2 and cmake-3.4.0-rc1.

snippet of the build log:

[ 96%] Linking CXX executable ../../bin/usWebConsoleDriver
cd /sandbox/jdicleme/CppMicroServices/webconsole/examples && /usr/local/cmake/cmake-3.4.0-rc1-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/usWebConsoleDriver.dir/link.txt --verbose=1
/usr/bin/c++     -std=c++11 -Werror -Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo -fdiagnostics-show-option -Wno-mismatched-tags -fstack-protector-all  -fvisibility=hidden -fvisibility-inlines-hidden -g   CMakeFiles/usWebConsoleDriver.dir/us_init.cpp.o CMakeFiles/usWebConsoleDriver.dir/usWebConsoleDriver.cpp.o  -o ../../bin/usWebConsoleDriver -rdynamic ../../lib/libusHttpService.a ../../lib/libCppMicroServices.a -ldl 
../../lib/libusHttpService.a(civetweb.c.o): In function `mg_start_thread':
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:1819: undefined reference to `pthread_create'
../../lib/libusHttpService.a(civetweb.c.o): In function `mg_start_thread_with_id':
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:1842: undefined reference to `pthread_create'
../../lib/libusHttpService.a(civetweb.c.o): In function `mg_join_thread':
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:1856: undefined reference to `pthread_join'
../../lib/libusHttpService.a(civetweb.c.o): In function `worker_thread_run':
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:6113: undefined reference to `pthread_setspecific'
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:6157: undefined reference to `pthread_setspecific'
../../lib/libusHttpService.a(civetweb.c.o): In function `master_thread_run':
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:6287: undefined reference to `pthread_setspecific'
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:6349: undefined reference to `pthread_setspecific'
../../lib/libusHttpService.a(civetweb.c.o): In function `free_context':
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:6417: undefined reference to `pthread_key_delete'
../../lib/libusHttpService.a(civetweb.c.o): In function `mg_start':
/sandbox/jdicleme/CppMicroServices/third_party/civetweb/civetweb.c:6499: undefined reference to `pthread_key_create'

Support LDAP queries against bundle meta-data

There is a requirement to be able to start bundles based on the result of LDAP queries against a bundle's embedded meta data (properties).

The OSGi spec seems to already support this capability (i.e. matching based on a map of key/value pairs) within its Filter interface, which CppMicroServices has implemented as LDAPFilter.

I am proposing that a general "property" class be created, of which ServiceProperties would derive. LDAPFilter The general property class will insulate CppMicroServices users from how the framework manages all forms of properties (i.e. service, framework, bundle).

@CppMicroServices/collaborators A google doc detailing the functional design and requirements will soon follow for review.

This isn't required to be in 3.0, but would need to be in a point release (e.g. 3.x.y) soon after 3.0.

usShell throws exception when built with US_BUILD_SHARED_LIBS=OFF

To reproduce:

  • Build with -D BUILD_SHARED_LIBS:BOOL=OFF
  • run usShell

This was seen on Windows and Linux. The issue should affect Mac as well (but I did not confirm).

On Linux you should see the following in a terminal:

terminate called after throwing an instance of 'std::runtime_error'
  what():  bundle.name is not defined in the bundle manifest.
Abort

When the framework starts, the bundle name for CppMicroServices can't be found, causing the exception.

usConfig.h not added to framework on Mac

Hi,

When I build CppMicroServices on Mac, the usConfig.h file is missing from the resulting framework directory. I see the public header directive includes ${us_config_h_file} but apparently that is not working. This occurs on Lion with cmake 2.8.8.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.