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

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

#include <ViewAllSchedules.h>

Public Member Functions

 ViewAllSchedules (const std::string description)
 
 ~ViewAllSchedules ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Print all schedules 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::IVxSchedule ** > GetSchedules (VxSdk::IVxSystem *vxSystem)
 Get a collection of schedules from the given VideoExpert system. More...
 
static void PrintSchedules (VxSdk::VxCollection< VxSdk::IVxSchedule ** > scheduleCollection)
 Prints the given collection of schedules to the screen. More...
 

Detailed Description

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

Definition at line 12 of file ViewAllSchedules.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Schedules::ViewAllSchedules::ViewAllSchedules ( const std::string  description)
inline

Definition at line 14 of file ViewAllSchedules.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::Schedules::ViewAllSchedules::~ViewAllSchedules ( )
inline

Definition at line 15 of file ViewAllSchedules.h.

15 { }

Member Function Documentation

VxCollection< IVxSchedule ** > CppSamples::Schedules::ViewAllSchedules::GetSchedules ( VxSdk::IVxSystem vxSystem)
staticprotected

Get a collection of schedules from the given VideoExpert system.

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

Definition at line 33 of file ViewAllSchedules.cpp.

33  {
35  VxResult::Value result = vxSystem->GetSchedules(schedules);
36  if (result == VxResult::kInsufficientSize) {
37  schedules.collection = new IVxSchedule*[schedules.collectionSize];
38  vxSystem->GetSchedules(schedules);
39  }
40  return schedules;
41 }
virtual VxResult::Value GetSchedules(VxCollection< IVxSchedule ** > &scheduleCollection) const =0
void CppSamples::Schedules::ViewAllSchedules::PrintSchedules ( VxSdk::VxCollection< VxSdk::IVxSchedule ** >  scheduleCollection)
staticprotected

Prints the given collection of schedules to the screen.

Parameters
scheduleCollectionCollection of schedules.

Definition at line 47 of file ViewAllSchedules.cpp.

47  {
48 
49  cout << scheduleCollection.collectionSize << " schedules found." << "\n";
50  if (scheduleCollection.collectionSize == 0)
51  return;
52 
53  cout << "------------------------------------------------------\n";
54  cout << "Number\tAction\tTrigger\tName\n";
55  cout << "\t\tCount\n";
56  cout << "------------------------------------------------------";
57  for (int i = 0; i < scheduleCollection.collectionSize; i++) {
58  IVxSchedule* schedule = scheduleCollection.collection[i];
59 
60  cout << "\n" << (i + 1);
61  cout << "\t" << schedule->action;
63  schedule->GetScheduleTriggers(triggers);
64  cout << "\t" << triggers.collectionSize;
65  cout << "\t" << schedule->name;
66  }
67  cout << "\n------------------------------------------------------\n";
68 }
virtual VxResult::Value GetScheduleTriggers(VxCollection< IVxScheduleTrigger ** > &triggerCollection) const =0
VxScheduleAction::Value action
Plugin * CppSamples::Schedules::ViewAllSchedules::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Print all schedules available in the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 13 of file ViewAllSchedules.cpp.

13  {
14  Utility::ClearScreen();
15 
16  VxCollection<IVxSchedule**> schedules = GetSchedules(dataModel->VxSystem);
17  PrintSchedules(schedules);
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[] schedules.collection;
24  // Return reference of parent plugin to move back to parent menu.
25  return GetParent();
26 }
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::IVxSchedule ** > GetSchedules(VxSdk::IVxSystem *vxSystem)
Get a collection of schedules from the given VideoExpert system.
static void PrintSchedules(VxSdk::VxCollection< VxSdk::IVxSchedule ** > scheduleCollection)
Prints the given collection of schedules to the screen.

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