Open
Graph Drawing
Framework

 v.2012.07
 

ModuleOption.h
Go to the documentation of this file.
1 /*
2  * $Revision: 2523 $
3  *
4  * last checkin:
5  * $Author: gutwenger $
6  * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7  ***************************************************************/
8 
44 #ifdef _MSC_VER
45 #pragma once
46 #endif
47 
48 #ifndef OGDF_MODULE_OPTION_H
49 #define OGDF_MODULE_OPTION_H
50 
51 
52 #include <ogdf/basic/basic.h>
53 
54 
55 namespace ogdf {
56 
57 
65 template<class M> class ModuleOption {
66 
67  M *m_pModule;
68 
69 public:
72 
73  // destruction
74  ~ModuleOption() { delete m_pModule; }
75 
77 
80  void set(M *pM) {
81  delete m_pModule;
82  m_pModule = pM;
83  }
84 
86  bool valid() const { return m_pModule != 0; }
87 
89 
93  M &get() { return *m_pModule; }
94 };
95 
96 
97 } // end namespace ogdf
98 
99 
100 #endif