1 /* === S I N F G =========================================================== */
3 ** \brief Template File
5 ** $Id: duck.cpp,v 1.1.1.1 2005/01/07 03:34:36 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 /* === H E A D E R S ======================================================= */
35 /* === U S I N G =========================================================== */
39 using namespace sinfg;
40 using namespace studio;
42 /* === M A C R O S ========================================================= */
44 /* === G L O B A L S ======================================================= */
46 int studio::Duck::duck_count(0);
54 sinfg::error("%d ducks not yet deleted!",counter);
58 int _DuckCounter::counter(0);
61 /* === P R O C E D U R E S ================================================= */
63 /* === M E T H O D S ======================================================= */
71 { duck_count++; _DuckCounter::counter++; }
73 Duck::Duck(const sinfg::Point &point):
82 { duck_count++; _DuckCounter::counter++;}
84 Duck::Duck(const sinfg::Point &point,const sinfg::Point &origin):
92 { duck_count++; _DuckCounter::counter++;}
94 Duck::~Duck() { duck_count--; _DuckCounter::counter--;}
97 Duck::get_data_guid()const
99 if(value_desc_.is_value_node())
100 return value_desc_.get_value_node()->get_guid();
101 return GUID::hasher(get_name());
105 Duck::set_name(const sinfg::String &x)
108 if(guid_==GUID::zero())
110 guid_=GUID::hasher(name);
116 Duck::operator==(const Duck &rhs)const
122 scalar==rhs.scalar &&
124 transform_stack_.size()==rhs.transform_stack_.size();
126 //(origin_duck?*origin_duck==*rhs.origin_duck:origin==rhs.origin) &&
127 //(shared_point?*shared_point==*rhs.shared_point:point==rhs.point) ;
131 Duck::get_trans_point()const
133 return transform_stack_.perform(get_sub_trans_point());
137 Duck::set_trans_point(const sinfg::Point &x)
139 set_sub_trans_point(transform_stack_.unperform(x));
142 //! Sets the origin point.
144 Duck::set_origin(const sinfg::Point &x)
146 origin=x; origin_duck=0;
149 //! Sets the origin point as another duck
151 Duck::set_origin(const etl::handle<Duck> &x)
156 //! Retrieves the origin location
158 Duck::get_origin()const
160 return origin_duck?origin_duck->get_point():origin;
163 //! Retrieves the origin duck
164 const etl::handle<Duck> &
165 Duck::get_origin_duck() const
170 //! Retrieves the origin location
172 Duck::get_trans_origin()const
174 return transform_stack_.perform(get_sub_trans_origin());
178 Duck::get_sub_trans_point()const
180 return get_point()*get_scalar()+get_sub_trans_origin();
184 Duck::set_sub_trans_point(const sinfg::Point &x)
186 set_point((x-get_sub_trans_origin())/get_scalar());
190 Duck::get_sub_trans_origin()const
192 return origin_duck?origin_duck->get_sub_trans_point():origin;