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 TTCN3MODULEINVENTORY_HH_
9 #define TTCN3MODULEINVENTORY_HH_
20 * Type that contains generated TTCN-3 modules in a list
21 * and performs some modifications:
23 * - conversion of the names of modules
24 * - finding module name information for import statements
25 * - reference resolving among parsed types
26 * - name conversion on defined types
27 * - and starting generation of TTCN-3 modules
30 class TTCN3ModuleInventory {
32 * contains all defined TTCN-3 modules
34 List<TTCN3Module*> definedModules;
37 * Member to help avoiding to print import twice or more times
39 List<TTCN3Module*> writtenImports;
42 * Next three members are used by name conversion part
45 List<QualifiedName> typenames;
48 * Used to register errors during the processing phase
49 * After this it is possible to check it
50 * and if errors occur possible to stop converter
52 static unsigned int num_errors;
53 static unsigned int num_warnings;
55 TTCN3ModuleInventory(const TTCN3ModuleInventory &); // not implemented
56 TTCN3ModuleInventory & operator=(const TTCN3ModuleInventory &); // not implemented
57 TTCN3ModuleInventory(); // private due to singleton
58 ~TTCN3ModuleInventory(); // private due to singleton
61 static TTCN3ModuleInventory& getInstance(); // singleton access
64 * Generation of a new module for the given xsd file
66 TTCN3Module * addModule(const char * xsd_filename, XMLParser * a_parser);
69 * Steps after all xsd files are parsed
71 void modulenameConversion();
72 void referenceResolving();
73 void nameConversion();
74 void finalModification();
77 * TTCN-3 module generating method
78 * Generate TTCN-3 files
80 void moduleGeneration();
82 List<TTCN3Module*> & getModules() {
83 return definedModules;
86 List<TTCN3Module*> & getWrittenImports() {
87 return writtenImports;
90 List<QualifiedName> & getTypenames() {
96 * Look for a simpleType (or element or attribute) or a complexType (or attributeGroup or group)
98 RootType * lookup(const RootType * ref, const Mstring& reference, wanted w) const;
99 RootType * lookup(const SimpleType * reference, wanted w) const;
100 RootType * lookup(const ComplexType * reference, wanted w) const;
101 RootType * lookup(const Mstring& name, const Mstring& nsuri,
102 const RootType *reference, wanted w) const;
104 static unsigned int getNumErrors() {
108 static unsigned int getNumWarnings() {
112 static void incrNumErrors() {
116 static void incrNumWarnings() {
123 #endif /* TTCN3MODULEINVENTORY_HH_ */