void LocatedEntity::processAppearDisappear(std::set<const LocatedEntity*> previousObserving, OpVector& res) const
{
    std::set<const LocatedEntity*> nowObservers;
    collectObservers(nowObservers);
    for (auto entity : nowObservers) {
        auto numberErased = previousObserving.erase(entity);
        if (numberErased == 0) {
            Atlas::Objects::Operation::Appearance appear;
            Atlas::Objects::Entity::Anonymous that_ent;
            that_ent->setId(getId());
            that_ent->setStamp(getSeq());
            appear->setArgs1(that_ent);
            appear->setTo(entity->getId());
            res.push_back(appear);
        }
    }

    for (auto entity : previousObserving) {
        Atlas::Objects::Operation::Disappearance disappear;
        Atlas::Objects::Entity::Anonymous that_ent;
        that_ent->setId(getId());
        that_ent->setStamp(getSeq());
        disappear->setArgs1(that_ent);
        disappear->setTo(entity->getId());
        res.push_back(disappear);
    }
}
Exemple #2
0
void BaseMindtest::test_appearanceOperation()
{
    OpVector res;
    Atlas::Objects::Operation::Appearance op;
    bm->operation(op, res);

    Atlas::Objects::Entity::Anonymous arg;
    op->setArgs1(arg);
    bm->operation(op, res);

    arg->setId("2");
    bm->operation(op, res);

    arg->setStamp(0);
    bm->operation(op, res);

    arg->setStamp(23);
    bm->operation(op, res);
}