1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
8 #ifndef _Common_CodeGenHelper_HH
9 #define _Common_CodeGenHelper_HH
11 #include "ttcn3/compiler.h"
15 #include "ttcn3/AST_ttcn3.hh"
27 SPLIT_NONE, ///< original code generation
28 SPLIT_BY_KIND, ///< place different kind of types in their own file
29 SPLIT_BY_NAME, ///< place all definitions/assignments in their own file
30 SPLIT_BY_HEURISTICS ///< heuristic function will decide the structure
34 struct generated_output_t {
37 ~generated_output_t();
41 string module_dispname;
45 bool has_circular_import;
48 static const char* const typetypemap[];
50 typedef map<string, generated_output_t> output_map_t;
52 output_map_t generated_code;
53 split_type split_mode;
55 struct module_names_t {
60 vector<module_names_t> modules;
61 string current_module;
63 static CodeGenHelper* instance;
68 static CodeGenHelper& GetInstance();
70 void set_split_mode(split_type st);
71 bool set_split_mode(const char* type);
72 split_type get_split_mode() const;
74 void add_module(const string& name, const string& dispname, bool is_ttcn,
75 bool has_circular_import);
76 output_struct* get_outputstruct(const string& name);
77 output_struct* get_outputstruct(Ttcn::Definition* def);
78 output_struct* get_outputstruct(Type* type);
79 output_struct* get_current_outputstruct();
80 void finalize_generation(Type* type);
82 void set_current_module(const string& name);
89 string get_key(Ttcn::Definition& def) const;
90 string get_key(Type& type) const;
91 static void transfer_value(char* &dst, char* &src);
96 #endif /* _Common_CodeGenHelper_HH */