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
14 ******************************************************************************/
15 #ifndef TTCN3MODULEINVENTORY_HH_
16 #define TTCN3MODULEINVENTORY_HH_
27 * Type that contains generated TTCN-3 modules in a list
28 * and performs some modifications:
30 * - conversion of the names of modules
31 * - finding module name information for import statements
32 * - reference resolving among parsed types
33 * - name conversion on defined types
34 * - and starting generation of TTCN-3 modules
37 class TTCN3ModuleInventory {
39 * contains all defined TTCN-3 modules
41 List<TTCN3Module*> definedModules;
44 * Member to help avoiding to print import twice or more times
46 List<TTCN3Module*> writtenImports;
49 * Next three members are used by name conversion part
52 List<QualifiedName> typenames;
55 * Used to register errors during the processing phase
56 * After this it is possible to check it
57 * and if errors occur possible to stop converter
59 static unsigned int num_errors;
60 static unsigned int num_warnings;
62 TTCN3ModuleInventory(const TTCN3ModuleInventory &); // not implemented
63 TTCN3ModuleInventory & operator=(const TTCN3ModuleInventory &); // not implemented
64 TTCN3ModuleInventory(); // private due to singleton
65 ~TTCN3ModuleInventory(); // private due to singleton
68 static TTCN3ModuleInventory& getInstance(); // singleton access
71 * Generation of a new module for the given xsd file
73 TTCN3Module * addModule(const char * xsd_filename, XMLParser * a_parser);
76 * Steps after all xsd files are parsed
78 void modulenameConversion();
79 void referenceResolving();
80 void nameConversion();
81 void finalModification();
84 * TTCN-3 module generating method
85 * Generate TTCN-3 files
87 void moduleGeneration();
89 List<TTCN3Module*> & getModules() {
90 return definedModules;
93 List<TTCN3Module*> & getWrittenImports() {
94 return writtenImports;
97 List<QualifiedName> & getTypenames() {
103 * Look for a simpleType (or element or attribute) or a complexType (or attributeGroup or group)
105 RootType * lookup(const RootType * ref, const Mstring& reference, wanted w) const;
106 RootType * lookup(const SimpleType * reference, wanted w) const;
107 RootType * lookup(const ComplexType * reference, wanted w) const;
108 RootType * lookup(const Mstring& name, const Mstring& nsuri,
109 const RootType *reference, wanted w) const;
111 static unsigned int getNumErrors() {
115 static unsigned int getNumWarnings() {
119 static void incrNumErrors() {
123 static void incrNumWarnings() {
130 #endif /* TTCN3MODULEINVENTORY_HH_ */