Xcos MVC: get default values for odstate, opar and firing 37/15137/2
Paul Bignier [Tue, 2 Sep 2014 10:08:19 +0000 (12:08 +0200)]
Fixed the absence of FIRING in ports management getter.

Change-Id: I84e378ebcea119dcf3fdac3683f152d6e4c91fd9

scilab/modules/scicos/src/cpp/view_scilab/ModelAdapter.cpp
scilab/modules/scicos/src/cpp/view_scilab/ports_management.hxx

index 320089e..fd7ebaa 100644 (file)
@@ -332,8 +332,10 @@ struct odstate
 
     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
     {
-        // FIXME: get odstate
-        return 0;
+        model::Block* adaptee = adaptor.getAdaptee();
+
+        // Return a default empty list.
+        return new types::List();
     }
 
     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
@@ -483,8 +485,10 @@ struct opar
 
     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
     {
-        // FIXME: get opar
-        return 0;
+        model::Block* adaptee = adaptor.getAdaptee();
+
+        // Return a default empty list.
+        return new types::List();
     }
 
     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
@@ -742,8 +746,10 @@ struct equations
 
     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
     {
-        // FIXME: get equations
-        return 0;
+        model::Block* adaptee = adaptor.getAdaptee();
+
+        // Return a default empty list.
+        return new types::List();
     }
 
     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
index 8862e8f..765b379 100644 (file)
@@ -78,6 +78,16 @@ types::InternalType* get_ports_property(const Adaptor& adaptor, object_propertie
             }
             return o;
         }
+        case FIRING:
+        {
+            double* data;
+            types::Double* o = new types::Double(ids.size(), 1, &data);
+            for (std::vector<ScicosID>::iterator it = ids.begin(); it != ids.end(); ++it, ++i)
+            {
+                controller.getObjectProperty(*it, PORT, p, data[i]);
+            }
+            return o;
+        }
         case IMPLICIT:
         {
             static const wchar_t E[] = L"E";