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

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

#include <ViewAllRoles.h>

Public Member Functions

 ViewAllRoles (const std::string description)
 
 ~ViewAllRoles ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Print all roles 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::IVxRole ** > GetRoles (VxSdk::IVxSystem *vxSystem)
 Get a collection of roles from the given VideoExpert system. More...
 
static void PrintRoles (VxSdk::VxCollection< VxSdk::IVxRole ** > roleCollection)
 Prints the given collection of roles to the screen. More...
 

Detailed Description

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

Definition at line 12 of file ViewAllRoles.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Roles::ViewAllRoles::ViewAllRoles ( const std::string  description)
inline

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

Definition at line 15 of file ViewAllRoles.h.

15 { }

Member Function Documentation

VxCollection< IVxRole ** > CppSamples::Roles::ViewAllRoles::GetRoles ( VxSdk::IVxSystem vxSystem)
staticprotected

Get a collection of roles from the given VideoExpert system.

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

Definition at line 33 of file ViewAllRoles.cpp.

33  {
35  VxResult::Value result = vxSystem->GetRoles(roles);
36  if (result == VxResult::kInsufficientSize) {
37  roles.collection = new IVxRole*[roles.collectionSize];
38  vxSystem->GetRoles(roles);
39  }
40  return roles;
41 }
virtual VxResult::Value GetRoles(VxCollection< IVxRole ** > &roleCollection) const =0
void CppSamples::Roles::ViewAllRoles::PrintRoles ( VxSdk::VxCollection< VxSdk::IVxRole ** >  roleCollection)
staticprotected

Prints the given collection of roles to the screen.

Parameters
roleCollectionCollection of roles.

Definition at line 47 of file ViewAllRoles.cpp.

47  {
48  cout << roleCollection.collectionSize << " roles found." << "\n";
49  if (roleCollection.collectionSize == 0)
50  return;
51 
52  cout << "---------------------------------------------------------------------------------------------";
53  for (int i = 0; i < roleCollection.collectionSize; i++) {
54  IVxRole* role = roleCollection.collection[i];
55 
56  cout << "\n" << (i + 1);
57  cout << "\t" << role->id;
58  cout << "\t" << role->name;
59  }
60  cout << "\n---------------------------------------------------------------------------------------------\n";
61 }
Plugin * CppSamples::Roles::ViewAllRoles::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Print all roles available in the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 13 of file ViewAllRoles.cpp.

13  {
14  Utility::ClearScreen();
15 
16  VxCollection<IVxRole**> roles = GetRoles(dataModel->VxSystem);
17  PrintRoles(roles);
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[] roles.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::IVxRole ** > GetRoles(VxSdk::IVxSystem *vxSystem)
Get a collection of roles from the given VideoExpert system.
static void PrintRoles(VxSdk::VxCollection< VxSdk::IVxRole ** > roleCollection)
Prints the given collection of roles to the screen.

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