eRPC Generator (erpcgen)  Rev. 1.7.2
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 #include <string>
15 
17 // Classes
19 
20 namespace erpcgen {
21 
25 class ListType : public DataType
26 {
27 public:
35  ListType(DataType *elementType)
36  : DataType("(list)", kListType)
37  , m_elementType(elementType)
39  {
40  }
41 
47  DataType *getElementType() const { return m_elementType; }
48 
54  void setElementType(DataType *elementType) { m_elementType = elementType; }
55 
61  virtual bool isList() const { return true; }
62 
77  virtual std::string getDescription() const;
78 
84  void setLengthVariableName(const std::string &lengthVariableName) { m_lengthVariableName = lengthVariableName; }
85 
91  std::string &getLengthVariableName() { return m_lengthVariableName; }
92 
99  bool hasLengthVariable() { return "" != m_lengthVariableName; }
100 
101 protected:
103  std::string m_lengthVariableName;
104 };
105 
106 } // namespace erpcgen
107 
108 #endif // _EMBEDDED_RPC__LISTTYPE_H_
bool hasLengthVariable()
This function returns information if object contains length variable.
Definition: ListType.h:99
virtual std::string getDescription() const
This function returns description about the list.
Definition: Type.cpp:268
Variable length list of another data type.
Definition: ListType.h:25
DataType * getElementType() const
This function returns element data type.
Definition: ListType.h:47
DataType * m_elementType
Definition: ListType.h:102
Base class for data types.
Definition: DataType.h:25
ListType(DataType *elementType)
Constructor.
Definition: ListType.h:35
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:84
virtual bool isList() const
This function return "true" value for identify list type.
Definition: ListType.h:61
void setElementType(DataType *elementType)
This function set element data type.
Definition: ListType.h:54
std::string m_lengthVariableName
Definition: ListType.h:103
std::string & getLengthVariableName()
This function returns variable name. This variable is used in generated file to store size of list...
Definition: ListType.h:91
Definition: AstNode.h:25