1 // Copyright (C) 2006-2008 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.
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
19 #ifndef __DEPLOYMENTTREE_HXX__
20 #define __DEPLOYMENTTREE_HXX__
31 class ComponentInstance;
33 class DeploymentTreeOnHeap
36 DeploymentTreeOnHeap();
37 ~DeploymentTreeOnHeap();
41 unsigned char appendTask(Task *task, Scheduler *cloner);
43 unsigned getNumberOfCTDefContainer() const;
44 unsigned getNumberOfRTODefContainer() const;
45 unsigned getNumberOfCTDefComponentInstances() const;
46 unsigned getNumberOfRTODefComponentInstances() const;
48 std::vector<Container *> getAllContainers() const;
49 std::vector<Container *> getAllCTDefContainers() const;
50 std::vector<Container *> getAllRTODefContainers() const;
51 std::vector<Task *> getTasksLinkedToComponent(ComponentInstance *comp) const;
52 std::vector<ComponentInstance *> getComponentsLinkedToContainer(Container *cont) const;
54 bool presenceOfDefaultContainer() const;
55 std::vector<Task *> getFreeDeployableTasks() const;
57 static bool isConsistentTaskRegardingShCompInst(std::vector< std::pair<Task *, Scheduler * > >& tasksSharingSameCompInst, Scheduler *cloner);
60 std::vector< std::pair<Task *,Scheduler *> > _freePlacableTasks;
61 //! internal representation of tree. Scheduler is the duplicating Task, \b if it exists, on runtime unpredictable times on compil-time
62 std::vector< std::vector< std::vector< std::pair<Task *, Scheduler * > > > > _tree;
70 DeploymentTree(const DeploymentTree& other);
71 const DeploymentTree &operator=(const DeploymentTree& other);
72 unsigned char appendTask(Task *task, Scheduler *cloner);
74 unsigned getNumberOfCTDefContainer() const;
75 unsigned getNumberOfRTODefContainer() const;
76 unsigned getNumberOfCTDefComponentInstances() const;
77 unsigned getNumberOfRTODefComponentInstances() const;
79 bool presenceOfDefaultContainer() const;
80 std::vector<Container *> getAllContainers() const;
81 std::vector<Container *> getAllCTDefContainers() const;
82 std::vector<Container *> getAllRTODefContainers() const;
83 std::vector<Task *> getTasksLinkedToComponent(ComponentInstance *comp) const;
84 std::vector<ComponentInstance *> getComponentsLinkedToContainer(Container *cont) const;
87 std::vector<Task *> getFreeDeployableTasks() const;
89 //possible return of appendTask method.
90 static const unsigned char NULL_TASK = 3;
91 static const unsigned char APPEND_OK = 0;
92 static const unsigned char NULL_TREE = 199;
93 static const unsigned char ALREADY_IN_TREE = 1;
94 static const unsigned char NOT_DEPLOYABLE_TASK = 2;
95 static const unsigned char DEPLOYABLE_BUT_NOT_SPECIFIED = 5;
96 static const unsigned char DUP_TASK_NOT_COMPATIBLE_WITH_EXISTING_TREE = 4;
98 DeploymentTreeOnHeap *_treeHandle;