Open
Graph Drawing
Framework

 v.2012.05
 

ModuleOption.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00043 #ifdef _MSC_VER
00044 #pragma once
00045 #endif
00046 
00047 #ifndef OGDF_MODULE_OPTION_H
00048 #define OGDF_MODULE_OPTION_H
00049 
00050 
00051 #include <ogdf/basic/basic.h>
00052 
00053 
00054 namespace ogdf {
00055 
00056 
00064 template<class M> class ModuleOption {
00065 
00066     M *m_pModule; 
00067 
00068 public:
00070     ModuleOption() : m_pModule(0) { }
00071 
00072     // destruction
00073     ~ModuleOption() { delete m_pModule; }
00074 
00076 
00079     void set(M *pM) {
00080         delete m_pModule;
00081         m_pModule = pM;
00082     }
00083 
00085     bool valid() const { return m_pModule != 0; }
00086 
00088 
00092     M &get() { return *m_pModule; }
00093 };
00094 
00095 
00096 } // end namespace ogdf
00097 
00098 
00099 #endif