Mercurial > hg > Database > Christie-sharp
view datagear/command/Command.cs @ 34:1236da135f79
update
author | riono <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 27 Apr 2021 22:57:14 +0900 |
parents | 96fc5e71274e |
children | 9217d14cc220 |
line wrap: on
line source
using System; using System.Diagnostics; 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 { public CommandType 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; 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(byte[] data) { return new RemoteMessage((int) type, fromDgmName, key, clazz.FullName, data); } public void SetDg(Object obj) { this.dg.SetData(obj); } public override string ToString() { return "Command : type = " + type + ", key = " + key + "toDgmName = " + toDgmName + " fromDgmName = " + fromDgmName + " cgmID = " + cgmID + " cg = " + cg + " dg = " + dg + " clazz = " + clazz + "connection = " + connection; } } }