diff options
author | Klement Sekera <ksekera@cisco.com> | 2018-08-24 11:43:20 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-08-27 19:35:30 +0000 |
commit | 2108c0c6daeb39a0619ace66189cc20e049a3c79 (patch) | |
tree | 91db4d48f374dbd8a2b69ede4d6cf6c8e36fc826 /src/vpp-api/vapi/vapi_cpp_gen.py | |
parent | ef89e4d6800e44a068ea4926bc24c4429eeacdb4 (diff) |
VAPI: support enums & unions
Change-Id: I76ac7e4eeb6a300538d52a0e355d66937764a4d1
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vpp-api/vapi/vapi_cpp_gen.py')
-rwxr-xr-x | src/vpp-api/vapi/vapi_cpp_gen.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/vpp-api/vapi/vapi_cpp_gen.py b/src/vpp-api/vapi/vapi_cpp_gen.py index 326026837fd..6b62bc4da22 100755 --- a/src/vpp-api/vapi/vapi_cpp_gen.py +++ b/src/vpp-api/vapi/vapi_cpp_gen.py @@ -4,8 +4,8 @@ import argparse import os import sys import logging -from vapi_c_gen import CField, CStruct, CSimpleType, CStructType, CMessage, \ - json_to_c_header_name +from vapi_c_gen import CField, CEnum, CStruct, CSimpleType, CStructType,\ + CMessage, json_to_c_header_name from vapi_json_parser import JsonParser @@ -17,6 +17,10 @@ class CppStruct(CStruct): pass +class CppEnum(CEnum): + pass + + class CppSimpleType (CSimpleType): pass @@ -69,7 +73,7 @@ class CppMessage (CMessage): return "%s%s" % (self.name[0].upper(), self.name[1:]) def get_req_template_name(self): - if self.is_dump(): + if self.reply_is_stream: template = "Dump" else: template = "Request" @@ -159,7 +163,7 @@ def gen_json_header(parser, logger, j, io, gen_h_prefix, add_debug_comments): print("/* m.get_cpp_constructor() */") print("%s" % m.get_cpp_constructor()) print("") - if not m.is_reply(): + if not m.is_reply and not m.is_event: if add_debug_comments: print("/* m.get_alloc_template_instantiation() */") print("%s" % m.get_alloc_template_instantiation()) @@ -168,7 +172,7 @@ def gen_json_header(parser, logger, j, io, gen_h_prefix, add_debug_comments): print("/* m.get_msg_class_instantiation() */") print("%s" % m.get_msg_class_instantiation()) print("") - if m.is_reply(): + if m.is_reply or m.is_event: if add_debug_comments: print("/* m.get_reply_type_alias() */") print("%s" % m.get_reply_type_alias()) @@ -246,6 +250,7 @@ if __name__ == '__main__': simple_type_class=CppSimpleType, struct_type_class=CppStructType, field_class=CppField, + enum_class=CppEnum, message_class=CppMessage) gen_cpp_headers(jsonparser, logger, args.prefix, args.gen_h_prefix, |