From ab1186d1e64ae5b7a67f05306909013cdea6f900 Mon Sep 17 00:00:00 2001
From: trang vu <trang.vu@epfl.ch>
Date: Fri, 19 Nov 2021 16:22:30 +0100
Subject: [PATCH] restrict SCDsignal datatype

---
 code/classes/SCDsignal/SCDsignal.m | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/code/classes/SCDsignal/SCDsignal.m b/code/classes/SCDsignal/SCDsignal.m
index 6bc3638..e1885e9 100644
--- a/code/classes/SCDsignal/SCDsignal.m
+++ b/code/classes/SCDsignal/SCDsignal.m
@@ -22,6 +22,8 @@ classdef SCDsignal
     
     function type = datatype(obj)
       type = class(obj.Value);
+      assert(ismember(type,{'single', 'boolean', 'int8','int16','int32'}),...
+        sprintf('DataType %s is not supported in SCDalgo', type))
     end
     
     function str = struct(obj)
@@ -79,8 +81,8 @@ classdef SCDsignal
     
     function Name = BusName(obj)
       % Returns the bus name for this signal
-      type = class(obj.Value);
-      siz  = size(obj.Value);
+      type = obj.datatype;
+      siz  = obj.datasize;
       assert(numel(siz)==2,'3 or larger dimensional data not supported')
       if all(siz == 1)
         sizestr = '_Scalar';
-- 
GitLab