diff --git a/CMakeLists.txt b/CMakeLists.txt index 007fc5fc..8b3978fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ set(SRC_LIST src/AnalogsSubframe.cpp src/Channel.cpp src/Data.cpp + src/DataStartInfo.cpp src/ezc3d.cpp src/Frame.cpp src/Group.cpp diff --git a/binding/ezc3d.i b/binding/ezc3d.i index ec290c5e..9158a991 100644 --- a/binding/ezc3d.i +++ b/binding/ezc3d.i @@ -58,6 +58,7 @@ namespace std { #define __attribute__(x) %include "ezc3dConfig.h" +%include "ezc3dNamespace.h" %include "ezc3d.h" %include "math/Matrix.h" %include "math/Matrix33.h" diff --git a/binding/matlab/ezc3dRead.cpp b/binding/matlab/ezc3dRead.cpp index 7a96a67c..46f53ad1 100644 --- a/binding/matlab/ezc3dRead.cpp +++ b/binding/matlab/ezc3dRead.cpp @@ -8,6 +8,8 @@ #include "Parameters.h" #include "Data.h" #include "modules/ForcePlatforms.h" +#include +#include void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[]) { diff --git a/binding/matlab/utils.cpp b/binding/matlab/utils.cpp index bbf7e918..34e2d81f 100644 --- a/binding/matlab/utils.cpp +++ b/binding/matlab/utils.cpp @@ -1,8 +1,12 @@ #include "mex.h" #include +#ifdef _WIN32 +#include +#endif #include #include "utils.h" +#include mxArray * fillMetadata( mxArray *field, diff --git a/binding/octave/ezc3dRead.cpp b/binding/octave/ezc3dRead.cpp index c4e05384..cbd621e7 100644 --- a/binding/octave/ezc3dRead.cpp +++ b/binding/octave/ezc3dRead.cpp @@ -12,6 +12,8 @@ #endif #include "Frame.h" #include "modules/ForcePlatforms.h" +#include +#include void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[]) { diff --git a/binding/octave/utils.cpp b/binding/octave/utils.cpp index c65ca912..33493bb2 100644 --- a/binding/octave/utils.cpp +++ b/binding/octave/utils.cpp @@ -1,8 +1,13 @@ #include "mex.h" #include +#include +#ifdef _WIN32 +#include +#endif #include #include "utils.h" +#include mxArray * fillMetadata( mxArray *field, diff --git a/examples/force_plate_example.cpp b/examples/force_plate_example.cpp index 027ba781..9af0572e 100644 --- a/examples/force_plate_example.cpp +++ b/examples/force_plate_example.cpp @@ -1,5 +1,6 @@ -#include #include "ezc3d_all.h" +#include +#include int main() { diff --git a/include/AnalogsInfo.h b/include/AnalogsInfo.h index 1b64e21a..b158bdc2 100644 --- a/include/AnalogsInfo.h +++ b/include/AnalogsInfo.h @@ -8,7 +8,8 @@ /// \date April 30th, 2022 /// -#include "ezc3d.h" +#include "ezc3dNamespace.h" +#include /// /// \brief 3D rotation data diff --git a/include/AnalogsSubframe.h b/include/AnalogsSubframe.h index 2f50d260..1e9473e6 100644 --- a/include/AnalogsSubframe.h +++ b/include/AnalogsSubframe.h @@ -9,6 +9,7 @@ /// #include "Channel.h" +#include /// /// \brief Subframe for the analogous data diff --git a/include/Channel.h b/include/Channel.h index 8987ea20..91ce7fb2 100644 --- a/include/Channel.h +++ b/include/Channel.h @@ -8,7 +8,7 @@ /// \date October 17th, 2018 /// -#include "ezc3d.h" +#include "ezc3dNamespace.h" /// /// \brief Channel of an analogous data diff --git a/include/Data.h b/include/Data.h index e3ec01c9..d06db422 100644 --- a/include/Data.h +++ b/include/Data.h @@ -45,16 +45,20 @@ class EZC3D_API ezc3d::DataNS::Data{ /// /// \brief Write all the data to an opened file + /// \param The header of a c3d /// \param f Already opened fstream file with write access /// \param pointScaleFactor The factor to scale the point data with /// \param analogScaleFactors The factors to scale the analog data with + /// \param dataStartInfoToFill The start position to fill /// /// Write all the data to a file by calling sequentially all the write method for all the frames /// void write( + const ezc3d::Header& header, std::fstream &f, float pointScaleFactor, - std::vector analogScaleFactors) const; + std::vector analogScaleFactors, + ezc3d::DataStartInfo& dataStartInfoToFill) const; //---- FRAME ----// diff --git a/include/DataStartInfo.h b/include/DataStartInfo.h new file mode 100644 index 00000000..efba82cc --- /dev/null +++ b/include/DataStartInfo.h @@ -0,0 +1,156 @@ +#ifndef DATA_START_INFO_H +#define DATA_START_INFO_H +/// +/// \file DataStartInfo.h +/// \brief Declaration of DataStartInfo class +/// \author Pariterre +/// \version 1.0 +/// \date October 17th, 2018 +/// + +#include "ezc3dNamespace.h" +#include + +/// +/// \brief Placeholder for stocking the position and value of data start +/// +class EZC3D_API ezc3d::DataStartInfo{ + +protected: + bool m_hasPointDataStart = false; ///< If the point data start is set + std::streampos m_pointDataStart; ///< The data start for the points + +public: + /// + /// \brief Returns if the point data start is set + /// \return If the point data start is set + /// + bool hasPointDataStart() const; + + /// + /// \brief The point data start + /// \param value The starting position of the points data in the c3d file + /// + void setPointDataStart(const std::streampos& value); + + /// + /// \brief Get the point data start + /// \return The point data start + /// + const std::streampos& pointDataStart() const; + + +protected: + bool m_hasHeaderPointDataStart = false; ///< If the point data start is set for the header + std::streampos m_headerPointDataStart; ///< Position in the c3d to put the point start start in the header + DATA_TYPE m_headerPointDataStartSize = DATA_TYPE::WORD; ///< The size of the value in the c3d file + +public: + /// + /// \brief Returns if the point data start is set for the header + /// \return If the point data start is set for the header + /// + bool hasHeaderPointDataStart() const; + + /// + /// \brief The position in the c3d where to put the header point data start + /// \param position + /// + void setHeaderPositionInC3dForPointDataStart(const std::streampos& position); + + /// + /// \brief Get the position in the c3d to put the point start start in the header + /// \return The position in the c3d to put the point start start in the header + /// + const std::streampos& headerPointDataStart() const; + + /// + /// \brief Get the size of the value in the c3d file header + /// \return The size of the value in the c3d file header + /// + DATA_TYPE headerPointDataStartSize() const; + +protected: + bool m_hasParameterPointDataStart = false; ///< If the point data start is set for the parameters + std::streampos m_parameterPointDataStart; ///< Position in the c3d to put the point start start in the parameters + DATA_TYPE m_parameterPointDataStartSize = DATA_TYPE::BYTE; ///< The size of the value in the c3d file + +public: + /// + /// \brief Returns if the point data start is set for the parameters + /// \return If the point data start is set for the parameters + /// + bool hasParameterPointDataStart() const; + /// + /// \brief The position in the c3d where to put the parameter point data start + /// \param position + /// + void setParameterPositionInC3dForPointDataStart(const std::streampos& position); + + /// + /// \brief Get the position in the c3d to put the point start start in the parameters + /// \return The position in the c3d to put the point start start in the parameters + /// + const std::streampos& parameterPointDataStart() const; + + /// + /// \brief Get the size of the value in the c3d file parameter + /// \return The size of the value in the c3d file parameter + /// + DATA_TYPE parameterPointDataStartSize() const; + +protected: + bool m_hasRotationDataStart = false; ///< If the rotation data start is set + std::streampos m_rotationsDataStart; ///< The data start for the rotations + +public: + /// + /// \brief Returns if the rotations data start is set + /// \return If the rotations data start is set + /// + bool hasRotationsDataStart() const; + + /// + /// \brief The rotations data start + /// \param value The starting position of the rotations data in the c3d file + /// + void setRotationsDataStart(const std::streampos& value); + + /// + /// \brief Get the rotations data start + /// \return The rotations data start + /// + const std::streampos& rotationsDataStart() const; + +protected: + bool m_hasParameterRotationsDataStart = false; ///< If the rotations data start is set for the parameters + std::streampos m_parameterRotationsDataStart; ///< Position in the c3d to put the rotations start start in the parameters + DATA_TYPE m_parameterRotationsDataStartSize = DATA_TYPE::BYTE; ///< The size of the value in the c3d file + +public: + /// + /// \brief Returns if the rotations data start is set for the parameters + /// \return If the rotations data start is set for the parameters + /// + bool hasParameterRotationsDataStart() const; + + /// + /// \brief The position in the c3d where to put the parameter rotations data start + /// \param position + /// + void setParameterPositionInC3dForRotationsDataStart(const std::streampos& position); + + /// + /// \brief Get the position in the c3d to put the rotations start start in the parameters + /// \return The position in the c3d to put the rotations start start in the parameters + /// + const std::streampos& parameterRotationsDataStart() const; + + /// + /// \brief Get the size of the value in the c3d file parameter + /// \return The size of the value in the c3d file parameter + /// + DATA_TYPE parameterRotationsDataStartSize() const; +}; + +#endif diff --git a/include/Frame.h b/include/Frame.h index ccbe6f31..e312f9a7 100644 --- a/include/Frame.h +++ b/include/Frame.h @@ -39,13 +39,15 @@ class EZC3D_API ezc3d::DataNS::Frame{ /// \param f Already opened fstream file with write access /// \param pointScaleFactor The factor to scale the point data with /// \param analogScaleFactors The factor to scale the analog data with + /// \param dataTypeToWrite The type of data block (0 points/analogs, 1 rotations) /// /// Write the frame to a file by calling sequentially the write method for points and analogs /// void write( std::fstream &f, float pointScaleFactor, - std::vector analogScaleFactors) const; + std::vector analogScaleFactors, + int dataTypeToWrite) const; //---- POINTS ----// diff --git a/include/Group.h b/include/Group.h index c4b20a40..010ec2cf 100644 --- a/include/Group.h +++ b/include/Group.h @@ -37,9 +37,12 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{ /// \brief Write the group to an opened file by calling the write method of all the parameters /// \param f Already opened fstream file with write access /// \param groupIdx Index of the group that this particular parameter is in - /// \param dataStartPosition The position in the file where the data start (special case for POINT:DATA_START parameter) + /// \param dataStartPositionToFill The position in the file where the data start (special case for POINT:DATA_START and ROTATION:DATA_START parameters) /// - void write(std::fstream &f, int groupIdx, std::streampos &dataStartPosition) const; + void write( + std::fstream &f, + int groupIdx, + ezc3d::DataStartInfo &dataStartPositionToFill) const; /// /// \brief Read and store a group of parameter from an opened C3D file @@ -49,10 +52,11 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Group{ /// \param nbCharInName The number of character of the group name /// \return The position in the file of the next Group/Parameter /// - int read(ezc3d::c3d &c3d, - const Parameters ¶ms, - std::fstream &file, - int nbCharInName); + int read( + ezc3d::c3d &c3d, + const Parameters ¶ms, + std::fstream &file, + int nbCharInName); /// /// \brief isEmpty If the group has no name and no parameter, it is considered empty diff --git a/include/Header.h b/include/Header.h index 58a5eee7..e148ad64 100644 --- a/include/Header.h +++ b/include/Header.h @@ -8,7 +8,8 @@ /// \date October 17th, 2018 /// -#include "ezc3d.h" +#include "ezc3dNamespace.h" +#include /// /// \brief Header of a C3D file @@ -41,11 +42,11 @@ class EZC3D_API ezc3d::Header{ /// /// \brief Write the header to an opened file /// \param f Already opened fstream file with write access - /// \param dataStartPosition Returns the byte where to put the data start parameter + /// \param dataStartPositionToFill Returns the byte where to put the data start parameter /// void write( std::fstream &f, - std::streampos &dataStartPosition) const; + ezc3d::DataStartInfo &dataStartPositionToFill) const; /// /// \brief Read and store a header from an opened C3D file diff --git a/include/Parameter.h b/include/Parameter.h index db20b741..3cda65a2 100644 --- a/include/Parameter.h +++ b/include/Parameter.h @@ -8,7 +8,12 @@ /// \date October 17th, 2018 /// -#include "ezc3d.h" +#include "ezc3dNamespace.h" +#include +#include +#ifdef _WIN32 +#include +#endif /// /// \brief Parameter of a C3D file @@ -37,14 +42,16 @@ class EZC3D_API ezc3d::ParametersNS::GroupNS::Parameter{ /// \brief Write the parameter to an opened file /// \param f Already opened fstream file with write access /// \param groupIdx Index of the group that this particular parameter is in - /// \param dataStartPosition The position in the file where the data start (special case for POINT:DATA_START parameter) + /// \param dataStartPositionToFill The position in the file where the data start (special case for POINT:DATA_START and ROTATION:DATA_START parameters) + /// \param dataStartType The type of data start (-1 no data start, 0 points, 1 rotations) /// /// Write the parameter and its values to a file /// void write( std::fstream &f, int groupIdx, - std::streampos &dataStartPosition) const; + ezc3d::DataStartInfo &dataStartPositionToFill, + int dataStartType) const; protected: /// diff --git a/include/Parameters.h b/include/Parameters.h index 5bb2b2dc..448ed79e 100644 --- a/include/Parameters.h +++ b/include/Parameters.h @@ -67,13 +67,13 @@ class EZC3D_API ezc3d::ParametersNS::Parameters{ /// /// \brief Write the groups to an opened file by calling the write method of all the groups /// \param f Already opened fstream file with write access - /// \param dataStartPosition Returns the byte where to put the data start parameter + /// \param dataStartPositionToFill Returns the byte where to put the data start parameter /// \param header A reference to the header section /// \param format What order should the file has /// ezc3d::ParametersNS::Parameters write( std::fstream &f, - std::streampos &dataStartPosition, + ezc3d::DataStartInfo &dataStartPositionToFill, const ezc3d::Header& header, const ezc3d::WRITE_FORMAT& format = ezc3d::WRITE_FORMAT::DEFAULT ) const; diff --git a/include/PointsInfo.h b/include/PointsInfo.h index 866f0e86..92e77afb 100644 --- a/include/PointsInfo.h +++ b/include/PointsInfo.h @@ -8,7 +8,7 @@ /// \date April 30th, 2022 /// -#include "ezc3d.h" +#include "ezc3dNamespace.h" /// /// \brief 3D rotation data diff --git a/include/RotationsInfo.h b/include/RotationsInfo.h index 010ba9b3..f38d473e 100644 --- a/include/RotationsInfo.h +++ b/include/RotationsInfo.h @@ -8,7 +8,7 @@ /// \date April 30th, 2022 /// -#include "ezc3d.h" +#include "ezc3dNamespace.h" /// /// \brief 3D rotation data diff --git a/include/ezc3d.h b/include/ezc3d.h index 0c1c29bf..e16efb62 100644 --- a/include/ezc3d.h +++ b/include/ezc3d.h @@ -36,143 +36,11 @@ /// // Includes for standard library -#include -#include #include -#include #include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#endif #include "ezc3dConfig.h" - -/// -/// \brief Namespace ezc3d -/// -/// Useful functions, enum and misc useful for the ezc3d project -/// -namespace ezc3d { - // ---- UTILS ---- // - /// - /// \brief Enum that describes the size of different types - /// - enum DATA_TYPE{ - CHAR = -1, - BYTE = 1, - INT = 2, - WORD = 2, - FLOAT = 4, - NO_DATA_TYPE = 10000 - }; - - /// - /// \brief The type of processor used to store the data - /// - enum PROCESSOR_TYPE{ - INTEL = 84, - DEC = 85, - MIPS = 86, - NO_PROCESSOR_TYPE = INTEL - }; - - /// - /// \brief The order of the parameters in the new c3d file - /// - enum WRITE_FORMAT{ - DEFAULT=0, - NEXUS - }; - - /// - /// \brief Remove the spaces at the end of a string - /// \param str The string to remove the trailing spaces from. - /// - /// The function receive a string and modify it by remove the trailing spaces - /// - EZC3D_API void removeTrailingSpaces(std::string& str); - - /// - /// \brief Swap all characters of a string to capital letters - /// \param str The string to capitalize - /// - EZC3D_API std::string toUpper(const std::string &str); - - - // ---- FORWARD DECLARATION OF THE WHOLE PROJECT STRUCTURE ----// - class c3d; - class EZC3D_API Matrix; - class EZC3D_API Matrix33; - class EZC3D_API Matrix44; - class EZC3D_API Matrix66; - class EZC3D_API Vector3d; - class EZC3D_API Vector6d; - class EZC3D_API Header; - - /// - /// \brief Namespace that holds the Parameters hierarchy - /// - namespace ParametersNS { - class EZC3D_API Parameters; - - /// - /// \brief Namespace that holds the Group and Parameter classes - /// - namespace GroupNS { - class EZC3D_API Group; - class EZC3D_API Parameter; - } - } - - /// - /// \brief Namespace that holds the Data hierarchy - /// - namespace DataNS { - class EZC3D_API Data; - - class Frame; - /// - /// \brief Namespace that holds the Points hierarchy - /// - namespace Points3dNS { - class EZC3D_API Points; - class EZC3D_API Point; - class EZC3D_API Info; - } - /// - /// \brief Namespace that holds the Analogs hierarchy - /// - namespace AnalogsNS { - class EZC3D_API Analogs; - class EZC3D_API SubFrame; - class EZC3D_API Channel; - class EZC3D_API Info; - } - - /// - /// \brief Namespace that holds the Rotations hierarchy - /// - namespace RotationNS { - class EZC3D_API Rotations; - class EZC3D_API Rotation; - class EZC3D_API SubFrame; - class EZC3D_API Info; - } - } - - - /// - /// \brief Namespace for all the analysis modules - /// - namespace Modules { - class EZC3D_API ForcePlatform; - class EZC3D_API ForcePlatforms; - } -} +#include "ezc3dNamespace.h" /// /// \brief Main class for C3D holder @@ -245,7 +113,7 @@ class EZC3D_API ezc3d::c3d { unsigned int nByteToRead, std::vector& c, int nByteFromPrevious = 0, - const std::ios_base::seekdir &pos = std::ios::cur); + const std::ios_base::seekdir &pos = std::ios::cur); /// /// \brief Convert an hexadecimal value to an unsigned integer @@ -267,11 +135,9 @@ class EZC3D_API ezc3d::c3d { /// \brief Write the data_start parameter where demanded /// \param file opened file stream to be read /// \param dataStartPosition The position in block of the data - /// \param type The type of data to write /// void writeDataStart(std::fstream &file, - const std::streampos& dataStartPosition, - const DATA_TYPE &type) const; + const ezc3d::DataStartInfo& dataStartPosition) const; public: /// @@ -373,6 +239,12 @@ class EZC3D_API ezc3d::c3d { const std::vector &dimension, std::vector ¶m_data); + /// + /// \brief Advance the cursor in a file to a new 512 bytes block + /// \param file The file stream + /// + static void moveCursorToANewBlock( + std::fstream & file); protected: /// /// \brief Internal function to dispatch a string array to a matrix of strings diff --git a/include/ezc3dNamespace.h b/include/ezc3dNamespace.h new file mode 100644 index 00000000..ae3e9c34 --- /dev/null +++ b/include/ezc3dNamespace.h @@ -0,0 +1,170 @@ +#ifndef EZC3D_NAMESPACE_H +#define EZC3D_NAMESPACE_H +/// +/// \file ezc3d_namespace.h +/// \brief Declaration of the ezc3d namespace +/// \author Pariterre +/// \version 1.0 +/// \date October 17th, 2018 +/// + +/// +/// \mainpage Documentation of ezc3d +/// +/// \section intro_sec Introduction +/// +/// This is the document for the library ezc3d +/// (http://github.com/pyomeca/ezc3d). The main goal of +/// this library is to eazily create, read and modify c3d (http://c3d.org) +/// files, largely used in biomechanics. +/// +/// This documentation was automatically generated for the "Nostalgia" Release 1.1.0 on the 9th of August, 2019. +/// +/// \section install_sec Installation +/// +/// To install ezc3d, please refer to the README.md file accessible via the github repository or by following this +/// link. +/// +/// \section contact_sec Contact +/// +/// If you have any questions, comments or suggestions for future development, you are very welcomed to +/// send me an email at pariterre@gmail.com. +/// +/// \section conclusion_sec Conclusion +/// +/// Enjoy C3D files! +/// + +// Includes for standard library +#include + +#include "ezc3dConfig.h" +#ifdef _WIN32 +#include +#endif + +/// +/// \brief Namespace ezc3d +/// +/// Useful functions, enum and misc useful for the ezc3d project +/// +namespace ezc3d { + // ---- UTILS ---- // + /// + /// \brief Enum that describes the size of different types + /// + enum DATA_TYPE{ + CHAR = -1, + BYTE = 1, + INT = 2, + WORD = 2, + FLOAT = 4, + NO_DATA_TYPE = 10000 + }; + + /// + /// \brief The type of processor used to store the data + /// + enum PROCESSOR_TYPE{ + INTEL = 84, + DEC = 85, + MIPS = 86, + NO_PROCESSOR_TYPE = INTEL + }; + + /// + /// \brief The order of the parameters in the new c3d file + /// + enum WRITE_FORMAT{ + DEFAULT=0, + NEXUS + }; + + /// + /// \brief Remove the spaces at the end of a string + /// \param str The string to remove the trailing spaces from. + /// + /// The function receive a string and modify it by remove the trailing spaces + /// + EZC3D_API void removeTrailingSpaces(std::string& str); + + /// + /// \brief Swap all characters of a string to capital letters + /// \param str The string to capitalize + /// + EZC3D_API std::string toUpper(const std::string &str); + + + // ---- FORWARD DECLARATION OF THE WHOLE PROJECT STRUCTURE ----// + class c3d; + class EZC3D_API Matrix; + class EZC3D_API Matrix33; + class EZC3D_API Matrix44; + class EZC3D_API Matrix66; + class EZC3D_API Vector3d; + class EZC3D_API Vector6d; + class EZC3D_API Header; + class DataStartInfo; + + /// + /// \brief Namespace that holds the Parameters hierarchy + /// + namespace ParametersNS { + class EZC3D_API Parameters; + + /// + /// \brief Namespace that holds the Group and Parameter classes + /// + namespace GroupNS { + class EZC3D_API Group; + class EZC3D_API Parameter; + } + } + + /// + /// \brief Namespace that holds the Data hierarchy + /// + namespace DataNS { + class EZC3D_API Data; + + class Frame; + /// + /// \brief Namespace that holds the Points hierarchy + /// + namespace Points3dNS { + class EZC3D_API Points; + class EZC3D_API Point; + class EZC3D_API Info; + } + /// + /// \brief Namespace that holds the Analogs hierarchy + /// + namespace AnalogsNS { + class EZC3D_API Analogs; + class EZC3D_API SubFrame; + class EZC3D_API Channel; + class EZC3D_API Info; + } + + /// + /// \brief Namespace that holds the Rotations hierarchy + /// + namespace RotationNS { + class EZC3D_API Rotations; + class EZC3D_API Rotation; + class EZC3D_API SubFrame; + class EZC3D_API Info; + } + } + + + /// + /// \brief Namespace for all the analysis modules + /// + namespace Modules { + class EZC3D_API ForcePlatform; + class EZC3D_API ForcePlatforms; + } +} +#endif + diff --git a/include/ezc3d_all.h b/include/ezc3d_all.h index 50f2b499..d8694aa3 100644 --- a/include/ezc3d_all.h +++ b/include/ezc3d_all.h @@ -8,8 +8,9 @@ /// \date March 27th, 2020 /// - +#include "ezc3dNamespace.h" #include "math/ezc3dMath.h" +#include "ezc3d.h" #include "Header.h" #include "Parameters.h" #include "Data.h" diff --git a/include/math/Matrix.h b/include/math/Matrix.h index f62ece99..3e44a0ef 100644 --- a/include/math/Matrix.h +++ b/include/math/Matrix.h @@ -8,7 +8,8 @@ /// \date March 25th, 2020 /// -#include "ezc3d.h" +#include "ezc3dNamespace.h" +#include /// /// \brief Matrix of unknown dimension diff --git a/include/modules/ForcePlatforms.h b/include/modules/ForcePlatforms.h index 1aabe443..f986223e 100644 --- a/include/modules/ForcePlatforms.h +++ b/include/modules/ForcePlatforms.h @@ -8,11 +8,12 @@ /// \date March 25th, 2020 /// -#include "ezc3d.h" +#include "ezc3dNamespace.h" #include "math/Matrix33.h" #include "math/Matrix66.h" #include "math/Vector3d.h" +#include /// /// \brief Force Platform analyse diff --git a/src/Analogs.cpp b/src/Analogs.cpp index ccdc5cf3..aa0abd98 100644 --- a/src/Analogs.cpp +++ b/src/Analogs.cpp @@ -8,7 +8,10 @@ /// #include "Analogs.h" +#include "ezc3d.h" #include "Header.h" +#include +#include ezc3d::DataNS::AnalogsNS::Analogs::Analogs() { diff --git a/src/AnalogsInfo.cpp b/src/AnalogsInfo.cpp index 98d0749f..d04b6836 100644 --- a/src/AnalogsInfo.cpp +++ b/src/AnalogsInfo.cpp @@ -8,6 +8,7 @@ /// #include "AnalogsInfo.h" +#include "ezc3d.h" #include "Header.h" #include "Parameters.h" diff --git a/src/AnalogsSubframe.cpp b/src/AnalogsSubframe.cpp index 33002963..90adda5d 100644 --- a/src/AnalogsSubframe.cpp +++ b/src/AnalogsSubframe.cpp @@ -8,7 +8,9 @@ /// #include "AnalogsSubframe.h" +#include "ezc3d.h" #include "Header.h" +#include ezc3d::DataNS::AnalogsNS::SubFrame::SubFrame() { diff --git a/src/Channel.cpp b/src/Channel.cpp index faf2a4a8..5c6ae1c0 100644 --- a/src/Channel.cpp +++ b/src/Channel.cpp @@ -8,8 +8,10 @@ /// #include "Channel.h" +#include "ezc3d.h" #include "Header.h" #include "AnalogsInfo.h" +#include ezc3d::DataNS::AnalogsNS::Channel::Channel() { diff --git a/src/Data.cpp b/src/Data.cpp index feb52e12..54cae2d9 100644 --- a/src/Data.cpp +++ b/src/Data.cpp @@ -8,11 +8,15 @@ /// #include "Data.h" +#include "ezc3d.h" #include "Header.h" #include "Parameters.h" #include "AnalogsInfo.h" #include "PointsInfo.h" #include "RotationsInfo.h" +#include "DataStartInfo.h" +#include +#include ezc3d::DataNS::Data::Data() { } @@ -63,11 +67,22 @@ void ezc3d::DataNS::Data::print() const { } void ezc3d::DataNS::Data::write( + const ezc3d::Header& header, std::fstream &f, float pointScaleFactor, - std::vector analogScaleFactors) const { + std::vector analogScaleFactors, + ezc3d::DataStartInfo& dataStartInfoToFill) const { + + dataStartInfoToFill.setPointDataStart(f.tellg()); for (size_t i = 0; i < nbFrames(); ++i) - frame(i).write(f, pointScaleFactor, analogScaleFactors); + frame(i).write(f, pointScaleFactor, analogScaleFactors, 0); + + if (header.hasRotationalData()){ + ezc3d::c3d::moveCursorToANewBlock(f); + dataStartInfoToFill.setRotationsDataStart(f.tellg()); + for (size_t i = 0; i < nbFrames(); ++i) + frame(i).write(f, pointScaleFactor, analogScaleFactors, 1); + } } size_t ezc3d::DataNS::Data::nbFrames() const { diff --git a/src/DataStartInfo.cpp b/src/DataStartInfo.cpp new file mode 100644 index 00000000..100d9b58 --- /dev/null +++ b/src/DataStartInfo.cpp @@ -0,0 +1,121 @@ +#define EZC3D_API_EXPORTS +/// +/// \file DataStartInfo.cpp +/// \brief Implementation of DataStartInfo class +/// \author Pariterre +/// \version 1.0 +/// \date October 17th, 2018 +/// + +#include "DataStartInfo.h" +#include + +bool ezc3d::DataStartInfo::hasPointDataStart() const +{ + return m_hasPointDataStart; +} + +void ezc3d::DataStartInfo::setPointDataStart( + const std::streampos &value) +{ + m_pointDataStart = value; + if (int(m_pointDataStart) % 512 > 0) + throw std::out_of_range( + "Something went wrong in the positioning of the pointer " + "for writting the data. Please report this error."); + m_hasPointDataStart = true; +} + +const std::streampos &ezc3d::DataStartInfo::pointDataStart() const +{ + return m_pointDataStart; +} + +bool ezc3d::DataStartInfo::hasHeaderPointDataStart() const +{ + return m_hasHeaderPointDataStart; +} + +void ezc3d::DataStartInfo::setHeaderPositionInC3dForPointDataStart( + const std::streampos &position) +{ + m_headerPointDataStart = position; + m_hasHeaderPointDataStart = true; +} + +const std::streampos &ezc3d::DataStartInfo::headerPointDataStart() const +{ + return m_headerPointDataStart; +} + +ezc3d::DATA_TYPE ezc3d::DataStartInfo::headerPointDataStartSize() const +{ + return m_headerPointDataStartSize; +} + +bool ezc3d::DataStartInfo::hasParameterPointDataStart() const +{ + return m_hasParameterPointDataStart; +} + +void ezc3d::DataStartInfo::setParameterPositionInC3dForPointDataStart( + const std::streampos &position) +{ + m_parameterPointDataStart = position; + m_hasParameterPointDataStart = true; +} + +const std::streampos &ezc3d::DataStartInfo::parameterPointDataStart() const +{ + return m_parameterPointDataStart; +} + +ezc3d::DATA_TYPE ezc3d::DataStartInfo::parameterPointDataStartSize() const +{ + return m_parameterPointDataStartSize; +} + +bool ezc3d::DataStartInfo::hasRotationsDataStart() const +{ + return m_hasRotationDataStart; +} + +void ezc3d::DataStartInfo::setRotationsDataStart( + const std::streampos &value) +{ + m_rotationsDataStart = value; + if (int(m_rotationsDataStart) % 512 > 0) + throw std::out_of_range( + "Something went wrong in the positioning of the pointer " + "for writting the data. Please report this error."); + m_hasRotationDataStart = true; +} + +const std::streampos &ezc3d::DataStartInfo::rotationsDataStart() const +{ + return m_rotationsDataStart; +} + +bool ezc3d::DataStartInfo::hasParameterRotationsDataStart() const +{ + return m_hasRotationDataStart; +} + +void ezc3d::DataStartInfo::setParameterPositionInC3dForRotationsDataStart( + const std::streampos &position) +{ + m_parameterRotationsDataStart = position; + m_hasParameterRotationsDataStart = true; +} + +const std::streampos &ezc3d::DataStartInfo::parameterRotationsDataStart() const +{ + return m_parameterRotationsDataStart; +} + +ezc3d::DATA_TYPE ezc3d::DataStartInfo::parameterRotationsDataStartSize() const +{ + return m_parameterRotationsDataStartSize; +} + + diff --git a/src/Frame.cpp b/src/Frame.cpp index 6061fb72..48c80461 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -8,6 +8,8 @@ /// #include "Frame.h" +#include "DataStartInfo.h" +#include ezc3d::DataNS::Frame::Frame() { _points = std::shared_ptr( @@ -27,10 +29,16 @@ void ezc3d::DataNS::Frame::print() const { void ezc3d::DataNS::Frame::write( std::fstream &f, float pointScaleFactor, - std::vector analogScaleFactors) const { - points().write(f, pointScaleFactor); - analogs().write(f, analogScaleFactors); - rotations().write(f); + std::vector analogScaleFactors, + int dataTypeToWrite) const { + if (dataTypeToWrite == 0){ // Points and analogs + points().write(f, pointScaleFactor); + analogs().write(f, analogScaleFactors); + } else if (dataTypeToWrite == 1) { // Rotations + rotations().write(f); + } else { + throw std::runtime_error("Data type not implemented yet"); + } } const ezc3d::DataNS::Points3dNS::Points& ezc3d::DataNS::Frame::points() const { diff --git a/src/Group.cpp b/src/Group.cpp index 7504b7f4..6cb9f3d4 100644 --- a/src/Group.cpp +++ b/src/Group.cpp @@ -8,7 +8,10 @@ /// #include "Group.h" +#include "ezc3d.h" #include "Parameters.h" +#include +#include ezc3d::ParametersNS::GroupNS::Group::Group( const std::string &name, @@ -33,7 +36,7 @@ void ezc3d::ParametersNS::GroupNS::Group::print() const { void ezc3d::ParametersNS::GroupNS::Group::write( std::fstream &f, int groupIdx, - std::streampos &dataStartPosition) const { + ezc3d::DataStartInfo &dataStartPositionToFill) const { int nCharName(static_cast(name().size())); if (isLocked()) nCharName *= -1; @@ -64,12 +67,15 @@ void ezc3d::ParametersNS::GroupNS::Group::write( 2*ezc3d::DATA_TYPE::BYTE); f.seekg(currentPos); - std::streampos defaultDataStartPosition(-1); - for (size_t i=0; i < nbParameters(); ++i) + for (size_t i=0; i < nbParameters(); ++i){ + int tagForDataStartFilling = -1; if (!name().compare("POINT")) - parameter(i).write(f, -groupIdx, dataStartPosition); - else - parameter(i).write(f, -groupIdx, defaultDataStartPosition); + tagForDataStartFilling = 0; + else if (!name().compare("ROTATION")) + tagForDataStartFilling = 1; + parameter(i).write(f, -groupIdx, dataStartPositionToFill, tagForDataStartFilling); + + } } int ezc3d::ParametersNS::GroupNS::Group::read( diff --git a/src/Header.cpp b/src/Header.cpp index fca204e2..de8ba5bf 100644 --- a/src/Header.cpp +++ b/src/Header.cpp @@ -8,7 +8,12 @@ /// #include "Header.h" +#include "ezc3d.h" #include "Parameters.h" +#include "DataStartInfo.h" +#include +#include +#include ezc3d::Header::Header(): _nbOfZerosBeforeHeader(0), @@ -99,7 +104,7 @@ void ezc3d::Header::print() const { void ezc3d::Header::write( std::fstream &f, - std::streampos &dataStartPosition) const { + ezc3d::DataStartInfo &dataStartPositionToFill) const { // write the checksum byte and the start point of header int parameterAddessDefault(2); f.write(reinterpret_cast( @@ -132,7 +137,7 @@ void ezc3d::Header::write( 2*ezc3d::DATA_TYPE::WORD); // Parameters of analog data - dataStartPosition = f.tellg(); + dataStartPositionToFill.setHeaderPositionInC3dForPointDataStart(f.tellg()); // dataStartPosition is to be changed when we know where the data are f.write(reinterpret_cast(&_dataStart), 1*ezc3d::DATA_TYPE::WORD); diff --git a/src/Parameter.cpp b/src/Parameter.cpp index c53293e4..d769c47c 100644 --- a/src/Parameter.cpp +++ b/src/Parameter.cpp @@ -8,7 +8,11 @@ /// #include "Parameter.h" +#include "ezc3d.h" #include "Parameters.h" +#include "DataStartInfo.h" +#include +#include ezc3d::ParametersNS::GroupNS::Parameter::Parameter( const std::string &name, @@ -49,7 +53,8 @@ void ezc3d::ParametersNS::GroupNS::Parameter::print() const { void ezc3d::ParametersNS::GroupNS::Parameter::write( std::fstream &f, int groupIdx, - std::streampos &dataStartPosition) const { + ezc3d::DataStartInfo &dataStartPositionToFill, + int dataStartType) const { int nCharName(static_cast(name().size())); if (isLocked()) nCharName *= -1; @@ -117,15 +122,16 @@ void ezc3d::ParametersNS::GroupNS::Parameter::write( writeImbricatedParameter(f, dimension, 1); } } else { - if (static_cast(dataStartPosition) != -1 - && !_name.compare("DATA_START")){ - // -1 means that it is not the POINT group - + if (!_name.compare("DATA_START") && dataStartType >= 0){ // This is a special case defined in the standard where you write - // the number of blocks up to the data - dataStartPosition = f.tellg(); - f.write(reinterpret_cast(&blank), - 2*ezc3d::DATA_TYPE::BYTE); + // the number of blocks up to the data for POINT or ROTATION group + if (dataStartType == 0) // POINT + dataStartPositionToFill.setParameterPositionInC3dForPointDataStart(f.tellg()); + else if (dataStartType == 1) // ROTATION + dataStartPositionToFill.setParameterPositionInC3dForRotationsDataStart(f.tellg()); + else + throw std::runtime_error("data start type not recognized"); + f.write(reinterpret_cast(&blank), 2*ezc3d::DATA_TYPE::BYTE); } else writeImbricatedParameter(f, dimension); } diff --git a/src/Parameters.cpp b/src/Parameters.cpp index 86b3e7e2..697c83d0 100644 --- a/src/Parameters.cpp +++ b/src/Parameters.cpp @@ -8,7 +8,11 @@ /// #include "Parameters.h" +#include "ezc3d.h" #include "Header.h" +#include +#include +#include ezc3d::ParametersNS::Parameters::Parameters(): _parametersStart(1), @@ -336,7 +340,7 @@ void ezc3d::ParametersNS::Parameters::print() const { ezc3d::ParametersNS::Parameters ezc3d::ParametersNS::Parameters::write( std::fstream &f, - std::streampos &dataStartPosition, + ezc3d::DataStartInfo &dataStartPositionToFill, const ezc3d::Header& header, const ezc3d::WRITE_FORMAT& format) const { ezc3d::ParametersNS::Parameters p(prepareCopyForWriting(header, format)); @@ -357,21 +361,22 @@ ezc3d::ParametersNS::Parameters ezc3d::ParametersNS::Parameters::write( for (size_t i=0; i < p.nbGroups(); ++i){ const ezc3d::ParametersNS::GroupNS::Group& currentGroup(p.group(i)); if (!currentGroup.isEmpty()) - currentGroup.write(f, -static_cast(i+1), dataStartPosition); + currentGroup.write(f, -static_cast(i+1), dataStartPositionToFill); } // Move the cursor to a beginning of a block + ezc3d::c3d::moveCursorToANewBlock(f); + // Go back at the left blank space (next parameter position in the last parameter) + // and write the current position std::streampos currentPos(f.tellg()); - for (int i=0; i<512 - static_cast(currentPos) % 512; ++i){ - f.write(reinterpret_cast(&blankValue), ezc3d::BYTE); - } - // Go back at the left blank space and write the current position currentPos = f.tellg(); f.seekg(pos); int nBlocksToNext = int(currentPos - pos-2)/512; if (int(currentPos - pos-2) % 512 > 0) ++nBlocksToNext; f.write(reinterpret_cast(&nBlocksToNext), ezc3d::BYTE); + + // Go back to where to start writing the data f.seekg(currentPos); return p; diff --git a/src/Point.cpp b/src/Point.cpp index 0f3ddbbe..b5a138bf 100644 --- a/src/Point.cpp +++ b/src/Point.cpp @@ -8,10 +8,13 @@ /// #include "Point.h" +#include "ezc3d.h" #include "Header.h" #include "PointsInfo.h" - +#include #include +#include +#include ezc3d::DataNS::Points3dNS::Point::Point() : ezc3d::Vector3d(), diff --git a/src/Points.cpp b/src/Points.cpp index 8dc0e0ef..4510153f 100644 --- a/src/Points.cpp +++ b/src/Points.cpp @@ -8,7 +8,9 @@ /// #include "Points.h" +#include "ezc3d.h" #include "Header.h" +#include // Point3d data ezc3d::DataNS::Points3dNS::Points::Points() { diff --git a/src/PointsInfo.cpp b/src/PointsInfo.cpp index 9283f06e..e5936f45 100644 --- a/src/PointsInfo.cpp +++ b/src/PointsInfo.cpp @@ -8,6 +8,7 @@ /// #include "PointsInfo.h" +#include "ezc3d.h" #include "Header.h" #include "Parameters.h" diff --git a/src/Rotation.cpp b/src/Rotation.cpp index ee19aaef..898919eb 100644 --- a/src/Rotation.cpp +++ b/src/Rotation.cpp @@ -8,9 +8,11 @@ /// #include "Rotation.h" +#include "ezc3d.h" #include "RotationsInfo.h" - +#include #include +#include ezc3d::DataNS::RotationNS::Rotation::Rotation() : ezc3d::Matrix44(), diff --git a/src/Rotations.cpp b/src/Rotations.cpp index 32721265..3aef07b4 100644 --- a/src/Rotations.cpp +++ b/src/Rotations.cpp @@ -8,10 +8,13 @@ /// #include "Rotations.h" +#include "ezc3d.h" #include "Header.h" #include "Parameters.h" #include "RotationsInfo.h" #include "RotationsSubframe.h" +#include +#include // Rotations data ezc3d::DataNS::RotationNS::Rotations::Rotations() diff --git a/src/RotationsInfo.cpp b/src/RotationsInfo.cpp index 672e8457..131ae720 100644 --- a/src/RotationsInfo.cpp +++ b/src/RotationsInfo.cpp @@ -8,8 +8,10 @@ /// #include "RotationsInfo.h" +#include "ezc3d.h" #include "Header.h" #include "Parameters.h" +#include ezc3d::DataNS::RotationNS::Info::Info( diff --git a/src/RotationsSubframe.cpp b/src/RotationsSubframe.cpp index 48c851db..9ad24078 100644 --- a/src/RotationsSubframe.cpp +++ b/src/RotationsSubframe.cpp @@ -10,6 +10,11 @@ #include "RotationsSubframe.h" #include "Header.h" #include "RotationsInfo.h" +#include +#ifdef _WIN32 +#include +#endif +#include ezc3d::DataNS::RotationNS::SubFrame::SubFrame() { diff --git a/src/ezc3d.cpp b/src/ezc3d.cpp index c3a1a31b..4c2922df 100644 --- a/src/ezc3d.cpp +++ b/src/ezc3d.cpp @@ -11,7 +11,10 @@ #include "Header.h" #include "Data.h" #include "Parameters.h" - +#include "DataStartInfo.h" +#include +#include +#include void ezc3d::removeTrailingSpaces( std::string& s) { @@ -92,23 +95,22 @@ void ezc3d::c3d::write( const WRITE_FORMAT& format) const { std::fstream f(filePath, std::ios::out | std::ios::binary); + ezc3d::DataStartInfo dataStartInfoToFill; + // Write the header - std::streampos dataStartHeader; - header().write(f, dataStartHeader); + header().write(f, dataStartInfoToFill); // Write the parameters - std::streampos dataStartParameters(-2); // -1 means not POINT group ezc3d::ParametersNS::Parameters p( - parameters().write(f, dataStartParameters, header(), format)); - - // Write the data start parameter in header and parameter sections - writeDataStart(f, dataStartHeader, DATA_TYPE::WORD); - writeDataStart(f, dataStartParameters, DATA_TYPE::BYTE); + parameters().write(f, dataStartInfoToFill, header(), format)); // Write the data float pointScaleFactor(p.group("POINT").parameter("SCALE").valuesAsDouble()[0]); std::vector pointAnalogFactors(p.group("ANALOG").parameter("SCALE").valuesAsDouble()); - data().write(f, pointScaleFactor, pointAnalogFactors); + data().write(header(), f, pointScaleFactor, pointAnalogFactors, dataStartInfoToFill); + + // Go back and write all the required data start + writeDataStart(f, dataStartInfoToFill); f.close(); } @@ -165,19 +167,25 @@ int ezc3d::c3d::hex2int( void ezc3d::c3d::writeDataStart( std::fstream &f, - const std::streampos &dataStartPosition, - const DATA_TYPE& type) const { - // Go back to data start blank space and write the current - // position (assuming current is the position of data!) - std::streampos dataPos = f.tellg(); - f.seekg(dataStartPosition); - if (int(dataPos) % 512 > 0) - throw std::out_of_range( - "Something went wrong in the positioning of the pointer " - "for writting the data. Please report this error."); - int nBlocksToNext = int(dataPos)/512 + 1; // DATA_START is 1-based - f.write(reinterpret_cast(&nBlocksToNext), type); - f.seekg(dataPos); + const ezc3d::DataStartInfo &dataStartPosition) const { + + if (dataStartPosition.hasHeaderPointDataStart()){ + f.seekg(dataStartPosition.headerPointDataStart()); + int nBlocksToNext = int(dataStartPosition.pointDataStart())/512 + 1; // DATA_START is 1-based + f.write(reinterpret_cast(&nBlocksToNext), dataStartPosition.headerPointDataStartSize()); + } + + if (dataStartPosition.hasParameterPointDataStart()){ + f.seekg(dataStartPosition.parameterPointDataStart()); + int nBlocksToNext = int(dataStartPosition.pointDataStart())/512 + 1; // DATA_START is 1-based + f.write(reinterpret_cast(&nBlocksToNext), dataStartPosition.parameterPointDataStartSize()); + } + + if (dataStartPosition.hasParameterRotationsDataStart()){ + f.seekg(dataStartPosition.parameterRotationsDataStart()); + int nBlocksToNext = int(dataStartPosition.rotationsDataStart())/512 + 1; // DATA_START is 1-based + f.write(reinterpret_cast(&nBlocksToNext), dataStartPosition.parameterRotationsDataStartSize()); + } } int ezc3d::c3d::readInt( @@ -331,6 +339,17 @@ void ezc3d::c3d::readParam( _dispatchMatrix(dimension, param_data_string_tp, param_data_string); } +void ezc3d::c3d::moveCursorToANewBlock( + std::fstream &f) +{ + // Move the cursor to the beginning of a block as rotations should start at a new block + int blankValue(0); + std::streampos currentPos(f.tellg()); + for (int i=0; i<512 - static_cast(currentPos) % 512; ++i){ + f.write(reinterpret_cast(&blankValue), ezc3d::BYTE); + } +} + size_t ezc3d::c3d::_dispatchMatrix( const std::vector &dimension, const std::vector ¶m_data_in, diff --git a/src/math/Matrix.cpp b/src/math/Matrix.cpp index 77e7ca81..66c7e7d0 100644 --- a/src/math/Matrix.cpp +++ b/src/math/Matrix.cpp @@ -10,6 +10,8 @@ #include "math/Matrix.h" #include "math/Vector3d.h" #include "math/Vector6d.h" +#include +#include ezc3d::Matrix::Matrix(): _nbRows(0), diff --git a/src/math/Matrix33.cpp b/src/math/Matrix33.cpp index 1b07220a..18452a67 100644 --- a/src/math/Matrix33.cpp +++ b/src/math/Matrix33.cpp @@ -10,6 +10,7 @@ #include "math/Matrix33.h" #include "math/Vector3d.h" +#include ezc3d::Matrix33::Matrix33() : ezc3d::Matrix(3, 3) diff --git a/src/math/Matrix44.cpp b/src/math/Matrix44.cpp index 12118b2e..041c58c7 100644 --- a/src/math/Matrix44.cpp +++ b/src/math/Matrix44.cpp @@ -10,6 +10,7 @@ #include "math/Matrix44.h" #include "math/Vector3d.h" +#include ezc3d::Matrix44::Matrix44() : ezc3d::Matrix(4, 4) diff --git a/src/math/Matrix66.cpp b/src/math/Matrix66.cpp index 3483d333..41970d35 100644 --- a/src/math/Matrix66.cpp +++ b/src/math/Matrix66.cpp @@ -10,6 +10,7 @@ #include "math/Matrix66.h" #include "math/Vector6d.h" +#include ezc3d::Matrix66::Matrix66() : ezc3d::Matrix(6, 6) diff --git a/src/math/Vector3d.cpp b/src/math/Vector3d.cpp index b0514015..8c640279 100644 --- a/src/math/Vector3d.cpp +++ b/src/math/Vector3d.cpp @@ -8,6 +8,9 @@ /// #include "math/Vector3d.h" +#include +#include +#include ezc3d::Vector3d::Vector3d() : ezc3d::Matrix(3, 1) diff --git a/src/math/Vector6d.cpp b/src/math/Vector6d.cpp index 17bfa294..5420d8fb 100644 --- a/src/math/Vector6d.cpp +++ b/src/math/Vector6d.cpp @@ -8,6 +8,8 @@ /// #include "math/Vector6d.h" +#include +#include ezc3d::Vector6d::Vector6d() : ezc3d::Matrix(6, 1) diff --git a/src/modules/ForcePlatforms.cpp b/src/modules/ForcePlatforms.cpp index 3e89265b..485808db 100644 --- a/src/modules/ForcePlatforms.cpp +++ b/src/modules/ForcePlatforms.cpp @@ -8,8 +8,8 @@ /// #include "modules/ForcePlatforms.h" - #include "ezc3d_all.h" +#include ezc3d::Modules::ForcePlatform::ForcePlatform() { diff --git a/test/python3/test_binder_python.py b/test/python3/test_binder_python.py index 179e753e..381e8747 100644 --- a/test/python3/test_binder_python.py +++ b/test/python3/test_binder_python.py @@ -504,6 +504,8 @@ def c3d_build_rebuild_reduced(request): original = ezc3d.c3d(orig_file.as_posix()) original.write(rebuild_file.as_posix()) rebuilt = ezc3d.c3d(rebuild_file.as_posix()) + if request.param == "C3DRotationExample": + rebuilt["parameters"]["ROTATION"]["DATA_START"]["value"][0] = 6 yield (original, rebuilt) diff --git a/test/test_ezc3d.cpp b/test/test_ezc3d.cpp index 383e04c3..3bf46638 100644 --- a/test/test_ezc3d.cpp +++ b/test/test_ezc3d.cpp @@ -2,6 +2,8 @@ #include #include "ezc3d_all.h" +#include +#include enum HEADER_TYPE{ ALL, @@ -1761,7 +1763,7 @@ TEST(c3dFileIO, readC3DWithRotation){ EXPECT_EQ(c3dCopy.parameters().group("ROTATION").parameter("USED").valuesAsInt()[0], 21); EXPECT_EQ(c3dCopy.parameters().group("ROTATION").parameter("DATA_START").type(), ezc3d::INT); EXPECT_EQ(c3dCopy.parameters().group("ROTATION").parameter("DATA_START").valuesAsInt().size(), 1); - EXPECT_EQ(c3dCopy.parameters().group("ROTATION").parameter("DATA_START").valuesAsInt()[0], 6); + EXPECT_EQ(c3dCopy.parameters().group("ROTATION").parameter("DATA_START").valuesAsInt()[0], 7); EXPECT_EQ(c3dCopy.parameters().group("ROTATION").parameter("RATIO").type(), ezc3d::INT); EXPECT_EQ(c3dCopy.parameters().group("ROTATION").parameter("RATIO").valuesAsInt().size(), 1); EXPECT_EQ(c3dCopy.parameters().group("ROTATION").parameter("RATIO").valuesAsInt()[0], 1); diff --git a/test/test_math.cpp b/test/test_math.cpp index 509e23a3..d4d2dac4 100644 --- a/test/test_math.cpp +++ b/test/test_math.cpp @@ -2,6 +2,7 @@ #include #include "ezc3d_all.h" +#include void testPrintingCall(const ezc3d::Matrix& m){ std::streambuf *old = std::cout.rdbuf(); // Save cout direction diff --git a/test/test_modules.cpp b/test/test_modules.cpp index a9d00fb3..6180ba53 100644 --- a/test/test_modules.cpp +++ b/test/test_modules.cpp @@ -2,6 +2,7 @@ #include #include "ezc3d_all.h" +#include TEST(ForcePlatForm, NoPlatForm){ ezc3d::c3d c3d("c3dTestFiles/Vicon.c3d");