1 // Copyright (C) 2006-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __DEPLOYMENTTREE_HXX__
21 #define __DEPLOYMENTTREE_HXX__
23 #include "YACSlibEngineExport.hxx"
34 class ComponentInstance;
36 class YACSLIBENGINE_EXPORT DeploymentTreeOnHeap
39 DeploymentTreeOnHeap();
40 ~DeploymentTreeOnHeap();
44 unsigned char appendTask(Task *task, Scheduler *cloner);
46 unsigned getNumberOfCTDefContainer() const;
47 unsigned getNumberOfRTODefContainer() const;
48 unsigned getNumberOfCTDefComponentInstances() const;
49 unsigned getNumberOfRTODefComponentInstances() const;
51 std::vector<Container *> getAllContainers() const;
52 std::vector<Container *> getAllCTDefContainers() const;
53 std::vector<Container *> getAllRTODefContainers() const;
54 std::vector<Task *> getTasksLinkedToComponent(ComponentInstance *comp) const;
55 std::vector<Task *> getTasksLinkedToContainer(Container *cont) const;
56 std::vector<ComponentInstance *> getComponentsLinkedToContainer(Container *cont) const;
58 bool presenceOfDefaultContainer() const;
59 std::vector<Task *> getFreeDeployableTasks() const;
62 std::vector< std::pair<Task *,Scheduler *> > _freePlacableTasks;
63 //! internal representation of tree. Scheduler is the duplicating Task, \b if it exists, on runtime unpredictable times on compil-time
64 std::vector< std::vector< std::vector< std::pair<Task *, Scheduler * > > > > _tree;
67 class YACSLIBENGINE_EXPORT DeploymentTree
72 DeploymentTree(const DeploymentTree& other);
73 const DeploymentTree &operator=(const DeploymentTree& other);
74 unsigned char appendTask(Task *task, Scheduler *cloner);
76 unsigned getNumberOfCTDefContainer() const;
77 unsigned getNumberOfRTODefContainer() const;
78 unsigned getNumberOfCTDefComponentInstances() const;
79 unsigned getNumberOfRTODefComponentInstances() const;
81 bool presenceOfDefaultContainer() const;
82 std::vector<Container *> getAllContainers() const;
83 std::vector<Container *> getAllCTDefContainers() const;
84 std::vector<Container *> getAllRTODefContainers() const;
85 std::vector<Task *> getTasksLinkedToComponent(ComponentInstance *comp) const;
86 std::vector<Task *> getTasksLinkedToContainer(Container *cont) const;
87 std::vector<ComponentInstance *> getComponentsLinkedToContainer(Container *cont) const;
90 std::vector<Task *> getFreeDeployableTasks() const;
92 //possible return of appendTask method.
93 static const unsigned char NULL_TASK = 3;
94 static const unsigned char APPEND_OK = 0;
95 static const unsigned char NULL_TREE = 199;
96 static const unsigned char ALREADY_IN_TREE = 1;
97 static const unsigned char NOT_DEPLOYABLE_TASK = 2;
98 static const unsigned char DEPLOYABLE_BUT_NOT_SPECIFIED = 5;
99 static const unsigned char DUP_TASK_NOT_COMPATIBLE_WITH_EXISTING_TREE = 4;
101 DeploymentTreeOnHeap *_treeHandle;