42namespace ALEMBIC_VERSION_NS {
44class IGroup::PrivateData
47 PrivateData(IStreamsPtr iStreams)
58 std::vector<Alembic::Util::uint64_t> childVec;
60 Alembic::Util::uint64_t numChildren;
61 Alembic::Util::uint64_t pos;
64IGroup::IGroup(IStreamsPtr iStreams,
65 Alembic::Util::uint64_t iPos,
67 std::size_t iThreadIndex) :
68 mData(new IGroup::PrivateData(iStreams))
71 if (iPos == EMPTY_GROUP || !mData->streams || !mData->streams->isValid())
77 mData->streams->read(iThreadIndex, iPos, 8, &mData->numChildren);
84 if (!iLight || mData->numChildren < 9)
86 mData->childVec.resize(mData->numChildren);
87 mData->streams->read(iThreadIndex, iPos + 8, mData->numChildren * 8,
88 &(mData->childVec.front()));
97IGroupPtr IGroup::getGroup(Alembic::Util::uint64_t iIndex,
bool iLight,
98 std::size_t iThreadIndex)
103 if (iIndex < mData->numChildren)
105 Alembic::Util::uint64_t childPos = 0;
106 mData->streams->read(iThreadIndex, mData->pos + 8 * iIndex + 8, 8,
110 if ((childPos & EMPTY_DATA) == 0)
112 child.reset(
new IGroup(mData->streams, childPos, iLight,
117 else if (isChildGroup(iIndex))
119 child.reset(
new IGroup(mData->streams, mData->childVec[iIndex], iLight,
125IDataPtr IGroup::getData(Alembic::Util::uint64_t iIndex,
126 std::size_t iThreadIndex)
131 if (iIndex < mData->numChildren)
133 Alembic::Util::uint64_t childPos = 0;
134 mData->streams->read(iThreadIndex, mData->pos + 8 * iIndex + 8, 8,
138 if ((childPos & EMPTY_DATA) != 0)
140 child.reset(
new IData(mData->streams, childPos, iThreadIndex));
144 else if (isChildData(iIndex))
146 child.reset(
new IData(mData->streams, mData->childVec[iIndex],
152Alembic::Util::uint64_t IGroup::getNumChildren()
const
154 return mData->numChildren;
157bool IGroup::isChildGroup(Alembic::Util::uint64_t iIndex)
const
159 return (iIndex < mData->childVec.size() &&
160 (mData->childVec[iIndex] & EMPTY_DATA) == 0);
163bool IGroup::isChildData(Alembic::Util::uint64_t iIndex)
const
165 return (iIndex < mData->childVec.size() &&
166 (mData->childVec[iIndex] & EMPTY_DATA) != 0);
169bool IGroup::isEmptyChildGroup(Alembic::Util::uint64_t iIndex)
const
171 return (iIndex < mData->childVec.size() &&
172 mData->childVec[iIndex] == EMPTY_GROUP);
175bool IGroup::isEmptyChildData(Alembic::Util::uint64_t iIndex)
const
177 return (iIndex < mData->childVec.size() &&
178 mData->childVec[iIndex] == EMPTY_DATA);
181bool IGroup::isLight()
const
183 return mData->numChildren != 0 && mData->childVec.empty();