DigitalCurling3  1.0.0
A curling simulation system for curling AIs
player_identical_factory.hpp
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2022 UEC Takeshi Ito Laboratory
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 // SOFTWARE.
22 
25 
26 #ifndef DIGITALCURLING3_PLAYERS_PLAYER_IDENTICAL_FACTORY_HPP
27 #define DIGITALCURLING3_PLAYERS_PLAYER_IDENTICAL_FACTORY_HPP
28 
29 #include <memory>
30 #include "../json/common.hpp"
31 #include "../i_player_factory.hpp"
32 
34 
36 constexpr std::string_view kPlayerIdenticalId = "identical";
37 
38 
41 public:
42  PlayerIdenticalFactory() = default;
43  virtual ~PlayerIdenticalFactory() = default;
46 
47  virtual std::unique_ptr<IPlayer> CreatePlayer() const override;
48  virtual std::unique_ptr<IPlayerFactory> Clone() const override;
49  virtual std::string GetPlayerId() const override
50  {
51  return std::string(kPlayerIdenticalId);
52  }
53 };
54 
55 
57 // json
58 void to_json(nlohmann::json &, PlayerIdenticalFactory const&);
59 void from_json(nlohmann::json const&, PlayerIdenticalFactory &);
61 
62 } // namespace digitalcurling3::players
63 
64 #endif // DIGITALCURLING3_PLAYERS_PLAYER_IDENTICAL_FACTORY_HPP
digitalcurling3::players::PlayerIdenticalFactory
乱数を加えないプレイヤー
Definition: player_identical_factory.hpp:40
digitalcurling3::players::PlayerIdenticalFactory::operator=
PlayerIdenticalFactory & operator=(PlayerIdenticalFactory const &)=default
コピー代入演算子
digitalcurling3::players::kPlayerIdenticalId
constexpr std::string_view kPlayerIdenticalId
プレイヤーIdenticalのID
Definition: player_identical_factory.hpp:36
digitalcurling3::players::PlayerIdenticalFactory::Clone
virtual std::unique_ptr< IPlayerFactory > Clone() const override
このインスタンスを複製する
digitalcurling3::players::PlayerIdenticalFactory::GetPlayerId
virtual std::string GetPlayerId() const override
対応するプレイヤーのプレイヤーIDを得る.
Definition: player_identical_factory.hpp:49
digitalcurling3::IPlayerFactory
IPlayer を構築するためのクラスです
Definition: i_player_factory.hpp:42
digitalcurling3::players
IPlayerFactory を継承したクラスを定義する名前空間
Definition: player_identical_factory.hpp:33
digitalcurling3::players::PlayerIdenticalFactory::PlayerIdenticalFactory
PlayerIdenticalFactory()=default
デフォルトコンストラクタ
digitalcurling3::players::PlayerIdenticalFactory::CreatePlayer
virtual std::unique_ptr< IPlayer > CreatePlayer() const override
プレイヤーを生成する