6 #ifndef CNOID_UTIL_ABSTRACT_SEQ_H
7 #define CNOID_UTIL_ABSTRACT_SEQ_H
14 #include "exportdecl.h"
32 virtual std::shared_ptr<AbstractSeq> cloneSeq()
const = 0;
40 virtual double getFrameRate()
const = 0;
41 virtual void setFrameRate(
double frameRate) = 0;
42 static double defaultFrameRate();
44 double getTimeStep()
const;
45 void setTimeStep(
double timeStep);
47 double getTimeOfFrame(
int frame)
const;
48 int getFrameOfTime(
double time)
const;
50 virtual double getOffsetTime()
const = 0;
51 virtual void setOffsetTime(
double time) = 0;
52 int getOffsetTimeFrame()
const;
54 virtual int getNumFrames()
const = 0;
55 virtual void setNumFrames(
int n,
bool clearNewElements =
false) = 0;
58 return setNumFrames(
static_cast<int>(length * getFrameRate()), clearNewElements);
67 double getTimeLength()
const;
73 virtual void setSeqContentName(
const std::string& name);
75 bool readSeq(
const Mapping* archive, std::ostream& os =
nullout());
79 const std::string& seqMessage()
const;
82 void setSeqType(
const std::string& type);
84 virtual bool doReadSeq(
const Mapping* archive, std::ostream& os);
85 virtual bool doWriteSeq(
YAMLWriter& writer, std::function<
void()> additionalPartCallback);
95 std::string contentName_;
106 using AbstractSeq::operator=;
109 virtual std::shared_ptr<AbstractSeq> cloneSeq()
const = 0;
113 virtual void setDimension(
int numFrames,
int numParts,
bool clearNewElements =
false) = 0;
115 virtual void setNumParts(
int numParts,
bool clearNewElements =
false) = 0;
116 virtual int getNumParts()
const = 0;
118 virtual int partIndex(
const std::string& partLabel)
const;
119 virtual const std::string& partLabel(
int partIndex)
const;
122 virtual bool doWriteSeq(
YAMLWriter& writer, std::function<
void()> additionalPartCallback);
123 std::vector<std::string> readSeqPartLabels(
const Mapping* archive);
127 #ifdef CNOID_BACKWARD_COMPATIBILITY
128 typedef std::shared_ptr<AbstractSeq> AbstractSeqPtr;
129 typedef std::shared_ptr<AbstractMultiSeq> AbstractMultiSeqPtr;