Exemple #1
0
Router::RouterResult Router::handleObject(const Root& obj)
{
    if (obj->instanceOf(Atlas::Objects::Operation::ROOT_OPERATION_NO))
        return handleOperation(smart_dynamic_cast<RootOperation>(obj));

    if (obj->instanceOf(Atlas::Objects::Entity::ROOT_ENTITY_NO))
        return handleEntity(smart_dynamic_cast<RootEntity>(obj));

    throw InvalidOperation("router got an object that is not an op or entity");
}
Exemple #2
0
void View::sight(const RootEntity& gent)
{
    bool visible = true;
    std::string eid = gent->getId();
    PendingSightMap::iterator pending = m_pending.find(eid);
    
// examine the pending map, to see what we should do with this entity
    if (pending != m_pending.end()) {
        switch (pending->second)
        {
        case SACTION_APPEAR:
            visible = true;
            break;

        case SACTION_DISCARD:
            m_pending.erase(pending);
            issueQueuedLook();
            return;

        case SACTION_HIDE:
            visible = false;
            break;

        case SACTION_QUEUED:
            error() << "got sight of queued entity " << eid << " somehow";
            eraseFromLookQueue(eid);
            break;
    
        default:
            throw InvalidOperation("got bad pending action for entity");
        }
    
         m_pending.erase(pending);
    }
    
// if we got this far, go ahead and build / update it
    Entity *ent = getEntity(eid);
    if (ent) {
        // existing entity, update in place
        ent->sight(gent);
    } else {
        ent = initialSight(gent);
        EntitySeen.emit(ent);
    }
        
    if (gent->isDefaultLoc()) { // new top level entity
        setTopLevelEntity(ent);
    }
    
    ent->setVisible(visible);
    issueQueuedLook();
}
Exemple #3
0
void Connection::unlock()
{
    if (m_lock < 1)
        throw InvalidOperation("Imbalanced lock/unlock calls on Connection");

    if (--m_lock == 0) {
        switch (_status)
        {
        case DISCONNECTING:
            debug() << "Connection unlocked in DISCONNECTING, closing socket";
            debug() << "have " << m_opDeque.size() << " ops waiting";
            m_opDeque.clear();
            hardDisconnect(true);
            break;

        default:
            warning() << "Connection unlocked in spurious state : this may cause a failure later";
            break;
        }
    }
}
void LindaTuplePool::ConnectPool(std::string lindaTuplesFilePath, std::string lindaWaitingQueueFilePath)
{
    if (this->m_bIsConnected) {
        throw InvalidOperation("Already connected to a Linda pool.");
    }

    try {
        this->m_pTuplesFileManager = std::unique_ptr<LindaTuplesFileManager>(new LindaTuplesFileManager(lindaTuplesFilePath));
    }
    catch (FileOperationError) {
        throw LindaTuplePoolConnectionError("Error when opening tuples file.", errno);
    }

    try {
        this->m_pQueueFileManager = std::unique_ptr<LindaQueueFileManager>(new LindaQueueFileManager(lindaWaitingQueueFilePath));
    }
    catch (FileOperationError) {
        this->m_pTuplesFileManager = std::unique_ptr<LindaTuplesFileManager>();
        throw LindaTuplePoolConnectionError("Error when opening waiting queue file.", errno);
    }
    this->m_bIsConnected = true;
}
Exemple #5
0
Rect WinGraphics::UpdateRect() const
{
    throw InvalidOperation(
        "Fehler in WinGraphics::UpdateRect() const: "
        "Funktion wird von dieser WinGraphics-Klasse nicht unterstuetzt");
}
Exemple #6
0
void WinGraphics::End()
{
    throw InvalidOperation(
        "Fehler in WinGraphics::End(): "
        "Funktion wird von dieser WinGraphics-Klasse nicht unterstuetzt");
}
Exemple #7
0
void WinGraphics::Begin(PlatformWindow* window)
{
    throw InvalidOperation(
        "Fehler in WinGraphics::Begin(PlatformWindow*): "
        "Funktion wird von dieser WinGraphics-Klasse nicht unterstuetzt");
}