Skip to content

Commit

Permalink
User types header-only (#263)
Browse files Browse the repository at this point in the history
* Refs #19960. Implementation

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #19960. New argument -no-typesupport

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #19960. Remove old template

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #19960. New configuration to set explicitly using modules in stg

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #19960. Update submodule

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #19960. Update submodule

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

---------

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
  • Loading branch information
richiware authored and JLBuenoLopez committed Jan 25, 2024
1 parent 3f5901a commit 058ab0c
Show file tree
Hide file tree
Showing 12 changed files with 649 additions and 1,695 deletions.
748 changes: 512 additions & 236 deletions src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg

Large diffs are not rendered by default.

1,348 changes: 0 additions & 1,348 deletions src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $fast_macro_declarations()$
$ctx.directIncludeDependencies : {include | %include "$include$.i"}; separator="\n"$

%{
#include "$ctx.filename$.h"
#include "$ctx.filename$.hpp"

#include <fastdds/dds/core/LoanableSequence.hpp>
%}
Expand Down Expand Up @@ -66,7 +66,7 @@ namespace swig {
$definitions; separator="\n"$

// Include the class interfaces
%include "$ctx.filename$.h"
%include "$ctx.filename$.hpp"

// Include the corresponding TopicDataType
%include "$ctx.filename$PubSubTypes.i"
Expand Down
214 changes: 112 additions & 102 deletions src/main/java/com/eprosima/fastdds/fastddsgen.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ $solution.projects : { project | $pub_sub_execs(project=project, libraries=solut
pub_sub_execs(project, libraries, test) ::= <<

message(STATUS "Configuring $project.name$...")
$if(!project.commonSrcFiles.empty)$
add_library($project.name$_lib $project.commonSrcFiles : { file | $file$}; separator=" "$)
target_link_libraries($project.name$_lib $solution.libraries : { library | $library$}; separator=" "$)
$endif$

$if(!project.projectSrcFiles.empty)$
add_executable($project.name$ $project.projectSrcFiles : { file | $file$}; separator=" "$)
target_link_libraries($project.name$ $solution.libraries : { library | $library$}; separator=" "$
$project.name$_lib $project.dependencies : { dep | $dep$_lib}; separator=" "$)
$project.name$_lib $project.dependencies : { dep | $dep$_lib}; separator=" "$
)
$endif$

$if(test)$
Expand All @@ -75,7 +78,8 @@ add_executable($project.name$SerializationTest
target_link_libraries($project.name$SerializationTest
GTest::gtest_main
$solution.libraries : { library | $library$}; separator=" "$
$project.name$_lib $project.dependencies : { dep | $dep$_lib}; separator=" "$)
$project.name$_lib $project.dependencies : { dep | $dep$_lib}; separator=" "$
)
gtest_discover_tests($project.name$SerializationTest)

$endif$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "PubSubTypes.h"], description=["This h
#include <fastdds/rtps/common/SerializedPayload.h>
#include <fastrtps/utils/md5.h>

#include "$ctx.filename$.h"
#include "$ctx.filename$.hpp"

$ctx.directIncludeDependencies : {include | #include "$include$PubSubTypes.h"}; separator="\n"$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t;

$definitions; separator="\n"$

$if(ctx.thereIsStructOrUnion)$
// Include auxiliary functions like for serializing/deserializing.
#include "$ctx.filename$CdrAux.ipp"
$endif$

>>

module(ctx, parent, module, definition_list) ::= <<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "eprosima.stg"
main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "JNII.cxx"], description=[""])$

#include "$ctx.filename$.h"
#include "$ctx.filename$.hpp"
#include <jni.h>

#if defined(_WIN32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "Serialization.h"], description=["This
#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$_SERIALIZATION_H_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$_SERIALIZATION_H_

#include "$ctx.filename$.h"
#include "$ctx.filename$.hpp"

$definitions; separator="\n"$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "TypeObject.cpp"], description=["This s
namespace { char dummy; }
#endif

#include "$ctx.filename$.h"
#include "$ctx.filename$.hpp"
#include "$ctx.filename$TypeObject.h"
#include <mutex>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "CdrAux.hpp"], description=["This sourc
#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$CDRAUX_HPP_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$CDRAUX_HPP_

#include "$ctx.filename$.h"
#include "$ctx.filename$.hpp"

$if(ctx.anyCdr)$
$ctx.types:{ type | $if(type.inScope)$$if(type.typeCode.isStructType)$
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/eprosima/fastdds/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

import org.stringtemplate.v4.ST;

import com.eprosima.idl.generator.manager.TemplateST;

import java.io.*;

public class Utils
Expand Down Expand Up @@ -74,6 +76,11 @@ public static String addFileSeparator(String directory)
return returnedValue;
}

public static boolean writeFile(String file, TemplateST template, boolean replace)
{
return writeFile(file, template.get_st(), replace);
}

public static boolean writeFile(String file, ST template, boolean replace)
{
boolean returnedValue = false;
Expand Down

0 comments on commit 058ab0c

Please sign in to comment.