1 /* === S I N F G =========================================================== */
3 ** \brief Template Header
5 ** $Id: waypoint.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SINFG_WAYPOINT_H
25 #define __SINFG_WAYPOINT_H
27 /* === H E A D E R S ======================================================= */
32 //#include "valuenode.h"
36 #include "interpolation.h"
38 /* === M A C R O S ========================================================= */
40 /* === T Y P E D E F S ===================================================== */
42 /* === C L A S S E S & S T R U C T S ======================================= */
53 class Waypoint : public UniqueID
56 -- ** -- T Y P E S -----------------------------------------------------------
61 typedef sinfg::Interpolation Interpolation;
65 friend class Waypoint;
73 Real temporal_tension;
75 bool priority_flag,before_flag,after_flag,tension_flag,continuity_flag,bias_flag,temporal_tension_flag;
83 continuity_flag(false),
85 temporal_tension_flag(false) { }
87 Interpolation get_before()const { return before; }
88 void set_before(Interpolation x) { before=x; before_flag=true;}
90 Interpolation get_after()const { return after; }
91 void set_after(Interpolation x) { after=x; after_flag=true;}
93 const Real &get_tension()const { return tension; }
94 void set_tension(const Real &x) { tension=x; tension_flag=true;}
96 const Real &get_continuity()const { return continuity; }
97 void set_continuity(const Real &x) { continuity=x; continuity_flag=true;}
99 const Real &get_bias()const { return bias; }
100 void set_bias(const Real &x) { bias=x; bias_flag=true;}
102 const Real &get_temporal_tension()const { return temporal_tension; }
103 void set_temporal_tension(const Real &x) { temporal_tension=x; temporal_tension_flag=true;}
105 int get_priority()const { return priority; }
106 void set_priority(int x) { priority=x; priority_flag=true;}
108 #define FLAG_MACRO(x) bool get_##x##_flag()const { return x##_flag; } void set_##x##_flag(bool y) { x##_flag=y; }
113 FLAG_MACRO(continuity)
115 FLAG_MACRO(temporal_tension)
124 continuity_flag=false;
126 temporal_tension_flag=false;
129 bool is_trivial()const
138 temporal_tension_flag
144 -- ** -- D A T A -------------------------------------------------------------
150 etl::loose_handle<ValueNode> parent_;
152 Interpolation before, after;
154 etl::rhandle<ValueNode> value_node;
158 // The following are for the INTERPOLATION_TCB type
163 // The following are for the INTERPOLATION_MANUAL type
164 ValueBase cpoint_before,cpoint_after;
170 -- ** -- C O N S T R U C T O R S ---------------------------------------------
175 Waypoint(ValueBase value, Time time);
176 Waypoint(etl::handle<ValueNode> value_node, Time time);
181 -- ** -- M E M B E R F U N C T I O N S -------------------------------------
186 void apply_model(const Model &x);
188 Interpolation get_before()const { return before; }
189 void set_before(Interpolation x) { before=x; }
191 Interpolation get_after()const { return after; }
192 void set_after(Interpolation x) { after=x; }
194 ValueBase get_value()const;
195 ValueBase get_value(const Time &t)const;
196 void set_value(const ValueBase &x);
198 const etl::rhandle<ValueNode> &get_value_node()const { return value_node; }
199 void set_value_node(const etl::handle<ValueNode> &x);
201 const Real &get_tension()const { return tension; }
202 void set_tension(const Real &x) { tension=x; }
204 const Real &get_continuity()const { return continuity; }
205 void set_continuity(const Real &x) { continuity=x; }
207 const Real &get_bias()const { return bias; }
208 void set_bias(const Real &x) { bias=x; }
210 const Time &get_time()const { return time; }
211 void set_time(const Time &x);
213 int get_priority()const { return priority_; }
214 void set_priority(int x) { priority_=x; }
216 const etl::loose_handle<ValueNode> &get_parent_value_node()const { return parent_; }
217 void set_parent_value_node(const etl::loose_handle<ValueNode> &x) { parent_=x; }
219 bool is_static()const;
221 float get_time_tension()const { return time_tension; }
222 void set_time_tension(const float& x) { time_tension=x; }
223 float get_temporal_tension()const { return time_tension; }
224 void set_temporal_tension(const float& x) { time_tension=x; }
226 bool operator<(const Waypoint &rhs)const
227 { return time<rhs.time; }
229 bool operator<(const Time &rhs)const
230 { return time.is_less_than(rhs); }
231 bool operator>(const Time &rhs)const
232 { return time.is_more_than(rhs); }
234 bool operator==(const Time &rhs)const
235 { return time.is_equal(rhs); }
236 bool operator!=(const Time &rhs)const
237 { return !time.is_equal(rhs); }
239 bool operator==(const UniqueID &rhs)const
240 { return get_uid()==rhs.get_uid(); }
241 bool operator!=(const UniqueID &rhs)const
242 { return get_uid()!=rhs.get_uid(); }
244 Waypoint clone(const GUID& deriv_guid=GUID())const;
246 GUID get_guid()const;
247 }; // END of class Waypoint
249 typedef std::vector< Waypoint > WaypointList;
251 }; // END of namespace sinfg
253 /* === E N D =============================================================== */