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

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

#include <ViewExport.h>

Public Member Functions

 ViewExport (const std::string description)
 
 ~ViewExport ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Print all exports 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 void DisplayExportDetailsOnScreen (VxSdk::VxCollection< VxSdk::IVxExport ** > exportCollection)
 Prints the given collection of exports to the screen. More...
 
static VxSdk::VxCollection< VxSdk::IVxExport ** > GetExports (VxSdk::IVxSystem *vxSystem)
 Get a collection of exports from the given VideoExpert system. More...
 

Detailed Description

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

Definition at line 12 of file ViewExport.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Exports::ViewExport::ViewExport ( const std::string  description)
inline

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

Definition at line 15 of file ViewExport.h.

15 { }

Member Function Documentation

void CppSamples::Exports::ViewExport::DisplayExportDetailsOnScreen ( VxSdk::VxCollection< VxSdk::IVxExport ** >  exportCollection)
staticprotected

Prints the given collection of exports to the screen.

Parameters
exportCollectionCollection of exports.

Definition at line 29 of file ViewExport.cpp.

29  {
30  cout << exportCollection.collectionSize << " exports found.";
31  if (exportCollection.collectionSize == 0)
32  return;
33 
34  // Header Line
35  cout << "\n-----------------------------------------------------------------";
36  for (int i = 0; i < exportCollection.collectionSize; i++) {
37  IVxExport* vxExport = exportCollection.collection[i];
38  VxExportStatus::Value expStatus = vxExport->status;
39 
40  // Status to string value
41  string expStatusInString = "U";
42  switch (expStatus) {
43  case VxExportStatus::Value::kExporting:
44  expStatusInString = "E";
45  break;
46  case VxExportStatus::Value::kSuccessful:
47  expStatusInString = "S";
48  break;
49  case VxExportStatus::Value::kFailed:
50  expStatusInString = "F";
51  break;
52  case VxExportStatus::Value::kPending:
53  expStatusInString = "P";
54  break;
55  case VxExportStatus::Value::kUnknown:
56  default:
57  break;
58  }
59 
60  // Print details of single export
61  cout << "\n\t" << (i + 1) << "\t" << vxExport->name << "\t" << expStatusInString;
62  }
63 
64  // Footer
65  cout << "\n-----------------------------------------------------------------";
66  cout << "\n Status: E-Exporting S-Successful F-Failed P-Pending U-Unknown\n";
67 }
VxExportStatus::Value status
VxCollection< IVxExport ** > CppSamples::Exports::ViewExport::GetExports ( VxSdk::IVxSystem vxSystem)
staticprotected

Get a collection of exports from the given VideoExpert system.

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

Definition at line 70 of file ViewExport.cpp.

70  {
71  cout << "Fetching exports from system. Please wait...\n";
72  // Read the size of collection from system.
74  VxResult::Value result = vxSystem->GetExports(exports);
75  if (result == VxResult::kInsufficientSize) {
76  // Allocate memory for the requried collection.
77  exports.collection = new IVxExport*[exports.collectionSize];
78  // Read the collection from system.
79  vxSystem->GetExports(exports);
80  }
81  return exports;
82 }
virtual VxResult::Value GetExports(VxCollection< IVxExport ** > &exportCollection) const =0
Plugin * CppSamples::Exports::ViewExport::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Print all exports available in the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 10 of file ViewExport.cpp.

10  {
11  Utility::ClearScreen();
12 
13  // Get a collection of exports from the system
14  VxCollection<IVxExport**> exportCollection = GetExports(dataModel->VxSystem);
15  // Display the details of exports in the collection on screen.
16  DisplayExportDetailsOnScreen(exportCollection);
17 
18  cout << "\n\n";
19  // Pause for user input before going back to parent menu.
20  Utility::Pause();
21 
22  // Remove the memory allocated to the collection.
23  delete[] exportCollection.collection;
24  // Return reference of parent plugin to move back to parent menu.
25  return GetParent();
26 }
static void DisplayExportDetailsOnScreen(VxSdk::VxCollection< VxSdk::IVxExport ** > exportCollection)
Prints the given collection of exports to the screen.
Definition: ViewExport.cpp:29
VxSdk::IVxSystem * VxSystem
Represents a VideoXpert system and allows the user to manage the system and devices.
Definition: Plugin.h:17
static VxSdk::VxCollection< VxSdk::IVxExport ** > GetExports(VxSdk::IVxSystem *vxSystem)
Get a collection of exports from the given VideoExpert system.
Definition: ViewExport.cpp:70
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: