|
47 | 47 | % modification, are permitted under the terms of the BSD License. See
|
48 | 48 | % LICENSE file in the root of the Project.
|
49 | 49 |
|
50 |
| -classdef Property < nix.NamedEntity |
| 50 | +classdef Property < nix.Entity |
51 | 51 |
|
52 | 52 | properties (Hidden)
|
53 | 53 | alias = 'Property' % namespace for Property nix backend function access.
|
|
59 | 59 |
|
60 | 60 | methods
|
61 | 61 | function obj = Property(h)
|
62 |
| - obj@nix.NamedEntity(h); |
| 62 | + obj = obj@nix.Entity(h); |
63 | 63 |
|
64 | 64 | % assign dynamic properties
|
| 65 | + nix.Dynamic.addProperty(obj, 'id', 'r'); |
| 66 | + nix.Dynamic.addProperty(obj, 'name', 'r'); |
| 67 | + nix.Dynamic.addProperty(obj, 'definition', 'rw'); |
65 | 68 | nix.Dynamic.addProperty(obj, 'unit', 'rw');
|
66 | 69 | nix.Dynamic.addProperty(obj, 'datatype', 'r');
|
67 | 70 | end
|
|
113 | 116 | fname = strcat(obj.alias, '::deleteValues');
|
114 | 117 | nix_mx(fname, obj.nixhandle);
|
115 | 118 | end
|
| 119 | + |
| 120 | + function r = compare(obj, entity) |
| 121 | + % Checks two NIX entities of the same class for equality. |
| 122 | + % |
| 123 | + % The name property is the first comparison. If they are the same, |
| 124 | + % the ids of the entities will be compared. |
| 125 | + % |
| 126 | + % Returns: (double) 0 if both entities are equal. |
| 127 | + % > or < 0 if the entities are different. |
| 128 | + % |
| 129 | + % Example: check = currSource.compare(otherSource); |
| 130 | + |
| 131 | + if (~isa(obj, class(entity))) |
| 132 | + err.identifier = 'NIXMX:InvalidArgument'; |
| 133 | + err.message = 'Only entities of the same class can be compared.'; |
| 134 | + error(err); |
| 135 | + end |
| 136 | + fname = strcat(obj.alias, '::compare'); |
| 137 | + r = nix_mx(fname, obj.nixhandle, entity.nixhandle); |
| 138 | + end |
116 | 139 | end
|
117 | 140 |
|
118 | 141 | end
|
0 commit comments