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

Support XCDRv1 and XCDRv2 [19120] #156

Merged
merged 125 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
e07ab90
Refs #18687. Adding EncodingAlgorithmFlag
richiware May 25, 2023
a917f3e
Refs #18687. Fix tests
richiware May 25, 2023
9260904
Refs #18687. First test for optional PLAIN_CDR2
richiware May 26, 2023
8fd5162
Refs #18687. First test for optional PLAIN_CDR and PL_CDR
richiware May 29, 2023
fa44af1
Refs #18687. First test for xcdrv1 members.
richiware May 29, 2023
8eddbf0
Refs #18687. Fix MemberLongHeader for v1: removed flags
richiware May 30, 2023
aa4b64d
Refs #18687. Add CdrVersion
richiware Jun 1, 2023
8944db5
Refs #18687. First tests with xcdrv2
richiware Jun 5, 2023
b9d9865
Refs #18687. Add optional class
richiware Jun 6, 2023
b23986c
Refs #18687. Fix c++11
richiware Jun 7, 2023
3324af3
Refs #18687. Fix contructor for non-trivial classes
richiware Jun 7, 2023
82a7d2a
Refs #18687. Fixes
richiware Jun 7, 2023
cb6bf23
Refs #18687. Fix assign value
richiware Jun 7, 2023
c393103
Refs #18687. Fix integration with fastddsgen
richiware Jun 8, 2023
afa0e44
Refs #18687. Move fixed_string here
richiware Jun 8, 2023
d55b3ea
Refs #18687. Add tests
richiware Jun 9, 2023
b52a70b
Refs #18687. Finish test for primitive types
richiware Jun 12, 2023
87e3ce0
Refs #18687. First tests with alignment
richiware Jun 12, 2023
115891d
Refs #18687. Add support of sequences of maps
richiware Jun 13, 2023
f1e5e2c
Refs #18687. Finish tests for primitive types
richiware Jun 13, 2023
7290eec
Refs #18687. Improve management of recursive inner MemberId
richiware Jun 13, 2023
1c27f56
Refs #18687. Extra check in two tests
richiware Jun 14, 2023
571b65c
Refs #18687. Add operator != to optional
richiware Jun 14, 2023
831f051
Refs #18687. Starting to bring size calculation here
richiware Jun 15, 2023
69e05f4
Refs #18687. Brought size calculation here
richiware Jun 16, 2023
d95d90b
Refs #18687. Add support enums and fixes
richiware Jun 19, 2023
e90d64b
Refs #18687. Improve tests and starting mutables
richiware Jun 20, 2023
b8b1800
Refs #18687. More test
richiware Jun 21, 2023
2df699e
Refs #18687. Support of NEXTINT + DHEADER
richiware Jun 21, 2023
cc5bd2e
Refs #18687. Update optional tests to support serialize_type
richiware Jun 23, 2023
20f6427
Refs #18687. Remove old api functions
richiware Jun 26, 2023
8cc983e
Refs #18687. Little improve
richiware Jun 27, 2023
6206017
Refs #18687. More tests
richiware Jun 28, 2023
b4ada88
Refs #18687. More tests for appendable and mutables
richiware Jun 29, 2023
4e0f3b4
Refs #18687. Support string wstring in xcdr2
richiware Jun 29, 2023
69ee3df
Refs #18687. Added tests for enum
richiware Jun 29, 2023
7868f41
Refs #18687. Support for arrays
richiware Jul 3, 2023
3058a7f
Refs #18687. Support for sequences
richiware Jul 4, 2023
862b60e
Refs #18687. Remove extensibility for collections and add maps
richiware Jul 4, 2023
91cd290
Refs #18687. Fix after rebasing
richiware Jul 4, 2023
1b4a00c
Refs #18687. Fix warnings on windows
richiware Jul 4, 2023
74a4d91
Refs #18687. Fix more warnings
richiware Jul 4, 2023
2a8c473
Refs #18687. Fix more warnings
richiware Jul 4, 2023
e062929
Refs #18687. Fix more warnings
richiware Jul 4, 2023
68509ce
Refs #18687. Fix execution of tests on Windows
richiware Jul 4, 2023
bf9ec4a
Refs #18687. Upgrade CMake version to 3.22
richiware Jul 4, 2023
857b89a
Refs #18687. Fix execution of test in directories with spaces
richiware Jul 5, 2023
c0a6b79
Refs #18687. Fix warning
richiware Jul 5, 2023
b23da04
Refs #18687. Fix compilation error with VS2017
richiware Jul 5, 2023
828e0bb
Refs #18687. Fix test with wchar in Windows
richiware Jul 5, 2023
f880d28
Refs #18687. Fix compilation warnings with VS2017
richiware Jul 5, 2023
57f154f
Refs #18687. Fix compilation warnings with VS2017
richiware Jul 5, 2023
1b5c751
Refs #18687. Fix compilation warnings with VS2017
richiware Jul 5, 2023
bea382a
Refs #18687. Fix compilation warnings with VS2017
richiware Jul 6, 2023
fb8e933
Refs #18687. Add BadOptionalAccessException
richiware Jul 7, 2023
4b68e7d
Refs #18687. optional documented
richiware Jul 7, 2023
2eb7c56
Refs #18687. Fix not pushed exception
richiware Jul 10, 2023
7c8ce34
Refs #18687. Improve doxygen for new features.
richiware Jul 10, 2023
71cbfe9
Refs #18687. Fix compilation error on windows
richiware Jul 10, 2023
4a9ab36
Refs #18687. Bump version 2.0.0
richiware Jul 10, 2023
f95ad1b
Refs #18687. Autoselect of cdr version
richiware Jul 11, 2023
ec5f76a
Refs #18687. Move the calculate_serialized_size to extern
richiware Jul 13, 2023
3cd2048
Refs #18687. Use extern serialize/deserialize and fix bug found in re…
richiware Jul 17, 2023
b9430ce
Refs #18687. Add support for std::bitset
richiware Jul 17, 2023
7c5ee57
Refs #18687. Added empty functions for raw cdr
richiware Jul 17, 2023
e1b8814
Refs #18687. Fix errors
richiware Jul 17, 2023
ea23ad7
Refs #18687. Fix using multi-arrays
richiware Jul 18, 2023
5e28337
Refs #18687. Added tests for fixed_size_string
richiware Jul 18, 2023
29a324d
Refs #18687. Fix recursive containers
richiware Jul 18, 2023
09bc88f
Refs #18687. Remove duplicated code
richiware Jul 18, 2023
bab79e6
Refs #18687. Applying style
richiware Jul 19, 2023
80cb9a6
Refs #18687. Remove old code
richiware Jul 19, 2023
d008a08
Refs #18687. Add missing header licenses
richiware Jul 19, 2023
4c9146f
Refs #18687. Apply suggestions.
richiware Jul 20, 2023
0cdf24b
Refs #18687. Apply suggestions.
richiware Jul 20, 2023
6e50f61
Refs #18687. Apply suggestions.
richiware Jul 20, 2023
5c39d70
Refs #18687. Apply suggestions.
richiware Jul 20, 2023
cb40c35
Refs #18687. Apply suggestions.
richiware Jul 20, 2023
102b45c
Refs #18687. Apply suggestions.
richiware Jul 20, 2023
e158c3c
Refs #18687. Apply suggestions.
richiware Jul 20, 2023
2793b40
Refs #18687. Apply suggestions.
richiware Jul 20, 2023
8463a38
Refs #18687. Add regression test
richiware Jul 20, 2023
e4c7d20
Refs #18687. Fix bug detected in revision
richiware Jul 20, 2023
da42dd0
Refs #18687. Fix wchar_t
richiware Jul 20, 2023
e71e071
Refs #18687. Add bitset to calculator and fix wchar_t
richiware Jul 20, 2023
b6f79d6
Refs #18687. Fix compilation error on Windows
richiware Jul 21, 2023
c662b5e
Refs #18687. BUILD_TESTING OFF by default
richiware Jul 21, 2023
1eeb063
Refs #18687. Activate tests on github action
richiware Jul 21, 2023
c74a523
Refs #18687. Remove EPROSIMA_BUILD
richiware Jul 21, 2023
0f79471
Refs #18687. Change Cdr_DllAPI
richiware Jul 24, 2023
8562bbc
Refs #18687. More Cdr_DllAPI
richiware Jul 24, 2023
61018f9
Refs #18687. Reordering for windows
richiware Jul 24, 2023
0236622
Refs #18687. Fix windows linkage
richiware Jul 25, 2023
7399962
Refs #18687. Fix on windows
richiware Jul 25, 2023
c8db141
Refs #18687. Fix on windows
richiware Jul 25, 2023
f375b28
Refs #18687. Fix on VS 2017
richiware Jul 27, 2023
57be0f8
Refs #18687. Apply suggestions
richiware Jul 27, 2023
7240cee
Refs #18687. Apply suggestions
richiware Jul 27, 2023
bd6085e
Refs #18687. Apply suggestions
richiware Jul 27, 2023
cca8c19
Refs #18687. Apply suggestions
richiware Jul 27, 2023
ac9b778
Refs #18687. Forgot a file
richiware Jul 27, 2023
26349b6
Refs #18687. Fix in sequences
richiware Jul 27, 2023
d9beb9c
Refs #18687. Apply suggestions
richiware Jul 28, 2023
3734b9f
Refs #18687. Add info of tests
richiware Jul 31, 2023
306c650
Refs #18687. Add tests for calculator
richiware Jul 31, 2023
abfe9c4
Refs #18687. Add doxygen for fixed_string
richiware Jul 31, 2023
5a01e48
Refs #18687. Add doxygen for CdrSizeCalculator
richiware Jul 31, 2023
73c44f0
Refs #18687. Fix doxygen
richiware Aug 1, 2023
358ecf1
Refs #18687. Fix in repos file
richiware Aug 2, 2023
7df3d47
Refs #18687. Apply suggestions
richiware Aug 2, 2023
962842f
Refs #18687. Apply suggestions
richiware Aug 23, 2023
7599056
Refs #18687. Don't POP after PUSH(origin=0)
richiware Aug 25, 2023
78371c6
Refs #18687. Apply suggestions
richiware Aug 25, 2023
e13957d
Refs #18687. Add versions.md file
richiware Aug 28, 2023
5a5a280
Refs #18687. Apply suggestions
richiware Aug 28, 2023
ef678e5
Refs #18687. Apply suggestions
richiware Aug 28, 2023
f5c99de
Refs #18687. Apply suggestions
richiware Aug 28, 2023
31b98d9
Refs #18687. Apply suggestions
richiware Aug 28, 2023
55df9fd
Refs #18687. Apply suggestions
richiware Aug 28, 2023
519aa0a
Refs #18687. Fix compilation on Windows.
richiware Aug 29, 2023
d26c7d3
Refs #18687. Fix test on Mac.
richiware Aug 29, 2023
071e283
Refs #18687. Apply suugestions
richiware Sep 5, 2023
6ecd264
Refs #18687. Apply suugestions
richiware Sep 5, 2023
d67ab8a
Refs #18687. Apply suggestions
richiware Sep 5, 2023
10e9235
Refs #18687. Apply suggestions
richiware Sep 5, 2023
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
Prev Previous commit
Next Next commit
Refs #18687. Apply suggestions.
Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
  • Loading branch information
richiware committed Sep 7, 2023
commit 2793b407e3c39d8782251328f3cc60f909230f0a
2 changes: 1 addition & 1 deletion include/fastcdr/Cdr.h
JLBuenoLopez marked this conversation as resolved.
Show resolved Hide resolved
JLBuenoLopez marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Cdr_DllAPI Cdr
//! Stores the last datasize serialized/deserialized when the state was created.
size_t last_data_size_ {0};

//! Next member id which will be encoded.
//! Not related with the state. Next member id which will be encoded.
MemberId next_member_id_;

//! Not related with the state. Used by encoding algorithms to set the encoded member size.
Expand Down
28 changes: 16 additions & 12 deletions src/cpp/Cdr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <cstring>
#include <limits>

#include <fastcdr/Cdr.h>
#include <fastcdr/exceptions/BadParamException.h>

#include <limits>

namespace eprosima {
namespace fastcdr {

Expand All @@ -28,6 +29,8 @@ const Cdr::Endianness Cdr::DEFAULT_ENDIAN = BIG_ENDIANNESS;
const Cdr::Endianness Cdr::DEFAULT_ENDIAN = LITTLE_ENDIANNESS;
#endif // if FASTCDR_IS_BIG_ENDIAN_TARGET

constexpr uint16_t PID_EXTENDED = 0x3F01;
constexpr uint16_t PID_EXTENDED_LENGTH = 0x8;
constexpr uint16_t PID_SENTINEL = 0x3F02;
JLBuenoLopez marked this conversation as resolved.
Show resolved Hide resolved
constexpr uint16_t PID_SENTINEL_LENGTH = 0x0;

Expand Down Expand Up @@ -145,7 +148,8 @@ void Cdr::reset_callbacks()

Cdr& Cdr::read_encapsulation()
{
uint8_t dummy = 0, encapsulation = 0;
uint8_t dummy {0};
uint8_t encapsulation {0};
state state_before_error(*this);

try
Expand Down Expand Up @@ -173,7 +177,7 @@ Cdr& Cdr::read_encapsulation()
}

// Check encapsulationKind correctness
const uint8_t encoding_flag = encapsulation & static_cast<uint8_t>(~0x1_8u);
const uint8_t encoding_flag = encapsulation & static_cast<uint8_t>(~0x1);
switch (encoding_flag)
{
case EncodingAlgorithmFlag::PLAIN_CDR2:
Expand Down Expand Up @@ -2278,9 +2282,9 @@ void Cdr::xcdr1_serialize_long_member_header(
{
make_alignment(alignment(4));

uint16_t flags_and_extended_pid = (member_id.must_understand ? 0x4000 : 0x0) | static_cast<uint16_t>(0x3F01);
uint16_t flags_and_extended_pid = (member_id.must_understand ? 0x4000 : 0x0) | static_cast<uint16_t>(PID_EXTENDED);
serialize(flags_and_extended_pid);
uint16_t size = 8;
uint16_t size = PID_EXTENDED_LENGTH;
serialize(size);
uint32_t id = member_id.id;
serialize(id);
Expand Down Expand Up @@ -2330,9 +2334,9 @@ void Cdr::xcdr1_change_to_long_member_header(
throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT);
}
make_alignment(align);
uint16_t flags_and_extended_pid = (member_id.must_understand ? 0x4000 : 0x0) | static_cast<uint16_t>(0x3F01);
uint16_t flags_and_extended_pid = (member_id.must_understand ? 0x4000 : 0x0) | static_cast<uint16_t>(PID_EXTENDED);
serialize(flags_and_extended_pid);
uint16_t size = 8;
uint16_t size = PID_EXTENDED_LENGTH;
serialize(size);
uint32_t id = member_id.id;
serialize(id);
Expand All @@ -2352,7 +2356,7 @@ bool Cdr::xcdr1_deserialize_member_header(
uint16_t id = (flags_and_member_id & 0x3FFF);


if (0x3F01 > id)
if (PID_EXTENDED > id)
{
member_id.id = id;
uint16_t size = 0;
Expand All @@ -2361,11 +2365,11 @@ bool Cdr::xcdr1_deserialize_member_header(
current_state.header_serialized_ = XCdrHeaderSelection::SHORT_HEADER;
reset_alignment();
}
else if (0x3F01 == id) // PID_EXTENDED
else if (PID_EXTENDED == id) // PID_EXTENDED
{
uint16_t size = 0;
deserialize(size);
if (8 != size)
if (PID_EXTENDED_LENGTH != size)
{
throw BadParamException("PID_EXTENDED comes with a size different than 8");
}
Expand All @@ -2376,7 +2380,7 @@ bool Cdr::xcdr1_deserialize_member_header(
current_state.header_serialized_ = XCdrHeaderSelection::LONG_HEADER;
reset_alignment();
}
else if (0x3F02 == id) // PID_SENTINEL
else if (PID_SENTINEL == id) // PID_SENTINEL
{
uint16_t size = 0;
deserialize(size);
Expand Down