eRPC Generator (erpcgen)  Rev. 1.12.0
NXP Semiconductors
erpcgen::UnionType Class Reference

Discriminated union data type. More...

#include <UnionType.hpp>

Inheritance diagram for erpcgen::UnionType:
erpcgen::DataType erpcgen::Symbol

Public Types

typedef std::vector< UnionCase * > case_vector_t
 
- Public Types inherited from erpcgen::DataType
enum  data_type_t {
  kAliasType,
  kArrayType,
  kBuiltinType,
  kEnumType,
  kFunctionType,
  kListType,
  kStructType,
  kUnionType,
  kVoidType
}
 Supported data types.
 
- Public Types inherited from erpcgen::Symbol
enum  symbol_type_t {
  kConstSymbol,
  kEnumMemberSymbol,
  kFunctionSymbol,
  kInterfaceSymbol,
  kProgramSymbol,
  kStructMemberSymbol,
  kTypenameSymbol,
  kUnionCaseMemberSymbol
}
 Supported symbol types.
 

Public Member Functions

 UnionType (const std::string &name, const std::string &discriminatorName)
 Constructor. More...
 
 UnionType (const Token &tok, const std::string &discriminatorName)
 Constructor. More...
 
StructTypegetParentStruct ()
 Returns the struct owning this union.
 
void setParentStruct (StructType *parent)
 Sets the struct owning this union.
 
void addCase (UnionCase *unionCase)
 This function will add union case to current union. More...
 
virtual std::string getDescription () const override
 This function returns description about the union. More...
 
bool isNonEncapsulatedUnion () const
 This function return "true" value for identify non-encapsulated discriminated union type. More...
 
case_vector_tgetCases ()
 This function returns union cases vector. More...
 
case_vector_t getUniqueCases ()
 This function returns unique union cases vector. More...
 
bool addUnionMemberDeclaration (const std::string &name, DataType *dataType)
 This function adds unique union member declaration. More...
 
StructTypegetUnionMembers ()
 This function returns struct of union members. More...
 
StructMembergetUnionMemberDeclaration (const std::string &name)
 This function returns union member declaration. More...
 
std::string getDiscriminatorName ()
 This function returns union discriminator name. More...
 
void printUnionMembers ()
 This function prints information about union members.
 
bool declarationExists (const std::string &name)
 This function is looking for member declaration. More...
 
- Public Member Functions inherited from erpcgen::DataType
 DataType (data_type_t dataType)
 Constructor. More...
 
 DataType (const std::string &name, data_type_t dataType)
 Constructor. More...
 
 DataType (const Token &tok, data_type_t dataType)
 Constructor. More...
 
data_type_t getDataType () const
 This function returns data type. More...
 
DataTypegetTrueDataType ()
 This function returns pointer to true data type instead of alias. More...
 
DataTypegetTrueContainerDataType ()
 This function returns pointer to true data type (enum, builtin, structs) except lists and arrays. More...
 
bool isAlias () const
 This function is testing data type. More...
 
bool isArray () const
 This function is testing data type. More...
 
virtual bool isBinary () const
 This function return "false" value as default for identify binary type. More...
 
virtual bool isBool () const
 This function return "false" value as default for identify bool type. More...
 
bool isBuiltin () const
 This function is testing data type. More...
 
bool isEnum () const
 This function is testing data type. More...
 
bool isFunction () const
 This function is testing data type. More...
 
bool isList () const
 This function is testing data type. More...
 
virtual bool isScalar () const
 This function return "false" value as default for identify scalar builtin type. More...
 
virtual bool isInt () const
 This function return "true" value for identify int type. More...
 
virtual bool isFloat () const
 This function return "true" value for identify float type. More...
 
virtual bool isString () const
 This function return "false" value as default for identify string type. More...
 
virtual bool isUString () const
 This function return "false" value as default for identify ustring type. More...
 
bool isStruct () const
 This function is testing data type. More...
 
bool isUnion () const
 This function is testing data type. More...
 
bool isVoid () const
 This function is testing data type. More...
 
- Public Member Functions inherited from erpcgen::Symbol
 Symbol (symbol_type_t symType)
 Constructor. More...
 
 Symbol (symbol_type_t symType, const std::string &name)
 Constructor. More...
 
 Symbol (symbol_type_t symType, const Token &tok)
 Constructor. More...
 
virtual ~Symbol ()
 Destructor.
 
symbol_type_t getSymbolType () const
 This function returns symbol type. More...
 
const std::string & getName () const
 This function returns symbol name. More...
 
void setName (const std::string &newName)
 This function set symbol name. More...
 
bool isConstSymbol () const
 This function is testing symbol type. More...
 
bool isEnumMemberSymbol () const
 This function is testing symbol type. More...
 
bool isFunctionSymbol () const
 This function is testing symbol type. More...
 
bool isInterfaceSymbol () const
 This function is testing symbol type. More...
 
bool isProgramSymbol () const
 This function is testing symbol type. More...
 
bool isStructMemberSymbol () const
 This function is testing symbol type. More...
 
bool isDatatypeSymbol () const
 This function is testing symbol type. More...
 
bool isUnionCaseSymbol () const
 This function is testing symbol type. More...
 
token_loc_tgetLocation ()
 This function returns location for symbol. More...
 
void setLocation (const token_loc_t &loc)
 This function set location for symbol. More...
 
int getFirstLine () const
 This function return first line from location of symbol. More...
 
int getLastLine () const
 This function return last line from location of symbol. More...
 
void addAnnotation (const Annotation &a)
 This function add annotation to vector of symbol annotations. More...
 
std::string printAnnotations ()
 This function returns description about annotation. More...
 
AnnotationfindAnnotation (const std::string &name, Annotation::program_lang_t lang)
 Find annotation in the annotation list. More...
 
std::vector< Annotation * > getAnnotations (const std::string &name, Annotation::program_lang_t lang)
 Find annotations matching name in the annotation list. More...
 
const std::vector< Annotation > & getAnnotations () const
 Return all Symbol annotations. More...
 
ValuegetAnnValue (const std::string &annName, Annotation::program_lang_t lang)
 This function search and returns Value object for given annotation name. More...
 
std::string getAnnStringValue (const std::string &annName, Annotation::program_lang_t lang)
 This function search and returns string for given annotation name. More...
 
std::string getMlComment ()
 This function returns multiline comment for this symbol declared in IDL file. More...
 
void setMlComment (const std::string &comment)
 This function set multiline comment for this symbol declared in IDL file. More...
 
std::string getIlComment ()
 This function returns inline comment for this symbol declared in IDL file. More...
 
void setIlComment (const std::string &comment)
 This function set inline comment for this symbol declared in IDL file. More...
 

Additional Inherited Members

- Protected Attributes inherited from erpcgen::DataType
data_type_t m_dataType
 
- Protected Attributes inherited from erpcgen::Symbol
symbol_type_t m_symbolType
 
std::string m_name
 
token_loc_t m_location
 
std::vector< Annotationm_annotations
 
std::string m_mlComment
 
std::string m_ilComment
 

Detailed Description

Discriminated union data type.

Member Typedef Documentation

Vector of Union cases.

Constructor & Destructor Documentation

erpcgen::UnionType::UnionType ( const std::string &  name,
const std::string &  discriminatorName 
)
inline

Constructor.

This function set data type to union data type and name to given name. It will also set discriminator name.

Parameters
[in]nameGiven name.
[in]discriminatorNameDiscriminator name.
erpcgen::UnionType::UnionType ( const Token tok,
const std::string &  discriminatorName 
)
inline

Constructor.

This function set data type to union data type and symbol token to given token. It will also set discriminator name.

Parameters
[in]tokGiven token..
[in]discriminatorNameDiscriminator name.

Member Function Documentation

void UnionType::addCase ( UnionCase unionCase)

This function will add union case to current union.

Parameters
[in]unionCaseGiven union case.
bool UnionType::addUnionMemberDeclaration ( const std::string &  name,
DataType dataType 
)

This function adds unique union member declaration.

Parameters
[in]nameUnion case name.
[in]dataTypeUnion case data type.
bool UnionType::declarationExists ( const std::string &  name)

This function is looking for member declaration.

Parameters
[in]nameName of union member.
Return values
truewhen declaration already exist.
falsewhen declaration don't exist.
case_vector_t& erpcgen::UnionType::getCases ( )
inline

This function returns union cases vector.

Returns
Vector of union cases vector.
string UnionType::getDescription ( ) const
overridevirtual

This function returns description about the union.

Returns
String description about struct.
See also
std::string AliasType::getDescription() const
std::string EnumType::getDescription() const
std::string EnumMember::getDescription() const
std::string StructMember::getDescription() const
std::string VoidType::getDescription() const
std::string ArrayType::getDescription() const
std::string ListType::getDescription() const

Reimplemented from erpcgen::Symbol.

std::string erpcgen::UnionType::getDiscriminatorName ( )
inline

This function returns union discriminator name.

Returns
Union discriminator name.
StructMember * UnionType::getUnionMemberDeclaration ( const std::string &  name)

This function returns union member declaration.

Parameters
[in]nameName of union member.
Returns
Union member.
StructType& erpcgen::UnionType::getUnionMembers ( )
inline

This function returns struct of union members.

Returns
Struct of union members.
UnionType::case_vector_t UnionType::getUniqueCases ( )

This function returns unique union cases vector.

Returns
Vector of union cases vector.
bool erpcgen::UnionType::isNonEncapsulatedUnion ( ) const
inline

This function return "true" value for identify non-encapsulated discriminated union type.

Return values
trueTrue when m_discriminator is not set.

The documentation for this class was generated from the following files: