tPolynomialMarshaler< T > Class Template Reference

Marshal a tPolynomial as an input value (var) for "a + b*var + (c + d*var)*t". More...

#include <tPolynomialMarshaler.h>

List of all members.

Public Member Functions

 tPolynomialMarshaler ()
 Default constructor.
 tPolynomialMarshaler (std::string str)
 Parsing constructor.
 tPolynomialMarshaler (const tPolynomialMarshaler &other)
 Copy constructor.
 tPolynomialMarshaler (const tPolynomial< T > &_constant, const tPolynomial< T > &_variant)
 Constructor from 2 tPolynomial.
void setConstant (REAL value, int index)
void setVariant (REAL value, int index)
void setConstant (const tPolynomial< T > &tpConstant)
void setVariant (const tPolynomial< T > &tpVariant)
void parse (std::string str)
tPolynomial< T > const marshal (const tPolynomial< T > &other)
std::string toString () const

Protected Member Functions

void parsePart (std::string str, tArray< REAL > &array)
int getLenConstant () const
int getLenVariant () const

Protected Attributes

tPolynomial< T > constant
tPolynomial< T > variant

Friends

template<typename D>
bool operator== (const tPolynomialMarshaler< D > &left, const tPolynomialMarshaler< D > &right)
template<typename D>
bool operator!= (const tPolynomialMarshaler< D > &left, const tPolynomialMarshaler< D > &right)


Detailed Description

template<typename T>
class tPolynomialMarshaler< T >

Marshal a tPolynomial as an input value (var) for "a + b*var + (c + d*var)*t".

Definition at line 39 of file tPolynomialMarshaler.h.


Constructor & Destructor Documentation

template<typename T>
tPolynomialMarshaler< T >::tPolynomialMarshaler (  )  [inline]

Default constructor.

Definition at line 117 of file tPolynomialMarshaler.h.

00118 :constant(0),
00119   variant(0)
00120 {
00121   // Empty
00122 }

template<typename T>
tPolynomialMarshaler< T >::tPolynomialMarshaler ( std::string  str  )  [inline]

Parsing constructor.

Definition at line 125 of file tPolynomialMarshaler.h.

References tPolynomialMarshaler< T >::parse().

00126 :constant(0),
00127   variant(0)
00128 {
00129   parse(str);
00130 }

Here is the call graph for this function:

template<typename T>
tPolynomialMarshaler< T >::tPolynomialMarshaler ( const tPolynomialMarshaler< T > &  other  )  [inline]

Copy constructor.

Definition at line 133 of file tPolynomialMarshaler.h.

00134 :constant(other.constant),
00135   variant(other.variant)
00136 {
00137   // Empty
00138 }

template<typename T>
tPolynomialMarshaler< T >::tPolynomialMarshaler ( const tPolynomial< T > &  _constant,
const tPolynomial< T > &  _variant 
) [inline]

Constructor from 2 tPolynomial.

Definition at line 141 of file tPolynomialMarshaler.h.

00142   :constant(_constant),
00143    variant(_variant)
00144 {
00145   // Empty
00146 }


Member Function Documentation

template<typename T>
void tPolynomialMarshaler< T >::setConstant ( REAL  value,
int  index 
) [inline]

Definition at line 170 of file tPolynomialMarshaler.h.

References tPolynomialMarshaler< T >::constant.

Referenced by tPolynomialMarshalerTest::setUp().

00171 {
00172   constant[index] = value;
00173 }

Here is the caller graph for this function:

template<typename T>
void tPolynomialMarshaler< T >::setVariant ( REAL  value,
int  index 
) [inline]

Definition at line 176 of file tPolynomialMarshaler.h.

References tPolynomialMarshaler< T >::variant.

Referenced by tPolynomialMarshalerTest::setUp().

00177 {
00178   variant[index] = value;
00179 }

Here is the caller graph for this function:

template<typename T>
void tPolynomialMarshaler< T >::setConstant ( const tPolynomial< T > &  tpConstant  )  [inline]

Definition at line 182 of file tPolynomialMarshaler.h.

References tPolynomialMarshaler< T >::constant.

00183 {
00184   constant = tpConstant;
00185 }

template<typename T>
void tPolynomialMarshaler< T >::setVariant ( const tPolynomial< T > &  tpVariant  )  [inline]

Definition at line 188 of file tPolynomialMarshaler.h.

References tPolynomialMarshaler< T >::variant.

00189 {
00190   variant = tpVariant;
00191 }

template<typename T>
void tPolynomialMarshaler< T >::parse ( std::string  str  )  [inline]

Definition at line 152 of file tPolynomialMarshaler.h.

References tPolynomialMarshaler< T >::constant, TPOLYNOMIAL_MARSHALER_DELIMITER, and tPolynomialMarshaler< T >::variant.

Referenced by tPolynomialMarshalerTest::testParsing(), and tPolynomialMarshaler< T >::tPolynomialMarshaler().

00153 {
00154     int bPos;
00155 #define TPOLYNOMIAL_MARSHALER_DELIMITER ':'
00156 
00157     if ( (bPos = str.find(TPOLYNOMIAL_MARSHALER_DELIMITER)) != -1)
00158     {
00159         constant.parse(str.substr(0, bPos));
00160         variant.parse(str.substr(bPos + 1, str.length()));
00161     }
00162     else
00163     {
00164         constant.parse(str);
00165         variant = tPolynomial<T>(0);
00166     }
00167 }

Here is the caller graph for this function:

template<typename T>
tPolynomial< T > const tPolynomialMarshaler< T >::marshal ( const tPolynomial< T > &  other  )  [inline]

Definition at line 85 of file tPolynomialMarshaler.h.

References tPolynomialMarshaler< T >::constant, REAL, tPolynomial< T >::setAtSameReferenceVarValue(), and tPolynomialMarshaler< T >::variant.

Referenced by zZoneInfluenceItemRotation::apply(), zMonitorInfluence::apply(), tPolynomialMarshalerTest::testMarshaling(), and tPolynomialMarshalerTest::testMarshalingWithBase().

00086 {
00087     tPolynomial<T> tf(0);
00088     tPolynomial<T> res(0);
00089 
00090     tf.setAtSameReferenceVarValue(other);
00091     res.setAtSameReferenceVarValue(other);
00092 
00093     tf = variant.substitute(other);
00094 
00095     {
00096       REAL tData[] = {0.0, 1.0};
00097       tPolynomial<T> t(tData, sizeof(tData)/sizeof(tData[0]));
00098       t.setAtSameReferenceVarValue(other);
00099 
00100       res = tf * t;
00101     }
00102 
00103     // Reset tf for further computation
00104     tf = tPolynomial<T>(0);
00105     tf.setAtSameReferenceVarValue(other);
00106 
00107     tf = constant.substitute(other);
00108 
00109     res += tf;
00110 
00111     return res;
00112 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T>
std::string tPolynomialMarshaler< T >::toString (  )  const [inline]

Definition at line 213 of file tPolynomialMarshaler.h.

References tPolynomialMarshaler< T >::constant, and tPolynomialMarshaler< T >::variant.

Referenced by tPolynomialMarshalerTest::testMarshaling().

00214 {
00215   std::ostringstream ostr("");
00216 
00217   ostr << "Constant :" << std::endl;
00218   ostr << constant.toString() ;
00219 
00220   ostr << std::endl << "Variant :" << std::endl;
00221   ostr << variant.toString() ;
00222 
00223   return ostr.str();
00224 }

Here is the caller graph for this function:

template<typename T>
void tPolynomialMarshaler< T >::parsePart ( std::string  str,
tArray< REAL > &  array 
) [protected]

template<typename T>
int tPolynomialMarshaler< T >::getLenConstant (  )  const [inline, protected]

Definition at line 64 of file tPolynomialMarshaler.h.

00064 {return constant.Len();};

template<typename T>
int tPolynomialMarshaler< T >::getLenVariant (  )  const [inline, protected]

Definition at line 65 of file tPolynomialMarshaler.h.

00065 {return variant.Len();};


Friends And Related Function Documentation

template<typename T>
template<typename D>
bool operator== ( const tPolynomialMarshaler< D > &  left,
const tPolynomialMarshaler< D > &  right 
) [friend]

template<typename T>
template<typename D>
bool operator!= ( const tPolynomialMarshaler< D > &  left,
const tPolynomialMarshaler< D > &  right 
) [friend]


Member Data Documentation

template<typename T>
tPolynomial<T> tPolynomialMarshaler< T >::constant [protected]

Definition at line 65 of file tPolynomialMarshaler.h.

Referenced by tPolynomialMarshaler< nMessage >::getLenConstant(), tPolynomialMarshaler< T >::marshal(), operator==(), tPolynomialMarshaler< T >::parse(), tPolynomialMarshaler< T >::setConstant(), and tPolynomialMarshaler< T >::toString().

template<typename T>
tPolynomial<T> tPolynomialMarshaler< T >::variant [protected]

Definition at line 68 of file tPolynomialMarshaler.h.

Referenced by tPolynomialMarshaler< nMessage >::getLenVariant(), tPolynomialMarshaler< T >::marshal(), operator==(), tPolynomialMarshaler< T >::parse(), tPolynomialMarshaler< T >::setVariant(), and tPolynomialMarshaler< T >::toString().


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:58:18 2008 for Armagetron Advanced by  doxygen 1.5.4