~choreonoid/choreonoid/debian

« back to all changes in this revision

Viewing changes to src/BodyPlugin/SimulatorItem.h

  • Committer: Thomas Moulard
  • Date: 2012-10-23 12:43:24 UTC
  • Revision ID: git-v1:351cf736ad49bc7a9a7b9767dee760a013517a5d
Tags: upstream/1.1.0
ImportedĀ UpstreamĀ versionĀ 1.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
  @file
 
3
  @author Shin'ichiro Nakaoka
 
4
*/
 
5
 
 
6
#ifndef CNOID_BODYPLUGIN_SIMULATOR_ITEM_H_INCLUDED
 
7
#define CNOID_BODYPLUGIN_SIMULATOR_ITEM_H_INCLUDED
 
8
 
 
9
#include <cnoid/Item>
 
10
#include <QWidget>
 
11
#include "exportdecl.h"
 
12
 
 
13
namespace cnoid {
 
14
        
 
15
    class SimulatorItemImpl;
 
16
        
 
17
    class CNOID_EXPORT SimulatorItem : public Item
 
18
    {
 
19
      public:
 
20
        SimulatorItem();
 
21
        SimulatorItem(const SimulatorItem& org);
 
22
        virtual ~SimulatorItem();
 
23
 
 
24
        void setAllLinkPositionOutputMode(bool on);
 
25
        bool isAllLinkPositionOutputMode();
 
26
            
 
27
        bool startSimulation();
 
28
        void stopSimulation();
 
29
        bool isSimulationRunning();
 
30
 
 
31
        SignalProxy< boost::signal<void()> > sigSimulationFinished();
 
32
            
 
33
      protected:
 
34
            
 
35
        virtual QWidget* settingPanel() = 0;
 
36
            
 
37
        virtual bool doStartSimulation() = 0;
 
38
        virtual bool doStepSimulation() = 0;
 
39
 
 
40
        /**
 
41
           @return time at the last flush
 
42
        */
 
43
        virtual double doFlushResults() = 0;
 
44
 
 
45
        /**
 
46
           @return finish time
 
47
        */
 
48
        virtual double doStopSimulation() = 0;
 
49
 
 
50
        void lockResults();
 
51
        void unlockResults();
 
52
 
 
53
        /**
 
54
           This must be called within the critical section
 
55
        */
 
56
        void requestToFlushResults();
 
57
            
 
58
      private:
 
59
            
 
60
        SimulatorItemImpl* impl;
 
61
 
 
62
        friend class SimulatorView;
 
63
        friend class SimulatorItemImpl;
 
64
    };
 
65
        
 
66
    typedef boost::intrusive_ptr<SimulatorItem> SimulatorItemPtr;
 
67
}
 
68
 
 
69
#endif