#include <parser.h>
Public Types | ||||
enum | Mode { Immediate, Callback, Progressive } | |||
Indicate the mode to use while parsing. More... | ||||
Public Member Functions | ||||
Parser (std::string path, Parser::Mode mode) | ||||
Create a parser loading the file 'path' and using the mode 'mode'. | ||||
void | parse () | |||
parse the input file
| ||||
void | write (const MeshSequenceType &type, const int &frame, const C< C< V > > &verts, const C< C< F > > &faces) | |||
int | getNbFrame () const | |||
MeshSequenceType | getMSType () const | |||
const C< C< V > > & | getVerticesInTime () const | |||
const C< C< F > > & | getFacesInTime () const | |||
C < SegmentationNS::SegmentationPtr > | getSegmentation () | |||
void | setSegmentation (const C< SegmentationNS::SegmentationPtr > &seg) | |||
void | setMeshSequence (MeshNS::MeshSequencePtr ms) | |||
MeshNS::PolyhedronPtr | getNext () |
V | the type of vertex : should have the &operator[] method, and &x(), &y(), &z() methods. | |
F | the type of face : should have push_back method. | |
C | container used to store F and V and the segmentation. should have a push_back method default is std::vector. |
The class is used in normal mode like that: Parser<V,F> parser(path); parser.parse() vector<vector<V> > verts= parser.getVertices(); vector<vector<F> > faces= parser.getVertices(); vector<Segmentation*> segmentations=parser.getSegmentations(); do everything you wants with verts, faces and segmentations.
The parser can also write file. Writing can only be done in immediate mode for now.
segmentation are always loaded in immediate mode
enum ParserNS::Parser::Mode |
Indicate the mode to use while parsing.
Possible values :
ParserNS::Parser< V, F, C >::Parser | ( | std::string | path, | |
Parser< V, F, C >::Mode | mode | |||
) | [inline] |
Create a parser loading the file 'path' and using the mode 'mode'.
path,: | the file to load | |
mode,: | the mode to use either Parser::Immediate or Parser::Progressive and Parser::Callback, please note that only Immediate is done and Callback |
void Parser::write | ( | const MeshSequenceType & | type, | |
const int & | frame, | |||
const C< C< V > > & | verts, | |||
const C< C< F > > & | faces | |||
) | [inline] |
type | : mesh sequence type |
frame | : number of frames | |
verts | : contains the verts of all the mesh in the sequence | |
faces | : contains the faces of all the mesh in the sequence |
ParserException |
int ParserNS::Parser< V, F, C >::getNbFrame | ( | ) | const [inline] |
MeshSequenceType ParserNS::Parser< V, F, C >::getMSType | ( | ) | const [inline] |
const C<C<V> >& ParserNS::Parser< V, F, C >::getVerticesInTime | ( | ) | const [inline] |
const C<C<F> >& ParserNS::Parser< V, F, C >::getFacesInTime | ( | ) | const [inline] |
C<SegmentationNS::SegmentationPtr> ParserNS::Parser< V, F, C >::getSegmentation | ( | ) | [inline] |
void ParserNS::Parser< V, F, C >::setSegmentation | ( | const C< SegmentationNS::SegmentationPtr > & | seg | ) | [inline] |
seg | : all the segmentation which have to be written |