say_message_parser.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_COMMON_SAY_MESSAGE_PARSER_H
00033 #define RCSC_COMMON_SAY_MESSAGE_PARSER_H
00034 
00035 #include <rcsc/types.h>
00036 
00037 #include <boost/shared_ptr.hpp>
00038 #include <string>
00039 
00040 namespace rcsc {
00041 
00042 class AudioMemory;
00043 class GameTime;
00044 
00045 /*-------------------------------------------------------------------*/
00050 class SayMessageParser {
00051 private:
00052 
00053     // not used
00054     SayMessageParser( const SayMessageParser & );
00055     SayMessageParser & operator=( const SayMessageParser & );
00056 
00057 protected:
00058 
00062     SayMessageParser()
00063       { }
00064 
00065 public:
00066 
00070     virtual
00071     ~SayMessageParser()
00072       { }
00073 
00078     virtual
00079     char header() const = 0;
00080 
00091     virtual
00092     int parse( const int sender,
00093                const double & dir,
00094                const char * msg,
00095                const GameTime & current ) = 0;
00096 
00097 };
00098 
00099 /*-------------------------------------------------------------------*/
00108 class BallMessageParser
00109     : public SayMessageParser {
00110 private:
00111 
00113     boost::shared_ptr< AudioMemory > M_memory;
00114 
00115 public:
00116 
00121     explicit
00122     BallMessageParser( boost::shared_ptr< AudioMemory > memory );
00123 
00128     static
00129     char sheader()
00130       {
00131           return 'b';
00132       }
00133 
00138     char header() const
00139       {
00140           return sheader();
00141       }
00142 
00147     static
00148     std::size_t slength()
00149       {
00150           return 6;
00151       }
00152 
00163     int parse( const int sender,
00164                const double & dir,
00165                const char * msg,
00166                const GameTime & current );
00167 
00168 };
00169 
00170 /*-------------------------------------------------------------------*/
00179 class PassMessageParser
00180     : public SayMessageParser {
00181 private:
00182 
00184     boost::shared_ptr< AudioMemory > M_memory;
00185 
00186 public:
00187 
00192     explicit
00193     PassMessageParser( boost::shared_ptr< AudioMemory > memory );
00194 
00199     static
00200     char sheader()
00201       {
00202           return 'p';
00203       }
00204 
00209     char header() const
00210       {
00211           return sheader();
00212       }
00213 
00218     static
00219     std::size_t slength()
00220       {
00221           return 10;
00222       }
00223 
00234     int parse( const int sender,
00235                const double & dir,
00236                const char * msg,
00237                const GameTime & current );
00238 
00239 };
00240 
00241 /*-------------------------------------------------------------------*/
00250 class InterceptMessageParser
00251     : public SayMessageParser {
00252 private:
00253 
00255     boost::shared_ptr< AudioMemory > M_memory;
00256 
00257 public:
00258 
00263     explicit
00264     InterceptMessageParser( boost::shared_ptr< AudioMemory > memory );
00265 
00270     static
00271     char sheader()
00272       {
00273           return 'i';
00274       }
00275 
00280     char header() const
00281       {
00282           return sheader();
00283       }
00284 
00289     static
00290     std::size_t slength()
00291       {
00292           return 3;
00293       }
00294 
00305     int parse( const int sender,
00306                const double & dir,
00307                const char * msg,
00308                const GameTime & current );
00309 
00310 };
00311 
00312 /*-------------------------------------------------------------------*/
00321 class GoalieMessageParser
00322     : public SayMessageParser {
00323 private:
00324 
00326     boost::shared_ptr< AudioMemory > M_memory;
00327 
00328 public:
00329 
00334     explicit
00335     GoalieMessageParser( boost::shared_ptr< AudioMemory > memory );
00336 
00341     static
00342     char sheader()
00343       {
00344           return 'g';
00345       }
00346 
00351     char header() const
00352       {
00353           return sheader();
00354       }
00355 
00360     static
00361     std::size_t slength()
00362       {
00363           return 5;
00364       }
00365 
00376     int parse( const int sender,
00377                const double & dir,
00378                const char * msg,
00379                const GameTime & current );
00380 
00381 };
00382 
00383 /*-------------------------------------------------------------------*/
00392 class OffsideLineMessageParser
00393     : public SayMessageParser {
00394 private:
00395 
00397     boost::shared_ptr< AudioMemory > M_memory;
00398 
00399 public:
00400 
00405     explicit
00406     OffsideLineMessageParser( boost::shared_ptr< AudioMemory > memory );
00407 
00412     static
00413     char sheader()
00414       {
00415           return 'o';
00416       }
00417 
00422     char header() const
00423       {
00424           return sheader();
00425       }
00426 
00431     static
00432     std::size_t slength()
00433       {
00434           return 2;
00435       }
00436 
00447     int parse( const int sender,
00448                const double & dir,
00449                const char * msg,
00450                const GameTime & current );
00451 
00452 };
00453 
00454 /*-------------------------------------------------------------------*/
00463 class DefenseLineMessageParser
00464     : public SayMessageParser {
00465 private:
00466 
00468     boost::shared_ptr< AudioMemory > M_memory;
00469 
00470 public:
00471 
00476     explicit
00477     DefenseLineMessageParser( boost::shared_ptr< AudioMemory > memory );
00478 
00483     static
00484     char sheader()
00485       {
00486           return 'd';
00487       }
00488 
00493     char header() const
00494       {
00495           return sheader();
00496       }
00497 
00502     static
00503     std::size_t slength()
00504       {
00505           return 2;
00506       }
00507 
00518     int parse( const int sender,
00519                const double & dir,
00520                const char * msg,
00521                const GameTime & current );
00522 
00523 };
00524 
00525 /*-------------------------------------------------------------------*/
00534 class WaitRequestMessageParser
00535     : public SayMessageParser {
00536 private:
00537 
00539     boost::shared_ptr< AudioMemory > M_memory;
00540 
00541 public:
00542 
00547     explicit
00548     WaitRequestMessageParser( boost::shared_ptr< AudioMemory > memory );
00549 
00554     static
00555     char sheader()
00556       {
00557           return 'w';
00558       }
00559 
00564     char header() const
00565       {
00566           return sheader();
00567       }
00568 
00573     static
00574     std::size_t slength()
00575       {
00576           return 1;
00577       }
00578 
00589     int parse( const int sender,
00590                const double & dir,
00591                const char * msg,
00592                const GameTime & current );
00593 
00594 };
00595 
00596 /*-------------------------------------------------------------------*/
00605 class PassRequestMessageParser
00606     : public SayMessageParser {
00607 private:
00608 
00610     boost::shared_ptr< AudioMemory > M_memory;
00611 
00612 public:
00613 
00618     explicit
00619     PassRequestMessageParser( boost::shared_ptr< AudioMemory > memory );
00620 
00625     static
00626     char sheader()
00627       {
00628           return 'h';
00629       }
00630 
00635     char header() const
00636       {
00637           return sheader();
00638       }
00639 
00644     static
00645     std::size_t slength()
00646       {
00647           return 4;
00648       }
00649 
00660     int parse( const int sender,
00661                const double & dir,
00662                const char * msg,
00663                const GameTime & current );
00664 
00665 };
00666 
00667 /*-------------------------------------------------------------------*/
00676 class StaminaMessageParser
00677     : public SayMessageParser {
00678 private:
00679 
00681     boost::shared_ptr< AudioMemory > M_memory;
00682 
00683 public:
00684 
00689     explicit
00690     StaminaMessageParser( boost::shared_ptr< AudioMemory > memory );
00691 
00696     static
00697     char sheader()
00698       {
00699           return 's';
00700       }
00701 
00706     char header() const
00707       {
00708           return sheader();
00709       }
00710 
00715     static
00716     std::size_t slength()
00717       {
00718           return 2;
00719       }
00720 
00731     int parse( const int sender,
00732                const double & dir,
00733                const char * msg,
00734                const GameTime & current );
00735 
00736 };
00737 
00738 /*-------------------------------------------------------------------*/
00747 class RecoveryMessageParser
00748     : public SayMessageParser {
00749 private:
00750 
00752     boost::shared_ptr< AudioMemory > M_memory;
00753 
00754 public:
00755 
00760     explicit
00761     RecoveryMessageParser( boost::shared_ptr< AudioMemory > memory );
00762 
00767     static
00768     char sheader()
00769       {
00770           return 'r';
00771       }
00772 
00777     char header() const
00778       {
00779           return sheader();
00780       }
00781 
00786     static
00787     std::size_t slength()
00788       {
00789           return 2;
00790       }
00791 
00802     int parse( const int sender,
00803                const double & dir,
00804                const char * msg,
00805                const GameTime & current );
00806 
00807 };
00808 
00809 /*-------------------------------------------------------------------*/
00818 class DribbleMessageParser
00819     : public SayMessageParser {
00820 private:
00821 
00823     boost::shared_ptr< AudioMemory > M_memory;
00824 
00825 public:
00826 
00831     explicit
00832     DribbleMessageParser( boost::shared_ptr< AudioMemory > memory );
00833 
00838     static
00839     char sheader()
00840       {
00841           return 'D';
00842       }
00843 
00848     char header() const
00849       {
00850           return sheader();
00851       }
00852 
00857     static
00858     std::size_t slength()
00859       {
00860           return 4;
00861       }
00862 
00873     int parse( const int sender,
00874                const double & dir,
00875                const char * msg,
00876                const GameTime & current );
00877 
00878 };
00879 
00880 /*-------------------------------------------------------------------*/
00889 class BallGoalieMessageParser
00890     : public SayMessageParser {
00891 private:
00892 
00894     boost::shared_ptr< AudioMemory > M_memory;
00895 
00896 public:
00897 
00902     explicit
00903     BallGoalieMessageParser( boost::shared_ptr< AudioMemory > memory );
00904 
00909     static
00910     char sheader()
00911       {
00912           return 'G';
00913       }
00914 
00919     char header() const
00920       {
00921           return sheader();
00922       }
00923 
00928     static
00929     std::size_t slength()
00930       {
00931           return 10;
00932       }
00933 
00944     int parse( const int sender,
00945                const double & dir,
00946                const char * msg,
00947                const GameTime & current );
00948 
00949 };
00950 
00951 /*-------------------------------------------------------------------*/
00960 class OnePlayerMessageParser
00961     : public SayMessageParser {
00962 private:
00963 
00965     boost::shared_ptr< AudioMemory > M_memory;
00966 
00967 public:
00968 
00973     explicit
00974     OnePlayerMessageParser( boost::shared_ptr< AudioMemory > memory );
00975 
00980     static
00981     char sheader()
00982       {
00983           return 'P';
00984       }
00985 
00990     char header() const
00991       {
00992           return sheader();
00993       }
00994 
00999     static
01000     std::size_t slength()
01001       {
01002           return 5;
01003       }
01004 
01015     int parse( const int sender,
01016                const double & dir,
01017                const char * msg,
01018                const GameTime & current );
01019 
01020 };
01021 
01022 /*-------------------------------------------------------------------*/
01031 class BallPlayerMessageParser
01032     : public SayMessageParser {
01033 private:
01034 
01036     boost::shared_ptr< AudioMemory > M_memory;
01037 
01038 public:
01039 
01044     explicit
01045     BallPlayerMessageParser( boost::shared_ptr< AudioMemory > memory );
01046 
01051     static
01052     char sheader()
01053       {
01054           return 'B';
01055       }
01056 
01061     char header() const
01062       {
01063           return sheader();
01064       }
01065 
01070     static
01071     std::size_t slength()
01072       {
01073           return 10;
01074       }
01075 
01086     int parse( const int sender,
01087                const double & dir,
01088                const char * msg,
01089                const GameTime & current );
01090 
01091 };
01092 
01093 }
01094 
01095 #endif

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