Choreonoid  1.8
PositionTagGroup.h
Go to the documentation of this file.
1 #ifndef CNOID_UTIL_POSITION_TAG_GROUP_H
2 #define CNOID_UTIL_POSITION_TAG_GROUP_H
3 
4 #include "ClonableReferenced.h"
5 #include "PositionTag.h"
6 #include "Signal.h"
7 #include "EigenTypes.h"
8 #include <vector>
9 #include "exportdecl.h"
10 
11 namespace cnoid {
12 
13 class PositionTag;
14 class Mapping;
15 
16 class CNOID_EXPORT PositionTagGroup : public ClonableReferenced
17 {
18 public:
19  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
20 
23  virtual ~PositionTagGroup();
24 
26  return static_cast<PositionTagGroup*>(doClone(nullptr));
27  }
28  PositionTagGroup* clone(CloneMap& cloneMap) const {
29  return static_cast<PositionTagGroup*>(doClone(&cloneMap));
30  }
31 
32  const std::string& name() const;
33  void setName(const std::string& name);
34 
35  void clearTags();
36 
37  bool empty() const { return tags_.empty(); }
38  int numTags() const { return tags_.size(); }
39 
40  const PositionTag* tagAt(int index) const {
41  return tags_[index];
42  }
43  PositionTag* tagAt(int index) {
44  return tags_[index];
45  }
46 
47  typedef std::vector<PositionTagPtr> Container;
48  Container::const_iterator begin() const { return tags_.begin(); }
49  Container::const_iterator end() const { return tags_.end(); }
50 
51  void insert(int index, PositionTag* tag);
52  void insert(int index, PositionTagGroup* group);
53  void append(PositionTag* tag);
54  bool removeAt(int index);
55  SignalProxy<void(int index)> sigTagAdded();
56  SignalProxy<void(int index, PositionTag* tag)> sigTagRemoved();
57  SignalProxy<void(int index)> sigTagPositionChanged();
58  SignalProxy<void(int index)> sigTagPositionUpdated();
59  void notifyTagPositionChange(int index);
60  void notifyTagPositionUpdate(int index, bool doNotifyPositionChange = true);
61 
62  bool read(const Mapping* archive);
63  bool write(Mapping* archive) const;
64 
65  enum CsvFormat { XYZMMRPYDEG = 0, XYZMM = 1 };
66  bool loadCsvFile(const std::string& filename, CsvFormat csvFormat, std::ostream& os);
67 
68 protected:
69  virtual Referenced* doClone(CloneMap* cloneMap) const override;
70 
71 private:
72  Container tags_;
73 
74  class Impl;
75  Impl* impl;
76 };
77 
79 
80 }
81 
82 #endif
cnoid::PositionTagGroup::clone
PositionTagGroup * clone(CloneMap &cloneMap) const
Definition: PositionTagGroup.h:28
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::PositionTagGroupPtr
ref_ptr< PositionTagGroup > PositionTagGroupPtr
Definition: PositionTagGroup.h:78
cnoid::write
Listing * write(Mapping *mapping, const std::string &key, const Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:145
cnoid::PositionTagGroup::empty
bool empty() const
Definition: PositionTagGroup.h:37
cnoid::PositionTag
Definition: PositionTag.h:12
cnoid::PositionTagGroup::numTags
int numTags() const
Definition: PositionTagGroup.h:38
cnoid::read
bool read(const Mapping *mapping, const std::string &key, Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:43
cnoid::ref_ptr< PositionTagGroup >
cnoid::PositionTagGroup::tagAt
PositionTag * tagAt(int index)
Definition: PositionTagGroup.h:43
PositionTag.h
cnoid::PositionTagGroup::CsvFormat
CsvFormat
Definition: PositionTagGroup.h:65
cnoid::PositionTagGroup::Container
std::vector< PositionTagPtr > Container
Definition: PositionTagGroup.h:47
cnoid::PositionTagGroup::clone
PositionTagGroup * clone() const
Definition: PositionTagGroup.h:25
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::ClonableReferenced
Definition: ClonableReferenced.h:10
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::PositionTagGroup::end
Container::const_iterator end() const
Definition: PositionTagGroup.h:49
Signal.h
cnoid::PositionTagGroup::tagAt
const PositionTag * tagAt(int index) const
Definition: PositionTagGroup.h:40
cnoid::PositionTagGroup
Definition: PositionTagGroup.h:16
cnoid::Referenced
Definition: Referenced.h:54
EigenTypes.h
cnoid::SignalProxy
Definition: Signal.h:470
ClonableReferenced.h
cnoid::PositionTagGroup::begin
Container::const_iterator begin() const
Definition: PositionTagGroup.h:48