PositionVelocity.cpp

Go to the documentation of this file.
00001 
00002 
00008 /* 
00009 *
00010 */
00012 
00013 #include "PositionVelocity.h"
00014 namespace O_SESSAME {
00015 PositionVelocity::PositionVelocity() : m_Elements(NUM_POSVEL_ELEMENTS)
00016 {
00017 
00018 }
00019 
00020 PositionVelocity::~PositionVelocity()
00021 {
00022 }
00023 
00024 PositionVelocity::PositionVelocity(const Vector &_Elements)
00025 {
00026     SetState(_Elements);
00027 }
00028 
00029 PositionVelocity::PositionVelocity(const Vector &_Position, const Vector &_Velocity)
00030 {
00031     SetState(_Position, _Velocity);
00032 }
00033 
00034 void PositionVelocity::SetState(const Vector &_Elements)
00035 {
00036     m_Elements = _Elements;
00037     return;
00038 }
00039 void PositionVelocity::SetState(const Vector &_Position, const Vector &_Velocity)
00040 {
00041     m_Elements(_(VectorIndexBase, VectorIndexBase + _Position.getIndexBound()-1)) = _Position(_);
00042     m_Elements(_(VectorIndexBase + _Position.getIndexBound(), VectorIndexBase+ _Position.getIndexBound()+ _Velocity.getIndexBound()-1)) = _Velocity(_);
00043     return;
00044 }
00045 Vector PositionVelocity::GetState() const
00046 {
00047     return m_Elements;
00048 }
00049 
00050 void PositionVelocity::GetState(Vector &_Position, Vector &_Velocity) const
00051 {
00052     int numPosElements = _Position.getIndexBound();
00053     int numVelElements = _Velocity.getIndexBound();
00054     _Position = m_Elements(_(VectorIndexBase,VectorIndexBase+numPosElements-1));
00055     _Velocity = m_Elements(_(VectorIndexBase+numPosElements, VectorIndexBase+numPosElements+numVelElements-1));
00056     return;
00057 }
00058 
00059 void PositionVelocity::SetPositionVelocity(const Vector &_Position, const Vector &_Velocity)
00060 {
00061     SetState(_Position, _Velocity);
00062     return;
00063 }
00064 
00065 PositionVelocity* PositionVelocity::NewPointer()
00066 {
00067     return new PositionVelocity();
00068 }
00069 
00070 PositionVelocity* PositionVelocity::Clone()
00071 {
00072     return new PositionVelocity(*this);
00073 }
00074 
00075 } // close namespace O_SESSAME
00076 
00077 // Do not change the comments below - they will be added automatically by CVS
00078 /*****************************************************************************
00079 *       $Log: PositionVelocity.cpp,v $
00080 *       Revision 1.4  2003/04/29 18:48:31  nilspace
00081 *       Added NewPointer and Clone functions to help in getting the correct memory allocation.
00082 *       
00083 *       Revision 1.3  2003/04/24 21:14:24  nilspace
00084 *       const'd all Get() functions.
00085 *       
00086 *       Revision 1.2  2003/04/24 20:19:30  nilspace
00087 *       const'd all Get() functions.
00088 *       
00089 *       Revision 1.1  2003/04/08 22:47:35  nilspace
00090 *       Initial Submission.
00091 *       
00092 *
00093 ******************************************************************************/

Generated on Wed Aug 6 12:58:50 2003 for Open-Sessame Framework by doxygen1.3