-
Notifications
You must be signed in to change notification settings - Fork 40
Home
Welcome to our documentation!
Kangaru is a simple inversion of control container for C++11 and later. Our goal is to create a container capable of automatic dependency injection that do most diagnostics at compile time, while keeping the simplest interface possible, and all that without modifying existing classes. Kangaru is a header only library because of it's extensive use of templates. The name kangaru comes from the container's feature that consists in injecting itself into a service as a dependency.
Indeed, the container does not impose a way to construct, allocate memory, contain or inject your classes. You are in full control of everything related to the classes of your project.
To install kangaru on a machine, you must create a build directory:
mkdir build
cd build
Then use cmake to generate the makefile and install it:
cmake ..
sudo make install
You must use the find_package
function:
find_package(kangaru REQUIRED)
And then add the include dirs to your target:
target_link_libraries(<YOUR TARGET> PUBLIC kangaru)
Then you can include the library as follow:
#include <kangaru/kangaru.hpp>
All declarations are made in the namespace kgr
. Additionnaly, the namespace kgr
contains the namespace detail
, which itself contains implementation details.
Note that the detail
namespace is not considered as a part of the API and its content might be subject to changes.
In this documentation, many classes will be refered as services or service definitions.
Services are classes that are either injected by the container or have other classes as dependencies.
Service Definitions are classes that contain a service and tell the container how this particular service should behave within the container.
This library does not make use of macros of macros to prevent multiple inclusion.
Every macros that starts with KGR_KANGARU_
is considered reserved.
Note that some features of this library are easier to use with macros, and we recommend you to use those that are defined in the documentation.
Macros defined by the library are not part of it's interface.
- MSVC: 2015 update 3 or better
- GCC: 5.1 or better
- Clang: 3.7 or better