aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/oo/Register_Implement.h
diff options
context:
space:
mode:
Diffstat (limited to 'meowpp/oo/Register_Implement.h')
-rw-r--r--meowpp/oo/Register_Implement.h55
1 files changed, 0 insertions, 55 deletions
diff --git a/meowpp/oo/Register_Implement.h b/meowpp/oo/Register_Implement.h
deleted file mode 100644
index 910ee11..0000000
--- a/meowpp/oo/Register_Implement.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef oo_Register_Implement_H__
-#define oo_Register_Implement_H__
-
-#include <map>
-#include <vector>
-
-namespace meow{
- template<class T>
- class ImplementInterface{
- private:
- T identify_;
- protected:
- ImplementInterface(T const& id): identify_(id) { }
- public:
- T const& identify() const { return identify_; }
- virtual ~ImplementInterface(){ }
- };
- //
- template<class T>
- class RegisterInterface{
- private:
- std::map<T, ImplementInterface<T>*> implements;
- protected:
- RegisterInterface();
- public:
- virtual bool regImplement(ImplementInterface<T>*imp);
- virtual ImplementInterface<T>* getImplement(T const& identify);
- virtual ~RegisterInterface(){ }
- std::vector<T> getIdentifys() const;
- };
- //#
- //# === meow:: *ImplementInterface/RegisterInterface* (C++ Class)
- //# ==== Description
- //# Assume there is a problem which can be solved by different algorithms.
- //# Then you can write multiple classes to approach this problem. +
- //# Now if you want to decide which algorithm to use in runtime, you can just
- //# approach this case by a simple way:
- //#
- //# * Let all the problem-solving classes inherit from
- //# `class ImplementInterface<T>` , and call the constructure with giving
- //# `identify` (type `T` ) .
- //# * Create an class inherit from `RegisterInterface<T>` ,
- //# and register all your implement class to it by call
- //# `regImplement(pointer to the class)`.
- //# * Select which implement class you want by call
- //# `getImplement(identify)` , which will return the pointer
- //# to the corresponding class.
- //#
- //# '''
- //#
-}
-
-#include "Register_Implement.hpp"
-
-#endif // oo_Register_Implement_H__