eRPC Generator (erpcgen)  Rev. 1.7.0
NXP Semiconductors
UniqueIdChecker.h
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2016, Freescale Semiconductor, Inc.
4  * Copyright 2016 NXP
5  * All rights reserved.
6  *
7  *
8  * Redistribution and use in source and binary forms, with or without modification,
9  * are permitted (subject to the limitations in the disclaimer below) provided
10  * that the following conditions are met:
11  *
12  * o Redistributions of source code must retain the above copyright notice, this list
13  * of conditions and the following disclaimer.
14  *
15  * o Redistributions in binary form must reproduce the above copyright notice, this
16  * list of conditions and the following disclaimer in the documentation and/or
17  * other materials provided with the distribution.
18  *
19  * o Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef _EMBEDDED_RPC__UNIQUEIDCHECKER_H_
37 #define _EMBEDDED_RPC__UNIQUEIDCHECKER_H_
38 #include <cstdio>
39 #include <set>
40 #include <string>
41 #include <utility>
42 #include <vector>
43 
44 #include "Interface.h"
45 #include "InterfaceDefinition.h"
46 #include "SymbolScope.h"
47 
49 // Classes
51 
52 namespace erpcgen {
53 
58 {
59 public:
60  typedef std::pair<int, std::string> idAndName_t;
68 
69 private:
75  void initUsedInterfaceIds(erpcgen::SymbolScope::symbol_vector_t ifaces);
76 
82  void initUsedFunctionIds(erpcgen::Interface *iface);
83 
90  void setFunctionId(Function *fn, Annotation *idAnnotation);
91 
98  void setInterfaceId(Interface *iface, Annotation *interfaceId);
99 
109  void checkDuplicateIds(std::vector<idAndName_t> ids, std::string idType);
110 
117  void printDuplicateIdWarning(std::set<idAndName_t> duplicateIds, std::string idType);
118 
119  std::vector<idAndName_t> m_usedFunctionIds;
120  std::vector<idAndName_t> m_usedInterfaceIds;
121 };
122 } // namespace erpcgen
123 
124 #endif // _EMBEDDED_RPC__UNIQUEIDCHECKER_H_
Collects all definitions from an IDL.
Definition: InterfaceDefinition.h:56
Annotation class.
Definition: Annotation.h:53
Function declaration.
Definition: Function.h:142
std::pair< int, std::string > idAndName_t
Definition: UniqueIdChecker.h:60
Add ids to interfaces and functions.
Definition: UniqueIdChecker.h:57
std::vector< Symbol * > symbol_vector_t
Definition: SymbolScope.h:57
void makeIdsUnique(erpcgen::InterfaceDefinition &def)
This function will set unique id numbers for functions and interfaces.
Definition: UniqueIdChecker.cpp:53
An interface that contains functions.
Definition: Interface.h:54
Definition: AstNode.h:51