[GCC-XML] gccxml and boost.shared_ptr

Alexis H. Rivera-Rios ahrivera at yahoo.com
Thu Jul 28 13:32:32 EDT 2005


can somebody explain me this error?  Here is the code.
 It compiles fine in VC71/Boost 1.32

class Entity
	{
	public:
		/// type of trajectory pointer
		typedef boost::shared_ptr<StatATA::Trajectory>
TrajectoryPtr;
		/// constructor
		Entity() : trajectory(), state() {}
		/// destructor
		virtual ~Entity() {}
		/// sets the position
		void SetPosition(const gmtl::Point3d &pos)
		{ 
			state.position = pos; 
		}
		/// returns the position
		gmtl::Point3d GetPosition() const { return
state.position; }
		
		/// sets the velocity
		void SetVelocity(const gmtl::Vec3d& vel)
		{
			state.velocity = vel;
		}
		/// returns the velocity
		gmtl::Vec3d GetVelocity() const { return
state.velocity; }

		/// sets the acceleration
		void SetAcceleration(const gmtl::Vec3d& acc)
		{
			state.acceleration = acc;
		}
		/// returns the acceleration
		gmtl::Vec3d GetAcceleration() const { return
state.acceleration; }
		/// set the heading (unit vector)
		void SetHeading(const gmtl::Vec3d& hed)
		{
			state.heading = hed;
		}
		/// returns the heading of the missile (unit vector)
		gmtl::Vec3d GetHeading() const { return
state.heading; }

		/// sets the trajectory strategy
		void SetTrajectory(const TrajectoryPtr&
newTrajectory)
		{
			trajectory = newTrajectory;
		}
        
		/// delegates to the Trajectory object 
		/// the updating of the missile state
		virtual void UpdateState(double ellapsedTime=1)
		{
			if (trajectory.get())
			{
				//Trajectory *t = trajectory.get();
				//t->UpdateState(state,ellapsedTime);
				trajectory->UpdateState(state,ellapseTime);
			}
		}


		/// reset the state to a default value
		virtual void ResetState()
		{
			state = EntityState();
		}
	private:
		EntityState state; ///< entity's physical state
		TrajectoryPtr trajectory; ///< algorithm for
updating the missle state
		/// copy constructor disabled
		Entity(const Entity& );
		/// assignment disabled
		Entity& operator=(const Entity &);

	};

But when I run Pyste (which calls gccxml) it
complains:

C:/Boost/include/boost-1_32/boost/shared_ptr.hpp: In
member function `T*
   boost::shared_ptr<T>::operator->() const [with T =
StatATA::Trajectory]':
../StatATA/entity.h:78:   instantiated from here
C:/Boost/include/boost-1_32/boost/shared_ptr.hpp:253:
error: invalid conversion

   from `void*' to `const char*'
../StatATA/entity.h: In member function `virtual void
   StatATA::Entity::UpdateState(double)':
../StatATA/entity.h:78: error: `ellapseTime'
undeclared (first use this
   function)
../StatATA/entity.h:78: error: (Each undeclared
identifier is reported only
   once for each function it appears in.)

But if I do:

Trajectory *t = trajectory.get();
t->UpdateState(state,ellapsedTime);

instead of:			
trajectory->UpdateState(state,ellapseTime);

it works... but that sucks.  

Any comments would be greatly appreciated.

Alexis

Programming Tutorial:
In Python: To do this, do this
In Perl: To do this, do this or this or this or this...
In C: To do this, do this, but be careful
In C++: To do this, do this, but don't do this, be careful of this, watch out for this, and whatever you do, don't do this

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the gccxml mailing list