Xcos MVC: blk.model.blocktype is a string
[scilab.git] / scilab / modules / scicos / src / cpp / view_scilab / ModelAdapter.cpp
1 /*
2  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  *  Copyright (C) 2014-2014 - Scilab Enterprises - Clement DAVID
4  *
5  *  This file must be used under the terms of the CeCILL.
6  *  This source file is licensed as described in the file COPYING, which
7  *  you should have received as part of this distribution.  The terms
8  *  are also available at
9  *  http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
10  *
11  */
12
13 #include <string>
14 #include <vector>
15 #include <algorithm>
16 #include <sstream>
17
18 #include "list.hxx"
19 #include "mlist.hxx"
20 #include "double.hxx"
21 #include "string.hxx"
22
23 #include "Controller.hxx"
24 #include "ModelAdapter.hxx"
25 #include "ports_management.hxx"
26
27 extern "C" {
28 #include "sci_malloc.h"
29 #include "charEncoding.h"
30 }
31
32 namespace org_scilab_modules_scicos
33 {
34 namespace view_scilab
35 {
36 namespace
37 {
38
39 static const wchar_t* diagram = L"diagram";
40
41 struct sim
42 {
43
44     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
45     {
46         model::Block* adaptee = adaptor.getAdaptee();
47
48         // First, extract the function Name
49         std::string name;
50         controller.getObjectProperty(adaptee->id(), adaptee->kind(), SIM_FUNCTION_NAME, name);
51         types::String* Name = new types::String(1, 1);
52         Name->set(0, name.data());
53
54         // Then the Api. If it is zero, then just return the Name. Otherwise, return a list containing both.
55         int api;
56         controller.getObjectProperty(adaptee->id(), adaptee->kind(), SIM_FUNCTION_API, api);
57
58         if (api == 0)
59         {
60             return Name;
61         }
62         else
63         {
64             types::Double* Api = new types::Double(static_cast<double>(api));
65             types::List* o = new types::List();
66             o->set(0, Name);
67             o->set(1, Api);
68             return o;
69         }
70     }
71
72     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
73     {
74         model::Block* adaptee = adaptor.getAdaptee();
75
76         if (v->getType() == types::InternalType::ScilabString)
77         {
78             types::String* current = v->getAs<types::String>();
79             if (current->getSize() != 1)
80             {
81                 return false;
82             }
83
84             char* c_str = wide_string_to_UTF8(current->get(0));
85             std::string name = std::string(c_str);
86             FREE(c_str);
87
88             // If the input is a scalar string, then the functionApi is 0.
89             int api = 0;
90
91             controller.setObjectProperty(adaptee->id(), adaptee->kind(), SIM_FUNCTION_NAME, name);
92             controller.setObjectProperty(adaptee->id(), adaptee->kind(), SIM_FUNCTION_API, api);
93         }
94         else if (v->getType() == types::InternalType::ScilabList)
95         {
96             // If the input is a 2-sized list, then it must be string and positive integer.
97             types::List* current = v->getAs<types::List>();
98             if (current->getSize() != 2)
99             {
100                 return false;
101             }
102             if (current->get(0)->getType() != types::InternalType::ScilabString || current->get(1)->getType() != types::InternalType::ScilabDouble)
103             {
104                 return false;
105             }
106
107             types::String* Name = current->get(0)->getAs<types::String>();
108             if (Name->getSize() != 1)
109             {
110                 return false;
111             }
112             char* c_str = wide_string_to_UTF8(Name->get(0));
113             std::string name = std::string(c_str);
114             FREE(c_str);
115
116             types::Double* Api = current->get(1)->getAs<types::Double>();
117             if (Api->getSize() != 1)
118             {
119                 return false;
120             }
121             double api = Api->get(0);
122             if (floor(api) != api)
123             {
124                 return false;
125             }
126             int api_int = static_cast<int>(api);
127
128             controller.setObjectProperty(adaptee->id(), adaptee->kind(), SIM_FUNCTION_NAME, name);
129             controller.setObjectProperty(adaptee->id(), adaptee->kind(), SIM_FUNCTION_API, api_int);
130         }
131         else
132         {
133             return false;
134         }
135         return true;
136     }
137 };
138
139 struct in
140 {
141
142     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
143     {
144         return get_ports_property<ModelAdapter, DATATYPE_ROWS>(adaptor, INPUTS, controller);
145     }
146
147     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
148     {
149         return update_ports_property<ModelAdapter, DATATYPE_ROWS>(adaptor, INPUTS, controller, v);
150     }
151 };
152
153 struct in2
154 {
155
156     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
157     {
158         return get_ports_property<ModelAdapter, DATATYPE_COLS>(adaptor, INPUTS, controller);
159     }
160
161     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
162     {
163         return set_ports_property<ModelAdapter, DATATYPE_COLS>(adaptor, INPUTS, controller, v);
164     }
165 };
166
167 struct intyp
168 {
169
170     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
171     {
172         return get_ports_property<ModelAdapter, DATATYPE_TYPE>(adaptor, INPUTS, controller);
173     }
174
175     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
176     {
177         return set_ports_property<ModelAdapter, DATATYPE_TYPE>(adaptor, INPUTS, controller, v);
178     }
179 };
180
181 struct out
182 {
183
184     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
185     {
186         return get_ports_property<ModelAdapter, DATATYPE_ROWS>(adaptor, OUTPUTS, controller);
187     }
188
189     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
190     {
191         return update_ports_property<ModelAdapter, DATATYPE_ROWS>(adaptor, OUTPUTS, controller, v);
192     }
193 };
194
195 struct out2
196 {
197
198     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
199     {
200         return get_ports_property<ModelAdapter, DATATYPE_COLS>(adaptor, OUTPUTS, controller);
201     }
202
203     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
204     {
205         return set_ports_property<ModelAdapter, DATATYPE_COLS>(adaptor, OUTPUTS, controller, v);
206     }
207 };
208
209 struct outtyp
210 {
211
212     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
213     {
214         return get_ports_property<ModelAdapter, DATATYPE_TYPE>(adaptor, OUTPUTS, controller);
215     }
216
217     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
218     {
219         return set_ports_property<ModelAdapter, DATATYPE_TYPE>(adaptor, OUTPUTS, controller, v);
220     }
221 };
222
223 struct evtin
224 {
225
226     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
227     {
228         return get_ports_property<ModelAdapter, DATATYPE_ROWS>(adaptor, EVENT_INPUTS, controller);
229     }
230
231     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
232     {
233         return update_ports_property<ModelAdapter, DATATYPE_ROWS>(adaptor, EVENT_INPUTS, controller, v);
234     }
235 };
236
237 struct evtout
238 {
239
240     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
241     {
242         return get_ports_property<ModelAdapter, DATATYPE_ROWS>(adaptor, EVENT_OUTPUTS, controller);
243     }
244
245     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
246     {
247         return update_ports_property<ModelAdapter, DATATYPE_ROWS>(adaptor, EVENT_OUTPUTS, controller, v);
248     }
249 };
250
251 struct state
252 {
253
254     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
255     {
256         model::Block* adaptee = adaptor.getAdaptee();
257
258         std::vector<double> state;
259         controller.getObjectProperty(adaptee->id(), adaptee->kind(), STATE, state);
260
261         double* data;
262         types::Double* o = new types::Double((int)state.size(), 1, &data);
263
264         std::copy(state.begin(), state.end(), data);
265
266         return o;
267     }
268
269     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
270     {
271
272         if (v->getType() != types::InternalType::ScilabDouble)
273         {
274             return false;
275         }
276
277         types::Double* current = v->getAs<types::Double>();
278         if (current->getCols() != 0 && current->getCols() != 1)
279         {
280             return false;
281         }
282
283         model::Block* adaptee = adaptor.getAdaptee();
284
285         std::vector<double> state (current->getSize());
286         std::copy(current->getReal(), current->getReal() + current->getSize(), state.begin());
287
288         controller.setObjectProperty(adaptee->id(), adaptee->kind(), STATE, state);
289         return true;
290     }
291 };
292
293 struct dstate
294 {
295
296     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
297     {
298         model::Block* adaptee = adaptor.getAdaptee();
299
300         std::vector<double> dstate;
301         controller.getObjectProperty(adaptee->id(), adaptee->kind(), DSTATE, dstate);
302
303         double* data;
304         types::Double* o = new types::Double((int)dstate.size(), 1, &data);
305
306         std::copy(dstate.begin(), dstate.end(), data);
307
308         return o;
309     }
310
311     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
312     {
313
314         if (v->getType() != types::InternalType::ScilabDouble)
315         {
316             return false;
317         }
318
319         types::Double* current = v->getAs<types::Double>();
320         if (current->getCols() != 0 && current->getCols() != 1)
321         {
322             return false;
323         }
324
325         model::Block* adaptee = adaptor.getAdaptee();
326
327         std::vector<double> dstate (current->getSize());
328         std::copy(current->getReal(), current->getReal() + current->getSize(), dstate.begin());
329
330         controller.setObjectProperty(adaptee->id(), adaptee->kind(), DSTATE, dstate);
331         return true;
332     }
333 };
334
335 struct odstate
336 {
337
338     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
339     {
340         // silent unused parameter warnings
341         (void) adaptor;
342         (void) controller;
343
344         // FIXME: implement as a scicos encoded list of values
345
346         // Return a default empty list.
347         return new types::List();
348     }
349
350     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
351     {
352         if (v->getType() != types::InternalType::ScilabList)
353         {
354             return false;
355         }
356
357         types::List* current = v->getAs<types::List>();
358
359         if (current->getSize() == 0)
360         {
361             return true;
362         }
363         else
364         {
365             // silent unused parameter warnings
366             (void) adaptor;
367             (void) v;
368             (void) controller;
369
370             // FIXME: implement as a scicos encoded list of values
371             return false;
372         }
373     }
374 };
375
376 struct rpar
377 {
378
379     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
380     {
381         model::Block* adaptee = adaptor.getAdaptee();
382
383         std::vector<ScicosID> children;
384         controller.getObjectProperty(adaptee->id(), adaptee->kind(), CHILDREN, children);
385
386         if (children.empty())
387         {
388             std::vector<double> rpar;
389             controller.getObjectProperty(adaptee->id(), adaptee->kind(), RPAR, rpar);
390
391             double *data;
392             types::Double* o = new types::Double((int)rpar.size(), 1, &data);
393             std::copy(rpar.begin(), rpar.end(), data);
394
395             return o;
396         }
397         else
398         {
399             types::MList* o = new types::MList();
400             types::String* Diagram = new types::String(1, 1);
401             Diagram->set(0, diagram);
402             o->set(0, Diagram);
403
404             // FIXME: return the full diagram contained in children
405             return o;
406         }
407     }
408
409     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
410     {
411         model::Block* adaptee = adaptor.getAdaptee();
412
413         if (v->getType() == types::InternalType::ScilabDouble)
414         {
415             types::Double* current = v->getAs<types::Double>();
416             if (current->getCols() != 0 && current->getCols() != 1)
417             {
418                 return false;
419             }
420
421             std::vector<double> rpar (current->getSize());
422             for (int i = 0; i < current->getSize(); ++i)
423             {
424                 rpar[i] = current->get(i);
425             }
426
427             controller.setObjectProperty(adaptee->id(), adaptee->kind(), RPAR, rpar);
428             return true;
429         }
430         else if (v->getType() == types::InternalType::ScilabString)
431         {
432             // Allow Text blocs to define strings in rpar
433             return true;
434         }
435         else
436         {
437             // FIXME: set rpar when input is a diagram (MList)
438             return false;
439         }
440     }
441 };
442
443 static double toDouble(const int a)
444 {
445     return static_cast<double>(a);
446 }
447
448 struct ipar
449 {
450
451     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
452     {
453         model::Block* adaptee = adaptor.getAdaptee();
454
455         std::vector<int> ipar;
456         controller.getObjectProperty(adaptee->id(), adaptee->kind(), IPAR, ipar);
457
458         double *data;
459         types::Double* o = new types::Double((int)ipar.size(), 1, &data);
460
461         std::transform(ipar.begin(), ipar.end(), data, toDouble);
462
463         return o;
464     }
465
466     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
467     {
468
469         if (v->getType() != types::InternalType::ScilabDouble)
470         {
471             return false;
472         }
473
474         types::Double* current = v->getAs<types::Double>();
475         if (current->getCols() != 0 && current->getCols() != 1)
476         {
477             return false;
478         }
479
480         model::Block* adaptee = adaptor.getAdaptee();
481
482         std::vector<int> ipar (current->getSize());
483         for (int i = 0; i < current->getSize(); ++i)
484         {
485             if (floor(current->get(i)) != current->get(i))
486             {
487                 return false;
488             }
489             ipar[i] = static_cast<int>(current->get(i));
490         }
491
492         controller.setObjectProperty(adaptee->id(), adaptee->kind(), IPAR, ipar);
493         return true;
494     }
495 };
496
497 struct opar
498 {
499
500     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
501     {
502         // silent unused parameter warnings
503         (void) adaptor;
504         (void) controller;
505
506         // FIXME: implement as a scicos encoded list of values
507
508         // Return a default empty list.
509         return new types::List();
510     }
511
512     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
513     {
514         if (v->getType() != types::InternalType::ScilabList)
515         {
516             return false;
517         }
518
519         types::List* current = v->getAs<types::List>();
520
521         if (current->getSize() == 0)
522         {
523             return true;
524         }
525         else
526         {
527             // silent unused parameter warnings
528             (void) adaptor;
529             (void) v;
530             (void) controller;
531
532             // FIXME: implement as a scicos encoded list of values
533             return false;
534         }
535     }
536 };
537
538 struct blocktype
539 {
540
541     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
542     {
543         model::Block* adaptee = adaptor.getAdaptee();
544
545         std::string type;
546         controller.getObjectProperty(adaptee->id(), adaptee->kind(), SIM_BLOCKTYPE, type);
547
548         types::String* o = new types::String(type.c_str());
549         return o;
550     }
551
552     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
553     {
554         model::Block* adaptee = adaptor.getAdaptee();
555
556         if (v->getType() != types::InternalType::ScilabString)
557         {
558             return false;
559         }
560
561         types::String* current = v->getAs<types::String>();
562         if (current->getSize() != 1)
563         {
564             return false;
565         }
566
567         char* c_str = wide_string_to_UTF8(current->get(0));
568         std::string type (c_str);
569         FREE(c_str);
570
571         // the value validation is performed on the model
572         return controller.setObjectProperty(adaptee->id(), adaptee->kind(), SIM_BLOCKTYPE, type) != FAIL;
573     }
574 };
575
576 struct firing
577 {
578
579     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
580     {
581         return get_ports_property<ModelAdapter, FIRING>(adaptor, EVENT_OUTPUTS, controller);
582     }
583
584     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
585     {
586         return set_ports_property<ModelAdapter, FIRING>(adaptor, EVENT_OUTPUTS, controller, v);
587     }
588 };
589
590 struct dep_ut
591 {
592
593     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
594     {
595         model::Block* adaptee = adaptor.getAdaptee();
596
597         std::vector<int> dep_ut;
598         controller.getObjectProperty(adaptee->id(), adaptee->kind(), SIM_DEP_UT, dep_ut);
599
600         int* dep;
601         types::Bool* o = new types::Bool(1, 2, &dep);
602
603         dep[0] = dep_ut[0];
604         dep[1] = dep_ut[1];
605
606         return o;
607     }
608
609     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
610     {
611         model::Block* adaptee = adaptor.getAdaptee();
612
613         if (v->getType() != types::InternalType::ScilabBool)
614         {
615             return false;
616         }
617
618         types::Bool* current = v->getAs<types::Bool>();
619         if (current->getRows() != 1 || current->getCols() != 2)
620         {
621             return false;
622         }
623
624         std::vector<int> dep_ut (2);
625         dep_ut[0] = current->get(0);
626         dep_ut[1] = current->get(1);
627
628         controller.setObjectProperty(adaptee->id(), adaptee->kind(), SIM_DEP_UT, dep_ut);
629         return true;
630     }
631 };
632
633 struct label
634 {
635
636     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
637     {
638         model::Block* adaptee = adaptor.getAdaptee();
639
640         std::string label;
641         controller.getObjectProperty(adaptee->id(), adaptee->kind(), LABEL, label);
642
643         types::String* o = new types::String(1, 1);
644         o->set(0, label.data());
645
646         return o;
647     }
648
649     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
650     {
651         if (v->getType() != types::InternalType::ScilabString)
652         {
653             return false;
654         }
655
656         types::String* current = v->getAs<types::String>();
657         if (current->getSize() != 1)
658         {
659             return false;
660         }
661
662         model::Block* adaptee = adaptor.getAdaptee();
663
664         std::string label;
665         char* c_str = wide_string_to_UTF8(current->get(0));
666         label = std::string(c_str);
667         FREE(c_str);
668
669         controller.setObjectProperty(adaptee->id(), adaptee->kind(), LABEL, label);
670         return true;
671     }
672 };
673
674 struct nzcross
675 {
676
677     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
678     {
679         model::Block* adaptee = adaptor.getAdaptee();
680
681         int nzcross;
682         controller.getObjectProperty(adaptee->id(), adaptee->kind(), NZCROSS, nzcross);
683
684         types::Double* o = new types::Double(static_cast<double>(nzcross));
685
686         return o;
687     }
688
689     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
690     {
691
692         if (v->getType() != types::InternalType::ScilabDouble)
693         {
694             return false;
695         }
696
697         types::Double* current = v->getAs<types::Double>();
698         if (current->getSize() != 1)
699         {
700             return false;
701         }
702         if (floor(current->get(0)) != current->get(0))
703         {
704             return false;
705         }
706
707         model::Block* adaptee = adaptor.getAdaptee();
708
709         int nzcross = static_cast<int>(current->get(0));
710
711         controller.setObjectProperty(adaptee->id(), adaptee->kind(), NZCROSS, nzcross);
712         return true;
713     }
714 };
715
716 struct nmode
717 {
718
719     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
720     {
721         model::Block* adaptee = adaptor.getAdaptee();
722
723         int nmode;
724         controller.getObjectProperty(adaptee->id(), adaptee->kind(), NMODE, nmode);
725
726         types::Double* o = new types::Double(static_cast<double>(nmode));
727
728         return o;
729     }
730
731     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
732     {
733
734         if (v->getType() != types::InternalType::ScilabDouble)
735         {
736             return false;
737         }
738
739         types::Double* current = v->getAs<types::Double>();
740         if (current->getSize() != 1)
741         {
742             return false;
743         }
744         if (floor(current->get(0)) != current->get(0))
745         {
746             return false;
747         }
748
749         model::Block* adaptee = adaptor.getAdaptee();
750
751         int nmode = static_cast<int>(current->get(0));
752
753         controller.setObjectProperty(adaptee->id(), adaptee->kind(), NMODE, nmode);
754         return true;
755     }
756 };
757
758 struct equations
759 {
760
761     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
762     {
763         // silent unused parameter warnings
764         (void) adaptor;
765         (void) controller;
766
767         // FIXME: implement as a stored modelica equations
768
769         // Return a default empty list.
770         return new types::List();
771     }
772
773     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
774     {
775         if (v->getType() != types::InternalType::ScilabList)
776         {
777             return false;
778         }
779
780         types::List* current = v->getAs<types::List>();
781
782         if (current->getSize() == 0)
783         {
784             return true;
785         }
786         else
787         {
788             // silent unused parameter warnings
789             (void) adaptor;
790             (void) v;
791             (void) controller;
792
793             // FIXME: implement as a stored modelica equations
794             // FIXME: get the input list and store it in the equations field
795             return false;
796         }
797     }
798 };
799
800 struct uid
801 {
802
803     static types::InternalType* get(const ModelAdapter& adaptor, const Controller& controller)
804     {
805         model::Block* adaptee = adaptor.getAdaptee();
806
807         std::string uid;
808         controller.getObjectProperty(adaptee->id(), adaptee->kind(), UID, uid);
809
810         types::String* o = new types::String(1, 1);
811         o->set(0, uid.data());
812
813         return o;
814     }
815
816     static bool set(ModelAdapter& adaptor, types::InternalType* v, Controller& controller)
817     {
818         if (v->getType() != types::InternalType::ScilabString)
819         {
820             return false;
821         }
822
823         types::String* current = v->getAs<types::String>();
824         if (current->getSize() != 1)
825         {
826             return false;
827         }
828
829         model::Block* adaptee = adaptor.getAdaptee();
830
831         std::string uid;
832         char* c_str = wide_string_to_UTF8(current->get(0));
833         uid = std::string(c_str);
834         FREE(c_str);
835
836         controller.setObjectProperty(adaptee->id(), adaptee->kind(), UID, uid);
837         return true;
838     }
839 };
840
841 } /* namespace */
842
843 template<> property<ModelAdapter>::props_t property<ModelAdapter>::fields = property<ModelAdapter>::props_t();
844
845 ModelAdapter::ModelAdapter(const ModelAdapter& o) :
846     BaseAdapter<ModelAdapter, org_scilab_modules_scicos::model::Block>(o) { }
847
848 ModelAdapter::ModelAdapter(org_scilab_modules_scicos::model::Block* o) :
849     BaseAdapter<ModelAdapter, org_scilab_modules_scicos::model::Block>(o)
850 {
851     if (property<ModelAdapter>::properties_have_not_been_set())
852     {
853         property<ModelAdapter>::fields.reserve(23);
854         property<ModelAdapter>::add_property(L"sim", &sim::get, &sim::set);
855         property<ModelAdapter>::add_property(L"in", &in::get, &in::set);
856         property<ModelAdapter>::add_property(L"in2", &in2::get, &in2::set);
857         property<ModelAdapter>::add_property(L"intyp", &intyp::get, &intyp::set);
858         property<ModelAdapter>::add_property(L"out", &out::get, &out::set);
859         property<ModelAdapter>::add_property(L"out2", &out2::get, &out2::set);
860         property<ModelAdapter>::add_property(L"outtyp", &outtyp::get, &outtyp::set);
861         property<ModelAdapter>::add_property(L"evtin", &evtin::get, &evtin::set);
862         property<ModelAdapter>::add_property(L"evtout", &evtout::get, &evtout::set);
863         property<ModelAdapter>::add_property(L"state", &state::get, &state::set);
864         property<ModelAdapter>::add_property(L"dstate", &dstate::get, &dstate::set);
865         property<ModelAdapter>::add_property(L"odstate", &odstate::get, &odstate::set);
866         property<ModelAdapter>::add_property(L"rpar", &rpar::get, &rpar::set);
867         property<ModelAdapter>::add_property(L"ipar", &ipar::get, &ipar::set);
868         property<ModelAdapter>::add_property(L"opar", &opar::get, &opar::set);
869         property<ModelAdapter>::add_property(L"blocktype", &blocktype::get, &blocktype::set);
870         property<ModelAdapter>::add_property(L"firing", &firing::get, &firing::set);
871         property<ModelAdapter>::add_property(L"dep_ut", &dep_ut::get, &dep_ut::set);
872         property<ModelAdapter>::add_property(L"label", &label::get, &label::set);
873         property<ModelAdapter>::add_property(L"nzcross", &nzcross::get, &nzcross::set);
874         property<ModelAdapter>::add_property(L"nmode", &nmode::get, &nmode::set);
875         property<ModelAdapter>::add_property(L"equations", &equations::get, &equations::set);
876         property<ModelAdapter>::add_property(L"uid", &uid::get, &uid::set);
877     }
878 }
879
880 ModelAdapter::~ModelAdapter()
881 {
882 }
883
884 std::wstring ModelAdapter::getTypeStr()
885 {
886     return getSharedTypeStr();
887 }
888
889 std::wstring ModelAdapter::getShortTypeStr()
890 {
891     return getSharedTypeStr();
892 }
893
894 } /* namespace view_scilab */
895 } /* namespace org_scilab_modules_scicos */