void
    QualityOfServiceData::ReadParameters()
    {
        ReadDistributionChannels();
        if (!IsStandalone())
        {
            ReadDistributionChannelAliases();
            ReadPriorities();
            ReadPriorityAliases();
        }

    }
    void
    QualityOfServiceData::ReadDistributionChannelAliases()
    {
        if (IsStandalone())
        {
            return;
        }

        NameIdTable aliases;
        try
        {
            for (int ix = 0; ix < Dob::DistributionChannelAliases::AliasesArraySize(); ++ix)
            {
                Dob::AliasPtr aliasItem = Dob::DistributionChannelAliases::Aliases(ix);
                const std::wstring alias = aliasItem->AliasName().GetVal();
                const std::wstring channelName = aliasItem->RealName().GetVal();

                //check that the alias name doesnt conflict with a real channel
                if (alias.empty() || m_DistributionChannelNameTable.find(alias) != m_DistributionChannelNameTable.end())
                {
                    throw Safir::Dob::Typesystem::SoftwareViolationException(L"Illegal alias name",__WFILE__,__LINE__);
                }

                if (channelName.empty())
                {
                    throw Safir::Dob::Typesystem::SoftwareViolationException(L"Illegal distribution channel name in alias",__WFILE__,__LINE__);
                }

                //find the channel that the alias points to
                NameIdTable::iterator theChannel = m_DistributionChannelNameTable.find(channelName);

                //did it exist?
                if (theChannel == m_DistributionChannelNameTable.end())
                {
                    throw Safir::Dob::Typesystem::SoftwareViolationException(L"Illegal channel name in alias",__WFILE__,__LINE__);
                }
                if (theChannel->second == POOL_DISTRIBUTION_CHANNEL)
                {
                    throw Safir::Dob::Typesystem::SoftwareViolationException(L"No alias may point to PoolDistribution channel!",__WFILE__,__LINE__);
                }
                aliases.insert(std::make_pair(alias,theChannel->second));
            }
        }
        catch (const Dob::Typesystem::FundamentalException &)
        {
            std::wcout << "Failed to read QoS channel parameters" <<std::endl;
            throw Safir::Dob::Typesystem::SoftwareViolationException(L"QoS failure",__WFILE__,__LINE__);
        }

        //merge the aliases with the channel
        m_DistributionChannelNameTable.insert(aliases.begin(),aliases.end());
    }
Ejemplo n.º 3
0
bool BadWords::IsMatch(const char *input, const MatchEntry& entry) {
    // Can't have more wildcard replacements than not
    if (entry.wildcard_replacements >= entry.char_count) {
        return false;
    }

    // Check for standalone if asked
    if (entry.standalone && !IsStandalone(input, entry.start, entry.end)) {
        return false;
    }

    // Don't allow spaces in matches that have wildcards of either type
    // (filler or replacement)
    if (entry.wildcard_count != 0 && entry.last_space >= entry.start &&
            entry.last_space <= entry.end) {
        return false;
    }
    return true;
}
    bool
    QualityOfServiceData::IsNodeInDistributionChannel(const Dob::Typesystem::TypeId typeId, const NodeNumber node) const
    {
        if (IsStandalone())
        {
            return false;
        }

        QoSTable::const_iterator result = m_QoSTable.find(typeId);
        if (result == m_QoSTable.end())
        {
            throw Dob::Typesystem::SoftwareViolationException
                                (L"TypeId was not found in the QoS tables.",__WFILE__,__LINE__);
        }

        if (result->second.distributionChannel == LOCAL_DISTRIBUTION_CHANNEL)
        {
            return false;
        }

        boost::uint64_t mask = 1;
        mask <<= node;
        return (GetDistributionChannelTable().find(result->second.distributionChannel)->second.includedNodes & mask) != 0;
    }
    void
    QualityOfServiceData::Init()
    {
        ReadParameters();

        if (!IsStandalone())
        {
            Dob::Typesystem::TypeIdVector typeIds = Safir::Dob::Typesystem::Operations::GetAllTypeIds();

            for (Dob::Typesystem::TypeIdVector::iterator it = typeIds.begin();
                 it != typeIds.end();
                 ++it)
            {
                if (Dob::Typesystem::Operations::IsOfType(*it,Safir::Dob::Entity::ClassTypeId) ||
                    Dob::Typesystem::Operations::IsOfType(*it,Safir::Dob::Service::ClassTypeId) ||
                    Dob::Typesystem::Operations::IsOfType(*it,Safir::Dob::Message::ClassTypeId) ||
                    Dob::Typesystem::Operations::IsOfType(*it,Safir::Dob::Response::ClassTypeId))
                {
                    m_QoSTable.insert(QoSTable::value_type(*it,QoSData(GetDistributionChannel(*it),
                        GetPriority(*it))));
                }
            }
        }
    }
Ejemplo n.º 6
0
bool wxScrollBar::PerformAction(const wxControlAction& action,
                                long numArg,
                                const wxString& strArg)
{
    int thumbOld = m_thumbPos;

    bool notify = false; // send an event about the change?

    wxEventType scrollType;

    // test for thumb move first as these events happen in quick succession
    if ( action == wxACTION_SCROLL_THUMB_MOVE )
    {
        DoSetThumb(numArg);

        // VS: we have to force redraw here, otherwise the thumb will lack
        //     behind mouse cursor
        UpdateThumb();

        scrollType = wxEVT_SCROLLWIN_THUMBTRACK;
    }
    else if ( action == wxACTION_SCROLL_LINE_UP )
    {
        scrollType = wxEVT_SCROLLWIN_LINEUP;
        ScrollLines(-1);
    }
    else if ( action == wxACTION_SCROLL_LINE_DOWN )
    {
        scrollType = wxEVT_SCROLLWIN_LINEDOWN;
        ScrollLines(1);
    }
    else if ( action == wxACTION_SCROLL_PAGE_UP )
    {
        scrollType = wxEVT_SCROLLWIN_PAGEUP;
        ScrollPages(-1);
    }
    else if ( action == wxACTION_SCROLL_PAGE_DOWN )
    {
        scrollType = wxEVT_SCROLLWIN_PAGEDOWN;
        ScrollPages(1);
    }
    else if ( action == wxACTION_SCROLL_START )
    {
        scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better?
        ScrollToStart();
    }
    else if ( action == wxACTION_SCROLL_END )
    {
        scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better?
        ScrollToEnd();
    }
    else if ( action == wxACTION_SCROLL_THUMB_DRAG )
    {
        // we won't use it but this line suppresses the compiler
        // warning about "variable may be used without having been
        // initialized"
        scrollType = wxEVT_NULL;
    }
    else if ( action == wxACTION_SCROLL_THUMB_RELEASE )
    {
        // always notify about this
        notify = true;
        scrollType = wxEVT_SCROLLWIN_THUMBRELEASE;
    }
    else
        return wxControl::PerformAction(action, numArg, strArg);

    // has scrollbar position changed?
    bool changed = m_thumbPos != thumbOld;
    if ( notify || changed )
    {
        if ( IsStandalone() )
        {
            // we should generate EVT_SCROLL events for the standalone
            // scrollbars and not the EVT_SCROLLWIN ones
            //
            // NB: we assume that scrollbar events are sequentially numbered
            //     but this should be ok as other code relies on this as well
            scrollType += wxEVT_SCROLL_TOP - wxEVT_SCROLLWIN_TOP;
            wxScrollEvent event(scrollType, this->GetId(), m_thumbPos,
                                IsVertical() ? wxVERTICAL : wxHORIZONTAL);
            event.SetEventObject(this);
            GetEventHandler()->ProcessEvent(event);
        }
        else // part of the window
        {
            wxScrollWinEvent event(scrollType, m_thumbPos,
                                   IsVertical() ? wxVERTICAL : wxHORIZONTAL);
            event.SetEventObject(this);
            GetParent()->GetEventHandler()->ProcessEvent(event);
        }
    }

    return true;
}
Ejemplo n.º 7
0
bool wxScrollBar::AcceptsFocus() const
{
    // the window scrollbars never accept focus
    return wxScrollBarBase::AcceptsFocus() && IsStandalone();
}