#include <Encoder.h>
Base class for encoders. Subclasses typically want to implement Encoder::init, Encoder::encode and Encoder::finish.
- See also
- prt::Callbacks
◆ Encoder()
Constructs an encoder instance. It is discouraged to call this directly, i.e. the corresponding EncoderFactory should be the only site which calls this constructor.
- See also
- prt::AttributeMap
-
prt::Callbacks
- Parameters
-
[in] | id | The encoder ID (supplied by corresponding factory class). |
[in] | options | The encoder options (supplied by corresponding factory class). |
[in] | callbacks | Client callbacks valid during the encoder life-time. |
◆ encode() [1/2]
virtual void prtx::Encoder::encode |
( |
GenerateContext & |
context, |
|
|
size_t |
initialShapeIndex |
|
) |
| |
|
virtual |
This encode member function is called once for each initial shape. This is where you can iterate over the shape tree to fetch any data necessary for your encoder. The default implementation does nothing. It is legal to throw exceptions.
- Parameters
-
[in] | context | The current generate context. |
[in] | initialShapeIndex | The initial shape index |
◆ encode() [2/2]
virtual void prtx::Encoder::encode |
( |
const prtx::ContentPtrVector & |
content | ) |
|
|
virtual |
This alternate encode member function is called from other encoders to defer encoding of other content objects. It is legal to throw exceptions.
- Parameters
-
[in] | content | Content objects whose encoding has been deferred from a upstream encoder. |
◆ finish()
Implement this member function to free resources allocated by this encoder or to complete output handler operations. This member function is called once after the last initial shape has been encoded. It is called regardless of any encode or generation errors. It is legal to throw exceptions.
- Parameters
-
[in] | context | The current generate context. |
◆ getCallbacks()
Accessor for callbacks for subclasses.
◆ getExtensionType()
|
inlinefinaloverridevirtual |
◆ getID()
const std::wstring& prtx::Encoder::getID |
( |
| ) |
const |
Returns the ID of this extension.
◆ getOptions()
Accessor to default options for subclasses.
◆ init()
Implement this member function to setup data structures needed by your encoder before the first call to encode happens. This default implementation does nothing. It is legal to throw exceptions.
- Parameters
-
[in] | context | The current generate context. |
◆ validate()
virtual bool prtx::Encoder::validate |
( |
GenerateContext & |
context, |
|
|
size_t |
initialShapeIndex |
|
) |
| const |
|
virtual |
This member function can be implemented to check if an initial shape is valid for encoding, e.g. if the necessary initial shape attributes are present for the specific encoder to work properly. PRT only calls encode if the return value is true.
- Returns
- Must return true if the initial shape is valid for encoding with this encoder. The default implementation always returns true. It is legal to throw exceptions.
- Parameters
-
[in] | context | The current generate context. |
[in] | initialShapeIndex | The initial shape index |
The documentation for this class was generated from the following file: