simulator.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008 Jakub Filak <xfilak01@stud.fit.vutbr.cz>
00003  *
00004  * This file is part of rob08
00005  *
00006  * rob08 is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * any later version.
00010  *
00011  * rob08 is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with rob08.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef __SIMULATOR_H__
00021 #define __SIMULATOR_H__
00022 
00023 #include "physics.h"
00024 
00025 #include <boost/shared_ptr.hpp>
00026 
00030 class State : public BaseMovingObject
00031 {
00032   public:
00033     State( const std::string& id, 
00034         DateTime st, 
00035         double speed,
00036         double tangle,
00037         double size,
00038         const struct Position& pos );
00042     const std::string& ComponentID() const;
00043 
00047     const DateTime& Stamp() const;
00048 
00049     virtual State* Clone();
00050 
00051     virtual ~State();
00052 
00053   protected:
00054     virtual void ImplSerialize( std::ostream& );  
00055     virtual void ImplDeserialize( std::istream& );
00056 
00057     virtual void StateSerialize( std::ostream& );
00058     virtual void StateDeserialize( std::istream& );
00059 
00060   private:
00061     struct Members;
00062     Members* pimpl;
00063 };
00064 
00065 typedef boost::shared_ptr<State> StatePtr;
00066 
00070 class StateContainer
00071 {
00072   public:
00073     StateContainer();
00074 
00075     StatePtr Current(const DateTime& now);
00076     StateContainer& Current( StatePtr );
00077 
00078     StatePtr Next(const DateTime& now);
00079     StateContainer& Next( StatePtr );
00080 
00081     void Serialize( std::ostream& output );
00082     void Deserialize( std::istream& input );
00083     
00084     ~StateContainer();
00085   private:
00086     static const std::string SER_START;
00087     static const std::string SER_NEXT;
00088     static const std::string SER_FINISH;
00089 
00090     void UpdateStates( const DateTime& now );
00091     struct Members;
00092     Members* pimpl;
00093 };
00094 
00095 #endif
00096 

Generated on Fri Jul 10 22:42:01 2009 for rob08 by  doxygen 1.5.4