ArcGIS Procedural Runtime  3.2.10650
List of all members | Public Member Functions | Protected Member Functions
prtx::Encoder Class Reference

#include <Encoder.h>

Inheritance diagram for prtx::Encoder:
[legend]

Public Member Functions

virtual void encode (GenerateContext &context, size_t initialShapeIndex)
 
virtual void encode (const prtx::ContentPtrVector &content)
 
 Encoder (const std::wstring &id, const prt::AttributeMap *options, prt::Callbacks *callbacks)
 
virtual void finish (prtx::GenerateContext &context)
 
virtual ExtensionType getExtensionType () const final override
 
const std::wstring & getID () const
 
virtual void init (GenerateContext &context)
 
virtual bool validate (GenerateContext &context, size_t initialShapeIndex) const
 
- Public Member Functions inherited from prtx::Extension
 Extension (const Extension &)=delete
 
virtual prt::ContentType getContentType () const =0
 
Extensionoperator= (const Extension &)=delete
 

Protected Member Functions

prt::CallbacksgetCallbacks () const
 
const prt::AttributeMapgetOptions () const
 

Additional Inherited Members

- Public Types inherited from prtx::Extension
enum  ExtensionType {
  ET_UNDEFINED,
  ET_STREAM_ADAPTOR,
  ET_RESOLVEMAP_PROVIDER,
  ET_ENCODER,
  ET_DECODER,
  ET_COUNT
}
 
- Static Public Member Functions inherited from prtx::Extension
static prt::ContentType toContentType (const std::wstring &ctStr)
 
static ExtensionType toExtensionType (const std::wstring &etStr)
 
static const std::wstring & toString (const ExtensionType &et)
 
static const std::wstring & toString (const prt::ContentType &ct)
 

Detailed Description

Base class for encoders. Subclasses typically want to implement Encoder::init, Encoder::encode and Encoder::finish.

See also
prt::Callbacks

Constructor & Destructor Documentation

◆ Encoder()

prtx::Encoder::Encoder ( const std::wstring &  id,
const prt::AttributeMap options,
prt::Callbacks callbacks 
)

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]idThe encoder ID (supplied by corresponding factory class).
[in]optionsThe encoder options (supplied by corresponding factory class).
[in]callbacksClient callbacks valid during the encoder life-time.

Member Function Documentation

◆ 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]contextThe current generate context.
[in]initialShapeIndexThe 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]contentContent objects whose encoding has been deferred from a upstream encoder.

◆ finish()

virtual void prtx::Encoder::finish ( prtx::GenerateContext context)
virtual

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]contextThe current generate context.

◆ getCallbacks()

prt::Callbacks* prtx::Encoder::getCallbacks ( ) const
protected

Accessor for callbacks for subclasses.

◆ getExtensionType()

virtual ExtensionType prtx::Encoder::getExtensionType ( ) const
inlinefinaloverridevirtual

Returns the extension type, i.e. ET_ENCODER.

Implements prtx::Extension.

◆ getID()

const std::wstring& prtx::Encoder::getID ( ) const

Returns the ID of this extension.

◆ getOptions()

const prt::AttributeMap* prtx::Encoder::getOptions ( ) const
protected

Accessor to default options for subclasses.

◆ init()

virtual void prtx::Encoder::init ( GenerateContext context)
virtual

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]contextThe 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]contextThe current generate context.
[in]initialShapeIndexThe initial shape index

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