Skip to content

Usage creation step for step

jurihock edited this page Oct 4, 2012 · 1 revision
  1. Specify an unique usage identifier in the Usage_Code_Point enumerator.
  2. An usage class must implement the IUsage interface.
    1. There are certain properties that returns constant values:
      • CodePoint: returns the corresponding Usage_Code_Point value,
      • Name: returns an user defined value,
      • KindId: returns a system-wide unique int value,
      • DataModel: returns the used data model, e.g. DICTIONARY.
    2. Other properties returns dynamically determined values:
      • ResourceName: is known at a later date,
      • Length: is generally set at a later date.
    3. Implement the Create method to retrieve the resource name stored in arguments[0] and the usage specific data stored in arguments[...].
    4. Methods FromReader and dump are used to de-/serialize the usage instance.
    5. Method AppProcedure must at least clear the passed kindResponse list.
    6. Encapsulate returns the usage instance wrapped into StoredDataValue.
    7. Report returns the arbitrary summary of the usage data.
  3. Additionally the usage class must implement a constructor with signature MyUsage(UsageManager).
  4. Register declared usage at Machine.InitUsageManager().

There are no restrictions about the serialization format or order. All values (incl. resource name) should be represent as a byte array. Because not all usage values are fixed-length values, e.g. strings, it is recommended to consequently attach a separate length field for each serialized value.

The total length of the serialized usage (Length property) can be computed during initialization (Create method) and after deserialization (FromReader method).

Finally the declared usage can be applied for Store or Fetch procedures by specifying its Usage_Code_Point identifier.

Clone this wiki locally