1 /* === S I N F G =========================================================== */
2 /*! \file valuenode_sine.cpp
3 ** \brief Template File
5 ** $Id: valuenode_sine.cpp,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 /* === H E A D E R S ======================================================= */
31 #include "valuenode_sine.h"
32 #include "valuenode_const.h"
37 /* === U S I N G =========================================================== */
41 using namespace sinfg;
43 /* === M A C R O S ========================================================= */
45 /* === G L O B A L S ======================================================= */
47 /* === P R O C E D U R E S ================================================= */
49 /* === M E T H O D S ======================================================= */
51 ValueNode_Sine::ValueNode_Sine(const ValueBase::Type &x):
56 case ValueBase::TYPE_REAL:
57 set_link("angle",ValueNode_Const::create(Angle::zero()));
58 set_link("amp",ValueNode_Const::create(Real(1)));
61 throw Exception::BadType(ValueBase::type_name(x));
68 ValueNode_Sine::create(const ValueBase &x)
70 return new ValueNode_Sine(x.get_type());
73 ValueNode_Sine::~ValueNode_Sine()
79 ValueNode_Sine::operator()(Time t)const
83 (*angle_)(t).get(Angle())
84 ).get() * (*amp_)(t).get(Real())
90 ValueNode_Sine::get_name()const
96 ValueNode_Sine::get_local_name()const
102 ValueNode_Sine::check_type(ValueBase::Type type)
104 return type==ValueBase::TYPE_REAL;
108 ValueNode_Sine::set_link_vfunc(int i,ValueNode::Handle x)
110 assert(i==0 || i==1);
114 signal_child_changed()(i);signal_value_changed()();
120 signal_child_changed()(i);signal_value_changed()();
126 ValueNode::LooseHandle
127 ValueNode_Sine::get_link_vfunc(int i)const
129 assert(i==0 || i==1);
139 ValueNode_Sine::link_count()const
145 ValueNode_Sine::link_name(int i)const
147 assert(i==0 || i==1);
156 ValueNode_Sine::link_local_name(int i)const
158 assert(i==0 || i==1);
162 return _("Amplitude");
167 ValueNode_Sine::get_link_index_from_name(const String &name)const
174 throw Exception::BadLinkName(name);
178 ValueNode_Sine::create_new()const
180 return new ValueNode_Sine(get_type());