eRPC Generator (erpcgen)  Rev. 1.7.0
NXP Semiconductors
StructMember.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__STRUCTMEMBER_H_
37 #define _EMBEDDED_RPC__STRUCTMEMBER_H_
38 
39 #include "DataType.h"
40 #include "Symbol.h"
41 #include <string>
42 
44 // Classes
46 
47 namespace erpcgen {
48 
52 enum _param_direction
53 {
54  kInDirection,
55  kOutDirection,
56  kInoutDirection,
57  kReturn
58 };
59 
63 class StructMember : public Symbol
64 {
65 public:
74  StructMember(const std::string &name, DataType *dataType)
75  : Symbol(kStructMemberSymbol, name)
76  , m_dataType(dataType)
78  , m_containList()
79  , m_containString()
80  , m_byref(false)
81  {
82  }
83 
92  StructMember(const Token &tok, DataType *dataType)
93  : Symbol(kStructMemberSymbol, tok)
94  , m_dataType(dataType)
96  , m_containList()
97  , m_containString()
98  , m_byref(false)
99  {
100  }
101 
108 
114  void setDataType(DataType *dataType) { m_dataType = dataType; }
115 
130  virtual std::string getDescription() const;
131 
139  void setDirection(_param_direction paramDirection) { m_paramDirection = paramDirection; }
140 
148  _param_direction getDirection() const { return m_paramDirection; }
149 
155  void setContainList(bool containList) { m_containList = containList; }
156 
162  bool getContainList() { return m_containList; }
163 
169  void setContainString(bool containString) { m_containString = containString; }
170 
177 
183  bool isByref() { return m_byref; }
184 
190  void setByref(bool byref) { m_byref = byref; }
191 
192 protected:
194  _param_direction m_paramDirection;
197  bool m_byref;
198 };
199 
200 } // namespace erpcgen
201 
202 #endif // _EMBEDDED_RPC__STRUCTMEMBER_H_
Member of a struct.
Definition: StructMember.h:63
_param_direction m_paramDirection
Definition: StructMember.h:194
StructMember(const std::string &name, DataType *dataType)
Constructor.
Definition: StructMember.h:74
bool m_containList
Definition: StructMember.h:195
StructMember(const Token &tok, DataType *dataType)
Constructor.
Definition: StructMember.h:92
Base class for all named declarations in the IDL.
Definition: Symbol.h:53
void setDataType(DataType *dataType)
This function will set element data type.
Definition: StructMember.h:114
DataType * getDataType()
This function returns pointer to element data type.
Definition: StructMember.h:107
bool m_byref
Definition: StructMember.h:197
bool isByref()
This function returns information if parameter is byref.
Definition: StructMember.h:183
bool m_containString
Definition: StructMember.h:196
void setContainString(bool containString)
This function set information about if member contains string data type.
Definition: StructMember.h:169
void setDirection(_param_direction paramDirection)
This function set direction type for parameter.
Definition: StructMember.h:139
Base class for data types.
Definition: DataType.h:51
Encapsulates all information about a token.
Definition: Token.h:86
void setByref(bool byref)
This function sets byref flag to the paramter.
Definition: StructMember.h:190
virtual std::string getDescription() const
This function returns description about the struct member.
Definition: Type.cpp:366
DataType * m_dataType
Definition: StructMember.h:193
bool getContainList()
This function set information about if member contains list data type.
Definition: StructMember.h:162
bool getContainString()
This function set information about if member contains string data type.
Definition: StructMember.h:176
_param_direction getDirection() const
This function returns routing for parameter.
Definition: StructMember.h:148
void setContainList(bool containList)
This function set information about if member contains list data type.
Definition: StructMember.h:155
Definition: AstNode.h:51