File tree Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,9 @@ namespace nixfeature {
12
12
13
13
mxArray *describe (const nix::Feature &feat)
14
14
{
15
- nix::LinkType link_type = feat.linkType ();
16
- uint8_t ltype;
17
-
18
- switch (link_type) {
19
- case nix::LinkType::Tagged: ltype = 0 ; break ;
20
- case nix::LinkType::Untagged: ltype = 1 ; break ;
21
- case nix::LinkType::Indexed: ltype = 2 ; break ;
22
- default : throw std::invalid_argument (" unkown link type" );
23
- }
24
-
25
15
struct_builder sb ({ 1 }, { " id" , " linkType" });
26
16
sb.set (feat.id ());
27
- sb.set (ltype );
17
+ sb.set (feat. linkType () );
28
18
return sb.array ();
29
19
}
30
20
Original file line number Diff line number Diff line change @@ -13,6 +13,22 @@ mxArray* make_mx_array(const nix::NDSize &size)
13
13
return res;
14
14
}
15
15
16
+ mxArray* make_mx_array (const nix::LinkType <ype)
17
+ {
18
+ uint8_t link_type;
19
+
20
+ switch (ltype) {
21
+ case nix::LinkType::Tagged: link_type = 0 ; break ;
22
+ case nix::LinkType::Untagged: link_type = 1 ; break ;
23
+ case nix::LinkType::Indexed: link_type = 2 ; break ;
24
+ default : throw std::invalid_argument (" unkown link type" );
25
+ }
26
+ mxArray *data = mxCreateDoubleScalar (link_type);
27
+
28
+ return data;
29
+ }
30
+
31
+
16
32
mxArray* make_mx_array (const nix::Value &v)
17
33
{
18
34
mxArray *res;
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ mxArray *make_mx_array(const nix::Value &value);
23
23
24
24
mxArray* make_mx_array (const nix::NDSize &size);
25
25
26
+ mxArray* make_mx_array (const nix::LinkType <ype);
27
+
26
28
template <typename T, nix::DataType dt = nix::to_data_type<T>::value>
27
29
mxArray* make_mx_array (const std::vector<T> &v) {
28
30
DType2 dtype = dtype_nix2mex (dt);
You can’t perform that action at this time.
0 commit comments