monitor_command.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_MONITOR_COMMAND_H
00033 #define RCSC_MONITOR_COMMAND_H
00034 
00035 #include <rcsc/types.h>
00036 
00037 #include <iostream>
00038 #include <string>
00039 
00040 namespace rcsc {
00041 
00046 class MonitorCommand {
00047 public:
00051     enum Type {
00052         INIT,
00053         BYE,
00054 
00055         START, // kickoff
00056         FOUL, // drop_ball & free_kick_[lr]
00057 
00058         PLAYER, // move player
00059         DISCARD, // discard player
00060 
00061         COMPRESSION,
00062 
00063         ILLEGAL
00064     };
00065 
00066 protected:
00070     MonitorCommand()
00071       { }
00072 
00073 public:
00077     virtual
00078     ~MonitorCommand()
00079       { }
00080 
00085     virtual
00086     Type type() const = 0;
00087 
00093     virtual
00094     std::ostream & toStr( std::ostream & to ) const = 0;
00095 
00100     virtual
00101     std::string name() const = 0;
00102 };
00103 
00105 
00109 class MonitorInitCommand
00110     : public MonitorCommand {
00111 private:
00113     int M_version;
00114 
00115 public:
00120     explicit
00121     MonitorInitCommand( const int version = 0 );
00122 
00127     Type type() const
00128       {
00129           return INIT;
00130       }
00131 
00137     std::ostream & toStr( std::ostream & to ) const;
00138 
00143     std::string name() const
00144       {
00145           return std::string( "init" );
00146       }
00147 };
00148 
00150 
00154 class MonitorByeCommand
00155     : public MonitorCommand {
00156 private:
00157 
00158 public:
00162     MonitorByeCommand()
00163       { }
00164 
00169     Type type() const
00170       {
00171           return BYE;
00172       }
00173 
00179     std::ostream & toStr( std::ostream & to ) const;
00180 
00185     std::string name() const
00186       {
00187           return std::string( "dispbye" );
00188       }
00189 };
00190 
00192 
00196 class MonitorKickOffCommand
00197     : public MonitorCommand {
00198 private:
00199 
00200 public:
00204     MonitorKickOffCommand()
00205       { }
00206 
00211     Type type() const
00212       {
00213           return START;
00214       }
00215 
00221     std::ostream & toStr( std::ostream & to ) const;
00222 
00227     std::string name() const
00228       {
00229           return std::string( "dispstart" );
00230       }
00231 };
00232 
00234 
00240 class MonitorDropBallCommand
00241     : public MonitorCommand {
00242 private:
00243     double M_x; 
00244     double M_y; 
00245 public:
00251     MonitorDropBallCommand( const double & x,
00252                             const double & y );
00253 
00258     Type type() const
00259       {
00260           return FOUL;
00261       }
00262 
00270     std::ostream & toStr( std::ostream & to ) const;
00271 
00276     std::string name() const
00277       {
00278           return std::string( "dispfoul" );
00279       }
00280 };
00281 
00283 
00289 class MonitorFreeKickCommand
00290     : public MonitorCommand {
00291 private:
00292     double M_x; 
00293     double M_y; 
00294     SideID M_side; 
00295 public:
00302     MonitorFreeKickCommand( const double & x,
00303                             const double & y,
00304                             const SideID side );
00305 
00310     Type type() const
00311       {
00312           return FOUL;
00313       }
00314 
00322     std::ostream & toStr( std::ostream & to ) const;
00323 
00328     std::string name() const
00329       {
00330           return std::string( "dispfoul" );
00331       }
00332 };
00333 
00335 
00339 class MonitorMovePlayerCommand
00340     : public MonitorCommand {
00341 private:
00342     SideID M_side; 
00343     int M_unum; 
00344     double M_x; 
00345     double M_y; 
00346     double M_angle; 
00347 
00352     bool check() const;
00353 
00354 public:
00363     MonitorMovePlayerCommand( const SideID side,
00364                               const int unum,
00365                               const double & x,
00366                               const double & y,
00367                               const double & angle );
00368 
00373     Type type() const
00374       {
00375           return PLAYER;
00376       }
00377 
00383     std::ostream & toStr( std::ostream & to ) const;
00384 
00389     std::string name() const
00390       {
00391           return std::string( "dispplayer" );
00392       }
00393 };
00394 
00396 
00400 class MonitorDiscardPlayerCommand
00401     : public MonitorCommand {
00402 private:
00403     SideID M_side; 
00404     int M_unum; 
00405 public:
00411     MonitorDiscardPlayerCommand( const SideID side,
00412                                  const int unum );
00413 
00418     Type type() const
00419       {
00420           return DISCARD;
00421       }
00422 
00428     std::ostream & toStr( std::ostream & to ) const;
00429 
00434     std::string name() const
00435       {
00436           return std::string( "dispdiscard" );
00437       }
00438 };
00439 
00441 
00445 class MonitorCompressionCommand
00446     : public MonitorCommand {
00447 private:
00449     int M_level;
00450 
00451 public:
00456     explicit
00457     MonitorCompressionCommand( const int level );
00458 
00463     Type type() const
00464       {
00465           return COMPRESSION;
00466       }
00467 
00473     std::ostream & toStr( std::ostream & to ) const;
00474 
00479     std::string name() const
00480       {
00481           return std::string( "compression" );
00482       }
00483 };
00484 
00485 }
00486 
00487 #endif

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