Skip to content
Snippets Groups Projects
Commit b78922c3 authored by Mederic Fourmy's avatar Mederic Fourmy
Browse files

[skip-ci] Merge branch 'devel' into 451-refactoring-wolf-installation-system

parents 1df8ee07 768795c7
No related branches found
No related tags found
2 merge requests!451After cmake and const refactor,!445Resolve "Refactoring WOLF installation system"
Pipeline #10656 skipped
......@@ -307,6 +307,8 @@ class Factory
static bool unregisterCreator(const std::string& _type);
static TypeBasePtr create(const std::string& _type, TypeInput... _input);
std::string getClass() const;
static void printAddress();
static void printCallbacks();
private:
CallbackMap callbacks_;
......@@ -321,9 +323,15 @@ class Factory
void operator=(Factory const&) = delete;
private:
Factory() { }
~Factory() { }
~Factory();
};
template<class TypeBase, typename... TypeInput>
inline Factory<TypeBase, TypeInput...>::~Factory<TypeBase, TypeInput...>()
{
std::cout << " Factory destructor " << this->getClass() << std::endl;
}
template<class TypeBase, typename... TypeInput>
inline bool Factory<TypeBase, TypeInput...>::registerCreator(const std::string& _type, CreatorCallback createFn)
{
......@@ -358,7 +366,7 @@ inline typename Factory<TypeBase, TypeInput...>::TypeBasePtr Factory<TypeBase, T
template<class TypeBase, typename... TypeInput>
inline Factory<TypeBase, TypeInput...>& Factory<TypeBase, TypeInput...>::get()
{
static Factory instance_;
static Factory<TypeBase, TypeInput...> instance_;
return instance_;
}
......@@ -368,6 +376,21 @@ inline std::string Factory<TypeBase, TypeInput...>::getClass() const
return "Factory<class TypeBase>";
}
template<class TypeBase, typename... TypeInput>
inline void Factory<TypeBase, TypeInput...>::printAddress()
{
std::cout << get().getClass() << " address: " << &get() << std::endl;
}
template<class TypeBase, typename... TypeInput>
inline void Factory<TypeBase, TypeInput...>::printCallbacks()
{
std::cout << get().getClass() << " callbacks size: " << get().callbacks_.size() << std::endl;
for (auto cb: get().callbacks_){
std::cout << "\t" << cb.first << std::endl;
}
}
} // namespace wolf
namespace wolf
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment