示例#1
0
PathItem PathTree::pathItem(Segment::PtrConst p) {
    Segment::PtrConst retSeg = seg(p->returnSegment());
    PathItem pI;
    pI.loc = loc(retSeg->source());
    pI.seg = p ;
    pI.returnSeg = seg(p->returnSegment());
    return pI;
}
示例#2
0
void Conn::onSegmentUpdate(Segment::PtrConst seg0) {
    FWK_DEBUG("Conn::onSegmentUpdate() with name: " << seg0->name());
    if (graphSegment_.find(seg0->name()) == graphSegment_.end()){
        FWK_DEBUG("Conn::onSegmentUpdate() did not find any segment called "
            << seg0->name() << " in the graph");
        if (isInsertable(seg0) == insertable_){
            Segment::PtrConst seg1 = 
                owner_->entityManager()->segment(seg0->returnSegment());
            FWK_DEBUG("Conn::onSegmentUpdate() Adding " << 
                seg0->name() << " to graph");
            graphSegment_[seg0->name()] = seg0;
            FWK_DEBUG("Conn::onSegmentUpdate() Adding " <<
                seg1->name() << " to graph");
            graphSegment_[seg1->name()] = seg1;
            if (graphLocation_.find(seg0->source()) == graphLocation_.end()) {
                Location::PtrConst loc0 =
                    owner_->entityManager()->location(seg0->source());
                FWK_DEBUG("Conn::onSegmentUpdate() Adding " << 
                    loc0->name() << " to graph");
                graphLocation_[loc0->name()] = loc0;
                routeTable_->statusIs(RouteTable::needsUpdate);
            }
            if (graphLocation_.find(seg1->source()) == graphLocation_.end()){
                Location::PtrConst loc1 = 
                    owner_->entityManager()->location(seg1->source());
                FWK_DEBUG("Conn::onSegmentUpdate() Adding " <<
                    loc1->name() << " to graph");
                graphLocation_[loc1->name()] = loc1;
                routeTable_->statusIs(RouteTable::needsUpdate);
            }
        } else {
            FWK_DEBUG("Conn::onSegmentUpdate() " << seg0->name() <<
                " is not insertable");
            return;
        }
    }
    if (seg0->source() == ""){
        removeGraphSegment(seg0);
        removeGraphSegment(graphSegment_[seg0->returnSegment()]);
    }
    if (seg0->returnSegment() == ""){
        removeGraphSegment(seg0);
    }
};
示例#3
0
void Conn::onLocationShipmentNew(Location::PtrConst _cur,
    Shipment::Ptr _shipment) {
        FWK_DEBUG("Conn::onLocationShipmentNew() with name: " << _cur->name());

        Location::PtrConst next =
            routeTable_->nextLocation(_cur, _shipment->destination());
        Segment::Ptr out;
        Location::OutSegmentIteratorConst it = _cur->outSegmenterIterConst();
        for (int i =0; i < _cur->outSegments(); ++i, ++it) {
            Segment::PtrConst r = graphSegment_.at((*it)->returnSegment());
            if (r->source() == next->name()){
                out = *it;
                break;
            }
        }
        //Segment * s = const_cast<Segment *> (out.ptr());
        Location::Ptr p =  const_cast<Location *>(next.ptr());
        out->shipmentEnq(_shipment,p);
};
示例#4
0
Conn::Insertable Conn::isInsertable(Segment::PtrConst seg){
    FWK_DEBUG("Conn::isInsertable() with name: " << seg->name());
    if (!owner_->entityManager()->segment(seg->returnSegment())){
        FWK_DEBUG("Conn::isInsertable() Missing Return");
        return missingReturn_;
    }
    if (!owner_->entityManager()->location(seg->source())){
        FWK_DEBUG("Conn::isInsertable() Missing Source");
        return missingSource_;
    }
    if (!owner_->entityManager()->location(
        owner_->entityManager()->segment(
        seg->returnSegment())->source())) {
            FWK_DEBUG("Conn::isInsertable() Missing Return Source");
            return missingReturnSource_;
    }
    FWK_DEBUG("Conn::isInsertable() Insertable");
    return insertable_;
};
示例#5
0
void Conn::removeGraphSegment(Segment::PtrConst seg) {
    FWK_DEBUG("Conn::removeGraphSegment() with name: " << seg->name());
    graphSegment_.erase(seg->name());
    if (graphLocation_.find(seg->source()) != graphLocation_.end())
        removeGraphLocation(graphLocation_[seg->source()]);
};