PLY reader/writer  1.2.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Public Member Functions | Public Attributes | List of all members
PLY::Writer Struct Reference

The writer for storing Objects into a ply stream. More...

#include <io.h>

Public Member Functions

 Writer (Header &h)
 Base constructor. More...
 
 Writer (Header &h, std::ostream &os)
 Construct from existing stream. More...
 
 Writer (Header &h, const char *file_name, const Stream_type &type=ASCII)
 Construct and open a file. More...
 
bool open_file (const char *file_name, const Stream_type &type=ASCII)
 Open a file for writing. More...
 
void close_file ()
 Close the stream. More...
 
bool write_header ()
 Write the Header to the current stream. More...
 
bool write_data (Storage *store)
 Write the Object data to the current stream. More...
 
bool write_element (const Element &elem, Array *collect)
 Write all Objects of one Element. More...
 
bool write_object (const Element &elem, Object *obj)
 Write an Object. More...
 

Public Attributes

Headerheader
 The Header to write.
 
std::ostream * stream
 The stream to write to.
 

Detailed Description

The writer for storing Objects into a ply stream.

See Also
Reader.

Constructor & Destructor Documentation

PLY::Writer::Writer ( Header h)
inline

Base constructor.

In order to be able to share a Header, for example with a Writer, it is stored as a reference.

Parameters
[in,out]hthe Header to use.
PLY::Writer::Writer ( Header h,
std::ostream &  os 
)
inline

Construct from existing stream.

It is assumed that the stream was opened correctly. In order to be able to write any binary file, the stream must be opened in binary mode.

Parameters
[in,out]hthe Header to use.
[in,out]osthe stream to use.
PLY::Writer::Writer ( Header h,
const char *  file_name,
const Stream_type type = ASCII 
)
inline

Construct and open a file.

This constructor tries to open a file for writing

Parameters
[in,out]hthe Header to use.
file_namethe name of the file to read.
typethe storage type to use for the data.

Member Function Documentation

void PLY::Writer::close_file ( )

Close the stream.

Note that this will throw an exception when trying to close a standard io stream.

bool PLY::Writer::open_file ( const char *  file_name,
const Stream_type type = ASCII 
)

Open a file for writing.

Parameters
file_namethe file to open.
typethe storage type to use for the data.
Returns
true if the file could be successfully opened.
bool PLY::Writer::write_data ( Storage store)

Write the Object data to the current stream.

Note that this method writes the Header and all the Objects to the stream.

Parameters
storethe Objects to store.
Returns
true if all the data could be successfully written.
bool PLY::Writer::write_element ( const Element elem,
Array collect 
)

Write all Objects of one Element.

Parameters
elemthe Element of the Objects.
collectthe Objects to write.
Returns
true if all the data could be successfully written.
bool PLY::Writer::write_header ( )

Write the Header to the current stream.

Note that you should not change the num values of the Elements after writing the Header, as then the header and data no longer match.

Returns
true if the header could be correctly written.
bool PLY::Writer::write_object ( const Element elem,
Object obj 
)
inline

Write an Object.

Parameters
elemthe Element of the Object to store.
objthe Object to store.
Returns
true if the Object could be successfully written.

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