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

Classes

struct  doc_ftype
 
struct  sandesh_level
 

Public Member Functions

 t_doc_generator (t_program *program, const map< string, string > &parsed_options, const string &option_string)
 
sandesh_level::type string_to_sandesh_level (const string &level)
 
string sandesh_level_to_string (const sandesh_level::type &slevel)
 
sandesh_level::type get_sandesh_level (t_sandesh *tsandesh)
 
string get_object_type (t_sandesh *tsandesh)
 
string get_doc_member (t_sandesh *tsandesh, string member)
 
bool is_sandesh_type (t_sandesh *tsandesh, doc_ftype::type dtype)
 
string get_doc_file_suffix (doc_ftype::type dtype)
 
string get_doc_file_description (doc_ftype::type dtype)
 
void generate_index ()
 
void generate_stats_schema_program ()
 
bool generate_sandesh_program (doc_ftype::type dtype)
 
void generate_const_enum_typedef_object_program ()
 
void generate_doc_type (ofstream &f_out)
 
void generate_program ()
 
void generate_program_toc (ofstream &f_out, string fsuffix, doc_ftype::type dtype)
 
void generate_program_toc_row (t_program *tprog, ofstream &f_out, string fsuffix, doc_ftype::type dtype)
 
bool generate_sandesh_program_doc (t_program *tprog, ofstream &f_out, string fsuffix, doc_ftype::type dtype)
 
void generate_sandesh_program_doc_schema (t_program *tprog, ofstream &f_out, string fsuffix, doc_ftype::type dtype)
 
void generate_sandesh_program_doc_schema_uve (t_program *tprog, ofstream &f_out, string fsuffix)
 
template<typename T >
void generate_stat_table_schema (string, t_field *, T *, string, vector< string > &)
 
template<typename T >
void generate_stat_schema_map (string, t_type *, t_type *, t_field *, T *, bool, bool, vector< string > &)
 
template<typename T >
void generate_stat_schema_list (string, t_type *, t_field *, T *, bool, bool, vector< string > &)
 
t_structfind_struct_with_name (string sname)
 
template<typename T >
void generate_stat_schema_struct (string, t_field *, t_struct *, T *, bool, vector< string > &)
 
template<typename T >
void extract_tags (T *, map< string, vector< string > > &, vector< string > &, vector< string > &)
 
string generate_stat_schema_struct_base_member (string, t_field *, string, t_field *)
 
void generate_stat_table_schema_header (string, string, string, string)
 
string get_datatype_from_tfield (t_type *tfield)
 
string generate_table_entry (string name, string datatype, string index, string)
 
template<typename T >
string get_type_of_member (string, t_field *, t_struct *, T *)
 
string get_uve_type (string, t_field *)
 
template<typename T >
void populate_stat_schema_map_key_value (t_field *tfield, t_type *, t_type *, T *)
 
void generate_stat_schema_struct_members (string name, t_field *, t_struct *, vector< string >, map< string, vector< string > >, vector< string > &)
 
void is_indexed_or_suffixed_field (string, vector< string >, map< string, vector< string > >, string &, bool &, bool &)
 
template<typename T >
void generate_stat_schema_suffixes (string, t_field *, t_struct *, T *, map< string, vector< string > > &, vector< string > &)
 
template<typename T >
void generate_stat_schema_toplevel_tags (T *, vector< string > &, vector< string > &, t_field *)
 
void generate_stat_tables_schema (t_sandesh *)
 
template<typename T >
void generate_stat_tables_schema (T *, const vector< t_field * >, string, string, vector< string > &)
 
string get_display_name_from_comments (t_field *)
 
template<typename T >
void find_recursive_tags (T *, t_field *, string, string, vector< string > &)
 
template<typename T >
void find_recursive_tags_struct (T *, t_field *, string, string, string, vector< string > &)
 
template<typename T >
void find_recursive_tags_list (T *, t_field *, string, t_type *, string, vector< string > &)
 
template<typename T >
void find_recursive_tags_map (T *, t_field *, string, t_type *, t_type *, string, vector< string > &)
 
string find_obj_table_name (const vector< t_field * >)
 
void generate_typedef (t_typedef *ttypedef)
 
void generate_enum (t_enum *tenum)
 
void generate_const (t_const *tconst)
 
void generate_struct (t_struct *tstruct)
 
void generate_service (t_service *tservice)
 
void generate_sandesh (t_sandesh *tsandesh)
 
bool generate_introspect_cli (t_sandesh *, ofstream &f_out, bool &first_file)
 
void print_doc (t_doc *tdoc, ofstream &f_out)
 
int print_type (t_type *ttype, ofstream &f_out)
 
void print_const_value (t_const_value *tvalue, ofstream &f_out)
 
void print_sandesh (t_sandesh *tdoc, ofstream &f_out)
 
void print_sandesh_message (t_sandesh *tdoc, ofstream &f_out)
 
void print_sandesh_message_table (t_sandesh *tdoc, ofstream &f_out)
 
void print_doc_string (string doc, ofstream &f_out)
 
- Public Member Functions inherited from t_generator
 t_generator (t_program *program)
 
virtual ~t_generator ()
 
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)
 

Public Attributes

ofstream f_index_out_
 
bool f_log_initialized_
 
bool f_log_invalid_initialized_
 
bool f_log_debug_initialized_
 
bool f_log_info_initialized_
 
bool f_log_notice_initialized_
 
bool f_log_warn_initialized_
 
bool f_log_error_initialized_
 
bool f_log_crit_initialized_
 
bool f_log_alert_initialized_
 
bool f_log_emerg_initialized_
 
bool f_uve_initialized_
 
bool f_trace_initialized_
 
bool f_introspect_initialized_
 
ofstream f_out_
 
ofstream f_stats_tables_
 

Private Member Functions

void generate_typedef (t_typedef *ttypedef, ofstream &f_out)
 
void generate_enum (t_enum *tenum, ofstream &f_out)
 
void generate_const (t_const *tconst, ofstream &f_out)
 
void generate_consts (vector< t_const * > consts, ofstream &f_out)
 
void generate_struct (t_struct *tstruct, ofstream &f_out)
 
void generate_struct_table (t_struct *tstruct, ofstream &f_out)
 
void generate_sandesh (t_sandesh *tsandesh, ofstream &f_out)
 
void generate_sandesh_uve (t_sandesh *tsandesh, ofstream &f_out)
 

Private Attributes

bool stat_table_created_
 
bool first_member_
 

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 init_generator ()
 
virtual void close_generator ()
 
virtual void generate_consts (std::vector< t_const * > consts)
 
virtual void generate_xception (t_struct *txception)
 
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

DOC generator

Definition at line 44 of file t_doc_generator.cc.

Constructor & Destructor Documentation

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

Definition at line 46 of file t_doc_generator.cc.

Member Function Documentation

template<typename T >
void t_doc_generator::extract_tags ( T *  tfield,
map< string, vector< string > > &  suffixes,
vector< string > &  top_level_tags,
vector< string > &  member_tags 
)

Definition at line 1461 of file t_doc_generator.cc.

string t_doc_generator::find_obj_table_name ( const vector< t_field * >  members)

Definition at line 1603 of file t_doc_generator.cc.

template<typename T >
void t_doc_generator::find_recursive_tags ( T *  tsandesh,
t_field tfield,
string  table,
string  fname,
vector< string > &  index_schemas 
)

Definition at line 1644 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::find_recursive_tags_list ( T *  tsandesh,
t_field tfield,
string  table,
t_type ttype,
string  prefix,
vector< string > &  schemas 
)

Definition at line 1627 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::find_recursive_tags_map ( T *  tsandesh,
t_field tfield,
string  table,
t_type keytype,
t_type valtype,
string  prefix,
vector< string > &  schemas 
)

Definition at line 1619 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::find_recursive_tags_struct ( T *  tsandesh,
t_field tfield,
string  table,
string  sname,
string  prefix,
vector< string > &  schemas 
)

Definition at line 1635 of file t_doc_generator.cc.

Here is the call graph for this function:

t_struct * t_doc_generator::find_struct_with_name ( string  sname)

Definition at line 1568 of file t_doc_generator.cc.

void t_doc_generator::generate_const ( t_const tconst)
inlinevirtual

Reimplemented from t_generator.

Definition at line 166 of file t_doc_generator.cc.

void t_doc_generator::generate_const ( t_const tconst,
ofstream &  f_out 
)
private

Generates a constant value

Definition at line 1099 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_const_enum_typedef_object_program ( )

Definition at line 576 of file t_doc_generator.cc.

void t_doc_generator::generate_consts ( vector< t_const * >  consts,
ofstream &  f_out 
)
private

Definition at line 1114 of file t_doc_generator.cc.

void t_doc_generator::generate_doc_type ( ofstream &  f_out)

Definition at line 402 of file t_doc_generator.cc.

void t_doc_generator::generate_enum ( t_enum tenum)
inlinevirtual

Implements t_generator.

Definition at line 165 of file t_doc_generator.cc.

void t_doc_generator::generate_enum ( t_enum tenum,
ofstream &  f_out 
)
private

Generates code for an enumerated type.

Parameters
tenumThe enumeration

Definition at line 1077 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_index ( )

Emits the index.html file for the recursive set of Thrift programs

Definition at line 635 of file t_doc_generator.cc.

bool t_doc_generator::generate_introspect_cli ( t_sandesh tsandesh,
ofstream &  f_out,
bool &  first_file 
)

Definition at line 1780 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_program ( )
virtual

Prepares for file generation by opening up the necessary file output stream.

Reimplemented from t_generator.

Definition at line 701 of file t_doc_generator.cc.

void t_doc_generator::generate_program_toc ( ofstream &  f_out,
string  fsuffix,
doc_ftype::type  dtype 
)

Emits the Table of Contents links at the top of the module's page

Definition at line 364 of file t_doc_generator.cc.

void t_doc_generator::generate_program_toc_row ( t_program tprog,
ofstream &  f_out,
string  fsuffix,
doc_ftype::type  dtype 
)

Emits the Table of Contents links at the top of the module's page

Definition at line 374 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_sandesh ( t_sandesh tsandesh)
inline

Definition at line 169 of file t_doc_generator.cc.

void t_doc_generator::generate_sandesh ( t_sandesh tsandesh,
ofstream &  f_out 
)
private

Generates the HTML block for a sandesh.

Parameters
tsandeshThe sandesh definition

Definition at line 1854 of file t_doc_generator.cc.

Here is the call graph for this function:

bool t_doc_generator::generate_sandesh_program ( doc_ftype::type  dtype)

Definition at line 559 of file t_doc_generator.cc.

Here is the call graph for this function:

bool t_doc_generator::generate_sandesh_program_doc ( t_program tprog,
ofstream &  f_out,
string  fsuffix,
doc_ftype::type  dtype 
)

Definition at line 520 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_sandesh_program_doc_schema ( t_program tprog,
ofstream &  f_out,
string  fsuffix,
doc_ftype::type  dtype 
)

Definition at line 429 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_sandesh_program_doc_schema_uve ( t_program tprog,
ofstream &  f_out,
string  fsuffix 
)

Definition at line 475 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_sandesh_uve ( t_sandesh tsandesh,
ofstream &  f_out 
)
private

Generates the HTML block for a sandesh.

Parameters
tsandeshThe sandesh definition

Definition at line 1884 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_service ( t_service tservice)
inlinevirtual

Implements t_generator.

Definition at line 168 of file t_doc_generator.cc.

template<typename T >
void t_doc_generator::generate_stat_schema_list ( string  name,
t_type ttype,
t_field tfield,
T *  tstruct,
bool  is_top_level,
bool  is_index,
vector< string > &  schemas 
)

Definition at line 1516 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::generate_stat_schema_map ( string  prefix,
t_type keytype,
t_type valtype,
t_field tfield,
T *  tstruct,
bool  is_top_level,
bool  is_index,
vector< string > &  schemas 
)

Definition at line 1365 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::generate_stat_schema_struct ( string  prefix,
t_field tfield,
t_struct cstruct,
T *  tstruct,
bool  is_top_level,
vector< string > &  schemas 
)

Definition at line 1494 of file t_doc_generator.cc.

string t_doc_generator::generate_stat_schema_struct_base_member ( string  prefix,
t_field tfield,
string  index,
t_field top_field 
)

Definition at line 1446 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_stat_schema_struct_members ( string  name,
t_field tfield,
t_struct tstruct,
vector< string >  tags,
map< string, vector< string > >  suffixes,
vector< string > &  schemas 
)

Definition at line 1291 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::generate_stat_schema_suffixes ( string  prefix,
t_field tfield,
t_struct cstruct,
T *  tstruct,
map< string, vector< string > > &  suffixes,
vector< string > &  schemas 
)

Definition at line 1208 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::generate_stat_schema_toplevel_tags ( T *  tstruct,
vector< string > &  top_level_tags,
vector< string > &  schema,
t_field tfield 
)

Definition at line 1189 of file t_doc_generator.cc.

template<typename T >
void t_doc_generator::generate_stat_table_schema ( string  oname,
t_field tfield,
T *  tsandesh,
string  prefix,
vector< string > &  tags 
)

Program-level generation functions

Definition at line 1586 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_stat_table_schema_header ( string  type,
string  attr,
string  table_name,
string  display_name 
)

Definition at line 1121 of file t_doc_generator.cc.

void t_doc_generator::generate_stat_tables_schema ( t_sandesh tsandesh)

Definition at line 1712 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::generate_stat_tables_schema ( T *  tsandesh,
const vector< t_field * >  members,
string  table,
string  prefix,
vector< string > &  tags 
)

Definition at line 1685 of file t_doc_generator.cc.

void t_doc_generator::generate_stats_schema_program ( )

Definition at line 412 of file t_doc_generator.cc.

void t_doc_generator::generate_struct ( t_struct tstruct)
inlinevirtual

Implements t_generator.

Definition at line 167 of file t_doc_generator.cc.

void t_doc_generator::generate_struct ( t_struct tstruct,
ofstream &  f_out 
)
private

Generates a struct definition for a thrift data type.

Parameters
tstructThe struct definition

Definition at line 1769 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::generate_struct_table ( t_struct tstruct,
ofstream &  f_out 
)
private

Generates a struct definition for a thrift data type.

Parameters
tstructThe struct definition

Definition at line 1733 of file t_doc_generator.cc.

Here is the call graph for this function:

string t_doc_generator::generate_table_entry ( string  name,
string  datatype,
string  index,
string  uve_type 
)

Definition at line 1343 of file t_doc_generator.cc.

void t_doc_generator::generate_typedef ( t_typedef ttypedef)
inlinevirtual

Pure virtual methods implemented by the generator subclasses.

Implements t_generator.

Definition at line 164 of file t_doc_generator.cc.

void t_doc_generator::generate_typedef ( t_typedef ttypedef,
ofstream &  f_out 
)
private

Generates a typedef.

Parameters
ttypedefThe type definition

Definition at line 1060 of file t_doc_generator.cc.

Here is the call graph for this function:

string t_doc_generator::get_datatype_from_tfield ( t_type tfield)

Definition at line 1336 of file t_doc_generator.cc.

Here is the call graph for this function:

string t_doc_generator::get_display_name_from_comments ( t_field tfield)

Definition at line 1660 of file t_doc_generator.cc.

Here is the call graph for this function:

string t_doc_generator::get_doc_file_description ( doc_ftype::type  dtype)

Definition at line 328 of file t_doc_generator.cc.

string t_doc_generator::get_doc_file_suffix ( doc_ftype::type  dtype)

Definition at line 295 of file t_doc_generator.cc.

string t_doc_generator::get_doc_member ( t_sandesh tsandesh,
string  member 
)

Definition at line 850 of file t_doc_generator.cc.

Here is the call graph for this function:

string t_doc_generator::get_object_type ( t_sandesh tsandesh)

Definition at line 882 of file t_doc_generator.cc.

t_doc_generator::sandesh_level::type t_doc_generator::get_sandesh_level ( t_sandesh tsandesh)

Definition at line 891 of file t_doc_generator.cc.

template<typename T >
string t_doc_generator::get_type_of_member ( string  name,
t_field tfield,
t_struct cstruct,
T *  tstruct 
)

Definition at line 1159 of file t_doc_generator.cc.

Here is the call graph for this function:

string t_doc_generator::get_uve_type ( string  name,
t_field tfield 
)

Definition at line 1135 of file t_doc_generator.cc.

void t_doc_generator::is_indexed_or_suffixed_field ( string  fname,
vector< string >  tags,
map< string, vector< string > >  suffixes,
string &  index,
bool &  is_suffixed_field,
bool &  is_tag 
)

Definition at line 1258 of file t_doc_generator.cc.

bool t_doc_generator::is_sandesh_type ( t_sandesh tsandesh,
doc_ftype::type  dtype 
)

Definition at line 211 of file t_doc_generator.cc.

Here is the call graph for this function:

template<typename T >
void t_doc_generator::populate_stat_schema_map_key_value ( t_field tfield,
t_type ,
t_type ,
T *   
)
void t_doc_generator::print_const_value ( t_const_value tvalue,
ofstream &  f_out 
)

Prints out an HTML representation of the provided constant value

Definition at line 1005 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::print_doc ( t_doc tdoc,
ofstream &  f_out 
)

If the provided documentable object has documentation attached, this will emit it to the output stream in HTML format.

Definition at line 743 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::print_doc_string ( string  doc,
ofstream &  f_out 
)

Definition at line 722 of file t_doc_generator.cc.

void t_doc_generator::print_sandesh ( t_sandesh tsandesh,
ofstream &  f_out 
)

If the provided documentable sandesh has documentation attached, this will emit it to the output stream in HTML format and print the in a table format.

Definition at line 904 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::print_sandesh_message ( t_sandesh tdoc,
ofstream &  f_out 
)

Definition at line 750 of file t_doc_generator.cc.

Here is the call graph for this function:

void t_doc_generator::print_sandesh_message_table ( t_sandesh tdoc,
ofstream &  f_out 
)

Definition at line 782 of file t_doc_generator.cc.

int t_doc_generator::print_type ( t_type ttype,
ofstream &  f_out 
)

Prints out the provided type in HTML

Definition at line 955 of file t_doc_generator.cc.

Here is the call graph for this function:

string t_doc_generator::sandesh_level_to_string ( const sandesh_level::type slevel)

Definition at line 824 of file t_doc_generator.cc.

t_doc_generator::sandesh_level::type t_doc_generator::string_to_sandesh_level ( const string &  level)

Definition at line 788 of file t_doc_generator.cc.

Member Data Documentation

ofstream t_doc_generator::f_index_out_

Definition at line 180 of file t_doc_generator.cc.

bool t_doc_generator::f_introspect_initialized_

Definition at line 193 of file t_doc_generator.cc.

bool t_doc_generator::f_log_alert_initialized_

Definition at line 189 of file t_doc_generator.cc.

bool t_doc_generator::f_log_crit_initialized_

Definition at line 188 of file t_doc_generator.cc.

bool t_doc_generator::f_log_debug_initialized_

Definition at line 183 of file t_doc_generator.cc.

bool t_doc_generator::f_log_emerg_initialized_

Definition at line 190 of file t_doc_generator.cc.

bool t_doc_generator::f_log_error_initialized_

Definition at line 187 of file t_doc_generator.cc.

bool t_doc_generator::f_log_info_initialized_

Definition at line 184 of file t_doc_generator.cc.

bool t_doc_generator::f_log_initialized_

Definition at line 181 of file t_doc_generator.cc.

bool t_doc_generator::f_log_invalid_initialized_

Definition at line 182 of file t_doc_generator.cc.

bool t_doc_generator::f_log_notice_initialized_

Definition at line 185 of file t_doc_generator.cc.

bool t_doc_generator::f_log_warn_initialized_

Definition at line 186 of file t_doc_generator.cc.

ofstream t_doc_generator::f_out_

Definition at line 194 of file t_doc_generator.cc.

ofstream t_doc_generator::f_stats_tables_

Definition at line 195 of file t_doc_generator.cc.

bool t_doc_generator::f_trace_initialized_

Definition at line 192 of file t_doc_generator.cc.

bool t_doc_generator::f_uve_initialized_

Definition at line 191 of file t_doc_generator.cc.

bool t_doc_generator::first_member_
private

Definition at line 208 of file t_doc_generator.cc.

bool t_doc_generator::stat_table_created_
private

Definition at line 207 of file t_doc_generator.cc.


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