00001
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifndef RCSC_COACH_COMMAND_H
00033 #define RCSC_COACH_COMMAND_H
00034
00035 #include <rcsc/types.h>
00036
00037 #include <string>
00038 #include <vector>
00039 #include <utility>
00040 #include <iostream>
00041
00042 namespace rcsc {
00043
00048 class CoachCommand {
00049 public:
00053 enum Type {
00054 INIT,
00055 BYE,
00056
00057 CHECK_BALL,
00058 LOOK,
00059 TEAM_NAMES,
00060
00061 EYE,
00062
00063 CHANGE_PLAYER_TYPE,
00064 CHANGE_PLAYER_TYPES,
00065 SAY,
00066
00067 TEAM_GRAPHIC,
00068 COMPRESSION,
00069 DONE,
00070
00071 ILLEGAL
00072 };
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 protected:
00090 CoachCommand()
00091 { }
00092
00093 public:
00097 virtual
00098 ~CoachCommand()
00099 { }
00100
00105 virtual
00106 Type type() const = 0;
00107
00113 virtual
00114 std::ostream & toStr( std::ostream & to ) const = 0;
00115
00120 virtual
00121 std::string name() const = 0;
00122 };
00123
00124
00126
00139 class CoachInitCommand
00140 : public CoachCommand {
00141 private:
00142 std::string M_team_name;
00143 double M_version;
00144 std::string M_coach_name;
00145 public:
00152 CoachInitCommand( const std::string & team_name,
00153 const double & version,
00154 const std::string & coach_name = "" );
00155
00160 Type type() const
00161 {
00162 return INIT;
00163 }
00164
00170 std::ostream & toStr( std::ostream & to ) const;
00171
00176 std::string name() const
00177 {
00178 return std::string( "init" );
00179 }
00180 };
00181
00183
00192 class CoachByeCommand
00193 : public CoachCommand {
00194 private:
00195
00196 public:
00200 CoachByeCommand()
00201 { }
00202
00207 Type type() const
00208 {
00209 return BYE;
00210 }
00211
00217 std::ostream & toStr( std::ostream & to ) const;
00218
00223 std::string name() const
00224 {
00225 return std::string( "bye" );
00226 }
00227 };
00228
00230
00243 class CoachCheckBallCommand
00244 : public CoachCommand {
00245 private:
00246
00247 public:
00251 CoachCheckBallCommand()
00252 { }
00253
00258 Type type() const
00259 {
00260 return CHECK_BALL;
00261 }
00262
00268 std::ostream & toStr( std::ostream & to ) const;
00269
00274 std::string name() const
00275 {
00276 return std::string( "check_ball" );
00277 }
00278 };
00279
00281
00292 class CoachLookCommand
00293 : public CoachCommand {
00294 private:
00295
00296 public:
00300 CoachLookCommand()
00301 { }
00302
00307 Type type() const
00308 {
00309 return LOOK;
00310 }
00311
00317 std::ostream & toStr( std::ostream & to ) const;
00318
00323 std::string name() const
00324 {
00325 return std::string( "look" );
00326 }
00327 };
00328
00330
00341 class CoachTeamNamesCommand
00342 : public CoachCommand {
00343 private:
00344
00345 public:
00349 CoachTeamNamesCommand()
00350 { }
00351
00356 Type type() const
00357 {
00358 return TEAM_NAMES;
00359 }
00360
00366 std::ostream & toStr( std::ostream & to ) const;
00367
00372 std::string name() const
00373 {
00374 return std::string( "team_names" );
00375 }
00376 };
00377
00379
00390 class CoachEyeCommand
00391 : public CoachCommand {
00392 private:
00393 bool M_on;
00394 public:
00399 explicit
00400 CoachEyeCommand( bool on )
00401 : M_on( on )
00402 { }
00403
00408 Type type() const
00409 {
00410 return EYE;
00411 }
00412
00418 std::ostream & toStr( std::ostream & to ) const;
00419
00424 std::string name() const
00425 {
00426 return std::string( "eye" );
00427 }
00428 };
00429
00431
00449 class CoachChangePlayerTypeCommand
00450 : public CoachCommand {
00451 private:
00452 int M_unum;
00453 int M_type;
00454 public:
00460 CoachChangePlayerTypeCommand( const int unum,
00461 const int type )
00462 : M_unum( unum )
00463 , M_type( type )
00464 { }
00465
00470 Type type() const
00471 {
00472 return CHANGE_PLAYER_TYPE;
00473 }
00474
00480 std::ostream & toStr( std::ostream & to ) const;
00481
00486 std::string name() const
00487 {
00488 return std::string( "change_player_type" );
00489 }
00490 };
00491
00492
00494
00512 class CoachChangePlayerTypesCommand
00513 : public CoachCommand {
00514 private:
00516 std::vector< std::pair< int, int > > M_types;
00517
00518 public:
00524 CoachChangePlayerTypesCommand( const int unum,
00525 const int type );
00526
00532 CoachChangePlayerTypesCommand( const std::vector< std::pair< int, int > > & types );
00533
00539 void add( const int unum,
00540 const int type );
00541
00546 Type type() const
00547 {
00548 return CHANGE_PLAYER_TYPES;
00549 }
00550
00556 std::ostream & toStr( std::ostream & to ) const;
00557
00562 std::string name() const
00563 {
00564 return std::string( "change_player_types" );
00565 }
00566 };
00567
00569
00583 class CoachSayCommand
00584 : public CoachCommand {
00585 private:
00587 const std::string & M_clang_msg;
00588 public:
00593 explicit
00594 CoachSayCommand( const std::string & clang_msg )
00595 : M_clang_msg( clang_msg )
00596 { }
00597
00602 Type type() const
00603 {
00604 return SAY;
00605 }
00606
00612 std::ostream & toStr( std::ostream & to ) const;
00613
00618 std::string name() const
00619 {
00620 return std::string( "say" );
00621 }
00622 };
00623
00625
00640 class CoachTeamGraphicCommand
00641 : public CoachCommand {
00642 private:
00643 unsigned int M_x;
00644 unsigned int M_y;
00645 std::vector< std::string > M_xpm_lines;
00646
00647 public:
00654 CoachTeamGraphicCommand( const unsigned int x,
00655 const unsigned int y,
00656 const std::vector< std::string > & xpm_lines );
00657
00662 Type type() const
00663 {
00664 return TEAM_GRAPHIC;
00665 }
00666
00672 std::ostream & toStr( std::ostream & to ) const;
00673
00678 std::string name() const
00679 {
00680 return std::string( "team_graphic" );
00681 }
00682 };
00683
00684
00686
00698 class CoachCompressionCommand
00699 : public CoachCommand {
00700 private:
00701 int M_level;
00702 public:
00706 explicit
00707 CoachCompressionCommand( const int level )
00708 : M_level( level )
00709 { }
00710
00715 Type type() const
00716 {
00717 return COMPRESSION;
00718 }
00719
00725 std::ostream & toStr( std::ostream & to ) const;
00726
00731 std::string name() const
00732 {
00733 return std::string( "compression" );
00734 }
00735 };
00736
00737
00739
00748 class CoachDoneCommand
00749 : public CoachCommand {
00750 private:
00751
00752 public:
00756 CoachDoneCommand()
00757 { }
00758
00763 Type type() const
00764 {
00765 return DONE;
00766 }
00767
00773 std::ostream & toStr( std::ostream & to ) const;
00774
00779 std::string name() const
00780 {
00781 return std::string( "done" );
00782 }
00783 };
00784
00785 }
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959 #endif