Ejemplo n.º 1
0
nImO::Array::~Array
    (void)
{
    ODL_OBJENTER(); //####
    clear();
    ODL_OBJEXIT(); //####
} // nImO::Array::~Array
Ejemplo n.º 2
0
void
nImO::Array::printToStringBuffer
    (nImO::StringBuffer &   outBuffer,
     const bool             squished)
    const
{
    ODL_OBJENTER(); //####
    ODL_P1("outBuffer = ", &outBuffer); //####
    ODL_B1("squished = ", squished); //####
    bool    first = true;

    outBuffer.addChar(kStartArrayChar);
    for (const_iterator walker(inherited2::begin()); inherited2::end() != walker; ++walker)
    {
        SpValue aValue(*walker);

        if (nullptr != aValue)
        {
            if ((! squished) || (! first))
            {
                outBuffer.addChar(' ');
            }
            aValue->printToStringBuffer(outBuffer, squished);
            first = false;
        }
    }
    if (! squished)
    {
        outBuffer.addChar(' ');
    }
    outBuffer.addChar(kEndArrayChar);
    ODL_OBJEXIT(); //####
} // nImO::Array::printToStringBuffer
Ejemplo n.º 3
0
bool
nImO::Array::equalTo
    (const nImO::Value &    other,
     bool &                 validComparison)
    const
{
    ODL_OBJENTER(); //####
    ODL_P2("other = ", &other, "validComparison = ", &validComparison); //####
    bool    result = (inherited2::begin() != inherited2::end());

    validComparison = result;
    ODL_B1("validComparison <- ", validComparison); //####
    // Note that all the values must be validated.
    for (const_iterator walker(inherited2::begin()); validComparison && (inherited2::end() != walker); ++walker)
    {
        SpValue aValue(*walker);

        if (aValue)
        {
            result &= aValue->equalTo(other, validComparison);
        }
    }
    ODL_OBJEXIT_I(result); //####
    return result;
} // nImO::Array::equalTo
Ejemplo n.º 4
0
const nImO::Array *
nImO::Array::asArray(void)
const
{
    ODL_OBJENTER(); //####
    ODL_OBJEXIT_P(this); //####
    return this;
} // nImO::Array::asArray
void
ServiceEntity::positionChangeComplete(void)
{
    ODL_OBJENTER(); //####
    _panel.getOwner().moveEntityToEndOfForegroundList(this);
    _selected = _drawMoveMarker = false;
    // something to do??
    ODL_OBJEXIT(); //####
} // ServiceEntity::positionChangeComplete
void
ServiceEntity::handlePositionChange(void)
{
    ODL_OBJENTER(); //####
    // Here we re-adjust any lines attached to the entity.
    _panel.getOwner().movementStarted();
    _selected = _drawMoveMarker = true;
    ODL_OBJEXIT(); //####
} // ServiceEntity::handlePositionChange
Ejemplo n.º 7
0
nImO::DataKind
nImO::Array::getTypeTag
    (void)
    const
{
    ODL_OBJENTER(); //####
    DataKind    result = DataKind::OtherMessageExpectedOtherValue;

    ODL_OBJEXIT_I(static_cast<int>(result));
    return result;
} // nImO::Array::getTypeTag
void
ServiceEntity::setup(string      entityName,
                     const float xx,
                     const float yy)
{
    ODL_OBJENTER(); //####
    ODL_S1s("entityName = ", entityName); //####
    ODL_D2("xx = ", xx, "yy = ", yy); //####
    _panel.setup();
    _panel.setName(entityName);
    setPosition(xx, yy);
    _panel.setTracker(this);
    ODL_OBJEXIT(); //####
} // ServiceEntity::setup
bool
ServiceEntity::hasPort(const PortEntry * aPort)
{
    ODL_OBJENTER(); //####
    bool result = false;
    
    for (int ii = 0, mm = _panel.getNumPorts(); mm > ii; ++ii)
    {
        PortEntry * anEntry = _panel.getPort(ii);
        
        if (aPort == anEntry)
        {
            result = true;
            break;
        }
        
    }
    ODL_OBJEXIT_B(result); //####
    return result;
} // ServiceEntity::hasPort
Ejemplo n.º 10
0
bool
nImO::Array::deeplyEqualTo
    (const nImO::Value &    other)
    const
{
    ODL_OBJENTER(); //####
    ODL_P1("other = ", &other); //####
    bool    result = (&other == this);

    if (! result)
    {
        const Array *   otherPtr = other.asArray();

        if (otherPtr && (size() == otherPtr->size()))
        {
            const_iterator  thisWalker(inherited2::begin());
            const_iterator  otherWalker(otherPtr->inherited2::begin());

            for (result = true; result && (thisWalker != inherited2::end()); ++thisWalker, ++otherWalker)
            {
                SpValue thisValue(*thisWalker);
                SpValue otherValue(*otherWalker);

                if ((nullptr != thisValue) && (nullptr != otherValue))
                {
                    result = thisValue->deeplyEqualTo(*otherValue);
                }
                else
                {
                    result = false;
                }
            }
        }
    }
    ODL_OBJEXIT_B(result); //####
    return result;
} // nImO::Array::deeplyEqualTo
MovementTracker::~MovementTracker(void)
{
    ODL_OBJENTER(); //####
    ODL_OBJEXIT(); //####
} // MovementTracker::~MovementTracker
ServiceEntity::~ServiceEntity(void)
{
    ODL_OBJENTER(); //####
    ODL_OBJEXIT(); //####
} // ServiceEntity::~ServiceEntity
void
ServiceEntity::draw(void)
{
    ODL_OBJENTER(); //####
    ServiceViewerApp & owner = _panel.getOwner();
    
    _panel.draw();
    if (_drawConnectMarker)
    {
        ofPoint markerPos(_panel.getWidth() / 2, _panel.getHeader());
        
        ofSetColor(ServiceViewerApp::getMarkerColor());
        ofFill();
        ofCircle(markerPos + getShape().getTopLeft(), kMarkerSide / 2);
    }
    else if (_drawDisconnectMarker)
    {
        ofPoint markerPos(_panel.getWidth() / 2, _panel.getHeader());
        
        ofSetColor(ServiceViewerApp::getMarkerColor());
        ofNoFill();
        ofSetLineWidth(2);
        ofCircle(markerPos + getShape().getTopLeft(), kMarkerSide / 2);
    }
    else if (_drawMoveMarker)
    {
        ofPoint markerPos(_panel.getWidth() / 2, _panel.getHeader());
        
        ofSetColor(ServiceViewerApp::getMarkerColor());
        ofFill();
        markerPos += getShape().getTopLeft() - ofPoint(kMarkerSide / 2, kMarkerSide / 2);
        ofRect(markerPos, kMarkerSide, kMarkerSide);
    }
    for (int ii = 0, mm = _panel.getNumPorts(); mm > ii; ++ii)
    {
        PortEntry * anEntry = _panel.getPort(ii);
        
        if (anEntry)
        {
            ofPoint                        aCentre(anEntry->getCentre());
            const PortEntry::Connections & connex = anEntry->getOutputConnections();
            
            for (PortEntry::Connections::const_iterator walker(connex.begin());
                 connex.end() != walker; ++walker)
            {
                PortEntry::AnchorSide       anchorHere;
                PortEntry::AnchorSide       anchorThere;
                MplusM::Common::ChannelMode mode = walker->_connectionMode;
                PortEntry *                 otherEntry = walker->_otherPort;
                ofPoint                     otherCentre(otherEntry->getCentre());
                ofPoint                     fromHere;
                ofPoint                     toThere;
                
                // Check if the destination is above the source, in which case we
                // determine the anchors in the reverse order.
                if (aCentre.y < otherCentre.y)
                {
                    anchorHere = anEntry->calculateClosestAnchor(fromHere, true, false,
                                                                 otherCentre);
                    anchorThere = otherEntry->calculateClosestAnchor(toThere, false,
                                                     PortEntry::kAnchorBottomCentre == anchorHere,
                                                                     aCentre);
                }
                else
                {
                    anchorThere = otherEntry->calculateClosestAnchor(toThere, false, false,
                                                                     aCentre);
                    anchorHere = anEntry->calculateClosestAnchor(fromHere, true,
                                                     PortEntry::kAnchorBottomCentre == anchorThere,
                                                                 otherCentre);
                }
                if (otherEntry->isService())
                {
                    ofSetLineWidth(owner.getServiceConnectionWidth());
                }
                else if (otherEntry->isInputOutput())
                {
                    ofSetLineWidth(owner.getInputOutputConnectionWidth());
                }
                else
                {
                    ofSetLineWidth(owner.getNormalConnectionWidth());
                }
                switch (mode)
                {
                    case MplusM::Common::kChannelModeTCP :
                        ofSetColor(ServiceViewerApp::getTcpConnectionColor());
                        break;
                        
                    case MplusM::Common::kChannelModeUDP :
                        ofSetColor(ServiceViewerApp::getUdpConnectionColor());
                        break;
                        
                    default :
                        ofSetColor(ServiceViewerApp::getOtherConnectionColor());
                        break;
                        
                }
                DrawBezier(fromHere, toThere, aCentre, otherCentre);
                ofSetLineWidth(1);
                PortEntry::drawSourceAnchor(anchorHere, fromHere);
                PortEntry::drawTargetAnchor(anchorThere, toThere);
            }
        }
    }
    ODL_OBJEXIT(); //####
} // ServiceEntity::draw