#ifndef VLWORLD_HEADER
#define VLWORLD_HEADER 1
/////////////////////////////////////////////////
//! docentry="Logic.World"
//! lib=VLWorld
//! rcsid="$Id: World.hh,v 1.7 2000/07/13 10:03:03 ees1cg Exp $"
//! file="amma/Logic/World/World.hh"
//! author="Charles Galambos"
//! date="20/07/98"
#include "amma/Logic2/LSpace.hh"
#include "amma/Logic2/LExprType.hh"
#include "amma/DP/Port.hh"
class VLWorldC;
///////////////////////////
//! userlevel=Develop
//: World interface body.
// Put: Input, Symbol = Action.
// Get: Output, Space = Percived world state.
class VLWorldBodyC
: public DPIOPortBodyC
{
public:
VLWorldBodyC();
//: Default constructor.
virtual BooleanT IsGetReady() const;
//: Is some data ready ?
// TRUE = yes.
virtual VLSpaceC Get();
//: Get next piece of data.
// May block if not ready, or it will return a constructed
// with the default constructor.
virtual BooleanT Put(const VLSymbC &);
//: Put data.
virtual BooleanT IsPutReady() const;
//: Is port ready for data ?
BooleanT AddAction(const VLSymbC &act);
//: Register action type.
BooleanT SetGoal(const VLSymbC &goal);
//: Register goal
protected:
VLSpaceC state; // Current world state.
static VLExprLabelC labGoal; // Label for goal argument. in labGoal
static VLExprLabelC labAction; // Label for action in actType
static VLExprLabelC labWorldId; // Label for world type id.
static VLExprTypeC etGoal; // Goal information.
static VLExprTypeC etActType; // Action type.
static VLExprTypeC etWorldId; // World id.
friend class VLWorldC;
};
///////////////////////////
//! userlevel=Normal
//: World interface.
// Put: Input, Symbol = Action.
// Get: Output, Space = Perceived world state.
class VLWorldC
: public DPIOPortC
{
public:
VLWorldC()
: DPEntityC(TRUE)
{}
//: Default constructor.
static VLExprLabelC LabGoal()
{ return VLWorldBodyC::labGoal; }
//: Label for goal argument. in labGoal
static VLExprLabelC LabAction()
{ return VLWorldBodyC::labAction; }
//: Label for action in actType
static VLExprLabelC LabWorldId()
{ return VLWorldBodyC::labWorldId; }
//: Label for world type id.
static VLExprTypeC EtGoal()
{ return VLWorldBodyC::etGoal; }
//: ExprType Goal information.
static VLExprTypeC EtActType()
{ return VLWorldBodyC::etActType; }
//: ExprType Action type.
static VLExprTypeC EtWorldId()
{ return VLWorldBodyC::etWorldId; }
//: ExprType World id.
protected:
VLWorldC(VLWorldBodyC &bod)
: DPEntityC(bod)
{}
//: Body constructor.
};
#endif