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

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

#include <ViewAllBookmarks.h>

Public Member Functions

 ViewAllBookmarks (const std::string description)
 
 ~ViewAllBookmarks ()
 
CppSamples::Common::PluginRun (CppSamples::Common::DataModel *dataModel) override
 Print all bookmarks 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::IVxBookmark ** > GetBookmarks (VxSdk::IVxSystem *vxSystem)
 Get a collection of bookmarks from the given VideoExpert system. More...
 
static void PrintBookmarks (VxSdk::VxCollection< VxSdk::IVxBookmark ** > bookmarkCollection)
 Prints the given collection of bookmarks to the screen. More...
 

Detailed Description

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

Definition at line 12 of file ViewAllBookmarks.h.

Inherits CppSamples::Common::Plugin.

Constructor & Destructor Documentation

CppSamples::Bookmarks::ViewAllBookmarks::ViewAllBookmarks ( const std::string  description)
inline

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

Definition at line 15 of file ViewAllBookmarks.h.

15 { }

Member Function Documentation

VxCollection< IVxBookmark ** > CppSamples::Bookmarks::ViewAllBookmarks::GetBookmarks ( VxSdk::IVxSystem vxSystem)
staticprotected

Get a collection of bookmarks from the given VideoExpert system.

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

Definition at line 33 of file ViewAllBookmarks.cpp.

33  {
35  VxResult::Value result = vxSystem->GetBookmarks(bookmarks);
36  if (result == VxResult::kInsufficientSize) {
37  bookmarks.collection = new IVxBookmark*[bookmarks.collectionSize];
38  vxSystem->GetBookmarks(bookmarks);
39  }
40  return bookmarks;
41 }
virtual VxResult::Value GetBookmarks(VxCollection< IVxBookmark ** > &bookmarkCollection) const =0
void CppSamples::Bookmarks::ViewAllBookmarks::PrintBookmarks ( VxSdk::VxCollection< VxSdk::IVxBookmark ** >  bookmarkCollection)
staticprotected

Prints the given collection of bookmarks to the screen.

Parameters
bookmarkCollectionCollection of bookmarks.

Definition at line 47 of file ViewAllBookmarks.cpp.

47  {
48 
49  cout << bookmarkCollection.collectionSize << " bookmarks found." << "\n";
50  if (bookmarkCollection.collectionSize == 0)
51  return;
52 
53  cout << "------------------------------------------------------------------------------------------\n";
54  cout << "No Data Source Name Time Description \n";
55  cout << "------------------------------------------------------------------------------------------";
56  for (int i = 0; i < bookmarkCollection.collectionSize; i++) {
57  IVxBookmark* bookmark = bookmarkCollection.collection[i];
58 
59  string dataSourceName = "";
60  IVxDataSource* dataSource = nullptr;
61  bookmark->GetDataSource(dataSource);
62  if (dataSource != nullptr) {
63 
64  dataSourceName = string(dataSource->name);
65  dataSourceName += string(30 - dataSourceName.length(), ' ');
66  }
67 
68  cout << "\n" << (i + 1);
69  cout << "\t" << dataSourceName;
70  cout << "\t" << bookmark->time;
71  cout << "\t" << bookmark->description;
72  }
73  cout << "\n------------------------------------------------------------------------------------------\n";
74 }
virtual VxResult::Value GetDataSource(IVxDataSource *&dataSource) const =0
char description[255]
Plugin * CppSamples::Bookmarks::ViewAllBookmarks::Run ( CppSamples::Common::DataModel dataModel)
overridevirtual

Print all bookmarks available in the current system.

Parameters
dataModelInstance of data model.

Implements CppSamples::Common::Plugin.

Definition at line 13 of file ViewAllBookmarks.cpp.

13  {
14  Utility::ClearScreen();
15 
16  VxCollection<IVxBookmark**> bookmarks = GetBookmarks(dataModel->VxSystem);
17  PrintBookmarks(bookmarks);
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[] bookmarks.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
static void PrintBookmarks(VxSdk::VxCollection< VxSdk::IVxBookmark ** > bookmarkCollection)
Prints the given collection of bookmarks to the screen.
Plugin * GetParent() const
Gets the reference to the parent of this plugin.
Definition: Plugin.h:46
static VxSdk::VxCollection< VxSdk::IVxBookmark ** > GetBookmarks(VxSdk::IVxSystem *vxSystem)
Get a collection of bookmarks from the given VideoExpert system.

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