Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

GoPlayerMove.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 /** @file GoPlayerMove.h */
00003 //----------------------------------------------------------------------------
00004 
00005 #ifndef GO_PLAYERMOVE_H
00006 #define GO_PLAYERMOVE_H
00007 
00008 #include <iosfwd>
00009 #include "SgBlackWhite.h"
00010 #include "SgPoint.h"
00011 
00012 //----------------------------------------------------------------------------
00013 
00014 /** Move and color of player who plays it. */
00015 class GoPlayerMove
00016 {
00017 public:
00018     GoPlayerMove(SgBlackWhite color, SgPoint point = SG_NULLMOVE);
00019 
00020     GoPlayerMove();
00021 
00022     ~GoPlayerMove();
00023 
00024     bool operator==(const GoPlayerMove& move) const;
00025 
00026     bool operator!=(const GoPlayerMove& move) const;
00027 
00028     SgPoint Point() const;
00029 
00030     SgBlackWhite Color() const;
00031 
00032     void SetPoint(SgPoint move);
00033 
00034 private:
00035     SgBlackWhite  m_color;
00036 
00037     SgPoint m_point;
00038 };
00039 
00040 inline GoPlayerMove::GoPlayerMove()
00041     : m_color(SG_BLACK),
00042       m_point(SG_NULLMOVE)
00043 {
00044 }
00045 
00046 inline GoPlayerMove::GoPlayerMove(SgBlackWhite color, SgPoint point)
00047     : m_color(color),
00048       m_point(point)
00049 {
00050     SG_ASSERT_BW(color);
00051 }
00052 
00053 inline GoPlayerMove::~GoPlayerMove()
00054 {
00055 }
00056 
00057 inline bool GoPlayerMove::operator==(const GoPlayerMove& move) const
00058 {
00059     return (m_color == move.m_color && m_point == move.m_point);
00060 }
00061 
00062 inline bool GoPlayerMove::operator!=(const GoPlayerMove& move) const
00063 {
00064     return ! operator==(move);
00065 }
00066 
00067 inline SgPoint GoPlayerMove::Point() const
00068 {
00069     return m_point;
00070 }
00071 
00072 inline void GoPlayerMove::SetPoint(SgPoint point)
00073 {
00074     m_point = point;
00075 }
00076 
00077 inline SgBlackWhite GoPlayerMove::Color() const
00078 {
00079     return m_color;
00080 }
00081 
00082 //----------------------------------------------------------------------------
00083 
00084 std::ostream& operator<<(std::ostream& out, GoPlayerMove mv);
00085 
00086 //----------------------------------------------------------------------------
00087 
00088 #endif // GO_PLAYERMOVE_H


17 Jun 2010 Doxygen 1.4.7