| eRPC Generator (erpcgen) Rev. 1.8.1 NXP Semiconductors

- Main Page
- Classes
- Files

- File List

Function.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__FUNCTION_H_
11 #define _EMBEDDED_RPC__FUNCTION_H_
12
13 #include "DataType.h"
14 #include "StructType.h"
15 #include "Symbol.h"
16
17 #include <string>
18
20 // Classes
22
23 namespace erpcgen {
24
30 class FunctionBase
31 {
32 public:
36 FunctionBase()
37 : m_parameters("(fn)")
38 , m_returnType(nullptr)
39 , m_isOneway(false)
40 {
41 }
42
43 virtual ~FunctionBase(){};
44
50 StructType &getParameters() { return m_parameters; }
51
57 DataType *getReturnType() { return m_returnType->getDataType(); }
58
64 StructMember *getReturnStructMemberType() { return m_returnType; }
65
71 void setReturnStructMemberType(StructMember *returnType) { m_returnType = returnType; }
72
79 bool isOneway() const { return m_isOneway; }
80
86 void setIsOneway(bool argIsOneway) { m_isOneway = argIsOneway; }
87
102 virtual std::string getDescription() const = 0;
103
104 protected:
105 StructType m_parameters;
106 StructMember *m_returnType;
107 bool m_isOneway;
108 };
109
110 class Interface;
111 class FunctionType;
117 class Function : public FunctionBase, public Symbol
118 {
119 public:
128 Function(const Token &tok, Interface *interface)
129 : FunctionBase()
130 , Symbol(kFunctionSymbol, tok)
131 , m_uniqueId(++s_idCounter)
132 , m_interface(interface)
133 , m_functionType(nullptr)
134 {
135 }
136
146 Function(const Token &tok, Interface *interface, uint32_t uniqueId)
147 : FunctionBase()
148 , Symbol(kFunctionSymbol, tok)
149 , m_uniqueId(uniqueId)
150 , m_interface(interface)
151 , m_functionType(nullptr)
152 {
153 s_idCounter = uniqueId;
154 }
155
161 uint32_t getUniqueId() const { return m_uniqueId; }
162
168 void setUniqueId(uint32_t newId) { m_uniqueId = newId; }
169
175 Interface *getInterface() const { return m_interface; }
176
191 virtual std::string getDescription() const;
192
198 void setFunctionType(FunctionType *functionType) { m_functionType = functionType; }
199
205 FunctionType *getFunctionType() const { return m_functionType; }
206
207 protected:
208 uint32_t m_uniqueId;
209 Interface *m_interface;
210 FunctionType *m_functionType;
212 static uint32_t s_idCounter;
213 };
214
215 } // namespace erpcgen
216
217 #endif // _EMBEDDED_RPC__FUNCTION_H_
erpcgen::FunctionType
Function data type.
Definition: FunctionType.h:31
erpcgen::FunctionBase::getReturnStructMemberType
StructMember * getReturnStructMemberType()
This function returns data type of function return value.
Definition: Function.h:64
erpcgen::FunctionBase::m_returnType
StructMember * m_returnType
Definition: Function.h:106
erpcgen::StructMember
Member of a struct.
Definition: StructMember.h:38
erpcgen::FunctionBase::getParameters
StructType & getParameters()
This function returns function parameters.
Definition: Function.h:50
erpcgen::FunctionBase::getReturnType
DataType * getReturnType()
This function returns data type of function return value.
Definition: Function.h:57
erpcgen::FunctionBase::getDescription
virtual std::string getDescription() const =0
This function returns description about the interface function.
erpcgen::StructType
Structure data type.
Definition: StructType.h:29
erpcgen::Function
Function declaration.
Definition: Function.h:117
erpcgen::Function::m_uniqueId
uint32_t m_uniqueId
Definition: Function.h:208
erpcgen::Symbol
Base class for all named declarations in the IDL.
Definition: Symbol.h:28
erpcgen::Function::Function
Function(const Token &tok, Interface *interface)
Constructor.
Definition: Function.h:128
erpcgen::StructMember::getDataType
DataType * getDataType()
This function returns pointer to element data type.
Definition: StructMember.h:82
erpcgen::Function::Function
Function(const Token &tok, Interface *interface, uint32_t uniqueId)
Constructor.
Definition: Function.h:146
erpcgen::Function::getInterface
Interface * getInterface() const
This function returns parent Interface.
Definition: Function.h:175
erpcgen::Function::m_functionType
FunctionType * m_functionType
Definition: Function.h:210
erpcgen::DataType
Base class for data types.
Definition: DataType.h:26
erpcgen::Token
Encapsulates all information about a token.
Definition: Token.h:60
erpcgen::Function::s_idCounter
static uint32_t s_idCounter
Definition: Function.h:212
erpcgen::FunctionBase::m_parameters
StructType m_parameters
Definition: Function.h:105
erpcgen::Function::m_interface
Interface * m_interface
Definition: Function.h:209
erpcgen::FunctionBase
Function base declaration.
Definition: Function.h:30
erpcgen::Function::getUniqueId
uint32_t getUniqueId() const
This function returns function unique id.
Definition: Function.h:161
erpcgen::Function::getFunctionType
FunctionType * getFunctionType() const
This function returns FunctionType (callback type).
Definition: Function.h:205
erpcgen::Function::setFunctionType
void setFunctionType(FunctionType *functionType)
This function sets FunctionType (callback type).
Definition: Function.h:198
erpcgen::Interface
An interface that contains functions.
Definition: Interface.h:29
erpcgen::FunctionBase::FunctionBase
FunctionBase()
Constructor.
Definition: Function.h:36
erpcgen::FunctionBase::m_isOneway
bool m_isOneway
Definition: Function.h:107
erpcgen::FunctionBase::isOneway
bool isOneway() const
This function returns true/false, when function return type is/isn&#39;t oneway.
Definition: Function.h:79
erpcgen::FunctionBase::setReturnStructMemberType
void setReturnStructMemberType(StructMember *returnType)
This function set data type of function return value.
Definition: Function.h:71
erpcgen::Function::setUniqueId
void setUniqueId(uint32_t newId)
This function set function unique id.
Definition: Function.h:168
erpcgen
Definition: AstNode.h:26
erpcgen::FunctionBase::setIsOneway
void setIsOneway(bool argIsOneway)
This function set true/false, when function return type is/isn&#39;t oneway.
Definition: Function.h:86