Choreonoid  1.8
AttachmentDevice.h
Go to the documentation of this file.
1 #ifndef CNOID_BODY_ATTACHMENT_DEVICE_H
2 #define CNOID_BODY_ATTACHMENT_DEVICE_H
3 
4 #include "Device.h"
5 #include "exportdecl.h"
6 
7 namespace cnoid {
8 
9 class HolderDevice;
10 class StdBodyLoader;
11 class Mapping;
12 
13 class CNOID_EXPORT AttachmentDevice : public Device
14 {
15 public:
17  virtual ~AttachmentDevice();
18 
19  virtual const char* typeName() const override;
20  void copyAttachmentDeviceStateFrom(const AttachmentDevice& other);
21  virtual void copyStateFrom(const DeviceState& other) override;
22  virtual DeviceState* cloneState() const override;
23  virtual void forEachActualType(std::function<bool(const std::type_info& type)> func) override;
24  virtual int stateSize() const override;
25  virtual const double* readState(const double* buf) override;
26  virtual double* writeState(double* out_buf) const override;
27 
28  virtual bool on() const override;
29  virtual void on(bool on) override;
30 
31  HolderDevice* holder();
32  bool isAttaching() const;
33  void detach();
34 
35  std::string category() const;
36  void setCategory(const std::string& category);
37  void clearCategory();
38 
39  bool readSpecifications(const Mapping* info);
40  bool writeSpecifications(Mapping* info) const;
41 
42 protected:
43  AttachmentDevice(const AttachmentDevice& org, bool copyStateOnly, CloneMap* cloneMap);
44  virtual Referenced* doClone(CloneMap* cloneMap) const override;
45 
46 private:
47  weak_ref_ptr<HolderDevice> weak_holder;
48  bool on_;
49 
50  std::string* category_; // Not a state
51 
52  friend class HolderDevice;
53  void setHolder(HolderDevice* holder);
54 };
55 
57 
58 }
59 
60 #endif
cnoid::Mapping
Definition: ValueTree.h:253
Device.h
cnoid::weak_ref_ptr
Definition: Referenced.h:276
cnoid::ref_ptr< AttachmentDevice >
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::HolderDevice
Definition: HolderDevice.h:13
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::AttachmentDevicePtr
ref_ptr< AttachmentDevice > AttachmentDevicePtr
Definition: AttachmentDevice.h:56
cnoid::AttachmentDevice
Definition: AttachmentDevice.h:13
cnoid::DeviceState
Definition: Device.h:20
cnoid::Referenced
Definition: Referenced.h:54
cnoid::Device
Definition: Device.h:53