LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
soccer_agent.h
Go to the documentation of this file.
1// -*-c++-*-
2
8/*
9 *Copyright:
10
11 Copyright (C) Hidehisa AKIYAMA
12
13 This code is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 3 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27 *EndCopyright:
28 */
29
31
32#ifndef RCSC_COMMON_SOCCER_AGENT_H
33#define RCSC_COMMON_SOCCER_AGENT_H
34
35#include <memory>
36#include <list>
37#include <string>
38
39namespace rcsc {
40
41class AbstractClient;
42class CmdLineParser;
43
55public:
56 friend class AbstractClient;
57
58protected:
60 std::shared_ptr< AbstractClient > M_client;
61
62private:
63
64 // nocopyable
65 SoccerAgent( const SoccerAgent & );
66 SoccerAgent & operator=( const SoccerAgent & );
67
68public:
69
74
78 virtual
80
92 bool init( CmdLineParser & cmd_parser );
93
97 void setClient( std::shared_ptr< AbstractClient > client );
98
103 virtual
104 std::shared_ptr< AbstractClient > createConsoleClient() = 0;
105
106protected:
107
116 virtual
117 bool initImpl( CmdLineParser & cmd_parser ) = 0;
118
127 virtual
128 bool handleStart() = 0;
129
138 virtual
140 {
141 return true;
142 }
143
149 virtual
150 void handleMessage() = 0;
151
152
158 virtual
160 { }
161
169 virtual
170 void handleTimeout( const int timeout_count,
171 const int waited_msec ) = 0;
172
178 virtual
179 void handleExit() = 0;
180};
181
182}
183
184#endif
abstract soccer client class
Definition: abstract_client.h:48
command line parser
Definition: cmd_line_parser.h:49
abstract soccer agent class
Definition: soccer_agent.h:54
virtual bool handleStartOffline()
(virtual) handle start event in offline client mode.
Definition: soccer_agent.h:139
virtual bool handleStart()=0
(pure virtual) handle start event
SoccerAgent()
nothing to do. just set NULL to M_client
virtual void handleMessageOffline()
(virtual) handle offline client log message in offline client mode.
Definition: soccer_agent.h:159
virtual void handleTimeout(const int timeout_count, const int waited_msec)=0
(pure virtual) handle timeout event
void setClient(std::shared_ptr< AbstractClient > client)
bool init(CmdLineParser &cmd_parser)
initialize with command line options.
std::shared_ptr< AbstractClient > M_client
interface to the rcssserver or offline log.
Definition: soccer_agent.h:60
virtual ~SoccerAgent()
virtual destructor.
virtual bool initImpl(CmdLineParser &cmd_parser)=0
init interval status using command line options
virtual void handleMessage()=0
(pure virtual) handle server messege
virtual void handleExit()=0
(pure virtual) handle exit event
virtual std::shared_ptr< AbstractClient > createConsoleClient()=0
create standard console client object (online or offline) according to the command line option.