Mercurial > hg > Database > Christie-sharp
view datagear/command/Command.cs @ 16:7352793b5dbe
add some Commands
author | riono <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 22 Nov 2020 01:52:22 +0900 |
parents | 49521c7269bc |
children | 4a3115ba746d |
line wrap: on
line source
using System; using System.IO; using Christie_net.codegear; using Christie_net.daemon; using Christie_net.datagear.dg; namespace Christie_net.datagear.command { public abstract class Command { private CommandType _type; public CommandTypeEtx type; public string key; public string toDgmName; // for take public string fromDgmName = "local"; // for remotetake/reply public int? cgmID = -1; // for localtake public CodeGear cg; // for localtake public DataGear<object> dg; // for put/localtake/reply public Type clazz; // for remote public Connection connection = null; // for reply public Command(CommandBuilder cb) { this._type = cb.type.commandType; this.type = new CommandTypeEtx(_type); this.key = cb.key; this.toDgmName = cb.toDgmName; this.fromDgmName = cb.fromDgmname; this.cgmID = cb.cgmID; this.cg = cb.cg; this.dg = cb.dg; this.clazz = cb.clazz; this.connection = cb.connection; } // instead of any Constoractor args protected void CheckNeedParam(CommandBuilder cb) { } public abstract void Execute(); // for remote public abstract MemoryStream Convert(); public RemoteMessage CreateRemoteMessage() { return new RemoteMessage(type.id, fromDgmName, key, clazz.Name); } public void SetDg(Object obj) { this.dg.SetData(obj); } public override string ToString() { return "Command : type = " + type.commandType + ", key = " + key + "toDgmName = " + toDgmName + " fromDgmName = " + fromDgmName + " cgmID = " + cgmID + " cg = " + cg + " dg = " + dg + " clazz = " + clazz + "connection = " + connection; } } }