// ----------------------------------------------------------------------- // Register something with our PM given the specified information. // The data passed in is stored directly in our map so the assumption // is that we are now owners. // ie. don't delete this data object elsewhere! // ----------------------------------------------------------------------- private int RegisterWithPM(String name, String units, String description, RegistrationKind regKind, String sDDML) //,Packable* data); { String ddml = sDDML; if (units != "") { addAttributeToXML(ddml, "unit=\"" + units + "\""); } if (description != "") { addAttributeToXML(ddml, "description=\"" + description + "\""); } // Add new object to our map. String fullRegName = name + regKind.ToString(); Reg reg = new Reg(); reg.data = new TDDMLValue(sDDML, ""); reg.kind = regKind; reg.ddml = ddml; reg.regID = nextID(); regNames.Add(fullRegName, reg); SendRegisterMsg(name, ddml, reg.regID, (int)regKind, 0); return(reg.regID); }
/// <summary> /// Return a registration id for the specified name. 0 if not found. /// </summary> /// <param name="name"></param> /// <param name="regKind"></param> /// <returns>0 if not found</returns> private int nameToRegistrationID(String name, RegistrationKind regKind) { String FullRegName = name + regKind.ToString(); if (regNames.ContainsKey(FullRegName)) { return(regNames[FullRegName].regID); } else { return(0); } }