EZC3D
Public Member Functions | Protected Attributes | List of all members
ezc3d::DataNS::Data Class Reference

Data of the C3D file. More...

#include <Data.h>

Public Member Functions

 Data ()
 Create a ready to fill Data class.
 
 Data (ezc3d::c3d &c3d, std::fstream &file)
 Create a filled Data class from a given file. More...
 
void print () const
 Print the data. More...
 
void write (std::fstream &f) const
 Write all the data to an opened file. More...
 
size_t nbFrames () const
 Get the number of frames in the data structure. More...
 
const ezc3d::DataNS::Frameframe (size_t idx) const
 Get the frame of index idx. More...
 
ezc3d::DataNS::Frameframe_nonConst (size_t idx)
 Get the frame of index idx in order to be modified by the caller. More...
 
void frame (const ezc3d::DataNS::Frame &frame, size_t idx=SIZE_MAX)
 Add/replace a frame to the data set. More...
 
const std::vector< ezc3d::DataNS::Frame > & frames () const
 Get all the frames from the data set. More...
 

Protected Attributes

std::vector< ezc3d::DataNS::Frame_frames
 Storage of the data.
 

Detailed Description

Data of the C3D file.

The class stores all the data frames of a given or create C3D into a STL vector of frame.

Definition at line 18 of file Data.h.

Constructor & Destructor Documentation

◆ Data()

ezc3d::DataNS::Data::Data ( ezc3d::c3d c3d,
std::fstream &  file 
)

Create a filled Data class from a given file.

Parameters
c3dReference to the c3d to copy the data in
fileFile to copy the data from

Definition at line 19 of file Data.cpp.

Member Function Documentation

◆ frame() [1/2]

const ezc3d::DataNS::Frame & ezc3d::DataNS::Data::frame ( size_t  idx) const

Get the frame of index idx.

Parameters
idxThe index of the frame
Returns
The frame of index idx

Get the frame of index idx.

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

Definition at line 113 of file Data.cpp.

◆ frame() [2/2]

void ezc3d::DataNS::Data::frame ( const ezc3d::DataNS::Frame frame,
size_t  idx = SIZE_MAX 
)

Add/replace a frame to the data set.

Parameters
framethe frame to add/replace
idxthe index of the frame

Add or replace a particular frame to the data set.

If no idx is sent, then the frame is appended to the data set. If the idx correspond to a specific frame, it replaces it. If idx is outside the data set, it resize the data set accordingly and add the frame where it belongs but leaves the other created frames empty.

Definition at line 137 of file Data.cpp.

◆ frame_nonConst()

ezc3d::DataNS::Frame & ezc3d::DataNS::Data::frame_nonConst ( size_t  idx)

Get the frame of index idx in order to be modified by the caller.

Parameters
idxThe index of the frame
Returns
A non-const reference to the frame of index idx

Return a frame in the form of a non-const reference. The user can thereafter modify this frame at will, but with the caution it requires.

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

Definition at line 125 of file Data.cpp.

◆ frames()

const std::vector< ezc3d::DataNS::Frame > & ezc3d::DataNS::Data::frames ( ) const

Get all the frames from the data set.

Returns
The frames

Definition at line 148 of file Data.cpp.

◆ nbFrames()

size_t ezc3d::DataNS::Data::nbFrames ( ) const

Get the number of frames in the data structure.

Returns
The number of frames

Definition at line 108 of file Data.cpp.

◆ print()

void ezc3d::DataNS::Data::print ( ) const

Print the data.

Print all the data to the console by calling sequentially all the print method for all the frames

Definition at line 93 of file Data.cpp.

◆ write()

void ezc3d::DataNS::Data::write ( std::fstream &  f) const

Write all the data to an opened file.

Parameters
fAlready opened fstream file with write access

Write all the data to a file by calling sequentially all the write method for all the frames

Definition at line 102 of file Data.cpp.


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