Commits

David Stone committed a152313

Created a non-networked Client base class.

Comments (0)

Files changed (5)

build_scripts/sources.py

 pokemon_lab = prepend_dir('pokemon_lab', ['battle.cpp', 'battle_settings.cpp', 'client.cpp', 'conversion.cpp', 'inmessage.cpp', 'outmessage.cpp', 'read_team_file.cpp', 'write_team_file.cpp'])
 pokemon_online = prepend_dir('pokemon_online', ['battle.cpp', 'battle_settings.cpp', 'client.cpp', 'conversion.cpp', 'read_team_file.cpp', 'inmessage.cpp', 'invalid_user.cpp', 'outmessage.cpp', 'read_user_info.cpp', 'write_team_file.cpp'])
 pokemon_showdown = prepend_dir('pokemon_showdown', ['battle.cpp', 'battle_settings.cpp', 'client.cpp', 'inmessage.cpp', 'outmessage.cpp'])
-clients = prepend_dir('clients', ['battle.cpp', 'battle_result.cpp', 'invalid_team_file_format.cpp', 'no_pending_challenges.cpp', 'party.cpp', 'updated_hp.cpp'] + network + pokemon_lab + pokemon_online + pokemon_showdown)
+clients = prepend_dir('clients', ['battle.cpp', 'battle_result.cpp', 'client.cpp', 'invalid_team_file_format.cpp', 'no_pending_challenges.cpp', 'party.cpp', 'updated_hp.cpp'] + network + pokemon_lab + pokemon_online + pokemon_showdown)
 
 ev_optimizer_sources = prepend_dir('team_predictor/ev_optimizer', ['combine.cpp', 'defensive.cpp', 'defensive_data_point.cpp', 'ev_optimizer.cpp', 'evs.cpp', 'offensive.cpp', 'single_classification_evs.cpp', 'speed.cpp'])
 

source/clients/client.cpp

+// Connect to an arbitrary Pokemon sim
+// Copyright (C) 2013 David Stone
+//
+// This file is part of Technical Machine.
+//
+// Technical Machine is free software: you can redistribute it and / or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// What follows are generic functions and data for connection to any Pokemon
+// sim. Specific functions and data are found in the respective sim's folder.
+
+#include "client.hpp"
+
+namespace technicalmachine {
+
+}	// namespace technicalmachine

source/clients/client.hpp

+// Connect to an arbitrary Pokemon sim
+// Copyright (C) 2013 David Stone
+//
+// This file is part of Technical Machine.
+//
+// Technical Machine is free software: you can redistribute it and / or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef CLIENTS__CLIENT_HPP_
+#define CLIENTS__CLIENT_HPP_
+
+namespace technicalmachine {
+
+class Client {
+	public:
+		virtual ~Client() { }
+};
+
+}	// namespace technicalmachine
+#endif	// CLIENTS__CLIENT_HPP_

source/clients/network/client.cpp

-// Connect to an arbitrary Pokemon sim
+// Connect to an arbitrary networked Pokemon sim
 // Copyright (C) 2013 David Stone
 //
 // This file is part of Technical Machine.

source/clients/network/client.hpp

-// Connect to an arbitrary Pokemon sim
+// Connect to an arbitrary networked Pokemon sim
 // Copyright (C) 2013 David Stone
 //
 // This file is part of Technical Machine.
 // You should have received a copy of the GNU Affero General Public License
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
 
-#ifndef NETWORK__CONNECT_HPP_
-#define NETWORK__CONNECT_HPP_
+#ifndef CLIENTS__NETWORK__CLIENT_HPP_
+#define CLIENTS__NETWORK__CLIENT_HPP_
 
 #include <cstdint>
 #include <random>
 #include "battles.hpp"
 
 #include "../battle.hpp"
+#include "../client.hpp"
 
 #include "../../evaluate/evaluate.hpp"
 
 class InMessage;
 class OutMessage;
 
-class Client {
+class Client : public ::technicalmachine::Client {
 	public:
 		void print_with_time_stamp(std::ostream & stream, std::string const & message) const;
 		void handle_channel_message (uint32_t channel_id, std::string const & user, std::string const & message) const;
 		void send_message(OutMessage & msg);
 	protected:
 		explicit Client(unsigned set_depth);
-		virtual ~Client() { }
 		void reconnect ();
 		virtual void send_channel_message(std::string const & channel, std::string const & message) = 0;
 		virtual void send_channel_message(uint32_t channel_id, std::string const & message) = 0;
 
 }	// namespace network
 }	// namespace technicalmachine
-#endif	// NETWORK__CONNECT_HPP_
+#endif	// CLIENTS__NETWORK__CLIENT_HPP_