1 /******************************************************************************
2 * Copyright (c) 2000-2016 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
11 * Zalanyi, Balazs Andor
13 ******************************************************************************/
14 #ifndef _Common_CodeGenHelper_HH
15 #define _Common_CodeGenHelper_HH
17 #include "ttcn3/compiler.h"
21 #include "ttcn3/AST_ttcn3.hh"
33 SPLIT_NONE, ///< original code generation
34 SPLIT_BY_KIND, ///< place different kind of types in their own file
35 SPLIT_BY_NAME, ///< place all definitions/assignments in their own file
36 SPLIT_BY_HEURISTICS ///< heuristic function will decide the structure
40 struct generated_output_t {
43 ~generated_output_t();
47 string module_dispname;
51 bool has_circular_import;
54 static const char* const typetypemap[];
56 typedef map<string, generated_output_t> output_map_t;
58 output_map_t generated_code;
59 split_type split_mode;
61 struct module_names_t {
66 vector<module_names_t> modules;
67 string current_module;
69 static CodeGenHelper* instance;
74 static CodeGenHelper& GetInstance();
76 void set_split_mode(split_type st);
77 bool set_split_mode(const char* type);
78 split_type get_split_mode() const;
80 void add_module(const string& name, const string& dispname, bool is_ttcn,
81 bool has_circular_import);
82 output_struct* get_outputstruct(const string& name);
83 output_struct* get_outputstruct(Ttcn::Definition* def);
84 output_struct* get_outputstruct(Type* type);
85 output_struct* get_current_outputstruct();
86 void finalize_generation(Type* type);
88 void set_current_module(const string& name);
95 string get_key(Ttcn::Definition& def) const;
96 string get_key(Type& type) const;
97 static void transfer_value(char* &dst, char* &src);
102 #endif /* _Common_CodeGenHelper_HH */