record.h
Go to the documentation of this file.
#ifndef _RECORD_H
#define _RECORD_H
#include "osl/record/searchInfo.h"
#include "osl/numEffectState.h"
#include "osl/csa.h"
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <iosfwd>
namespace osl
{
namespace record
{
struct Record
{
RecordMinimal record;
enum ResultType {
Unknown=0,
BlackWin=1,
WhiteWin=2,
Sennnichite=3,
JiShogi=4,
};
std::vector<int> times;
std::vector<std::string> comments;
std::vector<SearchInfo> move_info;
std::string version, initial_comment, tournament_name;
CArray<std::string,2> player;
ResultType result;
boost::gregorian::date start_date; // default : not_a_date_time
Record();
~Record();
static void addWithNewLine(std::string& a, const std::string& b) {
if (! a.empty())
a += "\n";
a += b;
}
NumEffectState initialState() const { return record.initial_state; }
std::vector<Move> moves() const { return record.moves; }
void setDate(const std::string& date_str);
void setMoveComment(const std::string&);
void setMoveInfo(const SearchInfo&);
void setMoveTime(int);
Move lastMove() const { return moves().empty() ? Move() : moves().back(); }
void load(std::vector<Move>& moves, std::vector<int>& times) const {
moves = record.moves;
times = this->times;
}
void load(std::vector<Move>& moves, std::vector<int>& times,
std::vector<std::string>& comments,
std::vector<SearchInfo>& move_info) const {
load(moves, times);
comments = this->comments;
move_info = this->move_info;
}
};
std::ostream& operator<<(std::ostream& os, const Record & r);
class RecordFile
{
protected:
Record record;
public:
virtual ~RecordFile();
Record load() const { return record; }
const NumEffectState initialState() const { return record.initialState(); }
const std::vector<Move> moves() const { return record.moves(); }
};
}
using record::SearchInfo;
using record::Record;
using record::RecordFile;
} // namespace osl
#endif /* _RECORD_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
osl::CArray
Definition container.h:20
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::record::RecordFile
Definition record.h:64
osl::record::RecordFile::load
Record load() const
Definition record.h:69
osl::record::RecordFile::~RecordFile
virtual ~RecordFile()
Definition record.cc:128
osl::record::RecordFile::moves
const std::vector< Move > moves() const
Definition record.h:71
osl::record::RecordFile::record
Record record
Definition record.h:66
osl::record::RecordFile::initialState
const NumEffectState initialState() const
Definition record.h:70
csa.h
osl::record
棋譜関係
Definition checkDuplicate.h:15
osl::record::operator<<
std::ostream & operator<<(std::ostream &os, const Color &c)
Definition kanjiPrint.cc:156
osl
Definition additionalEffect.h:6
numEffectState.h
searchInfo.h
osl::RecordMinimal
Definition csa.h:43
osl::Record::Record
Record()
Definition record.cc:10
osl::record::Record
Definition record.h:15
osl::record::Record::tournament_name
std::string tournament_name
Definition record.h:28
osl::record::Record::record
RecordMinimal record
Definition record.h:16
osl::record::Record::result
ResultType result
Definition record.h:30
osl::record::Record::version
std::string version
Definition record.h:28
osl::record::Record::Record
Record()
Definition record.cc:10
osl::record::Record::~Record
~Record()
Definition record.cc:13
osl::record::Record::addWithNewLine
static void addWithNewLine(std::string &a, const std::string &b)
Definition record.h:35
osl::record::Record::ResultType
ResultType
Definition record.h:17
osl::record::Record::WhiteWin
@ WhiteWin
Definition record.h:20
osl::record::Record::BlackWin
@ BlackWin
Definition record.h:19
osl::record::Record::Unknown
@ Unknown
Definition record.h:18
osl::record::Record::Sennnichite
@ Sennnichite
Definition record.h:21
osl::record::Record::JiShogi
@ JiShogi
Definition record.h:22
osl::record::Record::lastMove
Move lastMove() const
Definition record.h:47
osl::record::Record::initial_comment
std::string initial_comment
Definition record.h:28
osl::record::Record::load
void load(std::vector< Move > &moves, std::vector< int > &times) const
Definition record.h:49
osl::record::Record::setMoveInfo
void setMoveInfo(const SearchInfo &)
Definition record.cc:26
osl::record::Record::moves
std::vector< Move > moves() const
Definition record.h:41
osl::record::Record::times
std::vector< int > times
Definition record.h:24
osl::record::Record::setMoveTime
void setMoveTime(int)
Definition record.cc:33
osl::record::Record::setDate
void setDate(const std::string &date_str)
Definition record.cc:39
osl::record::Record::setMoveComment
void setMoveComment(const std::string &)
Definition record.cc:17
osl::record::Record::player
CArray< std::string, 2 > player
Definition record.h:29
osl::record::Record::initialState
NumEffectState initialState() const
Definition record.h:40
osl::record::Record::move_info
std::vector< SearchInfo > move_info
Definition record.h:26
osl::record::Record::comments
std::vector< std::string > comments
Definition record.h:25
osl::record::Record::start_date
boost::gregorian::date start_date
Definition record.h:31
osl::record::Record::load
void load(std::vector< Move > &moves, std::vector< int > &times, std::vector< std::string > &comments, std::vector< SearchInfo > &move_info) const
Definition record.h:53
osl::record::SearchInfo
Definition searchInfo.h:15