本文整理汇总了C++中JPType::setArrayRange方法的典型用法代码示例。如果您正苦于以下问题:C++ JPType::setArrayRange方法的具体用法?C++ JPType::setArrayRange怎么用?C++ JPType::setArrayRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPType
的用法示例。
在下文中一共展示了JPType::setArrayRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setRange
void JPArray::setRange(int start, int stop, vector<HostRef*>& val)
{
JPCleaner cleaner;
JPType* compType = m_Class->getComponentType();
if(stop < start)
{
std::stringstream out;
out << "Slice start (" << start << ") is greater than stop ("
<< stop << ")";
RAISE(JPypeException, out.str());
}
unsigned int len = stop-start;
size_t plength = val.size();
if (len != plength)
{
std::stringstream out;
out << "Slice assignment must be of equal lengths : " << len << " != " << plength;
RAISE(JPypeException, out.str());
}
for (size_t i = 0; i < plength; i++)
{
HostRef* v = val[i];
if ( compType->canConvertToJava(v)<= _explicit)
{
RAISE(JPypeException, "Unable to convert.");
}
}
compType->setArrayRange(m_Object, start, stop-start, val);
}
示例2: setRange
void JPArray::setRange(int start, int stop, PyObject* sequence)
{
JPType* compType = m_Class->getComponentType();
unsigned int len = stop-start;
// check bounds of sequence which is to be assigned
HostRef* ptr = new HostRef(sequence);
unsigned int plength = JPEnv::getHost()->getSequenceLength(ptr);
delete ptr;
if (len != plength)
{
std::stringstream out;
out << "Slice assignment must be of equal lengths : " << len << " != " << plength;
RAISE(JPypeException, out.str());
}
compType->setArrayRange(m_Object, start, len, sequence);
}