1#ifndef INCLUDED_Lightstreamer_Subscription
2#define INCLUDED_Lightstreamer_Subscription
4#include "../Lightstreamer.h"
5#include "Lightstreamer/LightstreamerError.h"
7namespace Lightstreamer {
93 Subscription(
const std::string& mode,
const std::vector<std::string>& items,
const std::vector<std::string>& fields) {
94 _delegate = Subscription_new(&mode, &items, &fields,
this);
98 Lightstreamer_releaseHaxeObject(_delegate);
114 if (listener ==
nullptr)
116 Subscription_addListener(_delegate, listener);
132 if (listener ==
nullptr)
134 Subscription_removeListener(_delegate, listener);
143 return Subscription_getListeners(_delegate);
161 return Subscription_isActive(_delegate);
177 return Subscription_isSubscribed(_delegate);
187 return Subscription_getDataAdapter(_delegate);
217 Subscription_setDataAdapter(_delegate, &dataAdapter);
228 return Subscription_getMode(_delegate);
240 return Subscription_getItems(_delegate);
258 void setItems(
const std::vector<std::string>& items) {
259 Subscription_setItems(_delegate, &items);
269 return Subscription_getItemGroup(_delegate);
287 Subscription_setItemGroup(_delegate, &group);
297 return Subscription_getFields(_delegate);
315 void setFields(
const std::vector<std::string>& fields) {
316 Subscription_setFields(_delegate, &fields);
326 return Subscription_getFieldSchema(_delegate);
344 Subscription_setFieldSchema(_delegate, &schema);
357 return Subscription_getRequestedBufferSize(_delegate);
391 Subscription_setRequestedBufferSize(_delegate, &size);
403 return Subscription_getRequestedSnapshot(_delegate);
442 Subscription_setRequestedSnapshot(_delegate, &snapshot);
455 return Subscription_getRequestedMaxFrequency(_delegate);
516 Subscription_setRequestedMaxFrequency(_delegate, &frequency);
527 return Subscription_getSelector(_delegate);
546 Subscription_setSelector(_delegate, &selector);
562 return Subscription_getCommandPosition(_delegate);
578 return Subscription_getKeyPosition(_delegate);
590 return Subscription_getCommandSecondLevelAdapter(_delegate);
620 Subscription_setCommandSecondLevelDataAdapter(_delegate, &dataAdapter);
633 return Subscription_getCommandSecondLevelFields(_delegate);
673 Subscription_setCommandSecondLevelFields(_delegate, &fields);
686 return Subscription_getCommandSecondLevelFieldSchema(_delegate);
721 Subscription_setCommandSecondLevelFieldSchema(_delegate, &schema);
742 std::string
getValue(
const std::string& itemName,
const std::string& fieldName) {
743 return Subscription_getValueSS(_delegate, &itemName, &fieldName);
768 return Subscription_getValueII(_delegate, itemPos, fieldPos);
791 std::string
getValue(
const std::string& itemName,
int fieldPos) {
792 return Subscription_getValueSI(_delegate, &itemName, fieldPos);
815 std::string
getValue(
int itemPos,
const std::string& fieldName) {
816 return Subscription_getValueIS(_delegate, itemPos, &fieldName);
838 std::string
getCommandValue(
const std::string& itemName,
const std::string& keyValue,
const std::string& fieldName) {
839 return Subscription_getCommandValueSS(_delegate, &itemName, &keyValue, &fieldName);
865 return Subscription_getCommandValueII(_delegate, itemPos, &keyValue, fieldPos);
888 std::string
getCommandValue(
const std::string& itemName,
const std::string& keyValue,
int fieldPos) {
889 return Subscription_getCommandValueSI(_delegate, &itemName, &keyValue, fieldPos);
913 std::string
getCommandValue(
int itemPos,
const std::string& keyValue,
const std::string& fieldName) {
914 return Subscription_getCommandValueIS(_delegate, itemPos, &keyValue, &fieldName);
Facade class for the management of the communication to Lightstreamer Server.
Definition LightstreamerClient.h:34
The LightstreamerError class provides a base class for exceptions thrown by the library.
Definition LightstreamerError.h:12
Class representing a Subscription to be submitted to a Lightstreamer Server.
Definition Subscription.h:56
std::string getValue(const std::string &itemName, int fieldPos)
Returns the latest value received for the specified item/field pair.
Definition Subscription.h:791
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:619
void setSelector(const std::string &selector)
Setter method that sets the selector name for all the items in the Subscription.
Definition Subscription.h:545
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:515
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:93
std::string getRequestedMaxFrequency()
Inquiry method that can be used to read the max frequency, configured through setRequestedMaxFrequenc...
Definition Subscription.h:454
std::string getItemGroup()
Inquiry method that can be used to read the item group specified for this Subscription.
Definition Subscription.h:268
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:838
std::string getFieldSchema()
Inquiry method that can be used to read the field schema specified for this Subscription.
Definition Subscription.h:325
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:216
void addListener(SubscriptionListener *listener)
Adds a listener that will receive events from the Subscription instance.
Definition Subscription.h:113
std::string getSelector()
Inquiry method that can be used to read the selector name specified for this Subscription through s...
Definition Subscription.h:526
std::string getCommandSecondLevelFieldSchema()
Inquiry method that can be used to read the "Field Schema" specified for second-level Subscriptions.
Definition Subscription.h:685
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:390
int getCommandPosition()
Returns the position of the "command" field in a COMMAND Subscription.
Definition Subscription.h:561
std::string getMode()
Inquiry method that can be used to read the mode specified for this Subscription.
Definition Subscription.h:227
std::vector< std::string > getCommandSecondLevelFields()
Inquiry method that can be used to read the "Field List" specified for second-level Subscriptions.
Definition Subscription.h:632
bool isSubscribed()
Inquiry method that checks if the Subscription is currently subscribed to through the server or not.
Definition Subscription.h:176
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:672
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:742
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:913
void setItemGroup(const std::string &group)
Setter method that sets the "Item Group" to be subscribed to through Lightstreamer Server.
Definition Subscription.h:286
std::vector< std::string > getItems()
Inquiry method that can be used to read the "Item List" specified for this Subscription.
Definition Subscription.h:239
std::string getValue(int itemPos, const std::string &fieldName)
Returns the latest value received for the specified item/field pair.
Definition Subscription.h:815
void removeListener(SubscriptionListener *listener)
Removes a listener from the Subscription instance so that it will not receive events anymore.
Definition Subscription.h:131
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:258
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:888
std::vector< SubscriptionListener * > getListeners()
Returns a list containing the SubscriptionListener instances that were added to this client.
Definition Subscription.h:142
std::string getCommandSecondLevelDataAdapter()
Inquiry method that can be used to read the second-level Data Adapter name configured through setComm...
Definition Subscription.h:589
int getKeyPosition()
Returns the position of the "key" field in a COMMAND Subscription.
Definition Subscription.h:577
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:315
std::string getRequestedSnapshot()
Inquiry method that can be used to read the snapshot preferences, configured through setRequestedSnap...
Definition Subscription.h:402
std::string getDataAdapter()
Inquiry method that can be used to read the name of the Data Adapter specified for this Subscription ...
Definition Subscription.h:186
void setFieldSchema(const std::string &schema)
Setter method that sets the "Field Schema" to be subscribed to through Lightstreamer Server.
Definition Subscription.h:343
std::string getValue(int itemPos, int fieldPos)
Returns the latest value received for the specified item/field pair.
Definition Subscription.h:767
std::vector< std::string > getFields()
Inquiry method that can be used to read the "Field List" specified for this Subscription.
Definition Subscription.h:296
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:864
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:720
void setRequestedSnapshot(const std::string &snapshot)
Setter method that enables/disables snapshot delivery request for the items in the Subscription.
Definition Subscription.h:441
bool isActive()
Inquiry method that checks if the Subscription is currently "active" or not.
Definition Subscription.h:160
std::string getRequestedBufferSize()
Inquiry method that can be used to read the buffer size, configured though setRequestedBufferSize,...
Definition Subscription.h:356
Interface to be implemented to listen to Subscription events comprehending notifications of subscript...
Definition SubscriptionListener.h:18