coach_audio_sensor.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_COACH_COACH_AUDIO_SENSOR_H
00033 #define RCSC_COACH_COACH_AUDIO_SENSOR_H
00034 
00035 #include <rcsc/common/audio_message.h>
00036 
00037 #include <rcsc/game_time.h>
00038 #include <rcsc/types.h>
00039 #include <rcsc/geom/vector_2d.h>
00040 
00041 #include <boost/shared_ptr.hpp>
00042 
00043 #include <string>
00044 #include <map>
00045 #include <list>
00046 
00047 namespace rcsc {
00048 
00049 class SayMessageParser;
00050 
00051 /*-------------------------------------------------------------------*/
00056 class CoachAudioSensor {
00057 private:
00058 
00060     typedef std::map< char, boost::shared_ptr< SayMessageParser > > ParserMap;
00061 
00063     std::string M_team_name;
00064 
00066     ParserMap M_say_message_parsers;
00067 
00069     GameTime M_teammate_message_time;
00070 
00072     std::list< HearMessage > M_teammate_messages;
00073 
00075     GameTime M_opponent_message_time;
00076 
00078     std::list< HearMessage > M_opponent_messages;
00079 
00081     GameTime M_trainer_message_time;
00082 
00084     std::string M_trainer_message;
00085 
00086 public:
00090     CoachAudioSensor();
00091 
00096     void setTeamName( const std::string & team_name );
00097 
00102     void addParser( boost::shared_ptr< SayMessageParser > parser );
00103 
00108     void removeParser( const char header );
00109 
00115     void parsePlayerMessage( const char * msg,
00116                              const GameTime & current );
00117 
00123     void parseTrainerMessage( const char * msg,
00124                               const GameTime & current );
00125 
00130     const
00131     GameTime & teammateMessageTime() const
00132       {
00133           return M_teammate_message_time;
00134       }
00135 
00140     const
00141     std::list< HearMessage > & teammateMessages() const
00142       {
00143           return M_teammate_messages;
00144       }
00145 
00150     const
00151     GameTime & trainerMessageTime() const
00152       {
00153           return M_trainer_message_time;
00154       }
00155 
00160     const
00161     std::string & trainerMessage() const
00162       {
00163           return M_trainer_message;
00164       }
00165 
00166 private:
00167     /*
00168       \brief analyze message from teammate
00169       \param message message object from teammate
00170     */
00171     void parseTeammateMessage( const HearMessage & message );
00172 
00173 };
00174 
00175 }
00176 
00177 #endif

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