@@ -969,8 +969,15 @@ namespace dynamicgraph {
969
969
}
970
970
971
971
void setCoeffs (const Vector& c) { coeffs = c; }
972
+ void setCoeff1 (const double & c) { assert (coeffs.size () == 2 ); coeffs (0 ) = c; }
973
+ void setCoeff2 (const double & c) { assert (coeffs.size () == 2 ); coeffs (1 ) = c; }
974
+
972
975
void setSignalNumber (const int & n)
973
976
{
977
+ if (entity->getSignalNumber () == 2 ) {
978
+ entity->removeSignal ();
979
+ entity->removeSignal ();
980
+ }
974
981
coeffs = Vector::Ones (n);
975
982
entity->setSignalNumber (n);
976
983
}
@@ -981,7 +988,9 @@ namespace dynamicgraph {
981
988
using namespace dynamicgraph ::command;
982
989
entity = ent;
983
990
984
- setSignalNumber (2 );
991
+ coeffs = Vector::Ones (2 );
992
+ entity->addSignal (" sin1" );
993
+ entity->addSignal (" sin2" );
985
994
986
995
commandMap.insert (std::make_pair ( " getSignalNumber" ,
987
996
new Getter<Base, int > (*ent, &Base::getSignalNumber,
@@ -996,6 +1005,17 @@ namespace dynamicgraph {
996
1005
makeCommandVoid1<Base,Vector>(*ent,
997
1006
boost::function <void (const Vector&)> (boost::bind ( &AdderVariadic::setCoeffs, this , _1)),
998
1007
docCommandVoid1 (" set the multipliers." , " vector" ))));
1008
+
1009
+ // Add deprecated commands.
1010
+ commandMap.insert (std::make_pair (" setCoeff1" ,
1011
+ makeCommandVoid1<Base,double >(*ent,
1012
+ boost::function <void (const double &)> (boost::bind ( &AdderVariadic::setCoeff1, this , _1)),
1013
+ docCommandVoid1 (" deprecated. Use setCoeffs." , " double" ))));
1014
+
1015
+ commandMap.insert (std::make_pair (" setCoeff2" ,
1016
+ makeCommandVoid1<Base,double >(*ent,
1017
+ boost::function <void (const double &)> (boost::bind ( &AdderVariadic::setCoeff2, this , _1)),
1018
+ docCommandVoid1 (" deprecated. Use setCoeffs." , " double" ))));
999
1019
}
1000
1020
1001
1021
virtual std::string getDocString () const
0 commit comments