C++ Samples
Demonstrates how to create a C++ application using the VideoXpert SDK
CppSamples::Notifications::ViewAllNotifications Class Reference

This plugin sample print all notifications available in the current system. More...

#include <ViewAllNotifications.h>

Public Member Functions

 ViewAllNotifications (const std::string description)
 
 ~ViewAllNotifications ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Print all notifications available in the current system. More...
 
- Public Member Functions inherited from CppSamples::Common::Plugin
 Plugin (const std::string description)
 
virtual ~Plugin ()
 
std::string GetDescription () const
 Gets the description of this plugin. More...
 
PluginGetParent () const
 Gets the reference to the parent of this plugin. More...
 
void SetParent (Plugin *parent)
 Sets the reference to the parent of this plugin. More...
 

Static Protected Member Functions

static VxSdk::VxCollection< VxSdk::IVxNotification ** > GetNotifications (VxSdk::IVxSystem *vxSystem)
 Get a collection of notifications from the given VideoExpert system. More...
 
static void PrintNotifications (VxSdk::VxCollection< VxSdk::IVxNotification ** > notificationCollection)
 Prints the given collection of notifications to the screen. More...
 

Detailed Description

This plugin sample print all notifications available in the current system.

Definition at line 12 of file ViewAllNotifications.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Notifications::ViewAllNotifications::ViewAllNotifications ( const std::string  description)
inline

Definition at line 14 of file ViewAllNotifications.h.

14 : CppSamples::Common::Plugin(description) { }
Plugin is the abstract class which can be a menu item and/or a sample. Every sample and menu item mus...
Definition: Plugin.h:33
CppSamples::Notifications::ViewAllNotifications::~ViewAllNotifications ( )
inline

Definition at line 15 of file ViewAllNotifications.h.

15 { }

Member Function Documentation

VxCollection< IVxNotification ** > CppSamples::Notifications::ViewAllNotifications::GetNotifications ( VxSdk::IVxSystem vxSystem)
staticprotected

Get a collection of notifications from the given VideoExpert system.

Parameters
vxSystemPointer to the VideoExpert system.
Returns
A collection of notifications.

Definition at line 33 of file ViewAllNotifications.cpp.

33  {
34  VxCollection<IVxNotification**> notifications;
35  VxResult::Value result = vxSystem->GetNotifications(notifications);
36  if (result == VxResult::kInsufficientSize) {
37  notifications.collection = new IVxNotification*[notifications.collectionSize];
38  vxSystem->GetNotifications(notifications);
39  }
40  return notifications;
41 }
virtual VxResult::Value GetNotifications(VxCollection< IVxNotification ** > &notificationCollection) const =0
void CppSamples::Notifications::ViewAllNotifications::PrintNotifications ( VxSdk::VxCollection< VxSdk::IVxNotification ** >  notificationCollection)
staticprotected

Prints the given collection of notifications to the screen.

Parameters
notificationCollectionCollection of notifications.

Definition at line 47 of file ViewAllNotifications.cpp.

47  {
48 
49  cout << notificationCollection.collectionSize << " notifications found." << "\n";
50  if (notificationCollection.collectionSize == 0)
51  return;
52 
53  cout << "---------------------------------------------------------------------------------------------";
54  for (int i = 0; i < notificationCollection.collectionSize; i++) {
55  IVxNotification* notification = notificationCollection.collection[i];
56 
57  cout << "\n" << (i + 1);
58  cout << "\t" << notification->id;
59 
61  VxResult::Value result = notification->GetRoles(roles);
62  if (result == VxResult::kInsufficientSize) {
63  roles.collection = new IVxRole*[roles.collectionSize];
64  notification->GetRoles(roles);
65  }
66  cout << "\t" << roles.collectionSize << " role(s) associated with this.";
67  for (int j = 0; j < roles.collectionSize; j++)
68  cout << "\n\t\t" << (i + 1) << "." << (j + 1) << "\t" << roles.collection[j]->name;
69  }
70  cout << "\n---------------------------------------------------------------------------------------------\n";
71 }
virtual VxResult::Value GetRoles(VxCollection< IVxRole ** > &roleCollection) const =0
Plugin * CppSamples::Notifications::ViewAllNotifications::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Print all notifications available in the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 13 of file ViewAllNotifications.cpp.

13  {
14  Utility::ClearScreen();
15 
16  VxCollection<IVxNotification**> notifications = GetNotifications(dataModel->VxSystem);
17  PrintNotifications(notifications);
18 
19  // Wait for user response before going back to parent menu.
20  Utility::Pause();
21 
22  // Remove the memory allocated to the collection.
23  delete[] notifications.collection;
24  // Return reference of parent plugin to move back to parent menu.
25  return GetParent();
26 }
static void PrintNotifications(VxSdk::VxCollection< VxSdk::IVxNotification ** > notificationCollection)
Prints the given collection of notifications to the screen.
VxSdk::IVxSystem * VxSystem
Represents a VideoXpert system and allows the user to manage the system and devices.
Definition: Plugin.h:17
Plugin * GetParent() const
Gets the reference to the parent of this plugin.
Definition: Plugin.h:46
static VxSdk::VxCollection< VxSdk::IVxNotification ** > GetNotifications(VxSdk::IVxSystem *vxSystem)
Get a collection of notifications from the given VideoExpert system.

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