MEPP2 Project
BaseWindow.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
13 #include "Base/Assert.h"
14 
17 // #include "Visualization/BaseViewer.h"
18 
19 namespace FEVV {
20 
21 class BaseAdapterVisu;
22 class BasePlugin;
23 
25 {
26 public:
28  using Plugin = BasePlugin;
29 
30 public:
39  {
40 #ifdef DEBUG_VISU2
41  std::cout << "*** this=" << this << " entering " << __func__ << std::endl;
42 #endif
43 
44 #ifdef DEBUG_VISU2
45  std::cout << "*** this=" << this << " leaving " << __func__ << std::endl;
46 #endif
47  }
48 
52  virtual ~BaseWindow()
53  {
54 #ifdef DEBUG_VISU2
55  std::cout << "*** this=" << this << " entering " << __func__ << std::endl;
56 #endif
57 
58 #ifdef DEBUG_VISU2
59  std::cout << "*** this=" << this << " leaving " << __func__ << std::endl;
60 #endif
61  }
62 
69  virtual void attach(Adapter *_adapter) = 0;
70 
71  virtual void attachPlugin(Plugin *_plugin) = 0;
72 
73  virtual void setParam(std::string _name,
74  int *_value,
75  std::string _pluginName,
76  Plugin *_plugin) = 0;
77 
78  virtual void setParam(std::string _name,
79  double *_value,
80  std::string _pluginName,
81  Plugin *_plugin) = 0;
82 
83  virtual void setParam(std::string _name,
84  float *_value,
85  std::string _pluginName,
86  Plugin *_plugin) = 0;
87 
88  virtual void setParam(std::string _name,
89  bool *_value,
90  std::string _pluginName,
91  Plugin *_plugin) = 0;
92 
93  virtual void setParam(std::string _name,
94  std::string *_value,
95  std::string _pluginName,
96  Plugin *_plugin) = 0;
97 
101  virtual void init() = 0;
102 
103  virtual bool isInit() const { return bIsInit; }
104 
105  virtual bool isValid() const { return bIsInit && (adapters.size() != 0); }
106 
107  virtual void notify() = 0;
108 
113  virtual std::vector< Adapter * > *getAdapters() { return &adapters; }
114 
115  virtual Adapter *getAdapter(unsigned int _pos)
116  {
117  Assert::check(_pos < adapters.size(),
118  "No adapter attached at this position.",
119  "BaseWindow::getAdapter(int)");
120  return adapters[_pos];
121  }
122 
123  virtual std::vector< Adapter * > getSelectedAdapters() = 0;
124  virtual std::vector< Adapter::Viewer * > getSelectedViewers() = 0;
125 
126 protected:
127  std::vector< Adapter * > adapters;
128  std::map< std::string, Plugin * > stackPlugins;
129  bool bIsInit = false;
130 };
131 
132 } // namespace FEVV
FEVV::BaseWindow::isInit
virtual bool isInit() const
Definition: BaseWindow.h:103
FEVV::BaseWindow::setParam
virtual void setParam(std::string _name, double *_value, std::string _pluginName, Plugin *_plugin)=0
FEVV::BaseWindow::setParam
virtual void setParam(std::string _name, int *_value, std::string _pluginName, Plugin *_plugin)=0
FEVV::BaseWindow::getAdapter
virtual Adapter * getAdapter(unsigned int _pos)
Definition: BaseWindow.h:115
FEVV::BaseWindow::getSelectedAdapters
virtual std::vector< Adapter * > getSelectedAdapters()=0
FEVV::BaseWindow::getAdapters
virtual std::vector< Adapter * > * getAdapters()
Definition: BaseWindow.h:113
BasePlugin.h
FEVV::BaseWindow::attachPlugin
virtual void attachPlugin(Plugin *_plugin)=0
FEVV::BaseWindow::~BaseWindow
virtual ~BaseWindow()
Definition: BaseWindow.h:52
FEVV::BaseAdapterVisu
Definition: BaseAdapterVisu.h:27
FEVV::BaseWindow::bIsInit
bool bIsInit
Definition: BaseWindow.h:129
FEVV::BaseWindow::BaseWindow
BaseWindow()
Definition: BaseWindow.h:38
FEVV::BaseWindow::setParam
virtual void setParam(std::string _name, std::string *_value, std::string _pluginName, Plugin *_plugin)=0
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::BaseWindow::notify
virtual void notify()=0
FEVV::BaseWindow::isValid
virtual bool isValid() const
Definition: BaseWindow.h:105
BaseAdapterVisu.h
FEVV::BaseWindow::getSelectedViewers
virtual std::vector< Adapter::Viewer * > getSelectedViewers()=0
FEVV::Assert::check
static bool check(const bool _check, const std::string &_message, const std::string &_where="")
Definition: Assert.h:70
FEVV::BaseWindow::setParam
virtual void setParam(std::string _name, bool *_value, std::string _pluginName, Plugin *_plugin)=0
FEVV::BaseWindow::stackPlugins
std::map< std::string, Plugin * > stackPlugins
Definition: BaseWindow.h:128
FEVV::BasePlugin
Definition: BasePlugin.h:38
FEVV::BaseWindow::adapters
std::vector< Adapter * > adapters
Definition: BaseWindow.h:127
FEVV::BaseWindow
Definition: BaseWindow.h:25
FEVV::BaseWindow::init
virtual void init()=0
FEVV::BaseWindow::setParam
virtual void setParam(std::string _name, float *_value, std::string _pluginName, Plugin *_plugin)=0
FEVV::BaseWindow::attach
virtual void attach(Adapter *_adapter)=0
Assert.h