InjectorConfiguration.hpp
Go to the documentation of this file.
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_APPLICATION__INJECTOR_CONFIGURATION
18 #define COM_BORA_SOFTWARE__BALAU_APPLICATION__INJECTOR_CONFIGURATION
19 
20 #include <Balau/Application/Impl/Binding.hpp>
21 #include <Balau/Application/Impl/StaticSingletonBuilder.hpp>
22 
23 namespace Balau {
24 
25 class Injector;
26 class ApplicationConfiguration;
27 class EnvironmentConfiguration;
28 
36  public: virtual void configure() const = 0;
37 
38  public: virtual ~InjectorConfiguration() = default;
39 
41 
42  // Builds the binding builders from the configuration.
43  private: virtual std::vector<std::shared_ptr<Impl::BindingBuilderBase>> build() const = 0;
44 
45  public: virtual std::vector<const InjectorConfiguration*> getExtraConfiguration() const = 0;
46  public: virtual std::list<std::function<void (const Injector& )>> getPostConstructionCalls() const = 0;
47  public: virtual std::list<std::function<void ()>> getPreDestructionCalls() const = 0;
48  public: virtual std::list<std::unique_ptr<StaticSingletonRegistrationBase>> getStaticSingletonPostConstructionCalls() const = 0;
49 
50  // Run configure and build stages.
51  public: std::vector<std::shared_ptr<Impl::BindingBuilderBase>> execute() const {
52  configure();
53  return build();
54  }
55 
56 };
57 
58 } // namespace Balau
59 
60 #endif // COM_BORA_SOFTWARE__BALAU_APPLICATION__INJECTOR_CONFIGURATION
The root Balau namespace.
Definition: ApplicationConfiguration.hpp:23
virtual void configure() const =0
Configure the injector configuration.
Injector configurations specify injector bindings.
Definition: InjectorConfiguration.hpp:32