History

TimeSeriesPlatformLibrary: Added InstancePublish sample to show how to create multiple GEP data publisher instances.

J. Ritchie Carroll committed 7 years ago

Commit a980d721 parent dcb6ae511 files · +549 −2Browse files

Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/InstanceSubscribe.cpp (1 of 11 files). Show all

Unified · Split

Source/Libraries/TimeSeriesPlatformLibrary/Samples/InstanceSubscribe.cpp+5−1
@@ -37,6 +37,7 @@ int main(int argc, char* argv[]) · 36 unmodified lines
37{37{
38 string hostname;38 string hostname;
39 uint16_t port;39 uint16_t port;
40 bool usePortOffset = false;
40 41
41 // Ensure that the necessary42 // Ensure that the necessary
42 // command line arguments are given.43 // command line arguments are given.
@@ -51,12 +52,15 @@ int main(int argc, char* argv[]) · 8 unmodified lines
51 hostname = argv[1];52 hostname = argv[1];
52 stringstream(argv[2]) >> port;53 stringstream(argv[2]) >> port;
53 54
55 if (argc > 3)
56 usePortOffset = ParseBoolean(argv[3]);
57
54 // Initialize the subscribers.58 // Initialize the subscribers.
55 for (uint32_t i = 0; i < TotalInstances; i++)59 for (uint32_t i = 0; i < TotalInstances; i++)
56 {60 {
57 // Maintain the life-time of SubscriberHandler instances within main61 // Maintain the life-time of SubscriberHandler instances within main
58 SubscriberHandler* subscriber = new SubscriberHandler("Subscriber " + ToString(i + 1));62 SubscriberHandler* subscriber = new SubscriberHandler("Subscriber " + ToString(i + 1));
59 subscriber->Initialize(hostname, port);63 subscriber->Initialize(hostname, port + static_cast<uint16_t>(usePortOffset ? i : 0));
60 64
61 switch (i)65 switch (i)
62 {66 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t