| eRPC Generator (erpcgen) Rev. 1.8.1 NXP Semiconductors

- Main Page
- Classes
- Files

- File List

EnumType.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__ENUMTYPE_H_
11 #define _EMBEDDED_RPC__ENUMTYPE_H_
12
13 #include "DataType.h"
14 #include "EnumMember.h"
15
16 #include <string>
17 #include <vector>
18
20 // Classes
22
23 namespace erpcgen {
24
28 class EnumType : public DataType
29 {
30 public:
31 typedef std::vector<EnumMember *> member_vector_t;
40 EnumType(const Token &tok)
41 : DataType(tok, kEnumType, kEnumTypeSymbol)
42 {
43 }
44
50 EnumType()
51 : DataType("", kEnumType, kEnumTypeSymbol)
52 {
53 }
54
62 void addMember(EnumMember *newMember);
63
69 member_vector_t &getMembers() { return m_members; }
70
76 EnumMember *getMember(std::string name);
77
83 virtual bool isEnum() const { return true; }
84
90 uint32_t getNextValue() { return m_currentValue++; }
91
97 void setCurrentValue(uint32_t value) { m_currentValue = value; }
98
113 virtual std::string getDescription() const;
114
115 protected:
116 member_vector_t m_members;
117 uint32_t m_currentValue = 0;
118 };
119
120 } // namespace erpcgen
121
122 #endif // _EMBEDDED_RPC__ENUMTYPE_H_
erpcgen::EnumType::getNextValue
uint32_t getNextValue()
This function returns the next value to use for an enum member.
Definition: EnumType.h:90
erpcgen::EnumType::member_vector_t
std::vector< EnumMember * > member_vector_t
Definition: EnumType.h:31
erpcgen::EnumType::m_members
member_vector_t m_members
Definition: EnumType.h:116
erpcgen::EnumType::isEnum
virtual bool isEnum() const
This function return "true" value for identify enum type.
Definition: EnumType.h:83
erpcgen::EnumType::addMember
void addMember(EnumMember *newMember)
This function will add enum member to the enum.
Definition: Type.cpp:358
erpcgen::EnumType::EnumType
EnumType(const Token &tok)
Constructor.
Definition: EnumType.h:40
erpcgen::EnumType::m_currentValue
uint32_t m_currentValue
Definition: EnumType.h:117
erpcgen::EnumType::getDescription
virtual std::string getDescription() const
This function returns description about the enum.
Definition: Type.cpp:364
erpcgen::EnumType::EnumType
EnumType()
Constructor.
Definition: EnumType.h:50
erpcgen::EnumMember
Member of a enum.
Definition: EnumMember.h:26
erpcgen::DataType
Base class for data types.
Definition: DataType.h:26
erpcgen::Token
Encapsulates all information about a token.
Definition: Token.h:60
erpcgen::EnumType
Enumerate data type.
Definition: EnumType.h:28
erpcgen::EnumType::getMembers
member_vector_t & getMembers()
This function returns vector of enum members.
Definition: EnumType.h:69
erpcgen::EnumType::setCurrentValue
void setCurrentValue(uint32_t value)
This function set current value.
Definition: EnumType.h:97
erpcgen
Definition: AstNode.h:26
erpcgen::EnumType::getMember
EnumMember * getMember(std::string name)
This function returns enum member based on given name.
Definition: Type.cpp:346