Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry picking orphaned commit #32

Merged
merged 1 commit into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/java/com/eprosima/fastcdr/idl/generator/TypesGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@

package com.eprosima.fastcdr.idl.generator;

import com.eprosima.log.ColorMessage;
import com.eprosima.idl.generator.manager.TemplateManager;
import com.eprosima.idl.context.Context;
import com.eprosima.idl.parser.typecode.TypeCode;
import com.eprosima.idl.generator.manager.TemplateManager;
import com.eprosima.idl.parser.tree.Definition;
import com.eprosima.idl.parser.tree.Export;
import com.eprosima.idl.parser.tree.Module;
import com.eprosima.idl.parser.tree.Interface;
import com.eprosima.idl.parser.tree.TypeDeclaration;

import org.antlr.stringtemplate.*;

import com.eprosima.idl.parser.typecode.Kind;
import com.eprosima.log.ColorMessage;
import java.io.*;
import java.util.ArrayList;
import java.util.Map;
import java.io.*;
import org.antlr.stringtemplate.StringTemplate;
import org.antlr.stringtemplate.StringTemplateGroup;



public class TypesGenerator
{
Expand Down Expand Up @@ -204,7 +204,7 @@ public StringTemplate processTypeDeclaration(Context context, TypeDeclaration ty
String extensionname = null;
System.out.println("processTypesDeclaration " + typedecl.getName());

if(typedecl.getTypeCode().getKind() == TypeCode.KIND_STRUCT)
if(typedecl.getTypeCode().getKind() == Kind.KIND_STRUCT)
{
typest = stg_.getInstanceOf("struct_type");
typest.setAttribute("struct", typedecl.getTypeCode());
Expand All @@ -216,7 +216,7 @@ public StringTemplate processTypeDeclaration(Context context, TypeDeclaration ty
extensionst.setAttribute("struct", typedecl.getTypeCode());
}
}
else if(typedecl.getTypeCode().getKind() == TypeCode.KIND_UNION)
else if(typedecl.getTypeCode().getKind() == Kind.KIND_UNION)
{
typest = stg_.getInstanceOf("union_type");
typest.setAttribute("union", typedecl.getTypeCode());
Expand All @@ -228,7 +228,7 @@ else if(typedecl.getTypeCode().getKind() == TypeCode.KIND_UNION)
extensionst.setAttribute("union", typedecl.getTypeCode());
}
}
else if(typedecl.getTypeCode().getKind() == TypeCode.KIND_ENUM)
else if(typedecl.getTypeCode().getKind() == Kind.KIND_ENUM)
{
typest = stg_.getInstanceOf("enum_type");
typest.setAttribute("enum", typedecl.getTypeCode());
Expand All @@ -240,7 +240,7 @@ else if(typedecl.getTypeCode().getKind() == TypeCode.KIND_ENUM)
extensionst.setAttribute("enum", typedecl.getTypeCode());
}
}
else if(typedecl.getTypeCode().getKind() == TypeCode.KIND_BITSET)
else if(typedecl.getTypeCode().getKind() == Kind.KIND_BITSET)
{
typest = stg_.getInstanceOf("bitset_type");
typest.setAttribute("bitset", typedecl.getTypeCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,9 @@ type_object->complete().struct_type().member_seq().emplace_back(cst_$object.name

>>

get_type_identifier(ctx, type, ek) ::= <<$if(type.isSequenceType)$TypeObjectFactory::GetInstance()->GetSequenceIdentifier($get_content_type(ctx=ctx, type=type.sequenceContentTypeCode)$, $type.maxsize$, $ek$)$elseif(type.isArrayType)$TypeObjectFactory::GetInstance()->GetArrayIdentifier($get_content_type(ctx=ctx, type=type.arrayContentTypeCode)$, {$type.dimensions:{ dim |$dim$}; separator=", "$}, $ek$)$elseif(type.isSetType)$TypeObjectFactory::GetInstance()->GetSequenceIdentifier($get_content_type(ctx=ctx, type=type.setContentTypeCode)$, $type.maxsize$, $ek$)$elseif(type.isMapType)$TypeObjectFactory::GetInstance()->GetMapIdentifier($get_content_type(ctx=ctx, type=type.keyTypeCode)$, $get_content_type(ctx=ctx, type=type.valueTypeCode)$, $type.maxsize$, $ek$)$elseif(type.isStringType)$TypeObjectFactory::GetInstance()->GetStringIdentifier($type.maxsize$, false)$elseif(type.isWStringType)$TypeObjectFactory::GetInstance()->GetStringIdentifier($type.maxsize$, true)$elseif(type.objectType)$Get$type.cppTypename$Identifier($ek$)$elseif(type.plainType)$TypeObjectFactory::GetInstance()->GetTypeIdentifier("$type.cppTypename$", false)$else$TypeObjectFactory::GetInstance()->GetTypeIdentifier("$type.cppTypename$", false)$endif$>>
get_type_identifier(ctx, type, ek) ::= <<$if(type.isSequenceType)$TypeObjectFactory::GetInstance()->GetSequenceIdentifier($get_content_type(ctx=ctx, type=type.contentTypeCode)$, $type.maxsize$, $ek$)$elseif(type.isArrayType)$TypeObjectFactory::GetInstance()->GetArrayIdentifier($get_content_type(ctx=ctx, type=type.contentTypeCode)$, {$type.dimensions:{ dim |$dim$}; separator=", "$}, $ek$)$elseif(type.isSetType)$TypeObjectFactory::GetInstance()->GetSequenceIdentifier($get_content_type(ctx=ctx, type=type.contentTypeCode)$, $type.maxsize$, $ek$)$elseif(type.isMapType)$TypeObjectFactory::GetInstance()->GetMapIdentifier($get_content_type(ctx=ctx, type=type.keyTypeCode)$, $get_content_type(ctx=ctx, type=type.valueTypeCode)$, $type.maxsize$, $ek$)$elseif(type.isStringType)$TypeObjectFactory::GetInstance()->GetStringIdentifier($type.maxsize$, false)$elseif(type.isWStringType)$TypeObjectFactory::GetInstance()->GetStringIdentifier($type.maxsize$, true)$elseif(type.objectType)$Get$type.cppTypename$Identifier($ek$)$elseif(type.plainType)$TypeObjectFactory::GetInstance()->GetTypeIdentifier("$type.cppTypename$", false)$else$TypeObjectFactory::GetInstance()->GetTypeIdentifier("$type.cppTypename$", false)$endif$>>

get_content_type(ctx, type) ::= <<$if(type.plainType)$$if(type.isSequenceType)$TypeNamesGenerator::getSequenceTypeName($get_content_type(ctx=ctx, type=type.sequenceContentTypeCode)$, $type.maxsize$)$elseif(type.isArrayType)$TypeNamesGenerator::getArrayTypeName($get_content_type(ctx=ctx, type=type.arrayContentTypeCode)$, {$type.dimensions:{ dim |$dim$}; separator=", "$})$elseif(type.isSetType)$TypeNamesGenerator::getSequenceTypeName($get_content_type(ctx=ctx, type=type.setContentTypeCode)$, $type.maxsize$)$elseif(type.isMapType)$TypeNamesGenerator::getMapTypeName($get_content_type(ctx=ctx, type=type.keyTypeCode)$, $get_content_type(ctx=ctx, type=type.valueTypeCode)$, $type.maxsize$)$elseif(type.isStringType)$TypeNamesGenerator::getStringTypeName($type.maxsize$, false)$elseif(type.isWStringType)$TypeNamesGenerator::getStringTypeName($type.maxsize$, true)$else$"$type.cppTypename$"$endif$$else$"$type.cppTypename$"$endif$>>
get_content_type(ctx, type) ::= <<$if(type.plainType)$$if(type.isSequenceType)$TypeNamesGenerator::getSequenceTypeName($get_content_type(ctx=ctx, type=type.contentTypeCode)$, $type.maxsize$)$elseif(type.isArrayType)$TypeNamesGenerator::getArrayTypeName($get_content_type(ctx=ctx, type=type.contentTypeCode)$, {$type.dimensions:{ dim |$dim$}; separator=", "$})$elseif(type.isSetType)$TypeNamesGenerator::getSequenceTypeName($get_content_type(ctx=ctx, type=type.contentTypeCode)$, $type.maxsize$)$elseif(type.isMapType)$TypeNamesGenerator::getMapTypeName($get_content_type(ctx=ctx, type=type.keyTypeCode)$, $get_content_type(ctx=ctx, type=type.valueTypeCode)$, $type.maxsize$)$elseif(type.isStringType)$TypeNamesGenerator::getStringTypeName($type.maxsize$, false)$elseif(type.isWStringType)$TypeNamesGenerator::getStringTypeName($type.maxsize$, true)$else$"$type.cppTypename$"$endif$$else$"$type.cppTypename$"$endif$>>

union_type(ctx, parent, union) ::= <<
const TypeIdentifier* Get$union.name$Identifier(bool complete)
Expand Down Expand Up @@ -888,4 +888,3 @@ type_object->complete().union_type().member_seq().emplace_back(cst_$object.name$
>>

/***** Utils *****/