eRPC Generator (erpcgen)  Rev. 1.11.0
NXP Semiconductors
ListType.hpp
1 /*
2  * Copyright (c) 2014, Freescale Semiconductor, Inc.
3  * Copyright 2016 NXP
4  * All rights reserved.
5  *
6  *
7  * SPDX-License-Identifier: BSD-3-Clause
8  */
9 
10 #ifndef _EMBEDDED_RPC__LISTTYPE_H_
11 #define _EMBEDDED_RPC__LISTTYPE_H_
12 
13 #include "DataType.hpp"
14 
15 #include <string>
16 
18 // Classes
20 
21 namespace erpcgen {
22 
26 class ListType : public DataType
27 {
28 public:
36  explicit ListType(DataType *elementType)
37  : DataType("(list)", kListType)
38  , m_elementType(elementType)
40  {
41  }
42 
48  DataType *getElementType() const { return m_elementType; }
49 
55  void setElementType(DataType *elementType) { m_elementType = elementType; }
56 
71  virtual std::string getDescription() const override;
72 
78  void setLengthVariableName(const std::string &lengthVariableName) { m_lengthVariableName = lengthVariableName; }
79 
85  std::string &getLengthVariableName() { return m_lengthVariableName; }
86 
93  bool hasLengthVariable() { return "" != m_lengthVariableName; }
94 
95 protected:
97  std::string m_lengthVariableName;
98 };
99 
100 } // namespace erpcgen
101 
102 #endif // _EMBEDDED_RPC__LISTTYPE_H_
bool hasLengthVariable()
This function returns information if object contains length variable.
Definition: ListType.hpp:93
Variable length list of another data type.
Definition: ListType.hpp:26
DataType * getElementType() const
This function returns element data type.
Definition: ListType.hpp:48
virtual std::string getDescription() const override
This function returns description about the list.
Definition: Type.cpp:270
DataType * m_elementType
Definition: ListType.hpp:96
Base class for data types.
Definition: DataType.hpp:26
ListType(DataType *elementType)
Constructor.
Definition: ListType.hpp:36
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.hpp:78
void setElementType(DataType *elementType)
This function set element data type.
Definition: ListType.hpp:55
std::string m_lengthVariableName
Definition: ListType.hpp:97
std::string & getLengthVariableName()
This function returns variable name. This variable is used in generated file to store size of list...
Definition: ListType.hpp:85
Definition: AstNode.hpp:26