Choreonoid  1.8
MprPositionList.h
Go to the documentation of this file.
1 #ifndef CNOID_MANIPULATOR_PLUGIN_MPR_POSITION_LIST_H
2 #define CNOID_MANIPULATOR_PLUGIN_MPR_POSITION_LIST_H
3 
4 #include <cnoid/ClonableReferenced>
5 #include <cnoid/Signal>
6 #include "exportdecl.h"
7 
8 namespace cnoid {
9 
10 class MprPosition;
11 class GeneralId;
12 class Mapping;
13 
14 class CNOID_EXPORT MprPositionList : public ClonableReferenced
15 {
16 public:
18  ~MprPositionList();
19 
21  return static_cast<MprPositionList*>(doClone(nullptr));
22  }
23  MprPositionList* clone(CloneMap& cloneMap) const {
24  return static_cast<MprPositionList*>(doClone(&cloneMap));
25  }
26 
27  void setStringIdEnabled(bool on);
28  bool isStringIdEnabled() const;
29 
30  void clear();
31  int numPositions() const;
32  const MprPosition* positionAt(int index) const;
33  MprPosition* positionAt(int index);
34  int indexOf(MprPosition* position);
35 
36  MprPosition* findPosition(const GeneralId& id) const;
37 
38  bool insert(int index, MprPosition* position);
39  bool append(MprPosition* position);
40  bool replace(int index, MprPosition* position);
41  void removeAt(int index);
42 
43  SignalProxy<void(int index)> sigPositionAdded();
44  SignalProxy<void(int index, MprPosition* position)> sigPositionRemoved();
45  SignalProxy<void(int index, int flags)> sigPositionUpdated();
46 
51  bool resetId(MprPosition* position, const GeneralId& newId);
52 
53  int removeUnreferencedPositions(std::function<bool(MprPosition* position)> isReferenced);
54 
55  void resetIdCounter();
56  GeneralId createNextId(int prevId = -1);
57 
58  bool read(const Mapping& archive);
59  bool write(Mapping& archive) const;
60 
61  class Impl;
62 
63 protected:
64  MprPositionList(const MprPositionList& org, CloneMap* cloneMap);
65  virtual Referenced* doClone(CloneMap* cloneMap) const override;
66 
67 private:
68  // Called from the CoordinateFrame implementation
69  void notifyPositionUpdate(MprPosition* position, int flags);
70 
71  Impl* impl;
72 
73  friend class MprPosition;
74 };
75 
77 
78 }
79 
80 #endif
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::GeneralId
Definition: GeneralId.h:11
cnoid::write
Listing * write(Mapping *mapping, const std::string &key, const Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:145
cnoid::read
bool read(const Mapping *mapping, const std::string &key, Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:43
cnoid::ref_ptr< MprPositionList >
cnoid::MprPositionList::clone
MprPositionList * clone(CloneMap &cloneMap) const
Definition: MprPositionList.h:23
cnoid::MprPositionListPtr
ref_ptr< MprPositionList > MprPositionListPtr
Definition: MprPositionList.h:76
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::ClonableReferenced
Definition: ClonableReferenced.h:10
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::MprPosition
Definition: MprPosition.h:23
cnoid::Referenced
Definition: Referenced.h:54
cnoid::SignalProxy
Definition: Signal.h:470
cnoid::MprPositionList
Definition: MprPositionList.h:14
cnoid::MprPositionList::clone
MprPositionList * clone() const
Definition: MprPositionList.h:20