1 #define EZC3D_API_EXPORTS 18 for (
int i = static_cast<int>(s.size()); i >= 0; --i)
19 if (s.size() > 0 && s[s.size()-1] ==
' ')
26 std::string new_str = str;
27 std::transform(new_str.begin(), new_str.end(), new_str.begin(), ::toupper);
34 m_nByteToReadMax_int(100)
49 m_nByteToReadMax_int(100)
51 std::fstream stream(
_filePath, std::ios::in | std::ios::binary);
57 if (!stream.is_open())
58 throw std::ios_base::failure(
"Could not open the c3d file");
94 std::fstream f(filePath, std::ios::out | std::ios::binary);
97 std::streampos dataStartHeader;
98 header().write(f, dataStartHeader);
103 int nFrames(this->parameters().group(
"POINT").parameter(
"FRAMES").valuesAsInt()[0]);
104 if (nFrames > 0xFFFF){
109 std::streampos dataStartParameters;
110 params.
write(f, dataStartParameters);
113 writeDataStart(f, dataStartHeader, DATA_TYPE::WORD);
114 writeDataStart(f, dataStartParameters, DATA_TYPE::BYTE);
126 m_nByteToReadMax_int = nByteToRead;
127 c_int =
new char[m_nByteToReadMax_int + 1];
128 c_int_tp =
new char[m_nByteToReadMax_int + 1];
132 const std::ios_base::seekdir &pos)
135 file.seekg (nByteFromPrevious, pos);
136 file.read (c, nByteToRead);
137 c[nByteToRead] =
'\0';
142 for (
unsigned int i = 0; i < len; i++)
143 ret |= static_cast<int>(static_cast<unsigned char>(val[i])) *
static_cast<int>(pow(0x100, i));
144 return static_cast<unsigned int>(ret);
148 unsigned int tp(hex2uint(val, len));
153 for (
unsigned int i=0; i<len; ++i)
154 max |= 0xFF * static_cast<unsigned int>(pow(0x100, i));
159 out =
static_cast<int>(tp - max - 1);
161 out =
static_cast<int>(tp);
169 std::streampos dataPos = f.tellg();
170 f.seekg(dataStartPosition);
171 if (
int(dataPos) % 512 > 0)
172 throw std::out_of_range(
"Something went wrong in the positioning of the pointer for writting the data. " 173 "Please report this error.");
174 int nBlocksToNext = int(dataPos)/512 + 1;
175 f.write(reinterpret_cast<const char*>(&nBlocksToNext), type);
180 const std::ios_base::seekdir &pos)
182 if (nByteToRead > m_nByteToReadMax_int)
183 resizeCharHolder(nByteToRead);
185 readFile(file, nByteToRead, c_int, nByteFromPrevious, pos);
188 if (processorType == PROCESSOR_TYPE::MIPS){
190 for (
size_t i=0; i<nByteToRead; ++i){
191 c_int_tp[i] = c_int[nByteToRead-1 - i];
193 c_int_tp[nByteToRead] =
'\0';
194 out = hex2int(c_int_tp, nByteToRead);
197 out = hex2int(c_int, nByteToRead);
204 const std::ios_base::seekdir &pos)
206 if (nByteToRead > m_nByteToReadMax_int)
207 resizeCharHolder(nByteToRead);
209 readFile(file, nByteToRead, c_int, nByteFromPrevious, pos);
212 if (processorType == PROCESSOR_TYPE::MIPS){
214 for (
size_t i=0; i<nByteToRead; ++i){
215 c_int_tp[i] = c_int[nByteToRead-1 - i];
217 c_int_tp[nByteToRead] =
'\0';
219 out = hex2uint(c_int_tp, nByteToRead);
222 out = hex2uint(c_int, nByteToRead);
229 const std::ios_base::seekdir &pos)
231 readFile(file, m_nByteToRead_float, c_float, nByteFromPrevious, pos);
233 if (processorType == PROCESSOR_TYPE::INTEL) {
234 out = *
reinterpret_cast<float*
>(c_float);
235 }
else if (processorType == PROCESSOR_TYPE::DEC){
236 c_float_tp[0] = c_float[2];
237 c_float_tp[1] = c_float[3];
238 c_float_tp[2] = c_float[0];
240 c_float_tp[3] = c_float[1]-1;
242 c_float_tp[3] = c_float[1];
243 c_float_tp[4] =
'\0';
244 out = *
reinterpret_cast<float*
>(c_float_tp);
245 }
else if (processorType == PROCESSOR_TYPE::MIPS) {
246 for (
unsigned int i=0; i<m_nByteToRead_float; ++i)
247 c_float_tp[i] = c_float[m_nByteToRead_float-1 - i];
248 c_float_tp[m_nByteToRead_float] =
'\0';
249 out = *
reinterpret_cast<float*
>(c_float_tp);
251 throw std::runtime_error(
"Wrong type of processor for floating points");
257 const std::ios_base::seekdir &pos)
259 if (nByteToRead > m_nByteToReadMax_int)
260 resizeCharHolder(nByteToRead);
262 char* c =
new char[nByteToRead + 1];
263 readFile(file, nByteToRead, c, nByteFromPrevious, pos);
270 std::vector<int> ¶m_data,
size_t currentIdx)
272 for (
size_t i = 0; i < dimension[currentIdx]; ++i)
273 if (currentIdx == dimension.size()-1)
274 param_data.push_back (readInt(processorType, file, dataLenghtInBytes*ezc3d::DATA_TYPE::BYTE));
276 readParam(processorType, file, dataLenghtInBytes, dimension, param_data, currentIdx + 1);
280 std::vector<float> ¶m_data,
size_t currentIdx)
282 for (
size_t i = 0; i < dimension[currentIdx]; ++i)
283 if (currentIdx == dimension.size()-1)
284 param_data.push_back (readFloat(processorType, file));
286 readParam(processorType, file, dimension, param_data, currentIdx + 1);
290 std::vector<std::string> ¶m_data_string)
292 std::vector<std::string> param_data_string_tp;
293 _readMatrix(file, dimension, param_data_string_tp);
297 if (dimension.size() == 1){
298 if (dimension[0] != 0) {
300 for (
size_t j = 0; j < dimension[0]; ++j)
301 tp += param_data_string_tp[j];
303 param_data_string.push_back(tp);
307 _dispatchMatrix(dimension, param_data_string_tp, param_data_string);
311 const std::vector<std::string> ¶m_data_in,
312 std::vector<std::string> ¶m_data_out,
size_t idxInParam,
315 for (
size_t i = 0; i < dimension[currentIdx]; ++i)
316 if (currentIdx == dimension.size()-1){
318 for (
size_t j = 0; j < dimension[0]; ++j){
319 tp += param_data_in[idxInParam];
323 param_data_out.push_back(tp);
326 idxInParam = _dispatchMatrix(dimension, param_data_in, param_data_out, idxInParam, currentIdx + 1);
331 std::vector<std::string> ¶m_data,
size_t currentIdx)
333 for (
size_t i = 0; i < dimension[currentIdx]; ++i)
334 if (currentIdx == dimension.size()-1)
335 param_data.push_back(readString(file, ezc3d::DATA_TYPE::BYTE));
337 _readMatrix(file, dimension, param_data, currentIdx + 1);
357 return parameters().group(
"POINT").parameter(
"LABELS").valuesAsString();
362 const std::vector<std::string> ¤tNames(pointNames());
363 for (
size_t i = 0; i < currentNames.size(); ++i)
364 if (!currentNames[i].compare(pointName))
366 throw std::invalid_argument(
"ezc3d::pointIdx could not find " + pointName +
" in the points data set.");
371 return parameters().group(
"ANALOG").parameter(
"LABELS").valuesAsString();
376 const std::vector<std::string> ¤tNames(channelNames());
377 for (
size_t i = 0; i < currentNames.size(); ++i)
378 if (!currentNames[i].compare(channelName))
380 throw std::invalid_argument(
"ezc3d::channelIdx could not find " + channelName +
381 " in the analogous data set");
386 if (!p.
name().compare(
"")){
387 throw std::invalid_argument(
"Parameter must have a name");
392 idx = parameters().groupIdx(groupName);
393 }
catch (std::invalid_argument) {
395 idx = parameters().groupIdx(groupName);
398 _parameters->group_nonConst(idx).parameter(p);
406 _parameters->group_nonConst(groupName).lock();
411 _parameters->group_nonConst(groupName).unlock();
417 size_t nPoints(static_cast<size_t>(parameters().group(
"POINT").parameter(
"USED").valuesAsInt()[0]));
419 throw std::runtime_error(
"Number of points in POINT:USED parameter must equal" 420 "the number of points sent in the frame");
422 std::vector<std::string> labels(parameters().group(
"POINT").parameter(
"LABELS").valuesAsString());
423 for (
size_t i=0; i<labels.size(); ++i)
426 }
catch (std::invalid_argument) {
427 throw std::invalid_argument(
"All the points in the frame must appear in the POINT:LABELS parameter");
430 if (f.
points().
nbPoints() > 0 &&
static_cast<double>(parameters().group(
"POINT").parameter(
"RATE").valuesAsFloat()[0]) == 0.0){
431 throw std::runtime_error(
"Point frame rate must be specified if you add some");
433 if (f.
analogs().
nbSubframes() > 0 &&
static_cast<double>(parameters().group(
"ANALOG").parameter(
"RATE").valuesAsFloat()[0]) == 0.0){
434 throw std::runtime_error(
"Analog frame rate must be specified if you add some");
437 size_t nAnalogs(static_cast<size_t>(parameters().group(
"ANALOG").parameter(
"USED").valuesAsInt()[0]));
441 size_t nAnalogByFrames(header().nbAnalogByFrame());
442 if (!(nAnalogs==0 && nAnalogByFrames==0) && nChannel != nAnalogs )
443 throw std::runtime_error(
"Number of analogs in ANALOG:USED parameter must equal " 444 "the number of analogs sent in the frame");
448 _data->frame(f, idx);
453 if (data().nbFrames() > 0){
454 std::vector<ezc3d::DataNS::Frame> dummy_frames;
457 dummy_pts.
point(emptyPoint);
459 frame.
add(dummy_pts);
460 for (
size_t f=0; f<data().nbFrames(); ++f)
461 dummy_frames.push_back(frame);
462 point(name, dummy_frames);
464 updateParameters({name});
468 void ezc3d::c3d::point(
const std::string& pointName,
const std::vector<ezc3d::DataNS::Frame>& frames){
469 std::vector<std::string> names;
470 names.push_back(pointName);
471 point(names, frames);
474 void ezc3d::c3d::point(
const std::vector<std::string>& ptsNames,
const std::vector<ezc3d::DataNS::Frame>& frames)
476 if (frames.size() == 0 || frames.size() != data().nbFrames())
477 throw std::invalid_argument(
"Size of the array of frames must equal the number of frames already " 478 "present in the data set");
479 if (frames[0].points().nbPoints() == 0)
480 throw std::invalid_argument(
"Points in the frames cannot be empty");
482 const std::vector<std::string>& labels(pointNames());
484 for (
size_t idx = 0; idx<ptsNames.size(); ++idx){
485 for (
size_t i=0; i<labels.size(); ++i)
486 if (!ptsNames[idx].compare(labels[i]))
487 throw std::invalid_argument(
"The point you try to create already exists in the data set");
489 for (
size_t f=0; f<data().nbFrames(); ++f)
490 _data->frame_nonConst(f).points_nonConst().point(frames[f].points().point(idx));
492 updateParameters(ptsNames);
497 if (data().nbFrames() > 0){
498 std::vector<ezc3d::DataNS::Frame> dummy_frames;
501 emptyChannel.
data(0);
503 dummy_subframes.
channel(emptyChannel);
504 for (
size_t sf = 0; sf < header().nbAnalogByFrame(); ++sf)
506 for (
size_t f=0; f<data().nbFrames(); ++f)
507 dummy_frames.push_back(frame);
508 analog(name, dummy_frames);
510 updateParameters({}, {name});
516 std::vector<std::string> names;
517 names.push_back(channelName);
518 analog(names, frames);
521 void ezc3d::c3d::analog(
const std::vector<std::string> &chanNames,
const std::vector<ezc3d::DataNS::Frame> &frames)
523 if (frames.size() != data().nbFrames())
524 throw std::invalid_argument(
"Size of the array of frames must equal the number of frames already " 525 "present in the data set");
526 if (frames[0].analogs().nbSubframes() != header().nbAnalogByFrame())
527 throw std::invalid_argument(
"Size of the subframes in the frames must equal the number of subframes " 528 "already present in the data set");
529 if (frames[0].analogs().subframe(0).nbChannels() == 0)
530 throw std::invalid_argument(
"Channels in the frame cannot be empty");
532 const std::vector<std::string>& labels(channelNames());
533 for (
size_t idx = 0; idx < chanNames.size(); ++idx){
534 for (
size_t i=0; i<labels.size(); ++i)
535 if (!chanNames[idx].compare(labels[i]))
536 throw std::invalid_argument(
"The channel you try to create already exists in the data set");
538 for (
size_t f=0; f < data().nbFrames(); ++f){
539 for (
size_t sf=0; sf < header().nbAnalogByFrame(); ++sf){
540 _data->frame_nonConst(f).analogs_nonConst().subframe_nonConst(sf).channel(frames[f].analogs().subframe(sf).channel(idx));
544 updateParameters({}, chanNames);
550 if (static_cast<size_t>(parameters().group(
"POINT").parameter(
"FRAMES").valuesAsInt()[0]) != header().nbFrames()){
552 _header->lastFrame(static_cast<size_t>(parameters().group(
"POINT").parameter(
"FRAMES").valuesAsInt()[0]) + _header->firstFrame() - 1);
554 float pointRate(parameters().group(
"POINT").parameter(
"RATE").valuesAsFloat()[0]);
556 if (static_cast<int>(pointRate*buffer) != static_cast<int>(header().frameRate()*buffer)){
557 _header->frameRate(pointRate);
559 if (static_cast<size_t>(parameters().group(
"POINT").parameter(
"USED").valuesAsInt()[0]) != header().nb3dPoints()){
560 _header->nb3dPoints(static_cast<size_t>(parameters().group(
"POINT").parameter(
"USED").valuesAsInt()[0]));
564 if (_data !=
nullptr && data().nbFrames() > 0 && data().frame(0).analogs().nbSubframes() != 0) {
565 if (data().frame(0).analogs().nbSubframes() != static_cast<size_t>(header().nbAnalogByFrame()))
566 _header->nbAnalogByFrame(data().frame(0).analogs().nbSubframes());
568 if (static_cast<size_t>(pointRate) == 0){
569 if (static_cast<size_t>(header().nbAnalogByFrame()) != 1)
570 _header->nbAnalogByFrame(1);
572 if (static_cast<size_t>(parameters().group(
"ANALOG").parameter(
"RATE").valuesAsFloat()[0] / pointRate) != static_cast<size_t>(header().nbAnalogByFrame()))
573 _header->nbAnalogByFrame(static_cast<size_t>(parameters().group(
"ANALOG").parameter(
"RATE").valuesAsFloat()[0] / pointRate));
577 if (static_cast<size_t>(parameters().group(
"ANALOG").parameter(
"USED").valuesAsInt()[0]) != header().nbAnalogs())
578 _header->nbAnalogs(static_cast<size_t>(parameters().group(
"ANALOG").parameter(
"USED").valuesAsInt()[0]));
585 size_t nFrames(data().nbFrames());
586 if (nFrames != static_cast<size_t>(grpPoint.parameter(
"FRAMES").valuesAsInt()[0])){
587 size_t idx(grpPoint.parameterIdx(
"FRAMES"));
588 grpPoint.parameter_nonConst(idx).set(nFrames);
593 if (data().nbFrames() > 0)
594 nPoints = data().frame(0).points().nbPoints();
596 nPoints = parameters().group(
"POINT").parameter(
"LABELS").valuesAsString().size() + newPoints.size();
597 if (nPoints != static_cast<size_t>(grpPoint.parameter(
"USED").valuesAsInt()[0])){
598 grpPoint.parameter_nonConst(
"USED").set(nPoints);
600 size_t idxLabels(grpPoint.parameterIdx(
"LABELS"));
601 size_t idxDescriptions(grpPoint.parameterIdx(
"DESCRIPTIONS"));
602 size_t idxUnits(grpPoint.parameterIdx(
"UNITS"));
603 std::vector<std::string> labels;
604 std::vector<std::string> descriptions;
605 std::vector<std::string> units;
606 std::vector<std::string> ptsNames(pointNames());
607 ptsNames.insert( ptsNames.end(), newPoints.begin(), newPoints.end() );
608 for (
size_t i = 0; i < nPoints; ++i){
610 if (data().nbFrames() == 0){
611 if (i < parameters().group(
"POINT").parameter(
"LABELS").valuesAsString().size())
612 name = parameters().group(
"POINT").parameter(
"LABELS").valuesAsString()[i];
614 name = newPoints[i - parameters().group(
"POINT").parameter(
"LABELS").valuesAsString().size()];
619 labels.push_back(name);
620 descriptions.push_back(
"");
621 units.push_back(
"mm");
623 grpPoint.parameter_nonConst(idxLabels).set(labels);
624 grpPoint.parameter_nonConst(idxDescriptions).set(descriptions);
625 grpPoint.parameter_nonConst(idxUnits).set(units);
631 if (data().nbFrames() > 0){
632 if (data().frame(0).analogs().nbSubframes() > 0)
633 nAnalogs = data().frame(0).analogs().subframe(0).nbChannels();
640 if (parameters().group(
"ANALOG").nbParameters()){
641 if (nAnalogs != static_cast<size_t>(grpAnalog.parameter(
"USED").valuesAsInt()[0])){
642 grpAnalog.parameter_nonConst(
"USED").set(nAnalogs);
644 size_t idxLabels(static_cast<size_t>(grpAnalog.parameterIdx(
"LABELS")));
645 size_t idxDescriptions(static_cast<size_t>(grpAnalog.parameterIdx(
"DESCRIPTIONS")));
646 std::vector<std::string> labels;
647 std::vector<std::string> descriptions;
648 std::vector<std::string> chanNames(channelNames());
649 chanNames.insert( chanNames.end(), newAnalogs.begin(), newAnalogs.end() );
650 for (
size_t i = 0; i<nAnalogs; ++i){
652 if (data().nbFrames() == 0){
653 if (i < parameters().group(
"ANALOG").parameter(
"LABELS").valuesAsString().size())
654 name = parameters().group(
"ANALOG").parameter(
"LABELS").valuesAsString()[i];
656 name = newAnalogs[i-parameters().group(
"ANALOG").parameter(
"LABELS").valuesAsString().size()];
661 labels.push_back(name);
662 descriptions.push_back(
"");
664 grpAnalog.parameter_nonConst(idxLabels).set(labels);
665 grpAnalog.parameter_nonConst(idxDescriptions).set(descriptions);
667 size_t idxScale(grpAnalog.parameterIdx(
"SCALE"));
668 std::vector<float> scales(grpAnalog.parameter(idxScale).valuesAsFloat());
669 for (
size_t i = grpAnalog.parameter(idxScale).valuesAsFloat().size(); i < nAnalogs; ++i)
671 grpAnalog.parameter_nonConst(idxScale).set(scales);
673 size_t idxOffset(grpAnalog.parameterIdx(
"OFFSET"));
674 std::vector<int> offset(grpAnalog.parameter(idxOffset).valuesAsInt());
675 for (
size_t i = grpAnalog.parameter(idxOffset).valuesAsInt().size(); i < nAnalogs; ++i)
677 grpAnalog.parameter_nonConst(idxOffset).set(offset);
679 size_t idxUnits(grpAnalog.parameterIdx(
"UNITS"));
680 std::vector<std::string> units(grpAnalog.parameter(idxUnits).valuesAsString());
681 for (
size_t i = grpAnalog.parameter(idxUnits).valuesAsString().size(); i < nAnalogs; ++i)
682 units.push_back(
"V");
683 grpAnalog.parameter_nonConst(idxUnits).set(units);
std::shared_ptr< ezc3d::DataNS::Data > _data
Pointer that holds the data of the C3D.
std::string _filePath
The file path if the C3D was opened from a file.
std::shared_ptr< ezc3d::Header > _header
Pointer that holds the header of the C3D.
size_t _dispatchMatrix(const std::vector< size_t > &dimension, const std::vector< std::string > ¶m_data_in, std::vector< std::string > ¶m_data_out, size_t idxInParam=0, size_t currentIdx=1)
Internal function to dispatch a string array to a matrix of strings.
void resizeCharHolder(unsigned int nByteToRead)
Resize the too small char to read.
void set(int data)
Set the integer scalar value for the parameter.
float data() const
Get the value of the analog data.
Group holder of C3D parameters.
int hex2int(const char *val, unsigned int len)
Convert an hexadecimal value to a integer.
size_t readUint(PROCESSOR_TYPE processorType, std::fstream &file, unsigned int nByteToRead, int nByteFromPrevious=0, const std::ios_base::seekdir &pos=std::ios::cur)
Read a unsigned integer of nByteToRead bytes at the position current + nByteFromPrevious from a file...
Points holder for C3D data 3D points data.
const ezc3d::DataNS::Points3dNS::Points & points() const
Return a reference to all the points.
const ezc3d::DataNS::AnalogsNS::Analogs & analogs() const
Return a reference to all the analogs.
void point(const std::string &name)
Create a point to the data set of name name.
PROCESSOR_TYPE
The type of processor used to store the data.
void add(const ezc3d::DataNS::Frame &frame)
Add a frame by copying a sent frame.
void unlockGroup(const std::string &groupName)
Unlock a particular group named groupName.
c3d()
Create a valid minimalistic C3D structure.
Group of parameter of a C3D file.
Declaration of data class.
void _readMatrix(std::fstream &file, const std::vector< size_t > &dimension, std::vector< std::string > ¶m_data, size_t currentIdx=0)
Internal function to read a string array to a matrix of strings.
void readParam(PROCESSOR_TYPE processorType, std::fstream &file, unsigned int dataLenghtInBytes, const std::vector< size_t > &dimension, std::vector< int > ¶m_data, size_t currentIdx=0)
Read a matrix of integer parameters of dimensions dimension with each integer of length dataLengthInB...
char * c_int_tp
Char to be used by the read function with the specific size of a int preventing to allocate it at eac...
size_t nbPoints() const
Get the number of points.
void parameter(const std::string &groupName, const ezc3d::ParametersNS::GroupNS::Parameter ¶meter)
Add/replace a parameter to a group named groupName.
const ezc3d::DataNS::AnalogsNS::Channel & channel(size_t idx) const
Get a particular analog channel of index idx from the analogous data.
void print() const
Print the C3D by calling print method of header, parameter and data.
size_t nbChannels() const
Get the number of analog channels.
const ezc3d::ParametersNS::GroupNS::Parameter & parameter(size_t idx) const
Get a particular parameter of index idx from the group.
Subframe for the analogous data.
const std::string & name() const
Get the name of the parameter.
const ezc3d::DataNS::AnalogsNS::SubFrame & subframe(size_t idx) const
Get a particular subframe of index idx from the analogous data set.
const std::vector< std::string > & pointNames() const
Get a reference to the names of the points.
char * c_int
Char to be used by the read function with the specific size of a int preventing to allocate it at eac...
ezc3d::DataNS::AnalogsNS::Analogs & analogs_nonConst() const
Return a reference to all the analogs in order to be modified by the caller.
Channel of an analogous data.
void updateHeader()
Update the header according to the parameters and the data.
virtual ~c3d()
Destroy the class properly.
size_t channelIdx(const std::string &channelName) const
Get the index of a analog channel in the subframe.
std::shared_ptr< ezc3d::ParametersNS::Parameters > _parameters
Pointer that holds the parameters of the C3D.
const ezc3d::Header & header() const
The header of the C3D.
const ezc3d::ParametersNS::Parameters & parameters() const
The parameters of the C3D.
void frame(const ezc3d::DataNS::Frame &frame, size_t idx=SIZE_MAX)
Add/replace a frame to the data set.
char * c_float_tp
Char to be used by the read function with the specific size of a float preventing to allocate it at e...
ezc3d::ParametersNS::GroupNS::Group & group_nonConst(size_t idx)
Get a particular group of index idx from the group holder in order to be modified by the caller...
void analog(const std::string &name)
Create a channel of analog data to the data set of name name.
void lockGroup(const std::string &groupName)
Lock a particular group named groupName.
const std::vector< std::string > & channelNames() const
Get a reference to the names of the analog channels.
const std::vector< std::string > & valuesAsString() const
Return the vector of values of the parameter.
size_t pointIdx(const std::string &pointName) const
Get the index of a point in the points holder.
char * c_float
Char to be used by the read function with the specific size of a float preventing to allocate it at e...
Frame holder for C3D data.
void write(const std::string &filePath) const
Write the C3D to an opened file by calling write method of header, parameter and data.
std::string toUpper(const std::string &str)
Swap all characters of a string to capital letters.
Declaration of ezc3d class.
int readInt(PROCESSOR_TYPE processorType, std::fstream &file, unsigned int nByteToRead, int nByteFromPrevious=0, const std::ios_base::seekdir &pos=std::ios::cur)
Read an integer of nByteToRead bytes at the position current + nByteFromPrevious from a file...
const ezc3d::DataNS::Data & data() const
The points and analogous data of the C3D.
void readFile(std::fstream &file, unsigned int nByteToRead, char *c, int nByteFromPrevious=0, const std::ios_base::seekdir &pos=std::ios::cur)
The function that reads the file, it returns the value into a generic char pointer that must be pre-a...
void write(std::fstream &f, std::streampos &dataStartPosition) const
Write the groups to an opened file by calling the write method of all the groups. ...
size_t nbSubframes() const
Get the number of subframes.
unsigned int m_nByteToRead_float
Declaration of the size of a float.
std::string readString(std::fstream &file, unsigned int nByteToRead, int nByteFromPrevious=0, const std::ios_base::seekdir &pos=std::ios::cur)
Read a string (array of char of nByteToRead bytes) at the position current + nByteFromPrevious from a...
DATA_TYPE
Enum that describes the size of different types.
void writeDataStart(std::fstream &file, const std::streampos &dataStartPosition, const DATA_TYPE &type) const
Write the data_start parameter where demanded.
void removeTrailingSpaces(std::string &str)
Remove the spaces at the end of a string.
void updateParameters(const std::vector< std::string > &newPoints=std::vector< std::string >(), const std::vector< std::string > &newAnalogs=std::vector< std::string >())
Update parameters according to the data.
unsigned int hex2uint(const char *val, unsigned int len)
Convert an hexadecimal value to an unsigned integer.
unsigned int m_nByteToReadMax_int
Declaration of the max size of a int.
const ezc3d::DataNS::Points3dNS::Point & point(size_t idx) const
Get a particular point of index idx from the 3D points data.
Declaration of Parameters class.
float readFloat(PROCESSOR_TYPE processorType, std::fstream &file, int nByteFromPrevious=0, const std::ios_base::seekdir &pos=std::ios::cur)
Read a float at the position current + nByteFromPrevious from a file.