OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
t_c_generator Class Reference
Inheritance diagram for t_c_generator:
Collaboration diagram for t_c_generator:

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_programget_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_typeget_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_programprogram_
 
std::string program_name_
 
std::string service_name_
 
std::string out_dir_base_
 
std::map< char, std::string > escape_
 

Detailed Description

C code generator

Definition at line 44 of file t_c_generator.cc.

Constructor & Destructor Documentation

t_c_generator::t_c_generator ( t_program program,
const map< string, string > &  parsed_options,
const string &  option_string 
)
inline

Definition at line 48 of file t_c_generator.cc.

Here is the call graph for this function:

Member Function Documentation

string t_c_generator::argument_list ( t_struct tstruct)
private

Renders a field list

Parameters
tstructThe struct definition
Returns
Comma sepearated list of all field names in that struct

Definition at line 773 of file t_c_generator.cc.

Here is the call graph for this function:

string t_c_generator::base_type_name ( t_base_type type)
private

Maps a Thrift primitive to a C primitive.

Definition at line 599 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::close_generator ( )
virtual

Finish up generation and close all file streams.

Reimplemented from t_generator.

Definition at line 295 of file t_c_generator.cc.

Here is the call graph for this function:

string t_c_generator::constant_value ( string  name,
t_type type,
t_const_value value 
)
private

Returns C code that represents a Thrift constant.

Definition at line 716 of file t_c_generator.cc.

Here is the call graph for this function:

string t_c_generator::declare_field ( t_field tfield,
bool  init = false,
bool  pointer = false,
bool  constant = false,
bool  reference = false 
)
private

Declares a field, including any necessary initialization.

Definition at line 794 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_buffer_bounds_chk ( ofstream &  out,
string  length,
int  error_ret 
)
private

Definition at line 1075 of file t_c_generator.cc.

void t_c_generator::generate_buffer_incr_offset ( ofstream &  out,
string  length 
)
private

Definition at line 1084 of file t_c_generator.cc.

void t_c_generator::generate_const_initializer ( string  name,
t_type type,
t_const_value value 
)
private

Generates C code that initializes complex constants.

Definition at line 859 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_consts ( vector< t_const * >  consts)

Generates Thrift constants in C code.

Definition at line 387 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_bool_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1852 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_byte_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1875 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_container ( ofstream &  out,
t_type ttype,
string  prefix,
int  error_ret 
)
private

Definition at line 2754 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_container_from_buffer ( ofstream &  out,
t_type ttype,
string  prefix,
int  error_ret 
)
private

Definition at line 2811 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_double_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2210 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_field ( ofstream &  out,
t_field tfield,
string  prefix,
string  suffix,
int  error_ret 
)
private

Definition at line 2534 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_field_from_buffer ( ofstream &  out,
t_field tfield,
string  prefix,
string  suffix,
int  error_ret 
)
private

Definition at line 2639 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_i16_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1902 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_i32_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1962 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_i64_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2024 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_ipaddr_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2154 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_list_element ( ofstream &  out,
t_list tlist,
string  prefix,
string  index,
int  error_ret 
)
private

Definition at line 2840 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_list_element_from_buffer ( ofstream &  out,
t_list tlist,
string  prefix,
string  index,
int  error_ret 
)
private

Definition at line 2850 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_string_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2092 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_struct ( ofstream &  out,
t_struct tstruct,
string  prefix,
int  error_ret 
)
private

Definition at line 2731 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_struct_from_buffer ( ofstream &  out,
t_struct tstruct,
string  prefix,
int  error_ret 
)
private

Definition at line 2742 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_deserialize_u16_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1932 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_u32_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1992 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_u64_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2053 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_uuid_t_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2192 of file t_c_generator.cc.

void t_c_generator::generate_deserialize_xml_from_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2073 of file t_c_generator.cc.

void t_c_generator::generate_enum ( t_enum tenum)
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 347 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_field_begin_reader_from_buffer ( ofstream &  out,
string  field_type,
string  field_id,
int  error_ret 
)
private

Definition at line 1808 of file t_c_generator.cc.

void t_c_generator::generate_field_begin_writer_to_buffer ( ofstream &  out,
string  key,
string  field_type,
int  error_ret 
)
private

Definition at line 1783 of file t_c_generator.cc.

void t_c_generator::generate_field_end_reader_from_buffer ( ofstream &  out)
private

Definition at line 1834 of file t_c_generator.cc.

void t_c_generator::generate_field_end_writer_to_buffer ( ofstream &  out)
private

Definition at line 1829 of file t_c_generator.cc.

void t_c_generator::generate_field_stop_writer_to_buffer ( ofstream &  out,
int  error_ret 
)
private

Definition at line 1219 of file t_c_generator.cc.

void t_c_generator::generate_list_begin_reader_from_buffer ( ofstream &  out,
string  element_size,
int  error_ret 
)
private

Definition at line 2792 of file t_c_generator.cc.

void t_c_generator::generate_list_begin_writer_to_buffer ( ofstream &  out,
string  element_type,
string  length,
int  error_ret 
)
private

Definition at line 2476 of file t_c_generator.cc.

void t_c_generator::generate_list_end_reader_from_buffer ( ofstream &  out)
private

Definition at line 2806 of file t_c_generator.cc.

void t_c_generator::generate_list_end_writer_to_buffer ( ofstream &  out)
private

Definition at line 2503 of file t_c_generator.cc.

void t_c_generator::generate_object ( t_struct tstruct)
private

Generates C code to represent a struct.

Definition at line 901 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_object ( t_sandesh tsandesh)
private

Generates C code to represent a sandesh.

Definition at line 893 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_object_internal ( string  name,
const vector< t_field * > &  members,
bool  is_sandesh 
)
private

Generates C code to represent a structure.

Definition at line 909 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_read_buffer_chk_memcpy_incr_offset ( ofstream &  out,
string  dest,
string  length,
int  error_ret,
bool  ref 
)
private

Definition at line 1145 of file t_c_generator.cc.

void t_c_generator::generate_read_buffer_memcpy ( ofstream &  out,
string  dest,
string  length,
bool  ref 
)
private

Definition at line 1105 of file t_c_generator.cc.

void t_c_generator::generate_read_buffer_memcpy_incr_offset ( ofstream &  out,
string  dest,
string  length,
bool  ref 
)
private

Definition at line 1128 of file t_c_generator.cc.

void t_c_generator::generate_sandesh ( t_sandesh tsandesh)

Generate C code to represent Sandesh.

Definition at line 437 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_sandesh_info ( )

Generate C code to represent Sandesh information for all Sandeshs

Definition at line 445 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_bool_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1839 of file t_c_generator.cc.

void t_c_generator::generate_serialize_byte_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1866 of file t_c_generator.cc.

void t_c_generator::generate_serialize_container ( ofstream &  out,
t_type ttype,
string  prefix,
int  error_ret 
)
private

Definition at line 2418 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_container_to_buffer ( ofstream &  out,
t_type ttype,
string  prefix,
int  error_ret 
)
private

Definition at line 2450 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_double_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2201 of file t_c_generator.cc.

void t_c_generator::generate_serialize_field ( ofstream &  out,
t_field tfield,
string  prefix,
string  suffix,
int  error_ret 
)
private

Definition at line 2219 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_field_to_buffer ( ofstream &  out,
t_field tfield,
string  prefix,
string  suffix,
int  error_ret 
)
private

Definition at line 2307 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_i16_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1889 of file t_c_generator.cc.

void t_c_generator::generate_serialize_i32_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1949 of file t_c_generator.cc.

void t_c_generator::generate_serialize_i64_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2009 of file t_c_generator.cc.

void t_c_generator::generate_serialize_ipaddr_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2122 of file t_c_generator.cc.

void t_c_generator::generate_serialize_list_element ( ofstream &  out,
t_list tlist,
string  list,
string  index,
int  error_ret 
)
private

Definition at line 2509 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_list_element_to_buffer ( ofstream &  out,
t_list tlist,
string  list,
string  index,
int  error_ret 
)
private

Definition at line 2521 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_string_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2079 of file t_c_generator.cc.

void t_c_generator::generate_serialize_struct ( ofstream &  out,
t_struct tstruct,
string  prefix,
int  error_ret 
)
private

Definition at line 2394 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_struct_to_buffer ( ofstream &  out,
t_struct tstruct,
string  prefix,
int  error_ret 
)
private

Definition at line 2404 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_serialize_u16_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1919 of file t_c_generator.cc.

void t_c_generator::generate_serialize_u32_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 1979 of file t_c_generator.cc.

void t_c_generator::generate_serialize_u64_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2038 of file t_c_generator.cc.

void t_c_generator::generate_serialize_uuid_t_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2183 of file t_c_generator.cc.

void t_c_generator::generate_serialize_xml_to_buffer ( ofstream &  out,
string  name,
int  error_ret 
)
private

Definition at line 2067 of file t_c_generator.cc.

void t_c_generator::generate_service ( t_service tservice)
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 509 of file t_c_generator.cc.

void t_c_generator::generate_service_client ( t_service tservice)
private

Generates C code that represents a Thrift service client.

Definition at line 879 of file t_c_generator.cc.

void t_c_generator::generate_service_server ( t_service tservice)
private

Generates C code that represents a Thrift service server.

Definition at line 886 of file t_c_generator.cc.

void t_c_generator::generate_struct ( t_struct tstruct)
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 429 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_struct_begin_reader_from_buffer ( ofstream &  out,
string  name,
bool  is_sandesh,
int  error_ret 
)
private

Definition at line 1185 of file t_c_generator.cc.

void t_c_generator::generate_struct_begin_writer_to_buffer ( ofstream &  out,
string  name,
bool  is_sandesh,
int  error_ret 
)
private

Definition at line 1168 of file t_c_generator.cc.

void t_c_generator::generate_struct_deleter ( ofstream &  out,
string  name,
const vector< t_field * > &  fields,
bool  is_sandesh,
bool  is_function = true 
)
private

Generates functions to free Thrift structures and sandeshs to a stream.

Definition at line 996 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_struct_end_reader_from_buffer ( ofstream &  out,
bool  is_sandesh 
)
private

Definition at line 1210 of file t_c_generator.cc.

void t_c_generator::generate_struct_end_writer_to_buffer ( ofstream &  out,
bool  is_sandesh 
)
private

Definition at line 1201 of file t_c_generator.cc.

void t_c_generator::generate_struct_reader ( ofstream &  out,
string  name,
const vector< t_field * > &  fields,
bool  is_sandesh,
bool  is_function = true 
)
private

Generates code to read Thrift structures from a stream.

Definition at line 1420 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_struct_reader_from_buffer ( ofstream &  out,
string  name,
const vector< t_field * > &  fields,
bool  is_sandesh,
bool  is_function = true 
)
private

Generates code to read Thrift structures from a buffer.

Definition at line 1618 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_struct_writer ( ofstream &  out,
string  name,
const vector< t_field * > &  fields,
bool  is_sandesh,
bool  is_function = true 
)
private

Generates functions to write Thrift structures and sandeshs to a stream.

Definition at line 1316 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_struct_writer_to_buffer ( ofstream &  out,
string  name,
const vector< t_field * > &  fields,
bool  is_sandesh,
bool  is_function = true 
)
private

Definition at line 1232 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_typedef ( t_typedef ttypedef)
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 324 of file t_c_generator.cc.

Here is the call graph for this function:

void t_c_generator::generate_write_buffer_binary ( ofstream &  out,
string  buf,
string  buf_len,
int  error_ret 
)
private

Definition at line 1154 of file t_c_generator.cc.

void t_c_generator::generate_write_buffer_chk_memcpy_incr_offset ( ofstream &  out,
string  source,
string  length,
int  error_ret,
bool  ref 
)
private

Definition at line 1136 of file t_c_generator.cc.

void t_c_generator::generate_write_buffer_memcpy ( ofstream &  out,
string  source,
string  length,
bool  ref 
)
private

Definition at line 1090 of file t_c_generator.cc.

void t_c_generator::generate_write_buffer_memcpy_incr_offset ( ofstream &  out,
string  source,
string  length,
bool  ref 
)
private

Definition at line 1120 of file t_c_generator.cc.

void t_c_generator::generate_xception ( t_struct tstruct)
virtual

Reimplemented from t_generator.

Definition at line 516 of file t_c_generator.cc.

void t_c_generator::init_generator ( )
virtual

Prepare for file generation by opening up the necessary file output streams.

Reimplemented from t_generator.

Definition at line 219 of file t_c_generator.cc.

Here is the call graph for this function:

bool t_c_generator::is_complex_type ( t_type ttype)
private

Returns true if ttype is not a primitive.

Definition at line 527 of file t_c_generator.cc.

Here is the call graph for this function:

string t_c_generator::type_name ( t_type ttype,
bool  in_typedef = false,
bool  is_const = false 
)
private

Maps a Thrift t_type to a C type.

Definition at line 544 of file t_c_generator.cc.

Here is the call graph for this function:

string t_c_generator::type_to_enum ( t_type type)
private

Returns a member of the ThriftType C enumeration in thrift_protocol.h for a Thrift type.

Definition at line 647 of file t_c_generator.cc.

Here is the call graph for this function:

Member Data Documentation

ofstream t_c_generator::f_header_
private

Definition at line 110 of file t_c_generator.cc.

ofstream t_c_generator::f_service_
private

Definition at line 111 of file t_c_generator.cc.

ofstream t_c_generator::f_types_
private

Definition at line 108 of file t_c_generator.cc.

ofstream t_c_generator::f_types_impl_
private

Definition at line 109 of file t_c_generator.cc.

string t_c_generator::nspace
private

Definition at line 114 of file t_c_generator.cc.

string t_c_generator::nspace_lc
private

Definition at line 117 of file t_c_generator.cc.

string t_c_generator::nspace_u
private

Definition at line 115 of file t_c_generator.cc.

string t_c_generator::nspace_uc
private

Definition at line 116 of file t_c_generator.cc.


The documentation for this class was generated from the following file: