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

This plugin sample deletes an export from the current system. More...

#include <DeleteExport.h>

Public Member Functions

 DeleteExport (const std::string description)
 
 ~DeleteExport ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Deletes an export from 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 DeleteSingleExport (VxSdk::IVxSystem *vxSystem)
 Deletes an export from the current system. More...
 
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 deletes an export from the current system.

Definition at line 12 of file DeleteExport.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

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

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

Definition at line 15 of file DeleteExport.h.

15 { }

Member Function Documentation

void CppSamples::Exports::DeleteExport::DeleteSingleExport ( VxSdk::IVxSystem vxSystem)
staticprotected

Deletes an export from the current system.

Parameters
vxSystemPointer to the VideoExpert system.

Definition at line 22 of file DeleteExport.cpp.

22  {
23  // Get all exports from the system
24  VxCollection<IVxExport**> exports = GetExports(vxSystem);
26 
27  // Validate Collection
28  if (exports.collectionSize <= 0)
29  return;
30 
31  // User selects an export
32  cout << "\n" << "Enter index of export to delete [1-" << exports.collectionSize << "] : ";
33  int exportIndex = Utility::ReadInt();
34 
35  // Validate user input
36  if (exportIndex < 1 || exportIndex > exports.collectionSize)
37  return;
38 
39  // Print details of selected export to delete
40  IVxExport* vxExport = exports.collection[exportIndex - 1];
41  cout << "\n" << "Name of the export you selected for delete : " << vxExport->name;
42 
43  // Delete the export
44  VxResult::Value result = vxExport->DeleteExport();
45  if (result == VxResult::kOK)
46  cout << "\n" << "Export deleted succesfully.\n";
47  else
48  cout << "\n" << "Failed to delete export!!\n";
49 
50  // Remove the memory allocated to the collection.
51  delete[] exports.collection;
52 }
static VxSdk::VxCollection< VxSdk::IVxExport ** > GetExports(VxSdk::IVxSystem *vxSystem)
Get a collection of exports from the given VideoExpert system.
static void DisplayExportDetailsOnScreen(VxSdk::VxCollection< VxSdk::IVxExport ** > exportCollection)
Prints the given collection of exports to the screen.
virtual VxResult::Value DeleteExport() const =0
void CppSamples::Exports::DeleteExport::DisplayExportDetailsOnScreen ( VxSdk::VxCollection< VxSdk::IVxExport ** >  exportCollection)
staticprotected

Prints the given collection of exports to the screen.

Parameters
exportCollectionCollection of exports.

Definition at line 55 of file DeleteExport.cpp.

55  {
56  cout << "\n" << exportCollection.collectionSize << " exports found.";
57  if (exportCollection.collectionSize == 0)
58  return;
59 
60  // Header Line
61  cout << "\n-----------------------------------------------------------------";
62  for (int i = 0; i < exportCollection.collectionSize; i++) {
63  IVxExport* vxExport = exportCollection.collection[i];
64 
65  // Status to string value
66  VxExportStatus::Value expStatus = vxExport->status;
67  string expStatusInString = "U";
68  switch (expStatus) {
69  case VxExportStatus::Value::kExporting:
70  expStatusInString = "E";
71  break;
72  case VxExportStatus::Value::kSuccessful:
73  expStatusInString = "S";
74  break;
75  case VxExportStatus::Value::kFailed:
76  expStatusInString = "F";
77  break;
78  case VxExportStatus::Value::kPending:
79  expStatusInString = "P";
80  break;
81  case VxExportStatus::Value::kUnknown:
82  default:
83  break;
84  }
85  // Print details of single export
86  cout << "\n\t" << (i + 1) << "\t" << vxExport->name << "\t" << expStatusInString;
87  }
88 
89  // Footer
90  cout << "\n-----------------------------------------------------------------";
91  cout << "\n Status: E-Exporting S-Successful F-Failed P-Pending U-Unknown\n";
92 }
VxExportStatus::Value status
VxCollection< IVxExport ** > CppSamples::Exports::DeleteExport::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 95 of file DeleteExport.cpp.

95  {
96  cout << "\n\n" << "Fetching exports from system. Please wait...\n";
97  // Read the size of collection from system.
99  VxResult::Value result = vxSystem->GetExports(exports);
100  if (result == VxResult::kInsufficientSize) {
101  // Allocate memory for the requried collection.
102  exports.collection = new IVxExport*[exports.collectionSize];
103  // Read the collection from system.
104  vxSystem->GetExports(exports);
105  }
106 
107  return exports;
108 }
virtual VxResult::Value GetExports(VxCollection< IVxExport ** > &exportCollection) const =0
Plugin * CppSamples::Exports::DeleteExport::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Deletes an export from the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 10 of file DeleteExport.cpp.

10  {
11  DeleteSingleExport(dataModel->VxSystem);
12 
13  cout << "\n\n";
14  // Pause for user input before going back to parent menu.
15  Utility::Pause();
16 
17  // Return reference of parent plugin to move back to parent menu.
18  return GetParent();
19 }
VxSdk::IVxSystem * VxSystem
Represents a VideoXpert system and allows the user to manage the system and devices.
Definition: Plugin.h:17
static void DeleteSingleExport(VxSdk::IVxSystem *vxSystem)
Deletes an export from the current system.
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: