dxFeed Graal CXX API v9.0.0
Loading...
Searching...
No Matches
InstrumentProfileReader Class Referencefinal

Reads instrument profiles from the stream using Instrument Profile Format (IPF). More...

#include <InstrumentProfileReader.hpp>

Inheritance diagram for InstrumentProfileReader:

Public Types

using Ptr = std::shared_ptr<InstrumentProfileReader>
 The alias to a type of shared pointer to the InstrumentProfileReader object.
using Unique = std::unique_ptr<InstrumentProfileReader>
 The alias to a type of unique pointer to the InstrumentProfileReader object.
Public Types inherited from SharedEntity
using Ptr = std::shared_ptr<SharedEntity>
 The alias to a type of shared pointer to the SharedEntity object.

Public Member Functions

std::int64_t getLastModified () const
 Returns the last modification time (in milliseconds) from the last InstrumentProfileReader::readFromFile() operation or zero if it is unknown.
bool wasComplete () const
 Returns true if IPF was fully read on last InstrumentProfileReader::readFromFile() operation.
std::vector< std::shared_ptr< InstrumentProfile > > readFromFile (StringParam address) const
 Reads and returns instrument profiles from specified file.
std::vector< std::shared_ptr< InstrumentProfile > > readFromFile (StringParam address, StringParam user, StringParam password) const
 Reads and returns instrument profiles from specified address with a specified basic user and password credentials.
std::vector< std::shared_ptr< InstrumentProfile > > readFromFile (StringParam address, const AuthToken &token) const
 Reads and returns instrument profiles from specified address with a specified token credentials.
Public Member Functions inherited from SharedEntity
template<typename T>
bool is () const noexcept
 Checks that the object is of type T: its dynamic type is T or derived from T.
template<typename T>
std::shared_ptr< T > sharedAs () noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.
template<typename T>
std::shared_ptr< T > sharedAs () const noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.
virtual std::string toString () const
 Returns a string representation of the current object.
Public Member Functions inherited from Entity
virtual ~Entity () noexcept
 The default virtual d-tor.

Static Public Member Functions

static Ptr create ()
 Creates the new InstrumentProfileReader.
static std::string resolveSourceURL (StringParam address)
 Converts a specified string address specification into an URL that will be read by InstrumentProfileReader::readFromFile() method.

Detailed Description

Reads instrument profiles from the stream using Instrument Profile Format (IPF).

Please see Instrument Profile Format documentation for complete description. This reader automatically uses data formats as specified in the stream.

This reader is intended for "one time only" usage: create new instances for new IPF reads.

Use InstrumentProfileConnection if support for streaming updates of instrument profiles is needed.

For backward compatibility reader can be configured with system property "-Dcom.dxfeed.ipf.complete" to control the strategy for missing "##COMPLETE" tag when reading IPF, possible values are:

  • warn - show warning in the log (default)
  • error - throw exception (future default)
  • ignore - do nothing (for backward compatibility)

Member Function Documentation

◆ create()

InstrumentProfileReader::Ptr InstrumentProfileReader::create ( )
static

Creates the new InstrumentProfileReader.

Returns
The new InstrumentProfileReader

◆ readFromFile() [1/3]

std::vector< std::shared_ptr< InstrumentProfile > > InstrumentProfileReader::readFromFile ( StringParam address) const

Reads and returns instrument profiles from specified file.

This method recognizes data compression formats "zip" and "gzip" automatically. In case of zip the first file entry will be read and parsed as a plain data stream. In case of gzip compressed content will be read and processed. In other cases data considered uncompressed and will be parsed as is.

Authentication information can be supplied to this method as part of URL user info like "http://user:password@host:port/path/file.ipf".

This operation updates lastModified and wasComplete.

Parameters
addressURL of file to read from
Returns
list of instrument profiles

◆ readFromFile() [2/3]

std::vector< std::shared_ptr< InstrumentProfile > > InstrumentProfileReader::readFromFile ( StringParam address,
const AuthToken & token ) const

Reads and returns instrument profiles from specified address with a specified token credentials.

This method recognizes data compression formats "zip" and "gzip" automatically. In case of zip the first file entry will be read and parsed as a plain data stream. In case of gzip compressed content will be read and processed. In other cases data considered uncompressed and will be parsed as is.

Specified token take precedence over authentication information that is supplied to this method as part of URL user info like "http://user:password@host:port/path/file.ipf".

This operation updates lastModified and wasComplete.

Parameters
addressURL of file to read from
tokenthe token
Returns
list of instrument profiles
Exceptions
JavaException("InstrumentProfileFormatException")if input stream does not conform to the Instrument Profile Format
JavaException("IOException")If an I/O error occurs

◆ readFromFile() [3/3]

std::vector< std::shared_ptr< InstrumentProfile > > InstrumentProfileReader::readFromFile ( StringParam address,
StringParam user,
StringParam password ) const

Reads and returns instrument profiles from specified address with a specified basic user and password credentials.

This method recognizes data compression formats "zip" and "gzip" automatically. In case of zip the first file entry will be read and parsed as a plain data stream. In case of gzip compressed content will be read and processed. In other cases data considered uncompressed and will be parsed as is.

Specified user and password take precedence over authentication information that is supplied to this method as part of URL user info like "http://user:password@host:port/path/file.ipf".

This operation updates lastModified and wasComplete.

Parameters
addressURL of file to read from
userthe user name
passwordthe password
Returns
list of instrument profiles