Skip to content

Commit

Permalink
Merge pull request #89 from pariterre/Credentials
Browse files Browse the repository at this point in the history
Added the credential to writter c3d
  • Loading branch information
pariterre authored Oct 18, 2019
2 parents 59c589f + 1d2ac4b commit b6993a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
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

0 comments on commit b6993a9

Please sign in to comment.