* Bug 16365 fixed: median(m,'r'|'c') was wrong after 5dc990
[scilab.git] / scilab / modules / scicos / src / cpp / view_scilab / StateAdapter.cpp
1 /*
2  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  *  Copyright (C) 2014-2016 - Scilab Enterprises - Clement DAVID
4  *
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  *
7  * This file is hereby licensed under the terms of the GNU GPL v2.0,
8  * pursuant to article 5.3.4 of the CeCILL v.2.1.
9  * This file was originally licensed under the terms of the CeCILL v2.1,
10  * and continues to be available under such terms.
11  * For more information, see the COPYING file which you should have received
12  * along with this program.
13  *
14  */
15
16 #include <string>
17
18 #include "internal.hxx"
19 #include "types.hxx"
20 #include "user.hxx"
21
22 #include "Controller.hxx"
23 #include "StateAdapter.hxx"
24
25 namespace org_scilab_modules_scicos
26 {
27 namespace view_scilab
28 {
29 namespace
30 {
31
32 struct dummy_property
33 {
34
35     static types::InternalType* get(const StateAdapter& /*adaptor*/, const Controller& /*controller*/)
36     {
37         // Return a default empty matrix.
38         return types::Double::Empty();
39     }
40
41     static bool set(StateAdapter& /*adaptor*/, types::InternalType* /*v*/, Controller& /*controller*/)
42     {
43         // Everything should be right as the properties mapped using this adapter do not perform anything
44         return true;
45     }
46 };
47
48 } /* namespace */
49
50 #ifndef _MSC_VER
51 template<>
52 #endif
53 property<StateAdapter>::props_t property<StateAdapter>::fields = property<StateAdapter>::props_t();
54 static void initialize_fields()
55 {
56     if (property<StateAdapter>::properties_have_not_been_set())
57     {
58         property<StateAdapter>::reserve_properties(8);
59         property<StateAdapter>::add_property(L"x", &dummy_property::get, &dummy_property::set);
60         property<StateAdapter>::add_property(L"z", &dummy_property::get, &dummy_property::set);
61         property<StateAdapter>::add_property(L"oz", &dummy_property::get, &dummy_property::set);
62         property<StateAdapter>::add_property(L"iz", &dummy_property::get, &dummy_property::set);
63         property<StateAdapter>::add_property(L"tevts", &dummy_property::get, &dummy_property::set);
64         property<StateAdapter>::add_property(L"evtspt", &dummy_property::get, &dummy_property::set);
65         property<StateAdapter>::add_property(L"pointi", &dummy_property::get, &dummy_property::set);
66         property<StateAdapter>::add_property(L"outtb", &dummy_property::get, &dummy_property::set);
67         property<StateAdapter>::shrink_to_fit();
68     }
69 }
70
71 StateAdapter::StateAdapter() :
72     BaseAdapter<StateAdapter, org_scilab_modules_scicos::model::Diagram>()
73 {
74     initialize_fields();
75 }
76
77 StateAdapter::StateAdapter(const Controller& c, org_scilab_modules_scicos::model::Diagram* adaptee) :
78     BaseAdapter<StateAdapter, org_scilab_modules_scicos::model::Diagram>(c, adaptee)
79 {
80     initialize_fields();
81 }
82
83 StateAdapter::~StateAdapter()
84 {
85 }
86
87 std::wstring StateAdapter::getTypeStr() const
88 {
89     return getSharedTypeStr();
90 }
91 std::wstring StateAdapter::getShortTypeStr() const
92 {
93     return getSharedTypeStr();
94 }
95
96 } /* namespace view_scilab */
97 } /* namespace org_scilab_modules_scicos */