C++ Samples
Demonstrates how to create a C++ application using the VideoXpert SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations
CppSamples::Users::ViewAllUsers Class Reference

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

#include <ViewAllUsers.h>

Public Member Functions

 ViewAllUsers (const std::string description)
 
 ~ViewAllUsers ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Print all users 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::IVxUser ** > GetUsers (VxSdk::IVxSystem *vxSystem)
 Get a collection of users from the given VideoExpert system. More...
 
static void PrintUsers (VxSdk::VxCollection< VxSdk::IVxUser ** > userCollection)
 Prints the given collection of users to the screen. More...
 

Detailed Description

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

Definition at line 12 of file ViewAllUsers.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Users::ViewAllUsers::ViewAllUsers ( const std::string  description)
inline

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

Definition at line 15 of file ViewAllUsers.h.

15 { }

Member Function Documentation

VxCollection< IVxUser ** > CppSamples::Users::ViewAllUsers::GetUsers ( VxSdk::IVxSystem vxSystem)
staticprotected

Get a collection of users from the given VideoExpert system.

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

Definition at line 33 of file ViewAllUsers.cpp.

33  {
35  VxResult::Value result = vxSystem->GetUsers(users);
36  if (result == VxResult::kInsufficientSize) {
37  users.collection = new IVxUser*[users.collectionSize];
38  vxSystem->GetUsers(users);
39  }
40  return users;
41 }
virtual VxResult::Value GetUsers(VxCollection< IVxUser ** > &userCollection) const =0
void CppSamples::Users::ViewAllUsers::PrintUsers ( VxSdk::VxCollection< VxSdk::IVxUser ** >  userCollection)
staticprotected

Prints the given collection of users to the screen.

Parameters
userCollectionCollection of users.

Definition at line 47 of file ViewAllUsers.cpp.

47  {
48  cout << userCollection.collectionSize << " users found." << "\n";
49  if (userCollection.collectionSize == 0)
50  return;
51 
52  cout << "---------------------------------------------------------------------------------------------";
53  for (int i = 0; i < userCollection.collectionSize; i++) {
54  IVxUser* user = userCollection.collection[i];
55 
56  cout << "\n" << (i + 1);
57  cout << "\t" << user->id;
58  cout << "\t" << user->name;
59  cout << "\t" << user->domain;
60  }
61  cout << "\n---------------------------------------------------------------------------------------------\n";
62 }
char domain[64]
Plugin * CppSamples::Users::ViewAllUsers::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Print all users available in the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 13 of file ViewAllUsers.cpp.

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

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