matlab::data::EnumArray - C++ class to access MATLAB enumeration arrays - MATLAB (original) (raw)
Main Content
C++ class to access MATLAB enumeration arrays
Description
Use EnumArray
objects to access enumeration arrays. To create anEnumArray
, call createEnumArray in theArrayFactory
class.
Class Details
Constructors
Copy Constructors
EnumArray(const EnumArray& rhs)
EnumArray(const Array& rhs)
Description
Creates a shared data copy of an EnumArray
object.
Parameters
const EnumArray& rhs | Value to copy. |
---|---|
const Array& rhs | Value specified as EnumArray object. |
Throws
matlab::data::InvalidArrayTypeException | Type of input Array is not ArrayType::ENUM. |
---|
Copy Assignment Operators
EnumArray& operator=(const EnumArray& rhs)
EnumArray& operator=(const Array& rhs)
Description
Assigns a shared data copy to an EnumArray
object.
Parameters
const EnumArray& rhs | Value to copy. |
---|---|
const Array& rhs | Value specified asArrayType::ENUM object. |
Returns
EnumArray& | Updated instance. |
---|
Throws
matlab::data::InvalidArrayTypeException | Type of input Array is not ArrayType::ENUM. |
---|
Move Constructors
EnumArray(EnumArray&& rhs)
Description
Moves contents of an EnumArray
object to a new instance.
Parameters
EnumArray&& rhs | Value to move. |
---|---|
Array&& rhs | Value specified asArrayType::ENUM object. |
Throws
matlab::data::InvalidArrayTypeException | Type of input Array is not ArrayType::ENUM. |
---|
Move Assignment Operators
EnumArray& operator=(EnumArray&& rhs)
EnumArray& operator=(Array&& rhs)
Description
Assigns the input to this EnumArray
object.
Parameters
EnumArray&& rhs | Value to move. |
---|---|
Array&& rhs | Value specified asArrayType::ENUM object. |
Returns
EnumArray& | Updated instance. |
---|
Throws
matlab::data::InvalidArrayTypeException | Type of input Array is not ArrayType::ENUM. |
---|
Member Functions
getClassName
std::string getClassName() const
Description
Return class name for this EnumArray
.
Examples
Display enum
Value
Define an enumeration class:
classdef MyClass enumeration A B C end end
Define a matlab::data::EnumArray
object for theMyClass.C
enumeration argument and display the value.
#include "MatlabDataArray.hpp" #include "MatlabEngine.hpp" #include
int main() { using namespace matlab::data; ArrayFactory f; auto e = f.createEnumArray({ 1,1 }, "MyClass", { "C" }); // Display enum value std::cout << "Property value: " << std::string(e[0]) << std::endl; return 0; }
Version History
Introduced in R2017b