CAD Exchanger SDK
cadex::Base_StreamProviderFactory< T > Class Template Referenceabstract

Base class for user-defined stream provider factories that can be used during file parsing or formatting. More...

Inherited by cadex::internal::Base_IFileStreamProviderFactory.

Public Member Functions

virtual ~Base_StreamProviderFactory ()
 Destructor.
 
virtual std::shared_ptr< Base_StreamProvider< T > > Create (const Base_UTF16String &theFileName)=0
 Creates an instance of a custom stream provider. More...
 
virtual std::shared_ptr< Base_StreamProvider< T > > Create ()=0
 Creates an instance of a custom stream provider. More...
 

Detailed Description

template<typename T>
class cadex::Base_StreamProviderFactory< T >

Base class for user-defined stream provider factories that can be used during file parsing or formatting.

Subclasses must implement creation of subclasses of Base_StreamProvider for corresponding stream to implement access to files residing on specific data storages (e.g. in cloud).

An instance of the factory is provided into Base_Reader::ReadFile() and will be retained significantly long up to until the entire file has been parsed.

See also
Base_StreamProvider, Base_IStreamProviderFactory.

Member Function Documentation

◆ Create() [1/2]

template<typename T >
std::shared_ptr< Base_StreamProvider > cadex::Base_StreamProviderFactory< T >::Create ( const Base_UTF16String theFileName)
pure virtual

Creates an instance of a custom stream provider.

Subclasses must redefine this method in order to create a stream per file name.

theFileName will contain a full path to the file. For example, if a central JT file is /custom_protocol/custom_path/assembly.jt and refers to a child file named assembly/part1.jt then the stream provider for the child file will be created with the file name /custom_protocol/custom_path/assembly/part1.jt.

◆ Create() [2/2]

template<typename T >
std::shared_ptr< Base_StreamProvider > cadex::Base_StreamProviderFactory< T >::Create ( )
pure virtual

Creates an instance of a custom stream provider.

Subclasses must redefine this method in order to create a stream without a specified file name. The stream will be opened later by explicitly calling Base_StreamProvider::Open().

When importing JT files with external referencesthis method will be called for any child file before starting parsing it.

theFileName will contain a full path to the file. For example, if a central JT file is /custom_protocol/custom_path/assembly.jt and refers to a child file named assembly/part1.jt then the stream provider for the child file will be created with the file name /custom_protocol/custom_path/assembly/part1.jt.