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

Group of parameter of a C3D file. More...

#include <Group.h>

Public Member Functions

 Group (const std::string &name="", const std::string &description="")
 Create an empty group of parameter. More...
 
void print () const
 Print the group by calling the print method of all the parameters.
 
void write (std::fstream &f, int groupIdx, std::streampos &dataStartPosition) const
 Write the group to an opened file by calling the write method of all the parameters. More...
 
int read (ezc3d::c3d &c3d, const Parameters &params, std::fstream &file, int nbCharInName)
 Read and store a group of parameter from an opened C3D file. More...
 
const std::string & name () const
 Get the name of the group. More...
 
void name (const std::string name)
 Set the name of the group. More...
 
const std::string & description () const
 Get the description of the group. More...
 
void description (const std::string description)
 Set the description of the group. More...
 
bool isLocked () const
 Get the locking status of the group. More...
 
void lock ()
 Set the locking status of the group to true.
 
void unlock ()
 Set the locking status of the group to false.
 
size_t nbParameters () const
 Get the number of parameters. More...
 
size_t parameterIdx (std::string parameterName) const
 Get the index of a parameter in the group. More...
 
const ezc3d::ParametersNS::GroupNS::Parameterparameter (size_t idx) const
 Get a particular parameter of index idx from the group. More...
 
ezc3d::ParametersNS::GroupNS::Parameterparameter_nonConst (size_t idx)
 Get a particular parameter of index idx from the group in order to be modified by the caller. More...
 
const ezc3d::ParametersNS::GroupNS::Parameterparameter (std::string parameterName) const
 Get a particular parameter with the name parameterName from the group. More...
 
ezc3d::ParametersNS::GroupNS::Parameterparameter_nonConst (std::string parameterName)
 Get a particular parameter with the name parameterName from the group in the form of a non-const reference. More...
 
int parameter (c3d &c3d, const Parameters &params, std::fstream &file, int nbCharInName)
 Add a parameter to the group from a C3D file. More...
 
void parameter (const ezc3d::ParametersNS::GroupNS::Parameter &parameter)
 Add/replace a parameter to the group. More...
 
const std::vector< ezc3d::ParametersNS::GroupNS::Parameter > & parameters () const
 Get all the parameter from the group. More...
 

Protected Attributes

std::string _name
 The name of the group.
 
std::string _description
 The description of the group.
 
bool _isLocked
 The lock status of the group.
 
std::vector< ezc3d::ParametersNS::GroupNS::Parameter_parameters
 Holder for the parameters of the group.
 

Detailed Description

Group of parameter of a C3D file.

Definition at line 16 of file Group.h.

Constructor & Destructor Documentation

◆ Group()

ezc3d::ParametersNS::GroupNS::Group::Group ( const std::string &  name = "",
const std::string &  description = "" 
)

Create an empty group of parameter.

Parameters
nameThe name of the group of parameter
descriptionThe description of the group of parameter

Definition at line 13 of file Group.cpp.

Member Function Documentation

◆ description() [1/2]

const std::string & ezc3d::ParametersNS::GroupNS::Group::description ( ) const

Get the description of the group.

Returns
The description of the group

Definition at line 105 of file Group.cpp.

◆ description() [2/2]

void ezc3d::ParametersNS::GroupNS::Group::description ( const std::string  description)

Set the description of the group.

Parameters
descriptionThe description of the group

Definition at line 110 of file Group.cpp.

◆ isLocked()

bool ezc3d::ParametersNS::GroupNS::Group::isLocked ( ) const

Get the locking status of the group.

Returns
The locking status of the group

Definition at line 115 of file Group.cpp.

◆ name() [1/2]

const std::string & ezc3d::ParametersNS::GroupNS::Group::name ( ) const

Get the name of the group.

Returns
The name of the group

Definition at line 95 of file Group.cpp.

◆ name() [2/2]

void ezc3d::ParametersNS::GroupNS::Group::name ( const std::string  name)

Set the name of the group.

Parameters
nameThe name of the group

Definition at line 100 of file Group.cpp.

◆ nbParameters()

size_t ezc3d::ParametersNS::GroupNS::Group::nbParameters ( ) const

Get the number of parameters.

Returns
The number of parameters

Definition at line 129 of file Group.cpp.

◆ parameter() [1/4]

const ezc3d::ParametersNS::GroupNS::Parameter & ezc3d::ParametersNS::GroupNS::Group::parameter ( size_t  idx) const

Get a particular parameter of index idx from the group.

Parameters
idxThe index of the parameter
Returns
The parameter

Get a particular point of index idx from the group.

Throw a std::out_of_range exception if idx is larger than the number of parameters

Definition at line 143 of file Group.cpp.

◆ parameter() [2/4]

const ezc3d::ParametersNS::GroupNS::Parameter & ezc3d::ParametersNS::GroupNS::Group::parameter ( std::string  parameterName) const

Get a particular parameter with the name parameterName from the group.

Parameters
parameterNameThe name of the parameter
Returns
The parameter

Throw a std::invalid_argument if parameterName is not found

Definition at line 167 of file Group.cpp.

◆ parameter() [3/4]

int ezc3d::ParametersNS::GroupNS::Group::parameter ( ezc3d::c3d c3d,
const Parameters params,
std::fstream &  file,
int  nbCharInName 
)

Add a parameter to the group from a C3D file.

Parameters
c3dC3D reference to copy the data in
paramsReference to a valid parameter
fileThe file stream already opened with read access
nbCharInNameThe number of character of the parameter name
Returns

Definition at line 177 of file Group.cpp.

◆ parameter() [4/4]

void ezc3d::ParametersNS::GroupNS::Group::parameter ( const ezc3d::ParametersNS::GroupNS::Parameter parameter)

Add/replace a parameter to the group.

Parameters
parameterThe parameter to add

If the parameter sent does not exist in the group, it is appended. Otherwise it is replaced

Definition at line 185 of file Group.cpp.

◆ parameter_nonConst() [1/2]

ezc3d::ParametersNS::GroupNS::Parameter & ezc3d::ParametersNS::GroupNS::Group::parameter_nonConst ( size_t  idx)

Get a particular parameter of index idx from the group in order to be modified by the caller.

Parameters
idxThe index of the parameter
Returns
The parameter

Get a particular parameter of index idx from the group 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 parameters

Definition at line 155 of file Group.cpp.

◆ parameter_nonConst() [2/2]

ezc3d::ParametersNS::GroupNS::Parameter & ezc3d::ParametersNS::GroupNS::Group::parameter_nonConst ( std::string  parameterName)

Get a particular parameter with the name parameterName from the group in the form of a non-const reference.

Parameters
parameterNameThe name of the parameter
Returns
The parameter

Get a particular parameterwith the name parameterName from the group 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::invalid_argument if parameterName is not found

Definition at line 172 of file Group.cpp.

◆ parameterIdx()

size_t ezc3d::ParametersNS::GroupNS::Group::parameterIdx ( std::string  parameterName) const

Get the index of a parameter in the group.

Parameters
parameterNameName of the parameter
Returns
The index of the parameter

Search for the index of a parameter into the group by the name of this parameter.

Throw a std::invalid_argument if parameterName is not found

Definition at line 134 of file Group.cpp.

◆ parameters()

const std::vector< ezc3d::ParametersNS::GroupNS::Parameter > & ezc3d::ParametersNS::GroupNS::Group::parameters ( ) const

Get all the parameter from the group.

Returns
The parameters

Definition at line 202 of file Group.cpp.

◆ read()

int ezc3d::ParametersNS::GroupNS::Group::read ( ezc3d::c3d c3d,
const Parameters params,
std::fstream &  file,
int  nbCharInName 
)

Read and store a group of parameter from an opened C3D file.

Parameters
c3dC3D reference to copy the data in
paramsReference to a valid parameter
fileThe file stream already opened with read access
nbCharInNameThe number of character of the group name
Returns
The position in the file of the next Group/Parameter

Definition at line 65 of file Group.cpp.

◆ write()

void ezc3d::ParametersNS::GroupNS::Group::write ( std::fstream &  f,
int  groupIdx,
std::streampos &  dataStartPosition 
) const

Write the group to an opened file by calling the write method of all the parameters.

Parameters
fAlready opened fstream file with write access
groupIdxIndex of the group that this particular parameter is in
dataStartPositionThe position in the file where the data start (special case for POINT:DATA_START parameter)

Definition at line 33 of file Group.cpp.


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