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

Added the credential to writter c3d #89

Merged
merged 1 commit into from
Oct 18, 2019
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
1 change: 1 addition & 0 deletions include/ezc3dConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@

// Write down the version of the ezc3d
#define EZC3D_VERSION "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"
#define EZC3D_CONTACT "[email protected]"

#endif // EZC3D_CONFIG_H
6 changes: 5 additions & 1 deletion src/ezc3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,18 @@ void ezc3d::c3d::write(
params.group("POINT").parameter(frames);
}

// Add the parameter EZC3D:VERSION
// Add the parameter EZC3D:VERSION and EZC3D:CONTACT
if (!params.isGroup("EZC3D")){
params.group(ezc3d::ParametersNS::GroupNS::Group("EZC3D"));
}
// Add/replace the version in the EZC3D group
ezc3d::ParametersNS::GroupNS::Parameter version("VERSION");
version.set(EZC3D_VERSION);
params.group("EZC3D").parameter(version);
// Add/replace the CONTACT in the EZC3D group
ezc3d::ParametersNS::GroupNS::Parameter contact("CONTACT");
contact.set(EZC3D_CONTACT);
params.group("EZC3D").parameter(contact);

std::streampos dataStartParameters(-2); // -1 means not POINT group
params.write(f, dataStartParameters);
Expand Down
2 changes: 2 additions & 0 deletions test/test_ezc3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,8 @@ TEST(c3dFileIO, CreateWriteAndReadBack){
EXPECT_STREQ(read_c3d.parameters().group("ANALOG").parameter("UNITS").valuesAsString()[a].c_str(), "V");
}

EXPECT_STREQ(read_c3d.parameters().group("EZC3D").parameter("VERSION").valuesAsString()[0].c_str(), EZC3D_VERSION);
EXPECT_STREQ(read_c3d.parameters().group("EZC3D").parameter("CONTACT").valuesAsString()[0].c_str(), EZC3D_CONTACT);

// DATA
for (size_t f = 0; f < ref_c3d.nFrames; ++f){
Expand Down