Open
Graph Drawing
Framework

 v.2010.10
 

ModuleOption.h

Go to the documentation of this file.
00001 /*
00002  * $Revision: 2027 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2010-09-01 11:55:17 +0200 (Wed, 01 Sep 2010) $ 
00007  ***************************************************************/
00008  
00053 #ifdef _MSC_VER
00054 #pragma once
00055 #endif
00056 
00057 #ifndef OGDF_MODULE_OPTION_H
00058 #define OGDF_MODULE_OPTION_H
00059 
00060 
00061 #include <ogdf/basic/basic.h>
00062 
00063 
00064 namespace ogdf {
00065 
00066 
00074 template<class M> class ModuleOption {
00075 
00076     M *m_pModule; 
00077 
00078 public:
00080     ModuleOption() : m_pModule(0) { }
00081 
00082     // destruction
00083     ~ModuleOption() { delete m_pModule; }
00084 
00086 
00089     void set(M *pM) {
00090         delete m_pModule;
00091         m_pModule = pM;
00092     }
00093 
00095     bool valid() const { return m_pModule != 0; }
00096 
00098 
00102     M &get() { return *m_pModule; }
00103 };
00104 
00105 
00106 } // end namespace ogdf
00107 
00108 
00109 #endif