16#ifndef INCLUDED_Lightstreamer_Subscription
17#define INCLUDED_Lightstreamer_Subscription
19#include "../Lightstreamer.h"
20#include "Lightstreamer/LightstreamerError.h"
22namespace Lightstreamer {
108 Subscription(
const std::string& mode,
const std::vector<std::string>& items,
const std::vector<std::string>& fields) {
109 _delegate = Subscription_new(&mode, &items, &fields,
this);
113 Lightstreamer_releaseHaxeObject(_delegate);
129 if (listener ==
nullptr)
131 Subscription_addListener(_delegate, listener);
147 if (listener ==
nullptr)
149 Subscription_removeListener(_delegate, listener);
158 return Subscription_getListeners(_delegate);
176 return Subscription_isActive(_delegate);
192 return Subscription_isSubscribed(_delegate);
202 return Subscription_getDataAdapter(_delegate);
232 Subscription_setDataAdapter(_delegate, &dataAdapter);
243 return Subscription_getMode(_delegate);
255 return Subscription_getItems(_delegate);
273 void setItems(
const std::vector<std::string>& items) {
274 Subscription_setItems(_delegate, &items);
284 return Subscription_getItemGroup(_delegate);
302 Subscription_setItemGroup(_delegate, &group);
312 return Subscription_getFields(_delegate);
330 void setFields(
const std::vector<std::string>& fields) {
331 Subscription_setFields(_delegate, &fields);
341 return Subscription_getFieldSchema(_delegate);
359 Subscription_setFieldSchema(_delegate, &schema);
372 return Subscription_getRequestedBufferSize(_delegate);
406 Subscription_setRequestedBufferSize(_delegate, &size);
418 return Subscription_getRequestedSnapshot(_delegate);
457 Subscription_setRequestedSnapshot(_delegate, &snapshot);
470 return Subscription_getRequestedMaxFrequency(_delegate);
531 Subscription_setRequestedMaxFrequency(_delegate, &frequency);
542 return Subscription_getSelector(_delegate);
561 Subscription_setSelector(_delegate, &selector);
577 return Subscription_getCommandPosition(_delegate);
593 return Subscription_getKeyPosition(_delegate);
605 return Subscription_getCommandSecondLevelAdapter(_delegate);
635 Subscription_setCommandSecondLevelDataAdapter(_delegate, &dataAdapter);
648 return Subscription_getCommandSecondLevelFields(_delegate);
688 Subscription_setCommandSecondLevelFields(_delegate, &fields);
701 return Subscription_getCommandSecondLevelFieldSchema(_delegate);
736 Subscription_setCommandSecondLevelFieldSchema(_delegate, &schema);
757 std::string
getValue(
const std::string& itemName,
const std::string& fieldName) {
758 return Subscription_getValueSS(_delegate, &itemName, &fieldName);
783 return Subscription_getValueII(_delegate, itemPos, fieldPos);
806 std::string
getValue(
const std::string& itemName,
int fieldPos) {
807 return Subscription_getValueSI(_delegate, &itemName, fieldPos);
830 std::string
getValue(
int itemPos,
const std::string& fieldName) {
831 return Subscription_getValueIS(_delegate, itemPos, &fieldName);
853 std::string
getCommandValue(
const std::string& itemName,
const std::string& keyValue,
const std::string& fieldName) {
854 return Subscription_getCommandValueSS(_delegate, &itemName, &keyValue, &fieldName);
880 return Subscription_getCommandValueII(_delegate, itemPos, &keyValue, fieldPos);
903 std::string
getCommandValue(
const std::string& itemName,
const std::string& keyValue,
int fieldPos) {
904 return Subscription_getCommandValueSI(_delegate, &itemName, &keyValue, fieldPos);
928 std::string
getCommandValue(
int itemPos,
const std::string& keyValue,
const std::string& fieldName) {
929 return Subscription_getCommandValueIS(_delegate, itemPos, &keyValue, &fieldName);
Facade class for the management of the communication to Lightstreamer Server.
Definition LightstreamerClient.h:49
The LightstreamerError class provides a base class for exceptions thrown by the library.
Definition LightstreamerError.h:27
Class representing a Subscription to be submitted to a Lightstreamer Server.
Definition Subscription.h:71
std::string getValue(const std::string &itemName, int fieldPos)
Returns the latest value received for the specified item/field pair.
Definition Subscription.h:806
void setCommandSecondLevelDataAdapter(const std::string &dataAdapter)
Setter method that sets the name of the second-level Data Adapter (within the Adapter Set used by the...
Definition Subscription.h:634
void setSelector(const std::string &selector)
Setter method that sets the selector name for all the items in the Subscription.
Definition Subscription.h:560
void setRequestedMaxFrequency(const std::string &frequency)
Setter method that sets the maximum update frequency to be requested to Lightstreamer Server for all ...
Definition Subscription.h:530
Subscription(const std::string &mode, const std::vector< std::string > &items, const std::vector< std::string > &fields)
Creates an object to be used to describe a Subscription that is going to be subscribed to through Lig...
Definition Subscription.h:108
std::string getRequestedMaxFrequency()
Inquiry method that can be used to read the max frequency, configured through setRequestedMaxFrequenc...
Definition Subscription.h:469
std::string getItemGroup()
Inquiry method that can be used to read the item group specified for this Subscription.
Definition Subscription.h:283
std::string getCommandValue(const std::string &itemName, const std::string &keyValue, const std::string &fieldName)
Returns the latest value received for the specified item/key/field combination.
Definition Subscription.h:853
std::string getFieldSchema()
Inquiry method that can be used to read the field schema specified for this Subscription.
Definition Subscription.h:340
void setDataAdapter(const std::string &dataAdapter)
Setter method that sets the name of the Data Adapter (within the Adapter Set used by the current sess...
Definition Subscription.h:231
void addListener(SubscriptionListener *listener)
Adds a listener that will receive events from the Subscription instance.
Definition Subscription.h:128
std::string getSelector()
Inquiry method that can be used to read the selector name specified for this Subscription through s...
Definition Subscription.h:541
std::string getCommandSecondLevelFieldSchema()
Inquiry method that can be used to read the "Field Schema" specified for second-level Subscriptions.
Definition Subscription.h:700
void setRequestedBufferSize(const std::string &size)
Setter method that sets the length to be requested to Lightstreamer Server for the internal queuing b...
Definition Subscription.h:405
int getCommandPosition()
Returns the position of the "command" field in a COMMAND Subscription.
Definition Subscription.h:576
std::string getMode()
Inquiry method that can be used to read the mode specified for this Subscription.
Definition Subscription.h:242
std::vector< std::string > getCommandSecondLevelFields()
Inquiry method that can be used to read the "Field List" specified for second-level Subscriptions.
Definition Subscription.h:647
bool isSubscribed()
Inquiry method that checks if the Subscription is currently subscribed to through the server or not.
Definition Subscription.h:191
void setCommandSecondLevelFields(const std::vector< std::string > &fields)
Setter method that sets the "Field List" to be subscribed to through Lightstreamer Server for the sec...
Definition Subscription.h:687
std::string getValue(const std::string &itemName, const std::string &fieldName)
Returns the latest value received for the specified item/field pair.
Definition Subscription.h:757
std::string getCommandValue(int itemPos, const std::string &keyValue, const std::string &fieldName)
Returns the latest value received for the specified item/key/field combination.
Definition Subscription.h:928
void setItemGroup(const std::string &group)
Setter method that sets the "Item Group" to be subscribed to through Lightstreamer Server.
Definition Subscription.h:301
std::vector< std::string > getItems()
Inquiry method that can be used to read the "Item List" specified for this Subscription.
Definition Subscription.h:254
std::string getValue(int itemPos, const std::string &fieldName)
Returns the latest value received for the specified item/field pair.
Definition Subscription.h:830
void removeListener(SubscriptionListener *listener)
Removes a listener from the Subscription instance so that it will not receive events anymore.
Definition Subscription.h:146
void setItems(const std::vector< std::string > &items)
Setter method that sets the "Item List" to be subscribed to through Lightstreamer Server.
Definition Subscription.h:273
std::string getCommandValue(const std::string &itemName, const std::string &keyValue, int fieldPos)
Returns the latest value received for the specified item/key/field combination.
Definition Subscription.h:903
std::vector< SubscriptionListener * > getListeners()
Returns a list containing the SubscriptionListener instances that were added to this client.
Definition Subscription.h:157
std::string getCommandSecondLevelDataAdapter()
Inquiry method that can be used to read the second-level Data Adapter name configured through setComm...
Definition Subscription.h:604
int getKeyPosition()
Returns the position of the "key" field in a COMMAND Subscription.
Definition Subscription.h:592
void setFields(const std::vector< std::string > &fields)
Setter method that sets the "Field List" to be subscribed to through Lightstreamer Server.
Definition Subscription.h:330
std::string getRequestedSnapshot()
Inquiry method that can be used to read the snapshot preferences, configured through setRequestedSnap...
Definition Subscription.h:417
std::string getDataAdapter()
Inquiry method that can be used to read the name of the Data Adapter specified for this Subscription ...
Definition Subscription.h:201
void setFieldSchema(const std::string &schema)
Setter method that sets the "Field Schema" to be subscribed to through Lightstreamer Server.
Definition Subscription.h:358
std::string getValue(int itemPos, int fieldPos)
Returns the latest value received for the specified item/field pair.
Definition Subscription.h:782
std::vector< std::string > getFields()
Inquiry method that can be used to read the "Field List" specified for this Subscription.
Definition Subscription.h:311
std::string getCommandValue(int itemPos, const std::string &keyValue, int fieldPos)
Returns the latest value received for the specified item/key/field combination.
Definition Subscription.h:879
void setCommandSecondLevelFieldSchema(const std::string &schema)
Setter method that sets the "Field Schema" to be subscribed to through Lightstreamer Server for the s...
Definition Subscription.h:735
void setRequestedSnapshot(const std::string &snapshot)
Setter method that enables/disables snapshot delivery request for the items in the Subscription.
Definition Subscription.h:456
bool isActive()
Inquiry method that checks if the Subscription is currently "active" or not.
Definition Subscription.h:175
std::string getRequestedBufferSize()
Inquiry method that can be used to read the buffer size, configured though setRequestedBufferSize,...
Definition Subscription.h:371
Interface to be implemented to listen to Subscription events comprehending notifications of subscript...
Definition SubscriptionListener.h:33