Thea
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
CodecObj< MeshT, BuilderT > Class Template Referenceabstract

Codec for reading and writing OBJ files. More...

#include <MeshCodecObj.hpp>

Inherits CodecObjBase< MeshT >.

Classes

class  ReadOptions
 Options for deserializing meshes. More...
 
class  WriteOptions
 Options for serializing meshes. More...
 

Public Types

typedef BuilderT Builder
 The mesh builder class used by the codec. More...
 
typedef std::array< int8,(size_t) MAGIC_LENGTHMagicString
 The type of the codec's magic string (an array of MAGIC_LENGTH bytes). More...
 
typedef MeshT Mesh
 The type of mesh processed by the codec. More...
 
typedef Graphics::MeshGroup< MeshMeshGroup
 A group of meshes. More...
 
typedef MeshGroup::MeshPtr MeshPtr
 A shared pointer to a mesh. More...
 
typedef BaseT::ReadCallback ReadCallback
 Called when a mesh element is read. More...
 
typedef BaseT::WriteCallback WriteCallback
 Called when a mesh element is written. More...
 

Public Member Functions

 CodecObj (ReadOptions const &read_opts_=ReadOptions::defaults(), WriteOptions const &write_opts_=WriteOptions::defaults())
 Constructor. More...
 
 operator intx () const
 Implicitly convert to an integer value for use in switch statements etc. More...
 
bool operator== (Codec const &other) const
 Check if two codecs are equal. More...
 
virtual void readMeshGroup (MeshGroup< Mesh > &mesh_group, BinaryInputStream &input, Codec::BlockHeader const *block_header, ReadCallback *callback) const =0
 Read a mesh group from a binary output stream. More...
 
int8 setName (char const *s)
 Set the name of the object. More...
 
virtual void writeMeshGroup (MeshGroup< Mesh > const &mesh_group, BinaryOutputStream &output, bool write_block_header, WriteCallback *callback) const =0
 Write a mesh group to a binary output stream. More...
 

Static Public Member Functions

static MagicString toMagic (std::string const &s)
 Convenience function to convert a string literal to a magic string. More...
 

Static Public Attributes

static intx const MAGIC_LENGTH = 8
 The standard length (in bytes) of the codec's magic string as used in BlockHeader. More...
 

Detailed Description

template<typename MeshT, typename BuilderT>
class Thea::CodecObj< MeshT, BuilderT >

Codec for reading and writing OBJ files.

Definition at line 100 of file MeshCodec.hpp.

Member Typedef Documentation

typedef BuilderT Builder

The mesh builder class used by the codec.

Definition at line 99 of file MeshCodecObj.hpp.

typedef std::array<int8, (size_t)MAGIC_LENGTH> MagicString
inherited

The type of the codec's magic string (an array of MAGIC_LENGTH bytes).

Definition at line 42 of file Codec.hpp.

typedef MeshT Mesh

The type of mesh processed by the codec.

Definition at line 96 of file MeshCodecObj.hpp.

A group of meshes.

Definition at line 97 of file MeshCodecObj.hpp.

A shared pointer to a mesh.

Definition at line 98 of file MeshCodecObj.hpp.

Called when a mesh element is read.

Definition at line 100 of file MeshCodecObj.hpp.

Called when a mesh element is written.

Definition at line 101 of file MeshCodecObj.hpp.

Constructor & Destructor Documentation

CodecObj ( ReadOptions const &  read_opts_ = ReadOptions::defaults(),
WriteOptions const &  write_opts_ = WriteOptions::defaults() 
)

Constructor.

Definition at line 213 of file MeshCodecObj.hpp.

Member Function Documentation

operator intx ( ) const
inherited

Implicitly convert to an integer value for use in switch statements etc.

This value will be common to all instances of the codec class

Definition at line 136 of file Codec.hpp.

bool operator== ( Codec const &  other) const
inherited

Check if two codecs are equal.

All instances of a codec class must be considered equal.

Definition at line 130 of file Codec.hpp.

virtual void readMeshGroup ( MeshGroup< Mesh > &  mesh_group,
BinaryInputStream input,
Codec::BlockHeader const *  block_header,
ReadCallback callback 
) const
pure virtualinherited

Read a mesh group from a binary output stream.

Any block header, if present, is assumed to have already been extracted from the stream and stored in the object pointed to by block_header. Else, block_header should be a null pointer.

int8 setName ( char const *  s)
virtualinherited

Set the name of the object.

Returns
True if the name was successfully set, else false (e.g. if the name is read-only).

Implements INamedObject.

Definition at line 124 of file Codec.hpp.

static MagicString toMagic ( std::string const &  s)
staticinherited

Convenience function to convert a string literal to a magic string.

Definition at line 139 of file Codec.hpp.

virtual void writeMeshGroup ( MeshGroup< Mesh > const &  mesh_group,
BinaryOutputStream output,
bool  write_block_header,
WriteCallback callback 
) const
pure virtualinherited

Write a mesh group to a binary output stream.

Optionally (if write_block_header is true) prefixes extra information about the mesh block such as its size and type (which may have not been specified in the encoding format itself).

Member Data Documentation

intx const MAGIC_LENGTH = 8
staticinherited

The standard length (in bytes) of the codec's magic string as used in BlockHeader.

Definition at line 39 of file Codec.hpp.


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