Ejemplo n.º 1
0
bool Computer::satisfy(GenericResource* resource)
{
    if(!getAvailability() || getDisable())
        return false;

    MultiResource* mres = dynamic_cast<MultiResource*>(resource);
    if(mres)
    {
        if(!mres->resourceCount())
            return true;
        for(int i=0; i<mres->resourceCount(); i++)
        {
            Computer* comp = dynamic_cast<Computer*>(&mres->getResourceAt(i));
            if(comp &&satisfyComputer(comp))
                return true;
            else if(satisfyComputerResource(&mres->getResourceAt(i)))
                return true;
        }
        return false;
    }

    Computer* comp = dynamic_cast<Computer*>(resource);
    if(comp)
        return satisfyComputer(comp);

    return satisfyComputerResource(resource);
}
Ejemplo n.º 2
0
bool Storage::satisfy(GenericResource* resource)
{
    if(!getAvailability() || getDisable())
        return false;

    Storage* mem = dynamic_cast<Storage*>(resource);
    if(!mem)
        return false;
    return ( (freeSpace >= mem->getFreeSpace()) &&
             (totalSpace >= mem->getTotalSpace()) );
}
Ejemplo n.º 3
0
bool ResYarpPort::satisfy(GenericResource* resource)
{   
    if(!getAvailability() || getDisable())
        return false;

    ResYarpPort* resport = dynamic_cast<ResYarpPort*>(resource);
    if(!resport)
        return false;
    return (strPort == string(resport->getPort()) || 
            strPort == string(resport->getName()) );
}
Ejemplo n.º 4
0
bool Platform::satisfy(GenericResource* resource)
{   
    if(!getAvailability() || getDisable())
        return false;

    Platform* os = dynamic_cast<Platform*>(resource);
    if(os)
        return satisfy_platform(os);

    return false;
}
Ejemplo n.º 5
0
bool Network::satisfy(GenericResource* resource)
{
    if(!getAvailability() || getDisable())
        return false;

    Network* net = dynamic_cast<Network*>(resource);
    if(!net)
        return false;
    bool ret = (!strlen(net->getIP4()))? true : (strIP4 == string(net->getIP4()));
    ret &= (!strlen(net->getIP6()))? true : (strIP6 == string(net->getIP6()));
    ret &= (!strlen(net->getMAC()))? true : (strMAC == string(net->getMAC()));
    return ret;
}
Ejemplo n.º 6
0
bool Processor::satisfy(GenericResource* resource)
{
    if(!getAvailability() || getDisable())
        return false;

    Processor* proc = dynamic_cast<Processor*>(resource);
    if(!proc)
        return false;

    bool ret = (!strlen(proc->getArchitecture()))? true : (strArchitecure == string(proc->getArchitecture()));
    ret &= (!strlen(proc->getModel()))? true : (strModel == string(proc->getModel()));
    ret &= (cores >= proc->getCores());
    ret &= (siblings >= proc->getSiblings());
    ret &= (frequency >= proc->getFrequency());
    return ret;
}
Ejemplo n.º 7
0
bool GPU::satisfy(GenericResource* resource)
{
    if(!getAvailability() || getDisable())
        return false;

    GPU* gpu = dynamic_cast<GPU*>(resource);
    if(!gpu)
        return false;
    bool ret = (!strlen(gpu->getCompCompatibility()))? true : (compCompatibility == string(gpu->getCompCompatibility()));
    ret &= (cores >= gpu->getCores());
    ret &= (frequency >= gpu->getFrequency());
    ret &= (globalMemory >= gpu->getGlobalMemory());
    ret &= (sharedMemory >= gpu->getSharedMemory());
    ret &= (constantMemory >= gpu->getConstantMemory());
    //ret &= (registerPerBlock == gpu->getRegisterPerBlock());
    //ret &= (threadPerBlock == gpu->getThreadPerBlock());
    ret &= (!gpu->getOverlap())? true : (bOverlap == gpu->getOverlap());
    return ret;
}