📄 portion.cc
字号:
bool EfOutcomePortion::IsReference(void) const{ return m_ref; }//-----------// NfPlayer//-----------#include "game/nfplayer.h"gPool NfPlayerPortion::pool(sizeof(NfPlayerPortion));NfPlayerPortion::NfPlayerPortion(NFPlayer *value) : _Value(new NFPlayer *(value)), _ref(false){ SetGame(&value->Game());}NfPlayerPortion::NfPlayerPortion(NFPlayer *&value, bool ref) : _Value(&value), _ref(ref){ if (!_ref) { SetGame(&value->Game()); }}NfPlayerPortion::~NfPlayerPortion(){ if (!_ref) delete _Value;}NFPlayer *NfPlayerPortion::Value(void) const{ return *_Value; }void NfPlayerPortion::SetValue(NFPlayer *value){ if (_ref) { ((NfPlayerPortion *) Original())->SetValue(value); } else { SetGame(&value->Game()); *_Value = value; }}PortionSpec NfPlayerPortion::Spec(void) const{ return PortionSpec(porNFPLAYER); }void NfPlayerPortion::Output(gOutput& s) const{ Portion::Output(s); s << "(NfPlayer) " << *_Value; if(*_Value) s << " \"" << (*_Value)->GetName() << "\""; }gText NfPlayerPortion::OutputString(void) const{ return "(NfPlayer)";}Portion* NfPlayerPortion::ValCopy(void) const{ return new NfPlayerPortion(*_Value); }Portion* NfPlayerPortion::RefCopy(void) const{ Portion* p = new NfPlayerPortion(*_Value, true); p->SetOriginal(Original()); return p;}bool NfPlayerPortion::IsReference(void) const{ return _ref; }//------------// Strategy//------------gPool StrategyPortion::pool(sizeof(StrategyPortion));StrategyPortion::StrategyPortion(Strategy *value) : _Value(new Strategy *(value)), _ref(false){ SetGame(&value->Player()->Game());}StrategyPortion::StrategyPortion(Strategy *&value, bool ref) : _Value(&value), _ref(ref){ if (!_ref) { SetGame(&value->Player()->Game()); }}StrategyPortion::~StrategyPortion(){ if (!_ref) delete _Value;}Strategy *StrategyPortion::Value(void) const{ return *_Value; }void StrategyPortion::SetValue(Strategy *value){ if (_ref) { ((StrategyPortion *) Original())->SetValue(value); } else { SetGame(&value->Player()->Game()); *_Value = value; }}PortionSpec StrategyPortion::Spec(void) const{ return PortionSpec(porSTRATEGY); }void StrategyPortion::Output(gOutput& s) const{ Portion::Output(s); s << "(Strategy) " << *_Value; if(*_Value) s << " \"" << (*_Value)->Name() << "\""; }gText StrategyPortion::OutputString(void) const{ return "(Strategy)";}Portion* StrategyPortion::ValCopy(void) const{ return new StrategyPortion(*_Value); }Portion* StrategyPortion::RefCopy(void) const{ Portion* p = new StrategyPortion(*_Value, true); p->SetOriginal(Original()); return p;}bool StrategyPortion::IsReference(void) const{ return _ref; }//-------------// NfOutcome//-------------gPool NfOutcomePortion::pool(sizeof(NfOutcomePortion));NfOutcomePortion::NfOutcomePortion(NFOutcome *value) : _Value(new NFOutcome *(value)), _ref(false){ SetGame(value->Game());}NfOutcomePortion::NfOutcomePortion(NFOutcome *&value, bool ref) : _Value(&value), _ref(ref){ if (!_ref) { SetGame(value->Game()); }}NfOutcomePortion::~NfOutcomePortion(){ if (!_ref) delete _Value;}NFOutcome *NfOutcomePortion::Value(void) const{ return *_Value; }void NfOutcomePortion::SetValue(NFOutcome *value){ if (_ref) { ((NfOutcomePortion *) Original())->SetValue(value); } else { SetGame(value->Game()); *_Value = value; }}PortionSpec NfOutcomePortion::Spec(void) const{ return porNFOUTCOME;}void NfOutcomePortion::Output(gOutput& s) const{ Portion::Output(s); s << "(NFOutcome) " << *_Value; if (*_Value) s << " \"" << (*_Value)->GetName() << "\"";}gText NfOutcomePortion::OutputString(void) const{ return "(Outcome)";}Portion* NfOutcomePortion::ValCopy(void) const{ return new NfOutcomePortion(*_Value);}Portion* NfOutcomePortion::RefCopy(void) const{ Portion* p = new NfOutcomePortion(*_Value, true); p->SetOriginal(Original()); return p;}bool NfOutcomePortion::IsReference(void) const{ return _ref; }//-------------// NfSupport//-------------gPool NfSupportPortion::pool(sizeof(NfSupportPortion));NfSupportPortion::rep::~rep(){ delete value; }NfSupportPortion::NfSupportPortion(NFSupport *value) : m_rep(new struct rep(value)), m_ref(false){ SetGame(&m_rep->value->Game());}NfSupportPortion::NfSupportPortion(NFSupport &value) : m_rep(new struct rep(new NFSupport(value))), m_ref(false){ SetGame(&m_rep->value->Game());}NfSupportPortion::NfSupportPortion(const NfSupportPortion *p, bool ref) : m_rep(p->m_rep), m_ref(ref){ m_rep->nref++; if (!m_ref) { SetGame(&m_rep->value->Game()); }}NfSupportPortion::~NfSupportPortion(){ if (--m_rep->nref == 0) delete m_rep;}NFSupport *NfSupportPortion::Value(void) const{ return m_rep->value; }void NfSupportPortion::SetValue(NFSupport *value){ if (m_ref) { ((NfSupportPortion *) Original())->SetValue(value); m_rep = ((NfSupportPortion *) Original())->m_rep; m_rep->nref++; } else { if (--m_rep->nref == 0) delete m_rep; m_rep = new rep(value); SetGame(&value->Game()); }}PortionSpec NfSupportPortion::Spec(void) const{ return porNFSUPPORT;}void NfSupportPortion::Output(gOutput& s) const{ Portion::Output(s); s << "(NfSupport) " << m_rep->value; if (m_rep->value) s << ' ' << *m_rep->value; }gText NfSupportPortion::OutputString(void) const{ return "(NfSupport)";}Portion* NfSupportPortion::ValCopy(void) const{ return new NfSupportPortion(this, false);}Portion* NfSupportPortion::RefCopy(void) const{ Portion* p = new NfSupportPortion(this, true); p->SetOriginal(Original()); return p;}bool NfSupportPortion::IsReference(void) const{ return m_ref; }//-------------// EfSupport//-------------gPool EfSupportPortion::pool(sizeof(EfSupportPortion));EfSupportPortion::rep::~rep(){ delete value; }EfSupportPortion::EfSupportPortion(EFSupport *value) : m_rep(new struct rep(value)), m_ref(false){ SetGame((efgGame *) &m_rep->value->GetGame());}EfSupportPortion::EfSupportPortion(EFSupport &value) : m_rep(new struct rep(new EFSupport(value))), m_ref(false){ SetGame((efgGame *) &m_rep->value->GetGame());}EfSupportPortion::EfSupportPortion(const EfSupportPortion *p, bool ref) : m_rep(p->m_rep), m_ref(ref){ m_rep->nref++; if (!m_ref) { SetGame((efgGame *) &m_rep->value->GetGame()); }}EfSupportPortion::~EfSupportPortion(){ if (--m_rep->nref == 0) delete m_rep;}EFSupport *EfSupportPortion::Value(void) const{ return m_rep->value; }void EfSupportPortion::SetValue(EFSupport *value){ if (m_ref) { ((EfSupportPortion *) Original())->SetValue(value); m_rep = ((EfSupportPortion *) Original())->m_rep; m_rep->nref++; } else { if (--m_rep->nref == 0) delete m_rep; m_rep = new rep(value); SetGame((efgGame *) &value->GetGame()); }}PortionSpec EfSupportPortion::Spec(void) const{ return PortionSpec(porEFSUPPORT);}void EfSupportPortion::Output(gOutput& s) const{ Portion::Output(s); s << "(EfSupport) " << m_rep->value; if (m_rep->value) s << ' ' << *m_rep->value;}gText EfSupportPortion::OutputString(void) const{ return "(EfSupport)";}Portion* EfSupportPortion::ValCopy(void) const{ return new EfSupportPortion(this, false);}Portion* EfSupportPortion::RefCopy(void) const{ Portion* p = new EfSupportPortion(this, true); p->SetOriginal(Original()); return p;}bool EfSupportPortion::IsReference(void) const{ return m_ref; }//----------// EfBasis//----------#include "game/efbasis.h"gPool EfBasisPortion::pool(sizeof(EfBasisPortion));EfBasisPortion::EfBasisPortion(EFBasis *value) : _Value(new EFBasis *(value)), _ref(false){ SetGame((efgGame *) &value->GetGame());}EfBasisPortion::EfBasisPortion(EFBasis *&value, bool ref) : _Value(&value), _ref(ref){ if (!_ref) { SetGame((efgGame *) &value->GetGame()); }}EfBasisPortion::~EfBasisPortion(){ if (!_ref) { delete *_Value; delete _Value; }}EFBasis *EfBasisPortion::Value(void) const{ return *_Value; }void EfBasisPortion::SetValue(EFBasis *value){ if (_ref) { ((EfBasisPortion *) Original())->SetValue(value); } else { SetGame((efgGame *) &value->GetGame()); delete *_Value; *_Value = value; }}PortionSpec EfBasisPortion::Spec(void) const{ return PortionSpec(porEFBASIS);}void EfBasisPortion::Output(gOutput& s) const{ Portion::Output(s); s << "(EfBasis) " << *_Value; if(*_Value) s << ' ' << **_Value;}gText EfBasisPortion::OutputString(void) const{ return "(EfBasis)";}Portion* EfBasisPortion::ValCopy(void) const{ return new EfBasisPortion(new EFBasis(**_Value)); }Portion* EfBasisPortion::RefCopy(void) const{ Portion* p = new EfBasisPortion(*_Value, true); p->SetOriginal(Original()); return p;}bool EfBasisPortion::IsReference(void) const{ return _ref; }//------------// EfPlayer//------------gPool EfPlayerPortion::pool(sizeof(EfPlayerPortion));EfPlayerPortion::EfPlayerPortion(EFPlayer *value) : _Value(new EFPlayer *(value)), _ref(false){ SetGame(value->Game());}EfPlayerPortion::EfPlayerPortion(EFPlayer *& value, bool ref) : _Value(&value), _ref(ref){ if (!_ref) SetGame(value->Game());}EfPlayerPortion::~EfPlayerPortion(){ if (!_ref) delete _Value;}EFPlayer *EfPlayerPortion::Value(void) const{ return *_Value; }void EfPlayerPortion::SetValue(EFPlayer *value){ if (_ref) { ((EfPlayerPortion *) Original())->SetValue(value); } else { *_Value = value; SetGame(value->Game()); }}PortionSpec EfPlayerPortion::Spec(void) const{ return PortionSpec(porEFPLAYER); }void EfPlayerPortion::Output(gOutput& s) const{ Portion::Output(s); s << "(EfPlayer) " << *_Value; if(*_Value) s << " \"" << (*_Value)->GetName() << "\""; }gText EfPlayerPortion::OutputString(void) const{ return "(EfPlayer)";}Portion* EfPlayerPortion::ValCopy(void) const{ return new EfPlayerPortion(*_Value); }Portion* EfPlayerPortion::RefCopy(void) const{ Portion* p = new EfPlayerPortion(*_Value, true); p->SetOriginal(Original()); return p;}bool EfPlayerPortion::IsReference(void) const{ return _ref;}//----------// Infoset//----------gPool InfosetPortion::pool(sizeof(InfosetPortion));InfosetPortion::InfosetPortion(Infoset *value) : _Value(new Infoset *(value)), _ref(false){ SetGame(value->Game());}InfosetPortion::InfosetPortion(Infoset *& value, bool ref) : _Value(&value), _ref(ref){ if (!_ref) { SetGame(value->Game()); }}InfosetPortion::~InfosetPortion(){ if (!_ref) delete _Value;}Infoset *InfosetPortion::Value(void) const{ return *_Value; }void InfosetPortion::SetValue(Infoset *value){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -