Choreonoid  1.8
MultiSeqItem.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BASE_MULTI_SEQ_ITEM_H
7 #define CNOID_BASE_MULTI_SEQ_ITEM_H
8 
9 #include "AbstractSeqItem.h"
10 #include <cnoid/MultiSeq>
11 #include "exportdecl.h"
12 
13 namespace cnoid {
14 
15 template <typename MultiSeqType>
17 {
18 public:
19  static void initializeClass(ExtensionManager* ext) { }
20 
22 
23  MultiSeqItem() : seq_(std::make_shared<MultiSeqType>()) { }
24 
25  MultiSeqItem(std::shared_ptr<MultiSeqType> seq) : seq_(seq) { }
26 
27  virtual std::shared_ptr<AbstractMultiSeq> abstractMultiSeq() override { return seq_; }
28 
29  typename std::shared_ptr<MultiSeqType> seq() { return seq_; }
30 
32  : AbstractMultiSeqItem(org),
33  seq_(std::make_shared<MultiSeqType>(*org.seq_)) { }
34 
35  virtual ~MultiSeqItem() { }
36 
37 protected:
41  MultiSeqItem(const MultiSeqItem<MultiSeqType>& org, std::shared_ptr<MultiSeqType> newSeq)
42  : AbstractMultiSeqItem(org),
43  seq_(newSeq) { }
44 
45  void resetSeq(std::shared_ptr<MultiSeqType> seq) { seq_ = seq; }
46 
47  virtual Item* doDuplicate() const override {
48  return new MultiSeqItem<MultiSeqType>(*this);
49  }
50 
51 private:
52  std::shared_ptr<MultiSeqType> seq_;
53 };
54 
55 }
56 
57 #endif
cnoid::ExtensionManager
Definition: ExtensionManager.h:23
cnoid::MultiSeqItem::resetSeq
void resetSeq(std::shared_ptr< MultiSeqType > seq)
Definition: MultiSeqItem.h:45
cnoid::MultiSeqItem::MultiSeqItem
MultiSeqItem(const MultiSeqItem< MultiSeqType > &org)
Definition: MultiSeqItem.h:31
AbstractSeqItem.h
cnoid::MultiSeqItem::seq
std::shared_ptr< MultiSeqType > seq()
Definition: MultiSeqItem.h:29
cnoid::ref_ptr
Definition: Referenced.h:103
cnoid::MultiSeqItem::~MultiSeqItem
virtual ~MultiSeqItem()
Definition: MultiSeqItem.h:35
cnoid::MultiSeqItem::MultiSeqItem
MultiSeqItem(const MultiSeqItem< MultiSeqType > &org, std::shared_ptr< MultiSeqType > newSeq)
Definition: MultiSeqItem.h:41
cnoid::MultiSeqItem::MultiSeqItem
MultiSeqItem()
Definition: MultiSeqItem.h:23
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Item
Definition: Item.h:29
cnoid::MultiSeqItem::initializeClass
static void initializeClass(ExtensionManager *ext)
Definition: MultiSeqItem.h:19
cnoid::MultiSeqItem::abstractMultiSeq
virtual std::shared_ptr< AbstractMultiSeq > abstractMultiSeq() override
Definition: MultiSeqItem.h:27
cnoid::MultiSeqItem::MultiSeqItem
MultiSeqItem(std::shared_ptr< MultiSeqType > seq)
Definition: MultiSeqItem.h:25
cnoid::MultiSeqItem::doDuplicate
virtual Item * doDuplicate() const override
Override this function to allow duplication of an instance.
Definition: MultiSeqItem.h:47
cnoid::AbstractMultiSeqItem
Definition: AbstractSeqItem.h:35
cnoid::MultiSeqItem::Ptr
ref_ptr< MultiSeqItem< MultiSeqType > > Ptr
Definition: MultiSeqItem.h:21
cnoid::MultiSeqItem
Definition: MultiSeqItem.h:16