Version: 8.3.0
DeploymentTree.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef __DEPLOYMENTTREE_HXX__
21 #define __DEPLOYMENTTREE_HXX__
22 
23 #include "YACSlibEngineExport.hxx"
24 
25 #include <vector>
26 
27 namespace YACS
28 {
29  namespace ENGINE
30  {
31  class Task;
32  class Container;
33  class Scheduler;
34  class ComponentInstance;
35 
37  {
38  public:
41  bool decrRef();
42  void incrRef() const;
43  //
44  unsigned char appendTask(Task *task, Scheduler *cloner);
45  //
46  unsigned getNumberOfCTDefContainer() const;
47  unsigned getNumberOfRTODefContainer() const;
48  unsigned getNumberOfCTDefComponentInstances() const;
49  unsigned getNumberOfRTODefComponentInstances() const;
50  //
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;
57  //
58  bool presenceOfDefaultContainer() const;
59  std::vector<Task *> getFreeDeployableTasks() const;
60  private:
61  mutable int _cnt;
62  std::vector< std::pair<Task *,Scheduler *> > _freePlacableTasks;
64  std::vector< std::vector< std::vector< std::pair<Task *, Scheduler * > > > > _tree;
65  };
66 
68  {
69  public:
71  ~DeploymentTree();
72  DeploymentTree(const DeploymentTree& other);
73  const DeploymentTree &operator=(const DeploymentTree& other);
74  unsigned char appendTask(Task *task, Scheduler *cloner);
75  //
76  unsigned getNumberOfCTDefContainer() const;
77  unsigned getNumberOfRTODefContainer() const;
78  unsigned getNumberOfCTDefComponentInstances() const;
79  unsigned getNumberOfRTODefComponentInstances() const;
80  //
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;
88  //
89  bool isNull() const;
90  std::vector<Task *> getFreeDeployableTasks() const;
91  public:
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;
100  private:
102  };
103  }
104 }
105 
106 #endif