formation_static.h

説明を見る。
00001 // -*-c++-*-
00002 
00008 /*
00009  *Copyright:
00010 
00011  Copyright (C) Hidehisa AKIYAMA
00012 
00013  This code is free software; you can redistribute it and/or
00014  modify it under the terms of the GNU Lesser General Public
00015  License as published by the Free Software Foundation; either
00016  version 2.1 of the License, or (at your option) any later version.
00017 
00018  This library is distributed in the hope that it will be useful,
00019  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  Lesser General Public License for more details.
00022 
00023  You should have received a copy of the GNU Lesser General Public
00024  License along with this library; if not, write to the Free Software
00025  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 
00027  *EndCopyright:
00028  */
00029 
00031 
00032 #ifndef RCSC_FORMATION_FORMATION_STATIC_H
00033 #define RCSC_FORMATION_FORMATION_STATIC_H
00034 
00035 #include <rcsc/formation/formation.h>
00036 #include <rcsc/geom/vector_2d.h>
00037 
00038 namespace rcsc {
00039 
00044 class FormationStatic
00045     : public Formation {
00046 private:
00047 
00049     std::string M_role_names[11];
00051     Vector2D M_pos[11];
00052 
00053 public:
00057     FormationStatic();
00058 
00063     static
00064     std::string name()
00065       {
00066           return std::string( "Static" );
00067       }
00068 
00073     static
00074     Formation * create()
00075       {
00076           return new FormationStatic();
00077       }
00078 
00079     //--------------------------------------------------------------
00080 
00085     virtual
00086     std::string methodName() const
00087       {
00088           return FormationStatic::name();
00089       }
00090 
00095     virtual
00096     Snapshot createDefaultParam();
00097 
00098 protected:
00099 
00106     virtual
00107     void createNewRole( const int unum,
00108                         const std::string & role_name,
00109                         const SideType type );
00110 
00116     virtual
00117     void setRoleName( const int unum,
00118                       const std::string & name );
00119 
00120 public:
00121 
00128     virtual
00129     std::string getRoleName( const int unum ) const;
00130 
00136     virtual
00137     Vector2D getPosition( const int unum,
00138                           const Vector2D & focus_point ) const;
00139 
00140     /*
00141       \brief get all positions for the current focus point
00142       \param focus_point current focus point, usually ball position
00143       \param positions contaner to store the result
00144      */
00145     virtual
00146     void getPositions( const Vector2D & focus_point,
00147                        std::vector< Vector2D > & positions ) const;
00148 
00153     virtual
00154     void train( const std::list< Snapshot > & train_data );
00155 
00161     virtual
00162     bool read( std::istream & is );
00163 
00169     virtual
00170     std::ostream & print( std::ostream & os ) const;
00171 
00172 private:
00173 
00179     bool readPlayers( std::istream & is );
00180 
00181 };
00182 
00183 }
00184 
00185 #endif

librcscに対してThu May 1 15:41:20 2008に生成されました。  doxygen 1.5.0