Mercurial > hg > orthanc-stone
diff Resources/CodeGeneration/template.in.ts @ 495:6405435480ae bgo-commands-codegen
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
author | bgo-osimis |
---|---|
date | Sat, 23 Feb 2019 14:14:32 +0100 |
parents | fc17251477d6 |
children | ce49eae4c887 |
line wrap: on
line diff
--- a/Resources/CodeGeneration/template.in.ts Sat Feb 23 10:18:13 2019 +0100 +++ b/Resources/CodeGeneration/template.in.ts Sat Feb 23 14:14:32 2019 +0100 @@ -50,7 +50,7 @@ public StoneSerialize(): string { let container: object = {}; - container['type'] = '{{rWholootName}}.{{struct['name']}}'; + container['type'] = '{{rootName}}.{{struct['name']}}'; container['value'] = this; return JSON.stringify(container); } @@ -66,14 +66,14 @@ {% endfor %} -export interface IDispatcher { +export interface IHandler { {% for struct in structs%} Handle{{struct['name']}}(value: {{struct['name']}}): boolean; {% endfor %} }; /** Service function for StoneDispatchToHandler */ export function StoneDispatchJsonToHandler( - jsonValue: any, dispatcher: IDispatcher): boolean + jsonValue: any, handler: IHandler): boolean { StoneCheckSerializedValueTypeGeneric(jsonValue); let type: string = jsonValue["type"]; @@ -85,7 +85,7 @@ {% for struct in structs%} else if (type == "{{rootName}}.{{struct['name']}}") { let value = jsonValue["value"] as {{struct['name']}}; - return dispatcher.Handle{{struct['name']}}(value); + return handler.Handle{{struct['name']}}(value); } {% endfor %} else @@ -94,9 +94,9 @@ } } -/** Takes a serialized type and passes this to the dispatcher */ +/** Takes a serialized type and passes this to the handler */ export function StoneDispatchToHandler( - strValue: string, dispatcher: IDispatcher): boolean + strValue: string, handler: IHandler): boolean { // console.//log("+------------------------------------------------+"); // console.//log("| StoneDispatchToHandler |"); @@ -104,5 +104,5 @@ // console.//log("strValue = "); // console.//log(strValue); let jsonValue: any = JSON.parse(strValue) - return StoneDispatchJsonToHandler(jsonValue, dispatcher); + return StoneDispatchJsonToHandler(jsonValue, handler); }