eRPC Generator (erpcgen)  Rev. 1.9.0
NXP Semiconductors
ListType.h
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.h"
14 
15 #include <string>
16 
18 // Classes
20 
21 namespace erpcgen {
22 
26 class ListType : public DataType
27 {
28 public:
36  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 
62  virtual bool isList() const { return true; }
63 
78  virtual std::string getDescription() const;
79 
85  void setLengthVariableName(const std::string &lengthVariableName) { m_lengthVariableName = lengthVariableName; }
86 
92  std::string &getLengthVariableName() { return m_lengthVariableName; }
93 
100  bool hasLengthVariable() { return "" != m_lengthVariableName; }
101 
102 protected:
104  std::string m_lengthVariableName;
105 };
106 
107 } // namespace erpcgen
108 
109 #endif // _EMBEDDED_RPC__LISTTYPE_H_
bool hasLengthVariable()
This function returns information if object contains length variable.
Definition: ListType.h:100
virtual std::string getDescription() const
This function returns description about the list.
Definition: Type.cpp:269
Variable length list of another data type.
Definition: ListType.h:26
DataType * getElementType() const
This function returns element data type.
Definition: ListType.h:48
DataType * m_elementType
Definition: ListType.h:103
Base class for data types.
Definition: DataType.h:26
ListType(DataType *elementType)
Constructor.
Definition: ListType.h: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.h:85
virtual bool isList() const
This function return "true" value for identify list type.
Definition: ListType.h:62
void setElementType(DataType *elementType)
This function set element data type.
Definition: ListType.h:55
std::string m_lengthVariableName
Definition: ListType.h:104
std::string & getLengthVariableName()
This function returns variable name. This variable is used in generated file to store size of list...
Definition: ListType.h:92
Definition: AstNode.h:26