📄 portion.h
字号:
void operator delete(void *p) { pool.Free(p); }};inline const EFSupport &AsEfgSupport(Portion *portion){ return *((EfSupportPortion *) portion)->Value(); }//-----------// EfBasis//-----------class EFBasis;class EfBasisPortion : public Portion {protected: EFBasis** _Value; bool _ref; static gPool pool; EfBasisPortion(EFBasis *&, bool);public: EfBasisPortion(EFBasis *); virtual ~EfBasisPortion(); EFBasis *Value(void) const; void SetValue(EFBasis *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//------------// EfPlayer//------------class EFPlayer;class EfPlayerPortion : public Portion {protected: EFPlayer** _Value; bool _ref; static gPool pool; EfPlayerPortion(EFPlayer *&, bool);public: EfPlayerPortion(EFPlayer *); virtual ~EfPlayerPortion(); EFPlayer *Value(void) const; void SetValue(EFPlayer *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//----------// Infoset//----------class Infoset;class InfosetPortion : public Portion {protected: Infoset** _Value; bool _ref; static gPool pool; InfosetPortion(Infoset *&, bool);public: InfosetPortion(Infoset *); virtual ~InfosetPortion(); Infoset *Value(void) const; void SetValue(Infoset *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//--------// Node//--------class Node;class NodePortion : public Portion {protected: Node** _Value; bool _ref; static gPool pool; NodePortion(Node *&, bool);public: NodePortion(Node *); virtual ~NodePortion(); Node *Value(void) const; void SetValue(Node *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//----------// Action//----------class Action;class ActionPortion : public Portion {protected: Action** _Value; bool _ref; static gPool pool; ActionPortion(Action *&, bool); public: ActionPortion(Action *); virtual ~ActionPortion(); Action *Value(void) const; void SetValue(Action *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//---------// Mixed//---------#include "nash/mixedsol.h"class MixedPortion : public Portion {protected: struct mixedrep { MixedSolution *value; int nref; mixedrep(MixedSolution *v) : value(v), nref(1) { } ~mixedrep() { delete value; } }; struct mixedrep *rep; bool _ref; static gPool pool; MixedPortion(const MixedPortion *, bool);public: MixedPortion(MixedSolution *); virtual ~MixedPortion(); MixedSolution *Value(void) const; void SetValue(MixedSolution *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};inline const MixedSolution &AsMixed(Portion *portion){ return *((MixedPortion *) portion)->Value(); }//--------// Behav//--------#include "nash/behavsol.h"class BehavPortion : public Portion {protected: struct behavrep { BehavSolution *value; int nref; behavrep(BehavSolution *v) : value(v), nref(1) { } ~behavrep() { delete value; } }; struct behavrep *rep; bool _ref; static gPool pool; BehavPortion(const BehavPortion *, bool);public: BehavPortion(BehavSolution *); virtual ~BehavPortion(); BehavSolution *Value(void) const; void SetValue(BehavSolution *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};inline const BehavSolution &AsBehav(Portion *portion){ return *((BehavPortion *) portion)->Value(); }//-------// Nfg//-------class NfgPortion : public Portion {protected: Nfg ** _Value; bool _ref; static gPool pool; NfgPortion(Nfg *&, bool);public: NfgPortion(Nfg *value); virtual ~NfgPortion(); Nfg *Value(void) const; void SetValue(Nfg *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//-------// Efg//-------class EfgPortion : public Portion {protected: efgGame ** _Value; bool _ref; static gPool pool; EfgPortion(efgGame *&, bool);public: EfgPortion(efgGame *value); virtual ~EfgPortion(); efgGame *Value(void) const; void SetValue(efgGame *); PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};inline efgGame &AsEfg(Portion *portion){ return *((EfgPortion *) portion)->Value(); }//---------// Output//---------class OutputPortion : public Portion {protected: struct outputrep { gOutput *value; int nref; outputrep(gOutput *v) : value(v), nref(1) { } // ~outputrep() { if (value != &gout && value != &gnull) delete value; } ~outputrep() { } }; struct outputrep *rep; bool _ref; static gPool pool; OutputPortion(const OutputPortion *, bool);public: OutputPortion(gOutput &value); virtual ~OutputPortion(); gOutput& Value(void) const; PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//---------// Input//---------class InputPortion : public Portion {protected: struct inputrep { gInput *value; int nref; inputrep(gInput *v) : value(v), nref(1) { } ~inputrep() { delete value; } }; struct inputrep *rep; bool _ref; static gPool pool; InputPortion(const InputPortion *, bool);public: InputPortion(gInput &value); virtual ~InputPortion(); gInput& Value(void) const; PortionSpec Spec(void) const; void Output(gOutput& s) const; gText OutputString(void) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//--------// List//--------template <class T> class gList;class ListPortion : public Portion {protected: struct listrep { gList<Portion *> *value; bool _ContainsListsOnly; unsigned long _DataType; bool _IsNull; unsigned int _ListDepth; int nref; listrep(void); listrep(gList<Portion *> *value); ~listrep(); }; struct listrep *rep; bool _ref; static gPool pool; ListPortion(const ListPortion *, bool);public: ListPortion(void); ListPortion(const gList<Portion *> &value); virtual ~ListPortion(); bool BelongsToGame( void* game ) const; bool MatchGameData( void* game, void* data ) const; bool IsInteger(void) const; bool ContainsListsOnly(void) const; const gList<Portion *> &Value(void) const; void SetDataType(unsigned long type); PortionSpec Spec(void) const; void Output(gOutput& s) const; void Output(gOutput& s, long ListLF) const; gText OutputString( void ) const; Portion* ValCopy(void) const; Portion* RefCopy(void) const; void AssignFrom(Portion* p); bool operator == (Portion* p) const; int Append (Portion* item); int Insert (Portion* item, int index); bool Contains (Portion* item) const; Portion* Remove (int index); int Length (void) const; void Flush (void); // Use operator[] when you just want to check the info on an element; Portion* operator[](int index) const; // Use SubscriptCopy() when you want to extract a copy of an element // Warning: SubscriptCopy() already makes a copy; // don't call ValCopy() or RefCopy() on Subscript() ! Portion* SubscriptCopy(int index) const; bool IsReference(void) const; void *operator new(size_t) { return pool.Alloc(); } void operator delete(void *p) { pool.Free(p); }};//-----------------------------------// Miscellaneous Portion functions//-----------------------------------gOutput& operator << (gOutput& s, Portion* p);bool PortionEqual(Portion* p1, Portion* p2, bool& type_found);#endif // PORTION_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -