BLPAPI C++  3.21.0
Service Class Reference

#include <blpapi_service.h>

Classes

struct  TestService
 

Public Member Functions

 Service ()
 
 Service (blpapi_Service_t *handle)
 
 Service (blpapi_Service_t *handle, TestService tag)
 
 Service (const Service &original)
 
 ~Service ()
 
Serviceoperator= (const Service &rhs)
 
Request createRequest (const char *operation) const
 
Request createAuthorizationRequest (const char *authorizationOperation=0) const
 
blpapi_Event_tcreatePublishEvent () const
 
blpapi_Event_tcreateAdminEvent () const
 
blpapi_Event_tcreateResponseEvent (const CorrelationId &correlationId) const
 
const char * name () const
 
const char * description () const
 
size_t numOperations () const
 
bool hasOperation (const char *name) const
 
bool hasOperation (const Name &name) const
 
Operation getOperation (size_t index) const
 
Operation getOperation (const char *name) const
 
Operation getOperation (const Name &name) const
 
int numEventDefinitions () const
 
bool hasEventDefinition (const char *name) const
 
bool hasEventDefinition (const Name &name) const
 
SchemaElementDefinition getEventDefinition (size_t index) const
 
SchemaElementDefinition getEventDefinition (const char *name) const
 
SchemaElementDefinition getEventDefinition (const Name &name) const
 
const char * authorizationServiceName () const
 
bool isValid () const
 
blpapi_Service_thandle () const
 
std::ostream & print (std::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Detailed Description

Defines a service which provides access to API data.

A Service object is obtained from a Session and contains the Operations (each of which contains its own schema) and the schema for Events which this Service may produce. A Service object is also used to create Request objects used with a Session to issue requests.

All API data is associated with a service. Before accessing API data using either request-reply or subscription, the appropriate Service must be opened and, if necessary, authorized.

Provider services are created to generate API data and must be registered before use.

The Service object is a handle to the underlying data which is owned by the Session. Once a Service has been successfully opened in a Session it remains accessible until the Session is terminated.

See Component blpapi_service

Constructor & Destructor Documentation

◆ Service() [1/4]

Service ( )

Create an uninitialized Service. The only valid operations on an uninitialized Service are assignment, isValid() and destruction.

◆ Service() [2/4]

Service ( blpapi_Service_t handle)

Assume ownership of the raw handle

◆ Service() [3/4]

Service ( blpapi_Service_t handle,
TestService  tag 
)

Assume ownership of the de-serialised service

◆ Service() [4/4]

Service ( const Service original)

Copy constructor.

◆ ~Service()

~Service ( )

Destructor. Destroying a Service object obtained from a Session does not close the underlying service.

Member Function Documentation

◆ authorizationServiceName()

const char * authorizationServiceName ( ) const

Returns the name of the Service which must be used in order to authorize access to restricted operations on this Service. If no authorization is required to access operations on this service an empty string is returned. Authorization services never require authorization to use.

◆ createAdminEvent()

blpapi_Event_t * createAdminEvent ( ) const

DEPRECATED Use Service::createPublishEvent() instead

Create an Admin Event suitable for publishing to this Service. Use an EventFormatter to add Messages to the Event and set fields.

◆ createAuthorizationRequest()

Request createAuthorizationRequest ( const char *  authorizationOperation = 0) const

Returns an empty Request object for the specified authorizationOperation. The request id of the new Request, i.e. Request::getRequestId(), is null.

An application must populate the Request before issuing it using Session::sendAuthorizationRequest().

If the authorizationOperation does not identify a valid operation for this Service then an exception is thrown.

◆ createPublishEvent()

blpapi_Event_t * createPublishEvent ( ) const

Create an Event suitable for publishing to this Service. Use an EventFormatter to add Messages to the Event and set fields.

◆ createRequest()

Request createRequest ( const char *  operation) const

Returns a empty Request object for the specified operation. If operation does not identify a valid operation in the Service then an exception is thrown.

An application must populate the Request before issuing it using Session::sendRequest().

◆ createResponseEvent()

blpapi_Event_t * createResponseEvent ( const CorrelationId correlationId) const

Create a response Event to answer the request. Use an EventFormatter to add a Message to the Event and set fields.

◆ description()

const char * description ( ) const

Returns a pointer to a null-terminated, read-only string which contains a human-readable description of this Service. The pointer remains valid until this Service object is destroyed.

◆ getEventDefinition() [1/3]

SchemaElementDefinition getEventDefinition ( size_t  index) const

Returns the SchemaElementDefinition of the specified indexth unsolicited event defined by this service. If index >= numEventDefinitions() an exception is thrown.

◆ getEventDefinition() [2/3]

SchemaElementDefinition getEventDefinition ( const char *  name) const

Return the SchemaElementDefinition of the unsolicited event defined by this Service identified by the specified name. If this Service does not define an unsolicited event name an exception is thrown.

◆ getEventDefinition() [3/3]

SchemaElementDefinition getEventDefinition ( const Name name) const

Return the definition of the unsolicited message having the specified name defined by this service. Throw exception of the no unsolicited message having the specified name is defined by this service.

◆ getOperation() [1/3]

Operation getOperation ( size_t  index) const

Returns the specified indexth Operation in this Service. If index>=numOperations() then an exception is thrown.

◆ getOperation() [2/3]

Operation getOperation ( const char *  name) const

Return the definition of the Operation identified by the specified name. If this Service does not define an operation name an exception is thrown.

◆ getOperation() [3/3]

Operation getOperation ( const Name name) const

Return the definition of the Operation having the specified name. Throw exception if no such Operation exists in this service.

◆ handle()

blpapi_Service_t * handle ( ) const

◆ hasEventDefinition() [1/2]

bool hasEventDefinition ( const char *  name) const

Returns true if the specified name identifies a valid event in this Service.

◆ hasEventDefinition() [2/2]

bool hasEventDefinition ( const Name name) const

Returns true if the specified name identifies a valid event in this Service.

◆ hasOperation() [1/2]

bool hasOperation ( const char *  name) const

Returns true if the specified name identifies a valid Operation in this Service. Otherwise returns false.

◆ hasOperation() [2/2]

bool hasOperation ( const Name name) const

Returns true if the specified name identifies a valid Operation in this Service. Otherwise returns false.

◆ isValid()

bool isValid ( ) const

Returns true if this Service is valid. That is, it was returned from a Session.

◆ name()

const char * name ( ) const

Returns a pointer to a null-terminated, read-only string which contains the name of this Service. The pointer remains valid until this Service object is destroyed.

◆ numEventDefinitions()

int numEventDefinitions ( ) const

Returns the number of unsolicited events defined by this Service.

◆ numOperations()

size_t numOperations ( ) const

Returns the number of Operations defined by this Service.

◆ operator=()

Service & operator= ( const Service rhs)

Assignment operator.

◆ print()

std::ostream & print ( std::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this Service schema to the specified output stream at (absolute value specified for) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level).


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