iutest  1.17.1.0
iutest_pool.hpp
[詳解]
1 //======================================================================
2 //-----------------------------------------------------------------------
13 //-----------------------------------------------------------------------
14 //======================================================================
15 #ifndef INCG_IRIS_IUTEST_POOL_HPP_60F7CC27_EA15_4AC7_BCA6_80FFDCBC890E_
16 #define INCG_IRIS_IUTEST_POOL_HPP_60F7CC27_EA15_4AC7_BCA6_80FFDCBC890E_
17 
18 //======================================================================
19 // include
20 #include <vector>
21 
22 #if IUTEST_HAS_LIB && IUTEST_HAS_EXTERN_TEMPLATE
23 
24 namespace iutest { namespace detail { class iuIObject; } }
25 
26 IUTEST_PRAGMA_EXTERN_TEMPLATE_WARN_DISABLE_BEGIN()
27 
28 extern template class ::std::vector< ::iutest::detail::iuIObject* >;
29 
30 IUTEST_PRAGMA_EXTERN_TEMPLATE_WARN_DISABLE_END()
31 
32 #endif
33 
34 namespace iutest {
35 namespace detail
36 {
37 
41 class iuIObject
42 {
43 public:
44  virtual ~iuIObject() {}
45 };
46 
50 class iuPool
51 {
52  typedef ::std::vector<iuIObject*> pool;
53  pool m_pool;
54 public:
55  typedef iuIObject *value_ptr;
56 
57 public:
58  ~iuPool()
59  {
60  // すべて解放する
61  for( pool::iterator it=m_pool.begin(); it != m_pool.end(); )
62  {
63  value_ptr p = *it;
64  it = m_pool.erase(it);
65  delete p;
66  }
67  }
68 public:
69  void push(value_ptr ptr) { m_pool.push_back(ptr); }
70 public:
71  static iuPool& GetInstance() { static iuPool inst; return inst; }
72 };
73 
74 } // end of namespace detail
75 } // end of namespace iutest
76 
77 #endif // INCG_IRIS_IUTEST_POOL_HPP_60F7CC27_EA15_4AC7_BCA6_80FFDCBC890E_
iutest_config.hpp
iris unit test config
iutest
iutest root namespace
Definition: iutest_charcode.hpp:31