eRPC Generator (erpcgen)  Rev. 1.7.0
NXP Semiconductors
StructType.h
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2014, 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__STRUCTTYPE_H_
37 #define _EMBEDDED_RPC__STRUCTTYPE_H_
38 
39 #include "DataType.h"
40 #include "StructMember.h"
41 #include "SymbolScope.h"
42 #include <string>
43 #include <vector>
44 
46 // Classes
48 
49 namespace erpcgen {
50 
54 class StructType : public DataType
55 {
56 public:
57  typedef std::vector<StructMember *> member_vector_t;
66  StructType(const std::string &name)
67  : DataType(name, kStructType, kStructTypeSymbol)
68  {
69  }
70 
78  StructType(const Token &tok)
79  : DataType(tok, kStructType, kStructTypeSymbol)
80  {
81  }
82 
91  void addMember(StructMember *newMember);
92 
98  SymbolScope &getScope() { return m_scope; }
99 
105  member_vector_t &getMembers() { return m_members; }
106 
112  virtual bool isStruct() const { return true; }
113 
128  virtual std::string getDescription() const;
129 
135  bool containListMember();
136 
142  bool containStringMember();
143 
149  bool containByrefMember();
150 
151 protected:
153  member_vector_t m_members;
154 };
155 
156 } // namespace erpcgen
157 
158 #endif // _EMBEDDED_RPC__STRUCTTYPE_H_
Member of a struct.
Definition: StructMember.h:63
void addMember(StructMember *newMember)
This function will add struct member to the struct.
Definition: Type.cpp:341
StructType(const std::string &name)
Constructor.
Definition: StructType.h:66
virtual std::string getDescription() const
This function returns description about the struct.
Definition: Type.cpp:349
Structure data type.
Definition: StructType.h:54
StructType(const Token &tok)
Constructor.
Definition: StructType.h:78
bool containByrefMember()
This function return true, when has member, which contains flag byref.
Definition: Type.cpp:329
SymbolScope & getScope()
This function returns symbol scope.
Definition: StructType.h:98
virtual bool isStruct() const
This function return "true" value for identify struct type.
Definition: StructType.h:112
A scoped namespace containing symbols.
Definition: SymbolScope.h:53
Base class for data types.
Definition: DataType.h:51
Encapsulates all information about a token.
Definition: Token.h:86
member_vector_t m_members
Definition: StructType.h:153
std::vector< StructMember * > member_vector_t
Definition: StructType.h:57
SymbolScope m_scope
Definition: StructType.h:152
bool containStringMember()
This function return true, when has member, which contains string type.
Definition: Type.cpp:317
bool containListMember()
This function return true, when has member, which contains list type.
Definition: Type.cpp:305
member_vector_t & getMembers()
This function returns struct members vector.
Definition: StructType.h:105
Definition: AstNode.h:51