Choreonoid  1.8
MprStatementViewBase.h
Go to the documentation of this file.
1 #ifndef CNOID_MANIPULATOR_PLUGIN_MPR_STATEMENT_VIEW_BASE_H
2 #define CNOID_MANIPULATOR_PLUGIN_MPR_STATEMENT_VIEW_BASE_H
3 
4 #include <cnoid/View>
5 #include "exportdecl.h"
6 
7 namespace cnoid {
8 
9 class Archive;
10 class MprProgramViewBase;
11 class MprStatementPanel;
12 
13 class CNOID_EXPORT MprStatementViewBase : public cnoid::View
14 {
15 public:
17  virtual ~MprStatementViewBase();
18 
19  virtual void onActivated() override;
20  virtual void onDeactivated() override;
21  virtual bool storeState(Archive& archive) override;
22  virtual bool restoreState(const Archive& archive) override;
23 
24 protected:
25  typedef MprStatementPanel* (*PanelFactoryFunction)();
26 
27  template<class StatementType, class StatementPanelType>
29  registerPanelFactory(
30  typeid(StatementType),
31  []() -> MprStatementPanel* { return new StatementPanelType; });
32  }
33 
34  virtual MprProgramViewBase* getProgramView() = 0;
35 
36 private:
37  class Impl;
38  Impl* impl;
39 
40  void registerPanelFactory(const std::type_info& statementType, PanelFactoryFunction factory);
41 };
42 
43 }
44 
45 #endif
cnoid::MprStatementViewBase
Definition: MprStatementViewBase.h:13
cnoid::View
Definition: View.h:27
cnoid::Archive
Definition: Archive.h:22
cnoid::MprProgramViewBase
Definition: MprProgramViewBase.h:20
cnoid::MprStatementPanel
Definition: MprStatementPanel.h:12
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::MprStatementViewBase::registerPanelFactory
void registerPanelFactory()
Definition: MprStatementViewBase.h:28