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

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

#include <DisplaySituations.h>

Public Member Functions

 DisplaySituations (const std::string description)
 
 ~DisplaySituations ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Print all available situations 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...
 

Private Member Functions

void Display (VxSdk::IVxSystem *vxSystem)
 Print all available situations in the current system. More...
 
VxSdk::VxCollection< VxSdk::IVxSituation ** > GetSituations (VxSdk::IVxSystem *vxSystem)
 Get a collection of situations from the given VideoExpert system. More...
 
void DisplaySituationDetailsOnScreen (VxSdk::VxCollection< VxSdk::IVxSituation ** > situations)
 Print the given collection of situations on screen More...
 

Detailed Description

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

Definition at line 12 of file DisplaySituations.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Events::DisplaySituations::DisplaySituations ( const std::string  description)
inline

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

Definition at line 15 of file DisplaySituations.h.

15 {}

Member Function Documentation

void CppSamples::Events::DisplaySituations::Display ( VxSdk::IVxSystem vxSystem)
private

Print all available situations in the current system.

Menu function for displaying situations available in a system

Parameters
vxSystemPointer to the VideoExpert system.
Parameters
vxSystemsystem pointer

Definition at line 26 of file DisplaySituations.cpp.

26  {
27 
28  cout << "\n\n" << "Fetching situations from system..Please wait..\n";
29  VxCollection<IVxSituation**> situations = GetSituations(vxSystem);
31 
32  // Remove the memory allocated to the collection.
33  delete[] situations.collection;
34 }
void DisplaySituationDetailsOnScreen(VxSdk::VxCollection< VxSdk::IVxSituation ** > situations)
Print the given collection of situations on screen
VxSdk::VxCollection< VxSdk::IVxSituation ** > GetSituations(VxSdk::IVxSystem *vxSystem)
Get a collection of situations from the given VideoExpert system.
void CppSamples::Events::DisplaySituations::DisplaySituationDetailsOnScreen ( VxSdk::VxCollection< VxSdk::IVxSituation ** >  situations)
private

Print the given collection of situations on screen

Method for displaying situation details

Parameters
situationsCollection of Situations to be printed.
Parameters
situationsSituations list to iterate

Definition at line 56 of file DisplaySituations.cpp.

56  {
57 
58  if (situations.collectionSize > 0) {
59  cout << situations.collectionSize << " situations found.\n";
60 
61  // Print Heading
62  cout << "\n\n";
63  cout << setfill(' ') << " INDEX " << setw(60) << left << " TYPE" << "\n";
64  cout << "\n--------------------------------------------------\n";
65 
66  // Print Situation Details
67  int index = 0;
68  for (int i = 0; i < situations.collectionSize;i++) {
69  IVxSituation* situation = situations.collection[i];
70  cout << setfill(' ') << "\n\t" << index + 1 << "\t" << left << setw(60) << left << situation->type;
71  index++;
72  }
73  // Print Footer
74  cout << "\n--------------------------------------------------\n";
75  }
76  else
77  cout << "No situations found!!\n";
78 }
VxCollection< IVxSituation ** > CppSamples::Events::DisplaySituations::GetSituations ( VxSdk::IVxSystem vxSystem)
private

Get a collection of situations from the given VideoExpert system.

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

Definition at line 37 of file DisplaySituations.cpp.

37  {
38 
39  // Read the size of collection from system.
41  VxResult::Value result = vxSystem->GetSituations(situations);
42  if (result == VxResult::kInsufficientSize) {
43  // Allocate memory for the requried collection.
44  situations.collection = new IVxSituation*[situations.collectionSize];
45  // Read the collection from system.
46  result = vxSystem->GetSituations(situations);
47  }
48 
49  return situations;
50 }
virtual VxResult::Value GetSituations(VxCollection< IVxSituation ** > &situationCollection) const =0
Plugin * CppSamples::Events::DisplaySituations::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Print all available situations in the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 10 of file DisplaySituations.cpp.

10  {
11 
12  Display(dataModel->VxSystem);
13 
14  // Pause for user input before going back to parent menu.
15  // Wait for user response before going back to parent menu.
16  Utility::Pause();
17 
18  // Return reference of parent plugin to move back to parent menu.
19  return GetParent();
20 }
void Display(VxSdk::IVxSystem *vxSystem)
Print all available situations in the current system.
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

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