Пример #1
0
void ValueImpl::initList(const List& fl)
{
    for (List::const_iterator iter = fl.begin();
         iter != fl.end(); iter++) {
        const FieldValue& fvalue(*iter->get());
        uint8_t amqType = fvalue.getType();

        if (amqType == 0x32) {
            Value* subval(new Value(TYPE_UINT64));
            subval->setUint64(fvalue.get<int64_t>());
            appendToList(subval);
        } else if ((amqType & 0xCF) == 0x02) {
            Value* subval(new Value(TYPE_UINT32));
            switch (amqType) {
            case 0x02 : subval->setUint(fvalue.get<int>()); break; // uint8
            case 0x12 : subval->setUint(fvalue.get<int>()); break; // uint16
            case 0x22 : subval->setUint(fvalue.get<int>()); break; // uint32
            }
            appendToList(subval);
        } else if (amqType == 0x31) {   // int64
            Value* subval(new Value(TYPE_INT64));
            subval->setInt64(fvalue.get<int64_t>());
            appendToList(subval);
        } else if ((amqType & 0xCF) == 0x01) {  // 0x01:int8, 0x11:int16, 0x21:int32
            Value* subval(new Value(TYPE_INT32));
            subval->setInt((int32_t)fvalue.get<int>());
            appendToList(subval);
        } else if (amqType == 0x85 || amqType == 0x95) {
            Value* subval(new Value(TYPE_LSTR));
            subval->setString(fvalue.get<string>().c_str());
            appendToList(subval);
        } else if (amqType == 0x23 || amqType == 0x33) {
            Value* subval(new Value(TYPE_DOUBLE));
            subval->setDouble(fvalue.get<double>());
            appendToList(subval);
        } else if (amqType == 0xa8) {
            FieldTable subFt;
            bool valid = qpid::framing::getEncodedValue<FieldTable>(*iter, subFt);
            if (valid) {
                Value* subval(new Value(TYPE_MAP));
                subval->impl->initMap(subFt);
                appendToList(subval);
            }
        } else if (amqType == 0xa9) {
            List subList;
            bool valid = qpid::framing::getEncodedValue<List>(*iter, subList);
            if (valid) {
                Value *subVal(new Value(TYPE_LIST));
                subVal->impl->initList(subList);
                appendToList(subVal);
            }
        } else if (amqType == 0x08) {
            Value* subval(new Value(TYPE_BOOL));
            subval->setBool(fvalue.get<int>() ? true : false);
            appendToList(subval);
        } else {
            QPID_LOG(error, "Unable to decode unsupported AMQP typecode =" << amqType);
        }
    }
}
Пример #2
0
    void connectPeerEndpoints (std::vector <IPAddress> const& list)
    {
        typedef std::vector <IPAddress> List;

        for (List::const_iterator iter (list.begin());
            iter != list.end(); ++iter)
            peerConnect (iter->withPort (0), iter->port());
    }
Пример #3
0
 Factory* find (std::string const& name) const
 {
     for (List::const_iterator iter (m_list.begin ());
         iter != m_list.end (); ++iter)
         if ((*iter)->getName().compareIgnoreCase (name) == 0)
             return iter->get();
     return nullptr;
 }
Пример #4
0
docstring BranchList::getFileNameSuffix() const
{
	docstring result;
	List::const_iterator it = list.begin();
	for (; it != list.end(); ++it) {
		if (it->isSelected() && it->hasFileNameSuffix())
			result += "-" + it->branch();
	}
	return support::subst(result, from_ascii("/"), from_ascii("_"));
}
int ReportVisualSensorCapabilities::WriteMessageBody(Packet& packet) const
{
    unsigned int startPos = packet.GetWritePos();
    UShort count = (UShort)mSensorList.size();
    List::const_iterator sensor = mSensorList.begin();
    packet.Write(count);
    while(sensor != mSensorList.end())
    {
        sensor->WriteMessageBody(packet);
        sensor++;
    }
    return packet.GetWritePos() - startPos;
}
void SetAnalogVideoSensorConfigurations::PrintMessageBody() const
{
    std::cout << "Sensor Count: " << mSensorList.size() << std::endl;
    UShort count = (UShort)mSensorList.size();
    List::const_iterator sensor = mSensorList.begin();
    while(sensor != mSensorList.end())
    {
        std::cout << "<Sensor>" <<  std::endl;
        sensor->PrintSensorFields();
        std::cout << "</Sensor>" <<  std::endl;
        sensor++;
    }
}
void QueryRangeSensorCapabilities::PrintMessageBody() const
{
    std::cout << "Sensor Count: " << mSensorList.size() << std::endl;
    UShort count = (UShort)mSensorList.size();
    List::const_iterator sensor = mSensorList.begin();
    while(sensor != mSensorList.end())
    {
        std::cout << "<Sensor>" <<  std::endl;
        sensor->PrintSensorFields();
        std::cout << "</Sensor>" <<  std::endl;
        sensor++;
    }
}
Пример #8
0
void
triggers::print (const std::string & seqname) const
{
    printf("sequence '%s' triggers:\n", seqname.c_str());
    for (List::const_iterator i = m_triggers.begin(); i != m_triggers.end(); ++i)
    {
        printf
        (
            "  tick_start = %ld; tick_end = %ld; offset = %ld; selected = %s\n",
            i->tick_start(), i->tick_end(), i->offset(),
            bool_string(i->selected())
        );
    }
}
int QueryStillImageSensorConfigurations::WriteMessageBody(Packet& packet) const
{
    UInt startPos = packet.GetWritePos();
    UShort count = (UShort)mSensorList.size();
    List::const_iterator stillImageSensorConfigurations = mSensorList.begin();
    packet.Write(count);
    while(stillImageSensorConfigurations != mSensorList.end())
    {
        packet.Write(stillImageSensorConfigurations->GetSensorId());          //required
        packet.Write(stillImageSensorConfigurations->GetPresenceVector());    //required
        stillImageSensorConfigurations++;
    }

    return packet.GetWritePos() - startPos;
}
int QueryRangeSensorCapabilities::WriteMessageBody(Packet& packet) const
{
    UInt startPos = packet.GetWritePos();
    UShort count = (UShort)mSensorList.size();
    List::const_iterator sensor = mSensorList.begin();
    packet.Write(count);
    while(sensor != mSensorList.end())
    {
        packet.Write(sensor->GetSensorId());           //required
        packet.Write(sensor->GetPresenceVector());     //required
        sensor++;
    }

    return packet.GetWritePos() - startPos;
}
int SetAnalogVideoSensorConfigurations::WriteMessageBody(Packet& packet) const
{
    UInt startPos = packet.GetWritePos();
    Byte requestId = mRequestId;
    UShort count = (UShort)mSensorList.size();
    List::const_iterator sensor = mSensorList.begin();
    packet.Write(requestId);
    packet.Write(count);
    while(sensor != mSensorList.end())
    {
        sensor->WriteMessageBody(packet);
        sensor++;
    }
    return packet.GetWritePos() - startPos;
}
int QueryVisualSensorConfigurations::WriteMessageBody(Packet& packet) const
{
    UInt startPos = packet.GetWritePos();
    UShort count = (UShort)mSensorList.size();
    List::const_iterator visualSensorConfiguration = mSensorList.begin();
    packet.Write(count);
    while(visualSensorConfiguration != mSensorList.end())
    {
        packet.Write(visualSensorConfiguration->GetSensorID());           //required
        packet.Write(visualSensorConfiguration->GetPresenceVector());     //required
        visualSensorConfiguration++;
    }

    return packet.GetWritePos() - startPos;
}
bool ReportVisualSensorCapabilities::IsLargeDataSet(const UInt maxPayloadSize) const
{
    //Quick Check to possibly avoid the time consuming loop (assume worst case of all fields supported)
    if(maxPayloadSize > (BYTE_SIZE * 10 + USHORT_SIZE * 6 + UINT_SIZE * 2) * mSensorList.size())
    {
        return false;
    }

    UInt currentSize = 0;
    List::const_iterator iter = mSensorList.begin();
    while(iter != mSensorList.end())
    {
        currentSize += iter->GetSize();        
        iter++;
    }
    
    return currentSize > maxPayloadSize;
}
Пример #14
0
std::ostream & OptionChecker::str_s(std::ostream & os) const
{
    os << this->checker_name() << '(';
    str_type sep = "";
    if(! this->_options.empty())
    {
        List::const_iterator i = this->_options.begin();
        os << i->grepr(ReprType::CONFIGSPEC);
        sep = ", ";
        while(++i != this->_options.end())
        {
            os << sep << i->grepr(ReprType::CONFIGSPEC);
        }
    }
    if(this->_has_default)
    {
        os << sep << "default=";
        this->_default.grepr_s(os, ReprType::CONFIGSPEC);
    }
    os << ')';
    return os;
}
Пример #15
0
FontSize FontList::highestInRange(pos_type startpos, pos_type endpos,
	FontSize def_size) const
{
	if (list_.empty())
		return def_size;

	List::const_iterator end_it = fontIterator(endpos);
	const_iterator const end = list_.end();
	if (end_it != end)
		++end_it;

	List::const_iterator cit = fontIterator(startpos);

	FontSize maxsize = FONT_SIZE_TINY;
	for (; cit != end_it; ++cit) {
		FontSize size = cit->font().fontInfo().size();
		if (size == FONT_SIZE_INHERIT)
			size = def_size;
		if (size > maxsize && size <= FONT_SIZE_HUGER)
			maxsize = size;
	}
	return maxsize;
}
Пример #16
0
    //---------------------------------------------------------------
    void InputList::add() const
    {
        // write inputs
        for ( List::const_iterator it = mList.begin(); it != mList.end(); ++it )
        {
            mSW->openElement ( CSWC::CSW_ELEMENT_INPUT );
            mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_SEMANTIC, getSemanticString ( it->getSemantic() ) );
            mSW->appendURIAttribute ( CSWC::CSW_ATTRIBUTE_SOURCE, it->getSource() );

            if ( it->getOffset() >= 0 )
                mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_OFFSET, ( unsigned long ) it->getOffset() );

            if ( it->getSet() >= 0 )
                mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_SET, ( unsigned long ) it->getSet() );

            mSW->closeElement();
        }
    }
Пример #17
0
bool FontList::hasChangeInRange(pos_type pos, int len) const
{
	List::const_iterator cit = fontIterator(pos);
	return cit == list_.end() || pos + len - 1 <= cit->pos();
}