Skip to content
Snippets Groups Projects

Resolve "Refactoring WOLF installation system"

Merged Mederic Fourmy requested to merge 451-refactoring-wolf-installation-system into devel
1 file
+ 25
2
Compare changes
  • Side-by-side
  • Inline
@@ -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
Loading