MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / getslice_string

Method getslice_string

src/python/PyImath/PyImathStringArray.cpp:101–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100template<class T>
101StringArrayT<T>*
102StringArrayT<T>::getslice_string(PyObject *index) const
103{
104 typedef boost::shared_array<StringTableIndex> StringTableIndexArrayPtr;
105 typedef boost::shared_ptr<StringTableT<T> > StringTablePtr;
106
107 BOOST_STATIC_ASSERT(boost::is_pod<StringTableIndex>::value);
108
109 size_t start=0, end=0, slicelength=0;
110 Py_ssize_t step;
111 extract_slice_indices(index,start,end,step,slicelength);
112
113 StringTableIndexArrayPtr indexArray(reinterpret_cast<StringTableIndex*>(new char[sizeof(StringTableIndex)*slicelength]));
114 StringTablePtr table(new StringTableT<T>);
115
116 for(size_t i=0; i<slicelength; ++i)
117 indexArray[i] = table->intern(getitem_string(start+i*step));
118
119 return new StringArrayT<T>(*table, indexArray.get(), slicelength, 1, indexArray, boost::any(table));
120}
121
122template<class T>
123StringArrayT<T>*

Callers

nothing calls this directly

Calls 3

extract_slice_indicesFunction · 0.85
internMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected