| eRPC Generator (erpcgen) Rev. 1.8.1 NXP Semiconductors

- Main Page
- Classes
- Files

- File List

InterfaceDefinition.h
1 /*
2 * Copyright (c) 2014-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__INTERFACEDEFINITION_H_
11 #define _EMBEDDED_RPC__INTERFACEDEFINITION_H_
12
13 #include "AstNode.h"
14 #include "types/Program.h"
15 #include "types/SymbolScope.h"
16
17 #include <boost/filesystem.hpp>
18 #include <iostream>
19
21 // Classes
23
24 namespace erpcgen {
25
31 class InterfaceDefinition
32 {
33 public:
34 enum codec_t
35 {
36 kNotSpecified,
37 kBasicCodec,
38 };
43 InterfaceDefinition();
44
48 virtual ~InterfaceDefinition() {}
49
55 void init();
56
67 void parse(const char *inputFile);
68
74 AstNode *getAst() { return m_ast; }
75
81 SymbolScope &getGlobals() { return m_globals; }
82
93 void setProgramInfo(const std::string &fileName, const std::string &outputFilePath, codec_t codec);
94
100 void setProgramName(const std::string &programName) { m_programName = programName; }
101
107 const std::string getProgramName() { return getProgramSymbol()->getName(); }
108
114 boost::filesystem::path getOutputDirectory() { return m_outputDirectory; }
115
121 std::string getOutputFilename() { return m_outputFilename; }
122
128 void setOutputFilename(const std::string &filename);
129
136 bool hasProgramSymbol();
137
143 Program *getProgramSymbol();
144
153 codec_t getCodecType() { return m_codec; }
154
160 uint16_t getIdlCrc16() { return m_idlCrc16; }
161
162 private:
163 /* Instance Variables */
164 AstNode *m_ast;
165 SymbolScope m_globals;
166 Program *m_program;
167 std::string m_programName;
168 std::string m_outputFilename;
169 boost::filesystem::path m_outputDirectory;
170 codec_t m_codec;
171 uint16_t m_idlCrc16;
173 /* Private Functions */
177 void createBuiltinTypes();
178 };
179
180 } // namespace erpcgen
181
182 #endif // _EMBEDDED_RPC__INTERFACEDEFINITION_H_
erpcgen::InterfaceDefinition
Collects all definitions from an IDL.
Definition: InterfaceDefinition.h:31
erpcgen::InterfaceDefinition::getCodecType
codec_t getCodecType()
This function returns used codec type in eRPC application.
Definition: InterfaceDefinition.h:153
erpcgen::InterfaceDefinition::~InterfaceDefinition
virtual ~InterfaceDefinition()
Destructor.
Definition: InterfaceDefinition.h:48
erpcgen::InterfaceDefinition::setOutputFilename
void setOutputFilename(const std::string &filename)
This function sets output file name.
Definition: InterfaceDefinition.cpp:115
erpcgen::AstNode
Homogeneous AST node class.
Definition: AstNode.h:36
erpcgen::InterfaceDefinition::getAst
AstNode * getAst()
This function returns node belong to this object.
Definition: InterfaceDefinition.h:74
erpcgen::Program
Program declaration.
Definition: Program.h:28
erpcgen::InterfaceDefinition::getProgramSymbol
Program * getProgramSymbol()
This function returns program symbol.
Definition: InterfaceDefinition.cpp:103
erpcgen::InterfaceDefinition::getIdlCrc16
uint16_t getIdlCrc16()
This function returns crc16 of all used IDL files.
Definition: InterfaceDefinition.h:160
erpcgen::InterfaceDefinition::parse
void parse(const char *inputFile)
This function parse given IDL file.
Definition: InterfaceDefinition.cpp:46
erpcgen::Symbol::getName
const std::string & getName() const
This function returns symbol name.
Definition: Symbol.h:125
erpcgen::SymbolScope
A scoped namespace containing symbols.
Definition: SymbolScope.h:28
erpcgen::InterfaceDefinition::getOutputFilename
std::string getOutputFilename()
This function returns output file name.
Definition: InterfaceDefinition.h:121
erpcgen::InterfaceDefinition::getProgramName
const std::string getProgramName()
This function returns program name.
Definition: InterfaceDefinition.h:107
erpcgen::InterfaceDefinition::InterfaceDefinition
InterfaceDefinition()
Default constructor.
Definition: InterfaceDefinition.cpp:30
erpcgen::InterfaceDefinition::init
void init()
This function initialize symbol scope variable m_globals.
Definition: InterfaceDefinition.cpp:41
erpcgen::InterfaceDefinition::setProgramName
void setProgramName(const std::string &programName)
This function sets program name.
Definition: InterfaceDefinition.h:100
erpcgen::InterfaceDefinition::hasProgramSymbol
bool hasProgramSymbol()
This function returns information if program symbol was set in parsed file.
Definition: InterfaceDefinition.cpp:98
erpcgen::InterfaceDefinition::getOutputDirectory
boost::filesystem::path getOutputDirectory()
This function returns output directory path.
Definition: InterfaceDefinition.h:114
erpcgen::InterfaceDefinition::getGlobals
SymbolScope & getGlobals()
This function returns global symbol scope.
Definition: InterfaceDefinition.h:81
erpcgen
Definition: AstNode.h:26
erpcgen::InterfaceDefinition::setProgramInfo
void setProgramInfo(const std::string &fileName, const std::string &outputFilePath, codec_t codec)
This function sets program information.
Definition: InterfaceDefinition.cpp:91