eRPC Generator (erpcgen)  Rev. 1.7.0
NXP Semiconductors
ListType.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__LISTTYPE_H_
37 #define _EMBEDDED_RPC__LISTTYPE_H_
38 
39 #include "DataType.h"
40 #include <string>
41 
43 // Classes
45 
46 namespace erpcgen {
47 
51 class ListType : public DataType
52 {
53 public:
61  ListType(DataType *elementType)
62  : DataType("(list)", kListType)
63  , m_elementType(elementType)
65  {
66  }
67 
73  DataType *getElementType() const { return m_elementType; }
74 
80  void setElementType(DataType *elementType) { m_elementType = elementType; }
81 
87  virtual bool isList() const { return true; }
88 
103  virtual std::string getDescription() const;
104 
110  void setLengthVariableName(const std::string &lengthVariableName) { m_lengthVariableName = lengthVariableName; }
111 
117  std::string &getLengthVariableName() { return m_lengthVariableName; }
118 
125  bool hasLengthVariable() { return "" != m_lengthVariableName; }
126 
127 protected:
129  std::string m_lengthVariableName;
130 };
131 
132 } // namespace erpcgen
133 
134 #endif // _EMBEDDED_RPC__LISTTYPE_H_
bool hasLengthVariable()
This function returns information if object contains length variable.
Definition: ListType.h:125
virtual std::string getDescription() const
This function returns description about the list.
Definition: Type.cpp:294
Variable length list of another data type.
Definition: ListType.h:51
DataType * getElementType() const
This function returns element data type.
Definition: ListType.h:73
DataType * m_elementType
Definition: ListType.h:128
Base class for data types.
Definition: DataType.h:51
ListType(DataType *elementType)
Constructor.
Definition: ListType.h:61
void setLengthVariableName(const std::string &lengthVariableName)
This function set variable name. This variable is used in generated file to store size of list...
Definition: ListType.h:110
virtual bool isList() const
This function return "true" value for identify list type.
Definition: ListType.h:87
void setElementType(DataType *elementType)
This function set element data type.
Definition: ListType.h:80
std::string m_lengthVariableName
Definition: ListType.h:129
std::string & getLengthVariableName()
This function returns variable name. This variable is used in generated file to store size of list...
Definition: ListType.h:117
Definition: AstNode.h:51