Skip to content

Commit

Permalink
Merge pull request #80 from pariterre/dev
Browse files Browse the repository at this point in the history
Fixed a major bug where parameters of group could be swap when reading a file
  • Loading branch information
pariterre authored Oct 11, 2019
2 parents 97809d0 + c4d7c09 commit 91cd0d6
Show file tree
Hide file tree
Showing 24 changed files with 1,318 additions and 856 deletions.
16 changes: 11 additions & 5 deletions include/Analogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class EZC3D_API ezc3d::DataNS::AnalogsNS::Analogs{
///
/// Write all the subframes to a file by calling sequentially the write method of each subframe
///
void write(std::fstream &f) const;
void write(
std::fstream &f) const;


//---- SUBFRAME ----//
Expand All @@ -55,7 +56,8 @@ class EZC3D_API ezc3d::DataNS::AnalogsNS::Analogs{
/// \brief Resize the number of subframes. Warning, this function drops data if subframes is downsized
/// \param nbSubframes The number of subframes to be in the holder
///
void nbSubframes(size_t nbSubframes);
void nbSubframes(
size_t nbSubframes);

///
/// \brief Get a particular subframe of index idx from the analogous data set
Expand All @@ -66,7 +68,8 @@ class EZC3D_API ezc3d::DataNS::AnalogsNS::Analogs{
///
/// Throw a std::out_of_range exception if idx is larger than the number of subframes
///
const ezc3d::DataNS::AnalogsNS::SubFrame& subframe(size_t idx) const;
const ezc3d::DataNS::AnalogsNS::SubFrame& subframe(
size_t idx) const;

///
/// \brief Get a particular subframe of index idx from the analogous data set in order to be modified by the caller
Expand All @@ -78,7 +81,8 @@ class EZC3D_API ezc3d::DataNS::AnalogsNS::Analogs{
///
/// Throw a std::out_of_range exception if idx is larger than the number of subframes
///
ezc3d::DataNS::AnalogsNS::SubFrame& subframe(size_t idx);
ezc3d::DataNS::AnalogsNS::SubFrame& subframe(
size_t idx);

///
/// \brief Add/replace a subframe to the analogous data set
Expand All @@ -92,7 +96,9 @@ class EZC3D_API ezc3d::DataNS::AnalogsNS::Analogs{
/// If idx is larger than the number of subframes, it resize the analogous data set accordingly and add the subframe
/// where it belongs but leaves the other created subframes empty.
///
void subframe(const ezc3d::DataNS::AnalogsNS::SubFrame& subframe, size_t idx = SIZE_MAX);
void subframe(
const ezc3d::DataNS::AnalogsNS::SubFrame& subframe,
size_t idx = SIZE_MAX);

///
/// \brief Get all the subframes from the analogous data set
Expand Down
9 changes: 6 additions & 3 deletions include/Channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class EZC3D_API ezc3d::DataNS::AnalogsNS::Channel{
/// \brief Copy an analog channel
/// \param channel The channel to copy
///
Channel(const ezc3d::DataNS::AnalogsNS::Channel &channel);
Channel(
const ezc3d::DataNS::AnalogsNS::Channel &channel);


//---- STREAM ----//
Expand All @@ -44,7 +45,8 @@ class EZC3D_API ezc3d::DataNS::AnalogsNS::Channel{
///
/// Write the value of the analog data to a file
///
void write(std::fstream &f) const;
void write(
std::fstream &f) const;


//---- DATA ----//
Expand All @@ -61,7 +63,8 @@ class EZC3D_API ezc3d::DataNS::AnalogsNS::Channel{
/// \brief Set the value of the analog data
/// \param value The value of the analog data
///
void data(float value);
void data(
float value);

///
/// \brief Return if the channel is empty
Expand Down
18 changes: 12 additions & 6 deletions include/Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ class EZC3D_API ezc3d::DataNS::Data{
/// \param c3d Reference to the c3d to copy the data in
/// \param file File to copy the data from
///
Data(ezc3d::c3d &c3d,
std::fstream &file);
Data(
ezc3d::c3d &c3d,
std::fstream &file);


//---- STREAM ----//
Expand All @@ -48,7 +49,8 @@ class EZC3D_API ezc3d::DataNS::Data{
///
/// Write all the data to a file by calling sequentially all the write method for all the frames
///
void write(std::fstream &f) const;
void write(
std::fstream &f) const;


//---- FRAME ----//
Expand All @@ -70,7 +72,8 @@ class EZC3D_API ezc3d::DataNS::Data{
///
/// Throw a std::out_of_range exception if idx is larger than the number of frames
///
const ezc3d::DataNS::Frame& frame(size_t idx) const;
const ezc3d::DataNS::Frame& frame(
size_t idx) const;

///
/// \brief Get the frame of index idx in order to be modified by the caller
Expand All @@ -83,7 +86,8 @@ class EZC3D_API ezc3d::DataNS::Data{
/// Throw a std::out_of_range exception if idx is larger than the number of frames
///
///
ezc3d::DataNS::Frame& frame(size_t idx);
ezc3d::DataNS::Frame& frame(
size_t idx);

///
/// \brief Add/replace a frame to the data set
Expand All @@ -97,7 +101,9 @@ class EZC3D_API ezc3d::DataNS::Data{
/// If idx is outside the data set, it resize the data set accordingly and add the frame where it belongs
/// but leaves the other created frames empty.
///
void frame(const ezc3d::DataNS::Frame& frame, size_t idx = SIZE_MAX);
void frame(
const ezc3d::DataNS::Frame& frame,
size_t idx = SIZE_MAX);

///
/// \brief Get all the frames from the data set
Expand Down
16 changes: 11 additions & 5 deletions include/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class EZC3D_API ezc3d::DataNS::Frame{
///
/// Write the frame to a file by calling sequentially the write method for points and analogs
///
void write(std::fstream &f) const;
void write(
std::fstream &f) const;


//---- POINTS ----//
Expand Down Expand Up @@ -88,26 +89,31 @@ class EZC3D_API ezc3d::DataNS::Frame{
/// \brief Add a frame by copying a sent frame
/// \param frame The frame to copy
///
void add(const ezc3d::DataNS::Frame &frame);
void add(
const ezc3d::DataNS::Frame &frame);

///
/// \brief Add points to a frame
/// \param points The 3D points to add
///
void add(const ezc3d::DataNS::Points3dNS::Points &points);
void add(
const ezc3d::DataNS::Points3dNS::Points &points);

///
/// \brief Add analogs to a frame
/// \param analogs The analogous data to add
///
void add(const ezc3d::DataNS::AnalogsNS::Analogs &analogs);
void add(
const ezc3d::DataNS::AnalogsNS::Analogs &analogs);

///
/// \brief Add points and analogs to a frame
/// \param points The 3D points to add
/// \param analogs The analogous data to add
///
void add(const ezc3d::DataNS::Points3dNS::Points &points, const ezc3d::DataNS::AnalogsNS::Analogs &analogs);
void add(
const ezc3d::DataNS::Points3dNS::Points &points,
const ezc3d::DataNS::AnalogsNS::Analogs &analogs);

///
/// \brief Return if the frame is empty
Expand Down
36 changes: 25 additions & 11 deletions include/Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{
/// \param name The name of the group of parameter
/// \param description The description of the group of parameter
///
Group(const std::string &name = "", const std::string &description = "");
Group(
const std::string &name = "",
const std::string &description = "");


//---- STREAM ----//
Expand Down Expand Up @@ -70,7 +72,7 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{
/// \brief Set the name of the group
/// \param name The name of the group
///
void name(const std::string name);
void name(const std::string& name);

///
/// \brief Get the description of the group
Expand All @@ -82,7 +84,7 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{
/// \brief Set the description of the group
/// \param description The description of the group
///
void description(const std::string description);
void description(const std::string& description);

///
/// \brief Get the locking status of the group
Expand Down Expand Up @@ -111,6 +113,14 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{
///
size_t nbParameters() const;

///
/// \brief Return if a parameter of a specific name exists
/// \param parameterName The parameter name to return
/// \return If the parameter exists (true) or not (false)
///
bool isParameter(
const std::string& parameterName) const;

///
/// \brief Get the index of a parameter in the group
/// \param parameterName Name of the parameter
Expand All @@ -120,7 +130,7 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{
///
/// Throw a std::invalid_argument if parameterName is not found
///
size_t parameterIdx(std::string parameterName) const;
size_t parameterIdx(const std::string& parameterName) const;

///
/// \brief Get a particular parameter of index idx from the group
Expand Down Expand Up @@ -152,7 +162,8 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{
///
/// Throw a std::invalid_argument if parameterName is not found
///
const ezc3d::ParametersNS::GroupNS::Parameter& parameter(std::string parameterName) const;
const ezc3d::ParametersNS::GroupNS::Parameter& parameter(
const std::string& parameterName) const;

///
/// \brief Get a particular parameter with the name parameterName from the group in the form of a non-const reference.
Expand All @@ -164,7 +175,8 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{
///
/// Throw a std::invalid_argument if parameterName is not found
///
ezc3d::ParametersNS::GroupNS::Parameter& parameter(std::string parameterName);
ezc3d::ParametersNS::GroupNS::Parameter& parameter(
const std::string& parameterName);

///
/// \brief Add a parameter to the group from a C3D file
Expand All @@ -174,18 +186,20 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{
/// \param nbCharInName The number of character of the parameter name
/// \return
///
int parameter(c3d &c3d,
const Parameters &params,
std::fstream &file,
int nbCharInName);
int parameter(
c3d &c3d,
const Parameters &params,
std::fstream &file,
int nbCharInName);

///
/// \brief Add/replace a parameter to the group
/// \param parameter The parameter to add
///
/// If the parameter sent does not exist in the group, it is appended. Otherwise it is replaced
///
void parameter(const ezc3d::ParametersNS::GroupNS::Parameter& parameter);
void parameter(
const ezc3d::ParametersNS::GroupNS::Parameter& parameter);

///
/// \brief Get all the parameter from the group
Expand Down
Loading

0 comments on commit 91cd0d6

Please sign in to comment.