aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/oo
diff options
context:
space:
mode:
authorcathook <b01902109@csie.ntu.edu.tw>2014-04-21 14:13:53 +0800
committercathook <b01902109@csie.ntu.edu.tw>2014-04-21 14:13:53 +0800
commit1817d739e89b1d4c1c09d5f553ce5068fab0e4d7 (patch)
treea2c19c84b45a7b814cff17df4ed952b47b50a49b /meowpp/oo
parent309e100b5d4200bec36d08e4882d62a80df262e6 (diff)
downloadmeow-1817d739e89b1d4c1c09d5f553ce5068fab0e4d7.tar
meow-1817d739e89b1d4c1c09d5f553ce5068fab0e4d7.tar.gz
meow-1817d739e89b1d4c1c09d5f553ce5068fab0e4d7.tar.bz2
meow-1817d739e89b1d4c1c09d5f553ce5068fab0e4d7.tar.lz
meow-1817d739e89b1d4c1c09d5f553ce5068fab0e4d7.tar.xz
meow-1817d739e89b1d4c1c09d5f553ce5068fab0e4d7.tar.zst
meow-1817d739e89b1d4c1c09d5f553ce5068fab0e4d7.zip
壓力測試完成~~~~~~~~~~
Diffstat (limited to 'meowpp/oo')
-rw-r--r--meowpp/oo/Register_Implement.h4
-rw-r--r--meowpp/oo/Register_Implement.hpp12
2 files changed, 14 insertions, 2 deletions
diff --git a/meowpp/oo/Register_Implement.h b/meowpp/oo/Register_Implement.h
index dd496fa..2e8ca32 100644
--- a/meowpp/oo/Register_Implement.h
+++ b/meowpp/oo/Register_Implement.h
@@ -2,6 +2,7 @@
#define REGISTER_IMPLEMENT_H_
#include <map>
+#include <vector>
namespace meow{
template<class T>
@@ -25,6 +26,7 @@ namespace meow{
virtual bool regImplement(ImplementInterface<T>*imp);
virtual ImplementInterface<T>* getImplement(T const& identify);
virtual ~RegisterInterface(){ }
+ std::vector<T> getIdentifys() const;
};
/*******************************************************************
@asciidoc
@@ -38,7 +40,7 @@ namespace meow{
* Let all the problem-solving classes inherit from
`class ImplementInterface<T>` , and call the constructure with giving
`identify` (type `T` ) .
- * Create an object, type `RegisterInterface<T>` , and register all your
+ * 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.
diff --git a/meowpp/oo/Register_Implement.hpp b/meowpp/oo/Register_Implement.hpp
index 34d9129..206b0a3 100644
--- a/meowpp/oo/Register_Implement.hpp
+++ b/meowpp/oo/Register_Implement.hpp
@@ -1,5 +1,5 @@
-
#include <map>
+#include <vector>
namespace meow{
template<class T>
@@ -20,4 +20,14 @@ namespace meow{
}
return implements[identify];
}
+ template<class T>
+ inline std::vector<T>
+ RegisterInterface<T>::getIdentifys() const{
+ std::vector<T> ret;
+ for(typename std::map<T, ImplementInterface<T>*>::const_iterator
+ it = implements.begin(); it != implements.end(); it++){
+ ret.push_back(it->first);
+ }
+ return ret;
+ }
}