|
OpenSDN source code
|


Public Member Functions | |
| t_c_generator (t_program *program, const map< string, string > &parsed_options, const string &option_string) | |
| void | init_generator () |
| void | close_generator () |
| void | generate_typedef (t_typedef *ttypedef) |
| void | generate_enum (t_enum *tenum) |
| void | generate_consts (vector< t_const * > consts) |
| void | generate_struct (t_struct *tstruct) |
| void | generate_service (t_service *tservice) |
| void | generate_xception (t_struct *tstruct) |
| void | generate_sandesh (t_sandesh *tsandesh) |
| void | generate_sandesh_info () |
Public Member Functions inherited from t_oop_generator | |
| t_oop_generator (t_program *program) | |
| void | scope_up (std::ostream &out) |
| void | scope_down (std::ostream &out) |
| std::string | upcase_string (std::string original) |
| virtual std::string | autogen_comment () |
Public Member Functions inherited from t_generator | |
| t_generator (t_program *program) | |
| virtual | ~t_generator () |
| virtual void | generate_program () |
| const t_program * | get_program () const |
| void | generate_docstring_comment (std::ofstream &out, const std::string &comment_start, const std::string &line_prefix, const std::string &contents, const std::string &comment_end) |
| virtual std::string | escape_string (const std::string &in) const |
| std::string | get_escaped_string (t_const_value *constval) |
Private Member Functions | |
| bool | is_complex_type (t_type *ttype) |
| string | type_name (t_type *ttype, bool in_typedef=false, bool is_const=false) |
| string | base_type_name (t_base_type *type) |
| string | type_to_enum (t_type *type) |
| string | constant_value (string name, t_type *type, t_const_value *value) |
| string | argument_list (t_struct *tstruct) |
| string | declare_field (t_field *tfield, bool init=false, bool pointer=false, bool constant=false, bool reference=false) |
| void | generate_const_initializer (string name, t_type *type, t_const_value *value) |
| void | generate_service_client (t_service *tservice) |
| void | generate_service_server (t_service *tservice) |
| void | generate_object (t_struct *tstruct) |
| void | generate_object (t_sandesh *tsandesh) |
| void | generate_object_internal (string name, const vector< t_field * > &members, bool is_sandesh) |
| void | generate_struct_writer (ofstream &out, string name, const vector< t_field * > &fields, bool is_sandesh, bool is_function=true) |
| void | generate_struct_writer_to_buffer (ofstream &out, string name, const vector< t_field * > &fields, bool is_sandesh, bool is_function=true) |
| void | generate_struct_reader (ofstream &out, string name, const vector< t_field * > &fields, bool is_sandesh, bool is_function=true) |
| void | generate_struct_reader_from_buffer (ofstream &out, string name, const vector< t_field * > &fields, bool is_sandesh, bool is_function=true) |
| void | generate_struct_deleter (ofstream &out, string name, const vector< t_field * > &fields, bool is_sandesh, bool is_function=true) |
| void | generate_buffer_bounds_chk (ofstream &out, string length, int error_ret) |
| void | generate_buffer_incr_offset (ofstream &out, string length) |
| void | generate_write_buffer_memcpy (ofstream &out, string source, string length, bool ref) |
| void | generate_write_buffer_memcpy_incr_offset (ofstream &out, string source, string length, bool ref) |
| void | generate_write_buffer_chk_memcpy_incr_offset (ofstream &out, string source, string length, int error_ret, bool ref) |
| void | generate_write_buffer_binary (ofstream &out, string buf, string buf_len, int error_ret) |
| void | generate_struct_begin_writer_to_buffer (ofstream &out, string name, bool is_sandesh, int error_ret) |
| void | generate_struct_end_writer_to_buffer (ofstream &out, bool is_sandesh) |
| void | generate_field_begin_writer_to_buffer (ofstream &out, string key, string field_type, int error_ret) |
| void | generate_field_end_writer_to_buffer (ofstream &out) |
| void | generate_field_stop_writer_to_buffer (ofstream &out, int error_ret) |
| void | generate_list_begin_writer_to_buffer (ofstream &out, string element_type, string length, int error_ret) |
| void | generate_list_end_writer_to_buffer (ofstream &out) |
| void | generate_serialize_bool_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_byte_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_i16_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_i32_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_i64_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_u16_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_u32_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_u64_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_string_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_xml_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_ipaddr_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_uuid_t_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_double_to_buffer (ofstream &out, string name, int error_ret) |
| void | generate_read_buffer_memcpy (ofstream &out, string dest, string length, bool ref) |
| void | generate_read_buffer_memcpy_incr_offset (ofstream &out, string dest, string length, bool ref) |
| void | generate_read_buffer_chk_memcpy_incr_offset (ofstream &out, string dest, string length, int error_ret, bool ref) |
| void | generate_struct_begin_reader_from_buffer (ofstream &out, string name, bool is_sandesh, int error_ret) |
| void | generate_struct_end_reader_from_buffer (ofstream &out, bool is_sandesh) |
| void | generate_field_begin_reader_from_buffer (ofstream &out, string field_type, string field_id, int error_ret) |
| void | generate_field_end_reader_from_buffer (ofstream &out) |
| void | generate_list_begin_reader_from_buffer (ofstream &out, string element_size, int error_ret) |
| void | generate_list_end_reader_from_buffer (ofstream &out) |
| void | generate_deserialize_bool_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_byte_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_i16_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_i32_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_i64_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_u16_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_u32_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_u64_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_string_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_xml_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_ipaddr_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_uuid_t_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_deserialize_double_from_buffer (ofstream &out, string name, int error_ret) |
| void | generate_serialize_field (ofstream &out, t_field *tfield, string prefix, string suffix, int error_ret) |
| void | generate_serialize_field_to_buffer (ofstream &out, t_field *tfield, string prefix, string suffix, int error_ret) |
| void | generate_serialize_struct (ofstream &out, t_struct *tstruct, string prefix, int error_ret) |
| void | generate_serialize_struct_to_buffer (ofstream &out, t_struct *tstruct, string prefix, int error_ret) |
| void | generate_serialize_container (ofstream &out, t_type *ttype, string prefix, int error_ret) |
| void | generate_serialize_container_to_buffer (ofstream &out, t_type *ttype, string prefix, int error_ret) |
| void | generate_serialize_list_element (ofstream &out, t_list *tlist, string list, string index, int error_ret) |
| void | generate_serialize_list_element_to_buffer (ofstream &out, t_list *tlist, string list, string index, int error_ret) |
| void | generate_deserialize_field (ofstream &out, t_field *tfield, string prefix, string suffix, int error_ret) |
| void | generate_deserialize_field_from_buffer (ofstream &out, t_field *tfield, string prefix, string suffix, int error_ret) |
| void | generate_deserialize_struct (ofstream &out, t_struct *tstruct, string prefix, int error_ret) |
| void | generate_deserialize_struct_from_buffer (ofstream &out, t_struct *tstruct, string prefix, int error_ret) |
| void | generate_deserialize_container (ofstream &out, t_type *ttype, string prefix, int error_ret) |
| void | generate_deserialize_container_from_buffer (ofstream &out, t_type *ttype, string prefix, int error_ret) |
| void | generate_deserialize_list_element (ofstream &out, t_list *tlist, string prefix, string index, int error_ret) |
| void | generate_deserialize_list_element_from_buffer (ofstream &out, t_list *tlist, string prefix, string index, int error_ret) |
Private Attributes | |
| ofstream | f_types_ |
| ofstream | f_types_impl_ |
| ofstream | f_header_ |
| ofstream | f_service_ |
| string | nspace |
| string | nspace_u |
| string | nspace_uc |
| string | nspace_lc |
Additional Inherited Members | |
Static Public Member Functions inherited from t_generator | |
| static bool | is_valid_namespace (const std::string &sub_namespace) |
| static t_type * | get_true_type (t_type *type) |
Protected Member Functions inherited from t_generator | |
| virtual void | generate_consts (std::vector< t_const * > consts) |
| virtual void | generate_const (t_const *tconst) |
| virtual std::string | get_program_name (t_program *tprogram) |
| virtual std::string | get_service_name (t_service *tservice) |
| virtual std::string | get_out_dir () const |
| std::string | tmp (std::string name) |
| void | indent_up () |
| void | indent_down () |
| std::string | indent () |
| std::ostream & | indent (std::ostream &os) |
| std::string | capitalize (std::string in) |
| std::string | decapitalize (std::string in) |
| std::string | lowercase (std::string in) |
| std::string | uppercase (std::string in) |
| std::string | underscore (std::string in) |
| std::string | camelcase (std::string in) |
Protected Attributes inherited from t_generator | |
| t_program * | program_ |
| std::string | program_name_ |
| std::string | service_name_ |
| std::string | out_dir_base_ |
| std::map< char, std::string > | escape_ |
C code generator
Definition at line 47 of file t_c_generator.cc.
|
inline |
|
private |
Renders a field list
| tstruct | The struct definition |
Definition at line 776 of file t_c_generator.cc.

|
private |
Maps a Thrift primitive to a C primitive.
Definition at line 602 of file t_c_generator.cc.

|
virtual |
Finish up generation and close all file streams.
Reimplemented from t_generator.
Definition at line 298 of file t_c_generator.cc.

|
private |
Returns C code that represents a Thrift constant.
Definition at line 719 of file t_c_generator.cc.

|
private |
Declares a field, including any necessary initialization.
Definition at line 797 of file t_c_generator.cc.

|
private |
Definition at line 1078 of file t_c_generator.cc.
|
private |
Definition at line 1087 of file t_c_generator.cc.
|
private |
Generates C code that initializes complex constants.
Definition at line 862 of file t_c_generator.cc.

| void t_c_generator::generate_consts | ( | vector< t_const * > | consts | ) |
Generates Thrift constants in C code.
Definition at line 390 of file t_c_generator.cc.

|
private |
Definition at line 1855 of file t_c_generator.cc.
|
private |
Definition at line 1878 of file t_c_generator.cc.
|
private |
|
private |
|
private |
Definition at line 2213 of file t_c_generator.cc.
|
private |
|
private |
|
private |
Definition at line 1905 of file t_c_generator.cc.
|
private |
Definition at line 1965 of file t_c_generator.cc.
|
private |
Definition at line 2027 of file t_c_generator.cc.
|
private |
Definition at line 2157 of file t_c_generator.cc.
|
private |
|
private |
|
private |
Definition at line 2095 of file t_c_generator.cc.
|
private |
|
private |
|
private |
Definition at line 1935 of file t_c_generator.cc.
|
private |
Definition at line 1995 of file t_c_generator.cc.
|
private |
Definition at line 2056 of file t_c_generator.cc.
|
private |
Definition at line 2195 of file t_c_generator.cc.
|
private |
Definition at line 2076 of file t_c_generator.cc.
|
virtual |
Generates a C enumeration. For example:
Thrift: enum MyEnum { ONE = 1, TWO }
C: enum _ThriftMyEnum { THRIFT_MY_ENUM_ONE = 1, THRIFT_MY_ENUM_TWO }; typedef enum _ThriftMyEnum ThriftMyEnum;
Implements t_generator.
Definition at line 350 of file t_c_generator.cc.

|
private |
Definition at line 1811 of file t_c_generator.cc.
|
private |
Definition at line 1786 of file t_c_generator.cc.
|
private |
Definition at line 1837 of file t_c_generator.cc.
|
private |
Definition at line 1832 of file t_c_generator.cc.
|
private |
Definition at line 1222 of file t_c_generator.cc.
|
private |
Definition at line 2795 of file t_c_generator.cc.
|
private |
Definition at line 2479 of file t_c_generator.cc.
|
private |
Definition at line 2809 of file t_c_generator.cc.
|
private |
Definition at line 2506 of file t_c_generator.cc.
|
private |
Generates C code to represent a sandesh.
Definition at line 896 of file t_c_generator.cc.

|
private |
Generates C code to represent a struct.
Definition at line 904 of file t_c_generator.cc.

|
private |
Generates C code to represent a structure.
Definition at line 912 of file t_c_generator.cc.

|
private |
Definition at line 1148 of file t_c_generator.cc.
|
private |
Definition at line 1108 of file t_c_generator.cc.
|
private |
Definition at line 1131 of file t_c_generator.cc.
| void t_c_generator::generate_sandesh | ( | t_sandesh * | tsandesh | ) |
Generate C code to represent Sandesh.
Definition at line 440 of file t_c_generator.cc.

| void t_c_generator::generate_sandesh_info | ( | ) |
Generate C code to represent Sandesh information for all Sandeshs
Definition at line 448 of file t_c_generator.cc.

|
private |
Definition at line 1842 of file t_c_generator.cc.
|
private |
Definition at line 1869 of file t_c_generator.cc.
|
private |
|
private |
|
private |
Definition at line 2204 of file t_c_generator.cc.
|
private |
|
private |
|
private |
Definition at line 1892 of file t_c_generator.cc.
|
private |
Definition at line 1952 of file t_c_generator.cc.
|
private |
Definition at line 2012 of file t_c_generator.cc.
|
private |
Definition at line 2125 of file t_c_generator.cc.
|
private |
|
private |
|
private |
Definition at line 2082 of file t_c_generator.cc.
|
private |
|
private |
|
private |
Definition at line 1922 of file t_c_generator.cc.
|
private |
Definition at line 1982 of file t_c_generator.cc.
|
private |
Definition at line 2041 of file t_c_generator.cc.
|
private |
Definition at line 2186 of file t_c_generator.cc.
|
private |
Definition at line 2070 of file t_c_generator.cc.
|
virtual |
Generate C code to represent Thrift services. Creates a new GObject which can be used to access the service.
Implements t_generator.
Definition at line 512 of file t_c_generator.cc.
|
private |
Generates C code that represents a Thrift service client.
Definition at line 882 of file t_c_generator.cc.
|
private |
Generates C code that represents a Thrift service server.
Definition at line 889 of file t_c_generator.cc.
|
virtual |
Generate Thrift structs in C code. Example:
Thrift: struct Bonk { 1: string message, 2: i32 type }
C instance header: struct _Bonk {
char * message; int32 type; }; typedef struct _Bonk
Implements t_generator.
Definition at line 432 of file t_c_generator.cc.

|
private |
Definition at line 1188 of file t_c_generator.cc.
|
private |
Definition at line 1171 of file t_c_generator.cc.
|
private |
Generates functions to free Thrift structures and sandeshs to a stream.
Definition at line 999 of file t_c_generator.cc.

|
private |
Definition at line 1213 of file t_c_generator.cc.
|
private |
Definition at line 1204 of file t_c_generator.cc.
|
private |
Generates code to read Thrift structures from a stream.
Definition at line 1423 of file t_c_generator.cc.

|
private |
Generates code to read Thrift structures from a buffer.
Definition at line 1621 of file t_c_generator.cc.

|
private |
Generates functions to write Thrift structures and sandeshs to a stream.
Definition at line 1319 of file t_c_generator.cc.

|
private |
|
virtual |
Generates a Thrift typedef in C code. For example:
Thrift: typedef map<i32,i32> SomeMap
C: typedef GHashTable * ThriftSomeMap;
Implements t_generator.
Definition at line 327 of file t_c_generator.cc.

|
private |
Definition at line 1157 of file t_c_generator.cc.
|
private |
Definition at line 1139 of file t_c_generator.cc.
|
private |
Definition at line 1093 of file t_c_generator.cc.
|
private |
Definition at line 1123 of file t_c_generator.cc.
|
virtual |
Reimplemented from t_generator.
Definition at line 519 of file t_c_generator.cc.
|
virtual |
Prepare for file generation by opening up the necessary file output streams.
Reimplemented from t_generator.
Definition at line 222 of file t_c_generator.cc.

|
private |
Returns true if ttype is not a primitive.
Definition at line 530 of file t_c_generator.cc.

|
private |
Maps a Thrift t_type to a C type.
Definition at line 547 of file t_c_generator.cc.

|
private |
Returns a member of the ThriftType C enumeration in thrift_protocol.h for a Thrift type.
Definition at line 650 of file t_c_generator.cc.
|
private |
Definition at line 113 of file t_c_generator.cc.
|
private |
Definition at line 114 of file t_c_generator.cc.
|
private |
Definition at line 111 of file t_c_generator.cc.
|
private |
Definition at line 112 of file t_c_generator.cc.
|
private |
Definition at line 117 of file t_c_generator.cc.
|
private |
Definition at line 120 of file t_c_generator.cc.
|
private |
Definition at line 118 of file t_c_generator.cc.
|
private |
Definition at line 119 of file t_c_generator.cc.