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

[21128] Update guards and extenstion .h to .hpp in headers #358

Merged
merged 3 commits into from
Jun 27, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import "FastCdrCommon.stg"
main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, ".hpp"], description=["This header file contains the declaration of the described types in the IDL file."])$

#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$_HPP_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$_HPP_
#ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$_HPP
#define FAST_DDS_GENERATED__$ctx.headerGuardName$_HPP

$if(ctx.thereIsArray)$
#include <array>
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/eprosima/fastdds/fastddsgen.java
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ private Project parseIDL(
project.addCommonTestingFile(relative_dir + ctx.getFilename() + "Serialization.cpp");

System.out.println("Generating Serialization Header file...");
String fileNameH = output_dir + ctx.getFilename() + "Serialization.h";
String fileNameH = output_dir + ctx.getFilename() + "Serialization.hpp";
returnedValue =
Utils.writeFile(fileNameH, maintemplates.getTemplate("com/eprosima/fastdds/idl/templates/SerializationHeader.stg"), m_replace);

Expand Down Expand Up @@ -993,9 +993,9 @@ private Project parseIDL(
}
}
returnedValue &=
Utils.writeFile(output_dir + ctx.getFilename() + "PubSubTypes.h",
Utils.writeFile(output_dir + ctx.getFilename() + "PubSubTypes.hpp",
maintemplates.getTemplate("com/eprosima/fastdds/idl/templates/DDSPubSubTypeHeader.stg"), m_replace);
project.addCommonIncludeFile(relative_dir + ctx.getFilename() + "PubSubTypes.h");
project.addCommonIncludeFile(relative_dir + ctx.getFilename() + "PubSubTypes.hpp");
if (ctx.existsLastStructure())
{
m_atLeastOneStructure = true;
Expand All @@ -1019,28 +1019,28 @@ private Project parseIDL(
{
System.out.println("Generating Publisher files...");
if (returnedValue =
Utils.writeFile(output_dir + ctx.getFilename() + "Publisher.h",
Utils.writeFile(output_dir + ctx.getFilename() + "Publisher.hpp",
maintemplates.getTemplate("com/eprosima/fastdds/idl/templates/DDSPublisherHeader.stg"), m_replace))
{
if (returnedValue =
Utils.writeFile(output_dir + ctx.getFilename() + "Publisher.cxx",
maintemplates.getTemplate("com/eprosima/fastdds/idl/templates/DDSPublisherSource.stg"), m_replace))
{
project.addProjectIncludeFile(relative_dir + ctx.getFilename() + "Publisher.h");
project.addProjectIncludeFile(relative_dir + ctx.getFilename() + "Publisher.hpp");
project.addProjectSrcFile(relative_dir + ctx.getFilename() + "Publisher.cxx");
}
}

System.out.println("Generating Subscriber files...");
if (returnedValue =
Utils.writeFile(output_dir + ctx.getFilename() + "Subscriber.h",
Utils.writeFile(output_dir + ctx.getFilename() + "Subscriber.hpp",
maintemplates.getTemplate("com/eprosima/fastdds/idl/templates/DDSSubscriberHeader.stg"), m_replace))
{
if (returnedValue =
Utils.writeFile(output_dir + ctx.getFilename() + "Subscriber.cxx",
maintemplates.getTemplate("com/eprosima/fastdds/idl/templates/DDSSubscriberSource.stg"), m_replace))
{
project.addProjectIncludeFile(relative_dir + ctx.getFilename() + "Subscriber.h");
project.addProjectIncludeFile(relative_dir + ctx.getFilename() + "Subscriber.hpp");
project.addProjectSrcFile(relative_dir + ctx.getFilename() + "Subscriber.cxx");
}
}
Expand Down Expand Up @@ -1103,11 +1103,11 @@ private Project parseIDL(
}
}

if (Utils.writeFile(output_dir + ctx.getFilename() + "PubSubJNII.h",
if (Utils.writeFile(output_dir + ctx.getFilename() + "PubSubJNII.hpp",
maintemplates.getTemplate("JNIHeader"),
m_replace))
{
project.addJniIncludeFile(relative_dir + ctx.getFilename() + "PubSubJNII.h");
project.addJniIncludeFile(relative_dir + ctx.getFilename() + "PubSubJNII.hpp");
}
else
{
Expand Down Expand Up @@ -1490,7 +1490,7 @@ boolean callJavah(
String javafile = (m_outputDir != null ? m_outputDir : "") +
(!m_package.isEmpty() ? m_package.replace('.', File.separatorChar) + File.separator : "") +
Util.getIDLFileNameOnly(idlFilename) + "PubSub.java";
String headerfile = m_outputDir + Util.getIDLFileNameOnly(idlFilename) + "PubSubJNI.h";
String headerfile = m_outputDir + Util.getIDLFileNameOnly(idlFilename) + "PubSubJNI.hpp";
int exitVal = -1;
String javac = null;
String javah = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "PubSubMain.cpp"], description=["This file acts as a main entry point to the application."])$


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

int main(
int argc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ group ProtocolHeader;
import "eprosima.stg"

main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "PubSubTypes.h"], description=["This header file contains the declaration of the serialization functions."])$
$fileHeader(ctx=ctx, file=[ctx.filename, "PubSubTypes.hpp"], description=["This header file contains the declaration of the serialization functions."])$


#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$_PUBSUBTYPES_H_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$_PUBSUBTYPES_H_
#ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$_PUBSUBTYPES_HPP
#define FAST_DDS_GENERATED__$ctx.headerGuardName$_PUBSUBTYPES_HPP

#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/dds/topic/TopicDataType.hpp>
#include <fastdds/rtps/common/InstanceHandle.h>
#include <fastdds/rtps/common/SerializedPayload.h>
#include <fastdds/utils/md5.h>
#include <fastdds/rtps/common/InstanceHandle.hpp>
#include <fastdds/rtps/common/SerializedPayload.hpp>
#include <fastdds/utils/md5.hpp>

#include "$ctx.filename$.hpp"

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

#if !defined(GEN_API_VER) || (GEN_API_VER != 2)
#error \
Expand All @@ -40,7 +40,7 @@ $ctx.directIncludeDependencies : {include | #include "$include$PubSubTypes.h"};

$definitions; separator="\n"$

#endif // _FAST_DDS_GENERATED_$ctx.headerGuardName$_PUBSUBTYPES_H_
#endif // FAST_DDS_GENERATED__$ctx.headerGuardName$_PUBSUBTYPES_HPP
$"\n"$
>>

Expand Down Expand Up @@ -165,10 +165,10 @@ public:
}

eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
$if(struct.isPlain)$
if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION)
if (data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION)
{
return is_plain_xcdrv2_impl();
}
Expand All @@ -194,7 +194,7 @@ public:

#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE

MD5 m_md5;
eprosima::fastdds::MD5 m_md5;
unsigned char* m_keyBuffer;

$if(struct.isPlain)$
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, "PubSubTypes.cpp"], description=["This header file contains the implementation of the serialization functions."])$

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

#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/common/CdrSerialization.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "PubSubTypes.i"], description=["This h
%import(module="fastdds") "fastdds/dds/topic/TopicDataType.hpp";

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

#define GEN_API_VER 2

%include "$ctx.filename$PubSubTypes.h"
%include "$ctx.filename$PubSubTypes.hpp"

>>
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ group ProtocolHeader;
import "eprosima.stg"

main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "Publisher.h"], description=["This header file contains the declaration of the publisher functions."])$
$fileHeader(ctx=ctx, file=[ctx.filename, "Publisher.hpp"], description=["This header file contains the declaration of the publisher functions."])$


#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$_PUBLISHER_H_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$_PUBLISHER_H_
#ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$_PUBLISHER_HPP
#define FAST_DDS_GENERATED__$ctx.headerGuardName$_PUBLISHER_HPP

#include <fastdds/dds/domain/DomainParticipant.hpp>
#include <fastdds/dds/publisher/DataWriter.hpp>
Expand Down Expand Up @@ -66,5 +66,5 @@ private:
listener_;
};

#endif // _FAST_DDS_GENERATED_$ctx.headerGuardName$_PUBLISHER_H_
#endif // FAST_DDS_GENERATED__$ctx.headerGuardName$_PUBLISHER_HPP
>>
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "Publisher.cpp"], description=["This file contains the implementation of the publisher functions."])$


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

#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
#include <fastdds/dds/publisher/Publisher.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ group ProtocolHeader;
import "eprosima.stg"

main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "Subscriber.h"], description=["This header file contains the declaration of the subscriber functions."])$
$fileHeader(ctx=ctx, file=[ctx.filename, "Subscriber.hpp"], description=["This header file contains the declaration of the subscriber functions."])$


#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$_SUBSCRIBER_H_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$_SUBSCRIBER_H_
#ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$_SUBSCRIBER_HPP
#define FAST_DDS_GENERATED__$ctx.headerGuardName$_SUBSCRIBER_HPP

#include <fastdds/dds/domain/DomainParticipant.hpp>
#include <fastdds/dds/subscriber/DataReader.hpp>
Expand Down Expand Up @@ -69,5 +69,5 @@ private:
listener_;
};

#endif // _FAST_DDS_GENERATED_$ctx.headerGuardName$_SUBSCRIBER_H_
#endif // FAST_DDS_GENERATED__$ctx.headerGuardName$_SUBSCRIBER_HPP
>>
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "Subscriber.cpp"], description=["This
#include <fastdds/dds/subscriber/Subscriber.hpp>
#include <fastdds/dds/subscriber/qos/DataReaderQos.hpp>

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

using namespace eprosima::fastdds::dds;

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

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

#include <fastrtps/participant/Participant.h>
#include <fastrtps/attributes/ParticipantAttributes.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ group ProtocolHeader;
import "eprosima.stg"

main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "Serialization.h"], description=["This file contains serialization definitions."])$
$fileHeader(ctx=ctx, file=[ctx.filename, "Serialization.hpp"], description=["This file contains serialization definitions."])$

#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$_SERIALIZATION_H_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$_SERIALIZATION_H_
#ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$_SERIALIZATION_HPP
#define FAST_DDS_GENERATED__$ctx.headerGuardName$_SERIALIZATION_HPP

#include "$ctx.filename$.hpp"

Expand All @@ -29,7 +29,7 @@ $definitions; separator="\n"$
extern bool g_$ctx.filename$_test_null_opt;
extern bool g_$ctx.filename$_test_empty_ext;

#endif //_FAST_DDS_GENERATED_$ctx.headerGuardName$_SERIALIZATION_H_
#endif //FAST_DDS_GENERATED__$ctx.headerGuardName$_SERIALIZATION_HPP
>>

struct_type(ctx, parent, struct, member_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, "SerializationSource.cpp"], description=["This file contains serialization code."])$

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

#include <cassert>
#include <cinttypes>
Expand All @@ -34,7 +34,7 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "SerializationSource.cpp"], descriptio
bool g_$ctx.filename$_test_null_opt = false;
bool g_$ctx.filename$_test_empty_ext = false;

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

$definitions; separator="\n"$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "SerializationTest.cpp"], description=

#include <gtest/gtest.h>

#include "$ctx.filename$PubSubTypes.h"
#include "$ctx.filename$Serialization.h"
#include "$ctx.filename$PubSubTypes.hpp"
#include "$ctx.filename$Serialization.hpp"
#include <fastcdr/Cdr.h>
#include <fastdds/rtps/common/SerializedPayload.h>
#include <fastdds/rtps/common/SerializedPayload.hpp>

$definitions; separator="\n"$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool eprosima::fastcdr::external<eprosima::fastdds::dds::xtypes::TypeIdentifier>
#include <fastdds/dds/xtypes/type_representation/ITypeObjectRegistry.hpp>
#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>
#include <fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp>
#include <fastdds/utils/md5.h>
#include <fastdds/utils/md5.hpp>
#include <gtest/gtest.h>

$ctx.directIncludeDependencies : {include | #include "$include$.hpp"}; separator="\n"$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import "eprosima.stg"
main(ctx, definitions, extensions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "CdrAux.hpp"], description=["This source file contains some definitions of CDR related functions."])$

#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$CDRAUX_HPP_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$CDRAUX_HPP_
#ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$CDRAUX_HPP
#define FAST_DDS_GENERATED__$ctx.headerGuardName$CDRAUX_HPP

#include "$ctx.filename$.hpp"

Expand All @@ -43,7 +43,7 @@ $definitions; separator="\n"$
} // namespace fastcdr
} // namespace eprosima

#endif // _FAST_DDS_GENERATED_$ctx.headerGuardName$CDRAUX_HPP_
#endif // FAST_DDS_GENERATED__$ctx.headerGuardName$CDRAUX_HPP
$"\n"$
>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import "com/eprosima/fastcdr/idl/templates/FastCdrCommon.stg"
main(ctx, definitions, extensions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "CdrAux.ipp"], description=["This source file contains some declarations of CDR related functions."])$

#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$CDRAUX_IPP_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$CDRAUX_IPP_
#ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$CDRAUX_IPP
#define FAST_DDS_GENERATED__$ctx.headerGuardName$CDRAUX_IPP

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

Expand All @@ -42,7 +42,7 @@ $definitions; separator="\n"$
} // namespace fastcdr
} // namespace eprosima

#endif // _FAST_DDS_GENERATED_$ctx.headerGuardName$CDRAUX_IPP_
#endif // FAST_DDS_GENERATED__$ctx.headerGuardName$CDRAUX_IPP
$"\n"$
>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import "eprosima.stg"
main(ctx, definitions) ::= <<
$fileHeader(ctx=ctx, file=[ctx.filename, "TypeObjectSupport.hpp"], description=["Header file containing the API required to register the TypeObject representation of the described types in the IDL file"])$

#ifndef _FAST_DDS_GENERATED_$ctx.headerGuardName$_TYPE_OBJECT_SUPPORT_HPP_
#define _FAST_DDS_GENERATED_$ctx.headerGuardName$_TYPE_OBJECT_SUPPORT_HPP_
#ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$_TYPE_OBJECT_SUPPORT_HPP
#define FAST_DDS_GENERATED__$ctx.headerGuardName$_TYPE_OBJECT_SUPPORT_HPP

#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>

Expand All @@ -42,7 +42,7 @@ $definitions; separator=""$

#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC

#endif // _FAST_DDS_GENERATED_$ctx.headerGuardName$_TYPE_OBJECT_SUPPORT_HPP_
#endif // FAST_DDS_GENERATED__$ctx.headerGuardName$_TYPE_OBJECT_SUPPORT_HPP

>>

Expand Down
Loading