#include <PlayGround.hxx>
Definition at line 39 of file PlayGround.hxx.
◆ Resource() [1/2]
| YACS::ENGINE::Resource::Resource |
( |
const std::string & |
name, |
|
|
int |
nbCores |
|
) |
| |
|
inline |
◆ Resource() [2/2]
| YACS::ENGINE::Resource::Resource |
( |
const std::pair< std::string, int > & |
p | ) |
|
|
inline |
◆ allocateFor()
| std::vector< std::size_t > Resource::allocateFor |
( |
std::size_t & |
nbOfPlacesToTake, |
|
|
int |
nbCoresPerCont |
|
) |
| const |
Definition at line 49 of file PlayGround.cxx.
51 std::vector<std::size_t> ret;
52 std::size_t pos(0),curWorkerId(0);
53 while( ( pos <
_occupied.size() ) && ( nbOfPlacesToTake > 0 ) )
55 bool isChunckFree(
true);
57 for( ; ( posInChunck < nbCoresPerCont ) && ( pos <
_occupied.size() ) ; ++posInChunck, ++pos)
60 if( isChunckFree && (posInChunck == nbCoresPerCont) )
62 for(
int i = 0 ;
i < nbCoresPerCont ; ++
i)
64 ret.push_back(curWorkerId);
References _occupied, and yacsorb.CORBAEngineTest::i.
◆ getNumberOfFreePlace()
| std::size_t Resource::getNumberOfFreePlace |
( |
int |
nbCoresPerCont | ) |
const |
Definition at line 33 of file PlayGround.cxx.
35 std::size_t ret(0),pos(0);
38 bool isChunckFree(
true);
40 for( ; ( posInChunck < nbCoresPerCont ) && ( pos <
_occupied.size() ) ; ++posInChunck, ++pos)
43 if( isChunckFree && (posInChunck == nbCoresPerCont) )
References _occupied.
◆ getNumberOfWorkers()
| std::size_t Resource::getNumberOfWorkers |
( |
int |
nbCoresPerCont | ) |
const |
◆ name()
| std::string YACS::ENGINE::Resource::name |
( |
| ) |
const |
|
inline |
◆ nbCores()
| int YACS::ENGINE::Resource::nbCores |
( |
| ) |
const |
|
inline |
◆ printSelf()
| void Resource::printSelf |
( |
std::ostream & |
oss | ) |
const |
◆ release()
| void Resource::release |
( |
std::size_t |
workerId, |
|
|
int |
nbCoresPerCont |
|
) |
| const |
Definition at line 72 of file PlayGround.cxx.
75 throw Exception(
"Resource::release : invalid worker id !");
76 std::size_t pos(workerId*
static_cast<std::size_t
>(nbCoresPerCont));
77 for(
int i = 0 ;
i < nbCoresPerCont ; ++
i)
79 if(!
_occupied[pos +
static_cast<std::size_t
>(
i)])
80 throw Exception(
"Resource::release : internal error ! A core is expected to be occupied !");
81 _occupied[pos +
static_cast<std::size_t
>(
i)] =
false;
std::size_t getNumberOfWorkers(int nbCoresPerCont) const
References _occupied, getNumberOfWorkers(), and yacsorb.CORBAEngineTest::i.
◆ toPair()
| std::pair<std::string,int> YACS::ENGINE::Resource::toPair |
( |
| ) |
const |
|
inline |
◆ _name
| std::string YACS::ENGINE::Resource::_name |
|
private |
◆ _nbCores
| int YACS::ENGINE::Resource::_nbCores |
|
private |
◆ _occupied
| std::vector<bool> YACS::ENGINE::Resource::_occupied |
|
mutableprivate |
The documentation for this class was generated from the following files: