EZC3D
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ezc3d::ParametersNS::Parameters Class Reference

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::Groupgroup (size_t idx) const
 Get a particular group of index idx from the group holder. More...
 
ezc3d::ParametersNS::GroupNS::Groupgroup_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::Groupgroup (const std::string &groupName) const
 Get a particular group with the name groupName from the group holder. More...
 
ezc3d::ParametersNS::GroupNS::Groupgroup_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.
 

Detailed Description

Group holder of C3D parameters.

Definition at line 16 of file Parameters.h.

Constructor & Destructor Documentation

◆ Parameters()

ezc3d::ParametersNS::Parameters::Parameters ( ezc3d::c3d c3d,
std::fstream &  file 
)

Construct group holder from a C3D file.

Parameters
c3dC3D reference to copy the data in
fileAlready opened fstream file with read access

Definition at line 22 of file Parameters.cpp.

Member Function Documentation

◆ checksum()

size_t ezc3d::ParametersNS::Parameters::checksum ( ) const

Get the checksum of the parameters.

Returns
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.

◆ group() [1/3]

const ezc3d::ParametersNS::GroupNS::Group & ezc3d::ParametersNS::Parameters::group ( size_t  idx) const

Get a particular group of index idx from the group holder.

Parameters
idxThe index of the group
Returns
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.

◆ group() [2/3]

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.

Parameters
groupNameThe name of the group
Returns
The group

Throw a std::invalid_argument if groupName is not found

Definition at line 336 of file Parameters.cpp.

◆ group() [3/3]

void ezc3d::ParametersNS::Parameters::group ( const ezc3d::ParametersNS::GroupNS::Group group)

Add/replace a group in the group holder.

Parameters
groupThe 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.

◆ group_nonConst() [1/2]

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.

Parameters
idxThe index of the group
Returns
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.

◆ group_nonConst() [2/2]

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.

Parameters
groupNameThe name of the group
Returns
The group

Throw a std::invalid_argument if groupName is not found

Definition at line 341 of file Parameters.cpp.

◆ groupIdx()

size_t ezc3d::ParametersNS::Parameters::groupIdx ( const std::string &  groupName) const

Get the index of a group in the group holder.

Parameters
groupNameName of the group
Returns
The index 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.

◆ groups()

const std::vector< ezc3d::ParametersNS::GroupNS::Group > & ezc3d::ParametersNS::Parameters::groups ( ) const

Get all groups the group holder with read-only access.

Returns
The groups

Definition at line 361 of file Parameters.cpp.

◆ nbGroups()

size_t ezc3d::ParametersNS::Parameters::nbGroups ( ) const

Get the number of groups.

Returns
The number of groups

Definition at line 299 of file Parameters.cpp.

◆ nbParamBlock()

size_t ezc3d::ParametersNS::Parameters::nbParamBlock ( ) const

Get the number of 256-bytes the parameters need in the file.

Returns
The number of 256-bytes the parameters need in the file

Definition at line 289 of file Parameters.cpp.

◆ parametersStart()

size_t ezc3d::ParametersNS::Parameters::parametersStart ( ) const

Get the byte in the file where the data starts.

Returns
The byte in the file where the data starts

Definition at line 279 of file Parameters.cpp.

◆ processorType()

ezc3d::PROCESSOR_TYPE ezc3d::ParametersNS::Parameters::processorType ( ) const

Get the processor type the file was writen on.

Returns
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.

◆ write()

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.

Parameters
fAlready opened fstream file with write access
dataStartPositionReturns the byte where to put the data start parameter

Definition at line 246 of file Parameters.cpp.

Member Data Documentation

◆ _checksum

size_t ezc3d::ParametersNS::Parameters::_checksum
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.

◆ _nbParamBlock

size_t ezc3d::ParametersNS::Parameters::_nbParamBlock
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.

◆ _parametersStart

size_t ezc3d::ParametersNS::Parameters::_parametersStart
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.

◆ _processorType

PROCESSOR_TYPE ezc3d::ParametersNS::Parameters::_processorType
protected

Byte 4 of the C3D file
Processor type (83 + [1 Inter, 2 DEC, 3 MIPS])

Definition at line 67 of file Parameters.h.


The documentation for this class was generated from the following files: