C++/CLI Sample
Demonstrates how to create a C++/CLI library using the VideoXpert SDK
CPPCli::DeviceAssignment Class Reference

The DeviceAssignment class represents a device assignment. More...

#include <DeviceAssignment.h>

Public Member Functions

 DeviceAssignment (VxSdk::IVxDeviceAssignment *vxDeviceAssignment)
 Constructor. More...
 
virtual ~DeviceAssignment ()
 Destructor. More...
 
 !DeviceAssignment ()
 Finaliser. More...
 

Package Functions

System::Collections::Generic::List< CPPCli::DataSource^ >^ _GetDataSources ()
 
CPPCli::DataStorage_GetDataStorage ()
 
CPPCli::Device_GetDevice ()
 
CPPCli::Driver_GetDriver ()
 
void _SetDataSources (System::Collections::Generic::List< CPPCli::DataSource^ >^dataSources)
 

Package Attributes

VxSdk::IVxDeviceAssignment_deviceAssignment
 

Properties

System::Collections::Generic::List< CPPCli::DataSource^ >^ DataSources [get, set]
 Gets or sets the data sources assigned by this device assignment. More...
 
CPPCli::DataStorage^  DataStorage [get]
 Gets the data storage that this device assignment is for. More...
 
CPPCli::Device^  Device [get]
 Gets the assigned device. More...
 
CPPCli::Driver^  Driver [get]
 Gets the assigned driver. More...
 
System::String^  DriverType [get, set]
 Gets or sets the driver type. More...
 
System::String^  Id [get]
 Gets the unique identifier of the device assignment. More...
 

Detailed Description

The DeviceAssignment class represents a device assignment.

Definition at line 15 of file DeviceAssignment.h.

Constructor & Destructor Documentation

CPPCli::DeviceAssignment::DeviceAssignment ( VxSdk::IVxDeviceAssignment vxDeviceAssignment)

Constructor.

Parameters
vxDeviceAssignmentThe vx device assignment.

Definition at line 9 of file DeviceAssignment.cpp.

9  {
10  _deviceAssignment = vxDeviceAssignment;
11 }
VxSdk::IVxDeviceAssignment * _deviceAssignment
virtual CPPCli::DeviceAssignment::~DeviceAssignment ( )
inlinevirtual

Destructor.

Definition at line 27 of file DeviceAssignment.h.

27  {
28  this->!DeviceAssignment();
29  }
DeviceAssignment(VxSdk::IVxDeviceAssignment *vxDeviceAssignment)
Constructor.
CPPCli::DeviceAssignment::!DeviceAssignment ( )

Finaliser.

Definition at line 13 of file DeviceAssignment.cpp.

13  {
15  _deviceAssignment = nullptr;
16 }
VxSdk::IVxDeviceAssignment * _deviceAssignment
virtual VxResult::Value Delete() const =0

Member Function Documentation

List< CPPCli::DataSource^ > CPPCli::DeviceAssignment::_GetDataSources ( )
package

Definition at line 18 of file DeviceAssignment.cpp.

18  {
19  // Create a list of managed data source objects
20  List<CPPCli::DataSource^>^ mlist = gcnew List<CPPCli::DataSource^>();
21  // Create a collection of unmanaged data source objects
23 
24  // Make the GetDataSources call, which will return with the total count of data sources, this allows the client to allocate memory.
26  // Unless there are no data sources on the system, this should return VxSdk::VxResult::kInsufficientSize
27  if (result == VxSdk::VxResult::kInsufficientSize) {
28  // An array of pointers is allocated using the size returned by the previous GetDataSources call
29  dataSources.collection = new VxSdk::IVxDataSource*[dataSources.collectionSize];
30  result = _deviceAssignment->GetDataSources(dataSources);
31  // The result should now be kOK since we have allocated enough space
32  if (result == VxSdk::VxResult::kOK) {
33  for (int i = 0; i < dataSources.collectionSize; i++)
34  mlist->Add(gcnew CPPCli::DataSource(dataSources.collection[i]));
35  }
36  // Remove the memory we previously allocated to the collection
37  delete[] dataSources.collection;
38  }
39  return mlist;
40 }
virtual VxResult::Value GetDataSources(VxCollection< IVxDataSource ** > &dataSourceCollection) const =0
The DataSource class represents a data producer in the system hosted by a device. Each DataSource pro...
Definition: DataSource.h:20
VxSdk::IVxDeviceAssignment * _deviceAssignment
CPPCli::DataStorage CPPCli::DeviceAssignment::_GetDataStorage ( )
package

Definition at line 42 of file DeviceAssignment.cpp.

42  {
43  // Get the data storage object
44  VxSdk::IVxDataStorage* dataStorage = nullptr;
46 
47  // Return the data storage if GetDataStorage was successful
48  if (result == VxSdk::VxResult::kOK)
49  return gcnew CPPCli::DataStorage(dataStorage);
50 
51  // Return nullptr if GetDataStorage is unsuccessful
52  return nullptr;
53 }
The DataStorage class represents a data storage provider in the system (e.g. an NSM5200 storage pool ...
Definition: DataStorage.h:18
virtual VxResult::Value GetDataStorage(IVxDataStorage *&dataStorage) const =0
VxSdk::IVxDeviceAssignment * _deviceAssignment
CPPCli::Device CPPCli::DeviceAssignment::_GetDevice ( )
package

Definition at line 55 of file DeviceAssignment.cpp.

55  {
56  // Get the device object
57  VxSdk::IVxDevice* device = nullptr;
59 
60  // Return the device if GetDevice was successful
61  if (result == VxSdk::VxResult::kOK)
62  return gcnew CPPCli::Device(device);
63 
64  // Return nullptr if GetDevice is unsuccessful
65  return nullptr;
66 }
virtual VxResult::Value GetDevice(IVxDevice *&device) const =0
VxSdk::IVxDeviceAssignment * _deviceAssignment
The Device class represents a particular physical device in the system.
Definition: Device.h:15
CPPCli::Driver CPPCli::DeviceAssignment::_GetDriver ( )
package

Definition at line 68 of file DeviceAssignment.cpp.

68  {
69  // Get the driver object
70  VxSdk::IVxDriver* driver = nullptr;
72 
73  // Return the driver if GetDriver was successful
74  if (result == VxSdk::VxResult::kOK)
75  return gcnew CPPCli::Driver(driver);
76 
77  // Return nullptr if GetDriver is unsuccessful
78  return nullptr;
79 }
virtual VxResult::Value GetDriver(IVxDriver *&driver) const =0
VxSdk::IVxDeviceAssignment * _deviceAssignment
The Driver class represents a device communication driver.
Definition: Driver.h:14
void CPPCli::DeviceAssignment::_SetDataSources ( System::Collections::Generic::List< CPPCli::DataSource^ >^  dataSources)
package

Definition at line 81 of file DeviceAssignment.cpp.

81  {
82  // Set the data source id size based on the list count
83  int dataSourceIdSize = dataSources->Count;
84  if (dataSourceIdSize == 0)
85  return;
86 
87  // Create a list of data source ids
88  char** dataSourceIds;
89  dataSourceIds = new char*[dataSourceIdSize];
90  for (int i = 0; i < dataSourceIdSize; i++) {
91  int idLength = dataSources[i]->Id->Length + 1;
92  dataSourceIds[i] = new char[idLength];
93  VxSdk::Utilities::StrCopySafe(dataSourceIds[i], Utils::ConvertSysString(dataSources[i]->Id), idLength);
94  }
95 
96  // Set the data sources using the list of ids
97  _deviceAssignment->SetDataSources(dataSourceIds, dataSourceIdSize);
98 }
virtual VxResult::Value SetDataSources(char **dataSourceIds, int dataSourceIdSize)=0
static void StrCopySafe(char(&dst)[dstSize], const char *src)
VxSdk::IVxDeviceAssignment * _deviceAssignment
System::String^ Id
Gets the unique identifier of the device assignment.
static const char * ConvertSysString(System::String^ sysString)
Convert a system string to a char.
Definition: Utils.h:233

Member Data Documentation

VxSdk::IVxDeviceAssignment* CPPCli::DeviceAssignment::_deviceAssignment
package

Definition at line 97 of file DeviceAssignment.h.

Property Documentation

System:: Collections:: Generic:: List< CPPCli:: DataSource^>^ CPPCli::DeviceAssignment::DataSources
getset

Gets or sets the data sources assigned by this device assignment.

A List of data sources.

Definition at line 40 of file DeviceAssignment.h.

CPPCli:: DataStorage^ CPPCli::DeviceAssignment::DataStorage
get

Gets the data storage that this device assignment is for.

The DataStorage for this assignment.

Definition at line 50 of file DeviceAssignment.h.

CPPCli:: Device^ CPPCli::DeviceAssignment::Device
get

Gets the assigned device.

The assigned Device.

Definition at line 59 of file DeviceAssignment.h.

CPPCli:: Driver^ CPPCli::DeviceAssignment::Driver
get

Gets the assigned driver.

The assigned Driver.

Definition at line 68 of file DeviceAssignment.h.

System:: String^ CPPCli::DeviceAssignment::DriverType
getset

Gets or sets the driver type.

The driver type.

Definition at line 77 of file DeviceAssignment.h.

System:: String^ CPPCli::DeviceAssignment::Id
get

Gets the unique identifier of the device assignment.

The unique identifier.

Definition at line 91 of file DeviceAssignment.h.


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