O P A R - Open Architecture Particle in Cell Simulation - Version 3.0
Plasma simulations with dust particles
 All Classes Files Functions Variables Friends Macros Groups Pages
stlpwrapper.h
Go to the documentation of this file.
1 
6 // The user still has to delete the objects from the heap
7 #ifndef STLPWRAPPER_H
8 #define STLPWRAPPER_H
9 #ifdef _DEBUG
10 #define PtrWrapper XP
11 #endif
12 //---------------------------------------------------------------------------------------------------------------------
13 
18 template <class TYPE>
19 class PtrWrapper {
20  private:
22  TYPE* m_pObj;
23  public:
25  PtrWrapper(TYPE* pObj = 0) : m_pObj(pObj) {};
27  PtrWrapper(const PtrWrapper<TYPE>& wrapper) {m_pObj = wrapper.m_pObj;};
30  m_pObj = wrapper.m_pObj;
31  return *this;
32  }
35 
37  operator const TYPE* () const { return m_pObj; };
38  operator TYPE* () { return m_pObj; };
40 
41 
43  TYPE* pObj () const {return m_pObj;};
45  friend bool operator== (const PtrWrapper<TYPE>& left, const PtrWrapper<TYPE>& right) {
46  return (left.m_pObj == right.m_pObj);
47  };
49  friend bool operator!= (const PtrWrapper<TYPE>& left, const PtrWrapper<TYPE>& right) {
50  return (left.m_pObj != right.m_pObj);
51  };
53  friend bool operator< (const PtrWrapper<TYPE>& left, const PtrWrapper<TYPE>& right) {
54  return (*(left.m_pObj) < *(right.m_pObj));
55  };
56 };
57 #endif