namespace Eva { public class Pid : Object, Term { public string node {get; construct;} public uint num {get; construct;} public uint serial {get; construct;} public uint creation {get; construct;} internal Pid(Erl.Pid pid) { this.create(binary_to_string(pid.node, Erl.MAXATOMLEN), pid.num, pid.serial, pid.creation); } private Pid.create(string node0, uint num0, uint serial0, uint creation0) { Object(node: node0, num: num0, serial: serial0, creation: creation0); } public string to_string() { return "<" + node + "." + num.to_string() + "." + serial.to_string() + ">"; } protected bool do_match(Term o, Gee.Map vars, Gee.Map aliases) { if(o is Var) { return o.do_match(this, vars, aliases); } if(!(o is Pid)) return false; Pid p = o as Pid; return (node == p.node && num == p.num && serial == p.serial && creation == p.creation); } internal void encode(Buffer buffer) { Erl.Pid pid = Erl.Pid(); char[]? nodedata = string_to_binary(node); assert(nodedata != null); Memory.copy(pid.node, nodedata, int.min(Erl.MAXATOMLEN, nodedata.length)); pid.node[int.min(Erl.MAXATOMLEN, nodedata.length)] = 0; pid.num = num; pid.serial = serial; pid.creation = creation; buffer.buffer.encode_pid(pid); } } }