]> Creatis software - clitk.git/blob - vv/vvToolBaseBase.h
Add SaveState and XmlReader capabilities
[clitk.git] / vv / vvToolBaseBase.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18
19 #ifndef VVTOOLBASEBASE_H
20 #define VVTOOLBASEBASE_H
21
22 #include "vvMainWindowBase.h"
23 #include "vvToolCreatorBase.h"
24 class QXmlStreamWriter;
25 class QXmlStreamReader;
26
27 //------------------------------------------------------------------------------
28 class vvToolBaseBase {
29 public:
30   virtual ~vvToolBaseBase() { 
31     DD("destrucotr vvToolBaseBase");
32     std::vector<vvToolBaseBase*> & v = mCreator->GetListOfTool();
33     v.erase(std::find(v.begin(), v.end(), this));
34     DD("end dest");
35   };
36   
37   virtual void SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter);
38   virtual void InitializeNewTool(bool ReadStateFlag);   
39   void SetCreator(vvToolCreatorBase * m) { mCreator = m; }
40   void SetXmlReader(QXmlStreamReader * r, int index) { m_XmlReader = r; mImageIndex = index;}  
41
42 protected:
43   vvMainWindowBase * mMainWindowBase;
44   QXmlStreamReader * m_XmlReader;
45   vvToolCreatorBase * mCreator;
46   int mImageIndex;
47 };
48 //------------------------------------------------------------------------------
49 #endif
50