EZC3D
Analogs.cpp
Go to the documentation of this file.
1 #define EZC3D_API_EXPORTS
2 
10 #include "Analogs.h"
11 
13 {
14 
15 }
16 
18 {
19  for (size_t i = 0; i < nbSubframes(); ++i){
20  std::cout << "Subframe = " << i << std::endl;
21  subframe(i).print();
22  std::cout << std::endl;
23  }
24 }
25 
26 void ezc3d::DataNS::AnalogsNS::Analogs::write(std::fstream &f) const
27 {
28  for (size_t i = 0; i < nbSubframes(); ++i){
29  subframe(i).write(f);
30  }
31 }
32 
34 {
35  return _subframe.size();
36 }
37 
39 {
40  _subframe.resize(nbSubframes);
41 }
42 
44 {
45  try {
46  return _subframe.at(idx);
47  } catch(std::out_of_range) {
48  throw std::out_of_range("Analogs::subframe method is trying to access the subframe "
49  + std::to_string(idx) +
50  " while the maximum number of subframes is "
51  + std::to_string(nbSubframes()) + ".");
52  }
53 }
54 
56 {
57  try {
58  return _subframe.at(idx);
59  } catch(std::out_of_range) {
60  throw std::out_of_range("Analogs::subframe method is trying to access the subframe "
61  + std::to_string(idx) +
62  " while the maximum number of subframes is "
63  + std::to_string(nbSubframes()) + ".");
64  }
65 }
66 
68 {
69  if (idx == SIZE_MAX)
70  _subframe.push_back(subframe);
71  else{
72  if (idx >= nbSubframes())
73  _subframe.resize(idx+1);
74  _subframe[idx] = subframe;
75  }
76 }
77 
78 const std::vector<ezc3d::DataNS::AnalogsNS::SubFrame> &ezc3d::DataNS::AnalogsNS::Analogs::subframes() const
79 {
80  return _subframe;
81 }
82 
84 {
85  for (SubFrame subframe : subframes())
86  if (!subframe.isempty())
87  return false;
88  return true;
89 }
const std::vector< ezc3d::DataNS::AnalogsNS::SubFrame > & subframes() const
Get all the subframes from the analogous data set.
Definition: Analogs.cpp:78
bool isempty() const
Return if the analogs are empty.
Definition: Analogs.cpp:83
void write(std::fstream &f) const
Write the subframes to an opened file.
Definition: Analogs.cpp:26
Declaration of Analogs class.
ezc3d::DataNS::AnalogsNS::SubFrame & subframe_nonConst(size_t idx)
Get a particular subframe of index idx from the analogous data set in order to be modified by the cal...
Definition: Analogs.cpp:55
void print() const
Print the subframes.
Definition: Analogs.cpp:17
Subframe for the analogous data.
Definition: Subframe.h:16
const ezc3d::DataNS::AnalogsNS::SubFrame & subframe(size_t idx) const
Get a particular subframe of index idx from the analogous data set.
Definition: Analogs.cpp:43
Analogs()
Create an empty holder for the analogous data.
Definition: Analogs.cpp:12
size_t nbSubframes() const
Get the number of subframes.
Definition: Analogs.cpp:33