Version: 9.15.0
SalomeHPContainerTools.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2025 CEA, EDF
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 #pragma once
21 
24 
25 #include "AutoRefCnt.hxx"
26 
27 #include <map>
28 #include <vector>
29 
30 namespace YACS
31 {
32  namespace ENGINE
33  {
34  class Task;
35  class SalomeComponent;
36  class SalomeHPContainer;
37  class SalomeContainerMonoHelper;
39  {
40  public:
41  std::size_t size() const { return _launchModeType.size(); }
42  void resize(std::size_t sz);
43  std::size_t getNumberOfFreePlace() const;
44  void allocateFor(const std::vector<const Task *>& nodes);
45  void allocateForCrude(const std::vector<std::pair<const Task *,std::size_t>>& nodes);
46  std::size_t release(const Task *node);
47  std::size_t locateTask(const Task *node) const;
48  const SalomeContainerMonoHelper *at(std::size_t pos) const { checkPosInVec(pos); return _launchModeType[pos]; }
49  SalomeContainerMonoHelper *at(std::size_t pos) { checkPosInVec(pos); return _launchModeType[pos]; }
50  const SalomeContainerMonoHelper *getHelperOfTaskThreadSafe(const SalomeHPContainer *cont, const Task *node) const;
51  const SalomeContainerMonoHelper *getHelperOfTask(const Task *node) const;
54  std::vector<std::string> getKernelContainerNames(const SalomeHPContainer *cont) const;
55  private:
56  void checkNoCurrentWork() const;
57  void checkPosInVec(std::size_t pos) const;
58  private:
59  std::vector<bool> _whichOccupied;
60  std::vector< BASES::AutoRefCnt<YACS::ENGINE::SalomeContainerMonoHelper> > _launchModeType;
61  std::map<const Task *,std::size_t > _currentlyWorking;
62  };
63  }
64 }
SalomeContainerMonoHelper * at(std::size_t pos)
void allocateFor(const std::vector< const Task * > &nodes)
std::size_t locateTask(const Task *node) const
void allocateForCrude(const std::vector< std::pair< const Task *, std::size_t >> &nodes)
const SalomeContainerMonoHelper * getHelperOfTaskThreadSafe(const SalomeHPContainer *cont, const Task *node) const
std::vector< std::string > getKernelContainerNames(const SalomeHPContainer *cont) const
const SalomeContainerMonoHelper * at(std::size_t pos) const
const SalomeContainerMonoHelper * getHelperOfTask(const Task *node) const
std::vector< BASES::AutoRefCnt< YACS::ENGINE::SalomeContainerMonoHelper > > _launchModeType
std::map< const Task *, std::size_t > _currentlyWorking