Xcos MVC: Avoid leaking memory and pass the tests
[scilab.git] / scilab / modules / scicos / src / cpp / view_scilab / DiagramAdapter.hxx
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 #ifndef DIAGRAMADAPTER_HXX_
14 #define DIAGRAMADAPTER_HXX_
15
16 #include <string>
17 #include <vector>
18 #include <memory>
19
20 #include "utilities.hxx"
21 #include "adapters_utilities.hxx"
22 #include "BaseAdapter.hxx"
23 #include "model/Diagram.hxx"
24
25 namespace org_scilab_modules_scicos
26 {
27 namespace view_scilab
28 {
29
30 class DiagramAdapter : public BaseAdapter<DiagramAdapter, org_scilab_modules_scicos::model::Diagram>
31 {
32 public:
33     DiagramAdapter(std::shared_ptr<org_scilab_modules_scicos::model::Diagram> adaptee);
34     DiagramAdapter(const DiagramAdapter& adapter);
35     ~DiagramAdapter();
36
37     static const std::wstring getSharedTypeStr()
38     {
39         return L"diagram";
40     }
41
42     std::wstring getTypeStr();
43     std::wstring getShortTypeStr();
44
45     types::InternalType* getListObjects() const;
46     void setListObjects(types::InternalType* v);
47
48     std::vector<link_t>& getFrom();
49     std::vector<link_t>& getTo();
50
51     types::InternalType* getContribContent() const;
52     void setContribContent(types::InternalType* v);
53
54 private:
55     types::InternalType* list_objects;
56
57     std::vector<link_t> from_vec;
58     std::vector<link_t> to_vec;
59
60     types::InternalType* contrib_content;
61 };
62
63 } /* namespace view_scilab */
64 } /* namespace org_scilab_modules_scicos */
65
66 #endif /* MODELADAPTER_HXX_ */