summaryrefslogtreecommitdiffstats
path: root/cmd/binapi-generator/generate.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-02-08 08:38:56 +0100
committerOndrej Fabry <ofabry@cisco.com>2019-02-08 10:04:56 +0100
commitdf05a70f90a1486a86a4156b1b0d68c94f2098b4 (patch)
tree45577756efc2ec766430ed17daa9ddcf9c5709b2 /cmd/binapi-generator/generate.go
parentfa21c9d726ebb807895a8571af9a16dab5cd8d6e (diff)
Add support for using multiple generated versions
- added CheckCompatibility for checking if given messages are compatible - generating Messages global for easier usage of compatibility check - added ReconnectInterval and MaxReconnectAttempts for reconnecting - added Failed state that is sent after exceeding max reconnect attempts Change-Id: I1062ba453f22657c1a2a31aa64cb103ef1223b0f Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'cmd/binapi-generator/generate.go')
-rw-r--r--cmd/binapi-generator/generate.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/binapi-generator/generate.go b/cmd/binapi-generator/generate.go
index f2da08a..f22a035 100644
--- a/cmd/binapi-generator/generate.go
+++ b/cmd/binapi-generator/generate.go
@@ -152,6 +152,14 @@ func generatePackage(ctx *context, w *bufio.Writer) error {
fmt.Fprintf(w, "\tapi.RegisterMessage((*%s)(nil), \"%s\")\n", name, ctx.moduleName+"."+name)
}
fmt.Fprintln(w, "}")
+ fmt.Fprintln(w)
+
+ fmt.Fprintln(w, "var Messages = []api.Message{")
+ for _, msg := range ctx.packageData.Messages {
+ name := camelCaseName(msg.Name)
+ fmt.Fprintf(w, "\t(*%s)(nil),\n", name)
+ }
+ fmt.Fprintln(w, "}")
}
// flush the data: