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_PLAYER_AUDIO_SENSOR_H
00033 #define RCSC_PLAYER_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 class FreeformParser;
00051 
00052 /*-------------------------------------------------------------------*/
00057 class AudioSensor {
00058 private:
00059 
00061     typedef std::map< char, boost::shared_ptr< SayMessageParser > > ParserMap;
00062 
00064     ParserMap M_say_message_parsers;
00065 
00067     boost::shared_ptr< FreeformParser > M_freeform_parser;
00068 
00070     GameTime M_teammate_message_time;
00071 
00073     std::list< HearMessage > M_teammate_messages;
00074 
00076     GameTime M_opponent_message_time;
00077 
00079     std::list< HearMessage > M_opponent_messages;
00080 
00082     GameTime M_freeform_message_time;
00083 
00085     std::string M_freeform_message;
00086 
00088     GameTime M_trainer_message_time;
00089 
00091     std::string M_trainer_message;
00092 
00093 public:
00097     AudioSensor();
00098 
00103     void addParser( boost::shared_ptr< SayMessageParser > parser );
00104 
00109     void removeParser( const char header );
00110 
00115     void setFreeformParser( boost::shared_ptr< FreeformParser > parser );
00116 
00122     void parsePlayerMessage( const char * msg,
00123                              const GameTime & current );
00124 
00130     void parseCoachMessage( const char * msg,
00131                             const GameTime & current );
00132 
00138     void parseTrainerMessage( const char * msg,
00139                               const GameTime & current );
00140 
00145     const
00146     GameTime & teammateMessageTime() const
00147       {
00148           return M_teammate_message_time;
00149       }
00150 
00155     const
00156     std::list< HearMessage > & teammateMessages() const
00157       {
00158           return M_teammate_messages;
00159       }
00160 
00165     const
00166     GameTime & opponentMessageTime() const
00167       {
00168           return M_opponent_message_time;
00169       }
00170 
00175     const
00176     std::list< HearMessage > & opponentMessages() const
00177       {
00178           return M_opponent_messages;
00179       }
00180 
00185     const
00186     GameTime & freeformMessageTime() const
00187       {
00188           return M_freeform_message_time;
00189       }
00190 
00195     const
00196     std::string & freeformMessage() const
00197       {
00198           return M_freeform_message;
00199       }
00200 
00205     const
00206     GameTime & trainerMessageTime() const
00207       {
00208           return M_trainer_message_time;
00209       }
00210 
00215     const
00216     std::string & trainerMessage() const
00217       {
00218           return M_trainer_message;
00219       }
00220 
00221 private:
00222     /*
00223       \brief analyze message from teammate
00224       \param message message object from teammate
00225     */
00226     void parseTeammateMessage( const HearMessage & message );
00227 
00228 };
00229 
00230 }
00231 
00232 #endif

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