singrdk/base/Contracts/ServiceManager.Contracts/GameContract.sg

85 lines
2.4 KiB
Plaintext
Raw Normal View History

2008-03-05 09:52:00 -05:00
///////////////////////////////////////////////////////////////////////////////
//
// Microsoft Research Singularity
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: Contracts/ServiceManager.Contracts/GameContract.sg
//
// Note: String replace game contract
//
using System;
using Microsoft.Singularity.Channels;
using Microsoft.Singularity.Directory;
namespace Microsoft.Singularity.ServiceManager
{
public contract GamePlayerContract : ServiceContract
{
public const String ModuleName = "ReplaceGame";
out message Success();
in message Search(char[]! in ExHeap query);
in message Overwrite(char[]! in ExHeap replacement, int position);
in message Protect(int position);
in message Score(char[]! in ExHeap query);
out message AckSearch(int position);
out message AckOverwrite();
out message AckProtect();
out message AckScore(int score);
override state Start : one {
Success! -> Ready;
}
state Ready : one {
Search? -> AckSearch! -> Action;
Score? -> AckScore! /* -> Truncate */ -> Ready;
}
state Action : one {
Overwrite? -> AckOverwrite! /* -> Snapshot */ -> Ready;
Protect? -> AckProtect! /* -> Truncate */ -> Ready;
}
}
public contract GameContract : ServiceContract
{
public const String ModuleName = "GameMaster";
out message Success();
in message NewGame();
in message Entry(GamePlayerContract.Exp:Start! player, int gameId);
in message StartGame();
in message EndGame();
out message AckNewGame(int gameId);
out message NakNewGame();
out message AckEntry();
out message NakEntry(GamePlayerContract.Exp:Start player);
out message AckStartGame();
out message AckEndGame();
override state Start : one {
Success! -> Ready;
}
state Ready : one {
NewGame? -> AckGameMaster;
}
state AckGameMaster : one {
AckNewGame! -> Play;
NakNewGame! -> Ready;
}
state Play : one {
Entry? -> (AckEntry! or NakEntry!) -> Play;
StartGame? -> AckStartGame! -> EndGame? -> AckEndGame! -> Ready;
}
}
}