iipRequestInvokeFunctionNamedArguments method

void iipRequestInvokeFunctionNamedArguments(
  1. int callback,
  2. int resourceId,
  3. int index,
  4. DC content,
)

Implementation

void iipRequestInvokeFunctionNamedArguments(
    int callback, int resourceId, int index, DC content) {
  Warehouse.getById(resourceId).then((r) {
    if (r != null) {
      Codec.parseStructure(content, 0, content.length, this)
          .then((namedArgs) {
        var ft = r.instance?.template.getFunctionTemplateByIndex(index);
        if (ft != null) {
          if (r is DistributedResource) {
            var rt = r.internal_invokeByNamedArguments(index, namedArgs);
            if (rt != null) {
              rt.then((res) {
                sendReply(
                    IIPPacketAction.InvokeFunctionNamedArguments, callback)
                  ..addDC(Codec.compose(res, this))
                  ..done();
              });
            } else {
              // function not found on a distributed object
            }
          } else {
            var fi = null;

            if (fi != null) {
            } else {
              // ft found, fi not found, this should never happen
            }
          }
        } else {
          // no function at this index
        }
      });
    } else {
      // no resource with this id
    }
  });
}