EZC3D
|
Group holder of C3D parameters. More...
#include <Parameters.h>
Public Member Functions | |
Parameters () | |
Create a default group holder with minimal groups to have a valid c3d. | |
Parameters (c3d &c3d, std::fstream &file) | |
Construct group holder from a C3D file. More... | |
void | print () const |
Print the groups by calling the print method of all the groups. | |
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. More... | |
size_t | parametersStart () const |
Get the byte in the file where the data starts. More... | |
size_t | checksum () const |
Get the checksum of the parameters. More... | |
size_t | nbParamBlock () const |
Get the number of 256-bytes the parameters need in the file. More... | |
PROCESSOR_TYPE | processorType () const |
Get the processor type the file was writen on. More... | |
size_t | nbGroups () const |
Get the number of groups. More... | |
size_t | groupIdx (const std::string &groupName) const |
Get the index of a group in the group holder. More... | |
const ezc3d::ParametersNS::GroupNS::Group & | group (size_t idx) const |
Get a particular group of index idx from the group holder. More... | |
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. More... | |
const ezc3d::ParametersNS::GroupNS::Group & | group (const std::string &groupName) const |
Get a particular group with the name groupName from the group holder. More... | |
ezc3d::ParametersNS::GroupNS::Group & | group_nonConst (const std::string &groupName) |
Get a particular group with the name groupName from the group holder. More... | |
void | group (const ezc3d::ParametersNS::GroupNS::Group &group) |
Add/replace a group in the group holder. More... | |
const std::vector< ezc3d::ParametersNS::GroupNS::Group > & | groups () const |
Get all groups the group holder with read-only access. More... | |
Protected Member Functions | |
void | setMandatoryParameters () |
Add all required parameter for a c3d to be valid. | |
Protected Attributes | |
size_t | _parametersStart |
size_t | _checksum |
size_t | _nbParamBlock |
PROCESSOR_TYPE | _processorType |
std::vector< ezc3d::ParametersNS::GroupNS::Group > | _groups |
Holder for the group of parameters. | |
Group holder of C3D parameters.
Definition at line 16 of file Parameters.h.
ezc3d::ParametersNS::Parameters::Parameters | ( | ezc3d::c3d & | c3d, |
std::fstream & | file | ||
) |
Construct group holder from a C3D file.
c3d | C3D reference to copy the data in |
file | Already opened fstream file with read access |
Definition at line 22 of file Parameters.cpp.
size_t ezc3d::ParametersNS::Parameters::checksum | ( | ) | const |
Get the checksum of the parameters.
The chechsum, according to C3D.org documentation, should be equals to 0x50 for a valid C3D
Definition at line 284 of file Parameters.cpp.
const ezc3d::ParametersNS::GroupNS::Group & ezc3d::ParametersNS::Parameters::group | ( | size_t | idx | ) | const |
Get a particular group of index idx from the group holder.
idx | The index of the group |
Get a particular group of index idx from the group holder.
Throw a std::out_of_range exception if idx is larger than the number of groups
Definition at line 312 of file Parameters.cpp.
const ezc3d::ParametersNS::GroupNS::Group & ezc3d::ParametersNS::Parameters::group | ( | const std::string & | groupName | ) | const |
Get a particular group with the name groupName from the group holder.
groupName | The name of the group |
Throw a std::invalid_argument if groupName is not found
Definition at line 336 of file Parameters.cpp.
void ezc3d::ParametersNS::Parameters::group | ( | const ezc3d::ParametersNS::GroupNS::Group & | group | ) |
Add/replace a group in the group holder.
group | The group to copy |
If the group sent does not exist in the group holder, it is appended. Otherwise it is replaced
Definition at line 346 of file Parameters.cpp.
ezc3d::ParametersNS::GroupNS::Group & ezc3d::ParametersNS::Parameters::group_nonConst | ( | size_t | idx | ) |
Get a particular group of index idx from the group holder in order to be modified by the caller.
idx | The index of the group |
Get a particular group of index idx from the group holder in the form of a non-const reference. The user can thereafter modify the parameter at will, but with the caution it requires.
Throw a std::out_of_range exception if idx is larger than the number of groups
Definition at line 324 of file Parameters.cpp.
ezc3d::ParametersNS::GroupNS::Group & ezc3d::ParametersNS::Parameters::group_nonConst | ( | const std::string & | groupName | ) |
Get a particular group with the name groupName from the group holder.
groupName | The name of the group |
Throw a std::invalid_argument if groupName is not found
Definition at line 341 of file Parameters.cpp.
size_t ezc3d::ParametersNS::Parameters::groupIdx | ( | const std::string & | groupName | ) | const |
Get the index of a group in the group holder.
groupName | Name of the group |
Search for the index of a group into the group holder by the name of this group.
Throw a std::invalid_argument if groupName is not found
Definition at line 304 of file Parameters.cpp.
const std::vector< ezc3d::ParametersNS::GroupNS::Group > & ezc3d::ParametersNS::Parameters::groups | ( | ) | const |
Get all groups the group holder with read-only access.
Definition at line 361 of file Parameters.cpp.
size_t ezc3d::ParametersNS::Parameters::nbGroups | ( | ) | const |
Get the number of groups.
Definition at line 299 of file Parameters.cpp.
size_t ezc3d::ParametersNS::Parameters::nbParamBlock | ( | ) | const |
Get the number of 256-bytes the parameters need in the file.
Definition at line 289 of file Parameters.cpp.
size_t ezc3d::ParametersNS::Parameters::parametersStart | ( | ) | const |
Get the byte in the file where the data starts.
Definition at line 279 of file Parameters.cpp.
ezc3d::PROCESSOR_TYPE ezc3d::ParametersNS::Parameters::processorType | ( | ) | const |
Get the processor type the file was writen on.
The processor type is defined by the value 83 + index. Where index is 1 for Intel, 2 for DEC and 3 for MIPS
Definition at line 294 of file Parameters.cpp.
void ezc3d::ParametersNS::Parameters::write | ( | std::fstream & | f, |
std::streampos & | dataStartPosition | ||
) | const |
Write the groups to an opened file by calling the write method of all the groups.
f | Already opened fstream file with write access |
dataStartPosition | Returns the byte where to put the data start parameter |
Definition at line 246 of file Parameters.cpp.
|
protected |
Byte 2 of the C3D file
It should be equals to 0x50 for a valid a c3d
Definition at line 60 of file Parameters.h.
|
protected |
Byte 3 of the C3D file
Number of 256-bytes blocks the paramertes fits in. It defines the starting position of the data
Definition at line 63 of file Parameters.h.
|
protected |
Byte 1 of the parameter's section of the C3D file.
If the value is 1 then it starts at byte 3 otherwise, it starts at byte 512*parametersStart
Definition at line 56 of file Parameters.h.
|
protected |
Byte 4 of the C3D file
Processor type (83 + [1 Inter, 2 DEC, 3 MIPS])
Definition at line 67 of file Parameters.h.