| eRPC Generator (erpcgen) Rev. 1.8.1 NXP Semiconductors

- Main Page
- Classes
- Files

- File List

UnionCase.h
1 /*
2 * Copyright (c) 2016, 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__UNIONCASE_H_
11 #define _EMBEDDED_RPC__UNIONCASE_H_
12 #include <map>
13 #include <utility>
14
16 // Classes
18
19 namespace erpcgen {
20
21 class UnionType;
22
26 class UnionCase : public Symbol
27 {
28 public:
38 UnionCase(const std::string &caseName, int32_t caseValue)
39 : Symbol(kUnionCaseMemberSymbol, caseName)
40 , m_caseName(caseName)
41 , m_caseValue(caseValue)
42 , m_containingUnion(nullptr)
43 {
44 }
45
54 UnionCase(int32_t caseValue)
55 : Symbol(kUnionCaseMemberSymbol)
56 , m_caseName("")
57 , m_caseValue(caseValue)
58 , m_containingUnion(nullptr)
59 {
60 }
61
70 UnionCase(const std::string &caseName)
71 : Symbol(kUnionCaseMemberSymbol)
72 , m_caseName(caseName)
73 , m_caseValue(-1)
74 , m_containingUnion(nullptr)
75 {
76 }
77
83 void setUnionReferencePointer(UnionType *unionType) { m_containingUnion = unionType; }
84
90 int32_t getCaseValue() const { return m_caseValue; }
91
97 std::string getCaseName() { return m_caseName; }
98
104 std::vector<std::string> getMemberDeclarationNames() const { return m_memberDeclarationNames; }
105
111 void addCaseMemberName(const std::string &name) { m_memberDeclarationNames.push_back(name); };
112
116 void printUnionMembers();
117
124 bool caseMemberIsVoid() const;
125
131 virtual std::string getDescription() const;
132
140 StructMember *getUnionMemberDeclaration(const std::string &name);
141
142 private:
143 std::string m_caseName;
144 int32_t m_caseValue;
145 std::vector<std::string> m_memberDeclarationNames;
146 UnionType *m_containingUnion;
147 };
148
149 } // namespace erpcgen
150
151 #endif // _EMBEDDED_RPC__UNIONCASE_H_
erpcgen::UnionCase::UnionCase
UnionCase(int32_t caseValue)
Constructor.
Definition: UnionCase.h:54
erpcgen::UnionCase::UnionCase
UnionCase(const std::string &caseName)
Constructor.
Definition: UnionCase.h:70
erpcgen::StructMember
Member of a struct.
Definition: StructMember.h:38
erpcgen::UnionCase
Discriminated union case type.
Definition: UnionCase.h:26
erpcgen::UnionCase::getCaseName
std::string getCaseName()
This function returns union case name.
Definition: UnionCase.h:97
erpcgen::Symbol
Base class for all named declarations in the IDL.
Definition: Symbol.h:28
erpcgen::UnionCase::getUnionMemberDeclaration
StructMember * getUnionMemberDeclaration(const std::string &name)
This function returns union member declaration.
Definition: Type.cpp:568
erpcgen::UnionCase::setUnionReferencePointer
void setUnionReferencePointer(UnionType *unionType)
This function set reference to union type.
Definition: UnionCase.h:83
erpcgen::UnionCase::getMemberDeclarationNames
std::vector< std::string > getMemberDeclarationNames() const
This function returns vector of member declarations.
Definition: UnionCase.h:104
erpcgen::UnionCase::getCaseValue
int32_t getCaseValue() const
This function returns union case value.
Definition: UnionCase.h:90
erpcgen::UnionCase::addCaseMemberName
void addCaseMemberName(const std::string &name)
This function adds case member name.
Definition: UnionCase.h:111
erpcgen::UnionCase::UnionCase
UnionCase(const std::string &caseName, int32_t caseValue)
Constructor.
Definition: UnionCase.h:38
erpcgen::UnionType
Discriminated union data type.
Definition: UnionType.h:28
erpcgen::UnionCase::printUnionMembers
void printUnionMembers()
This function prints debug information about union case members.
erpcgen::UnionCase::getDescription
virtual std::string getDescription() const
This function returns description about case members.
Definition: Type.cpp:545
erpcgen::UnionCase::caseMemberIsVoid
bool caseMemberIsVoid() const
This function returns information if case is void type.
Definition: Type.cpp:536
erpcgen
Definition: AstNode.h:26