本文整理汇总了C++中IndexedIOPtr::subdirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ IndexedIOPtr::subdirectory方法的具体用法?C++ IndexedIOPtr::subdirectory怎么用?C++ IndexedIOPtr::subdirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IndexedIOPtr
的用法示例。
在下文中一共展示了IndexedIOPtr::subdirectory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
AttributeCache::AttributeCache( const std::string &filename, IndexedIO::OpenMode mode )
{
IndexedIOPtr io = IndexedIO::create(filename, IndexedIO::rootPath, mode );
if ( mode == IndexedIO::Write || mode == IndexedIO::Append )
{
m_headersIO = io->subdirectory("headers", IndexedIO::CreateIfMissing );
m_objectsIO = io->subdirectory("objects", IndexedIO::CreateIfMissing );
CompoundObjectPtr header = HeaderGenerator::header();
for ( CompoundObject::ObjectMap::const_iterator it = header->members().begin(); it != header->members().end(); it++ )
{
writeHeader( it->first, it->second.get() );
}
}
if ( mode == IndexedIO::Read )
{
try
{
m_headersIO = io->subdirectory("headers");
m_objectsIO = io->subdirectory("objects");
}
catch (IECore::Exception &e)
{
throw Exception("Not an AttributeCache file.");
}
}
}
示例2: save
void save( IECore::Object::SaveContext *context ) const
{
IndexedIOPtr container = context->container( ShaderNetwork::staticTypeName(), g_ioVersion );
IndexedIOPtr shaders = container->subdirectory( "shaders", IndexedIO::CreateIfMissing );
IndexedIOPtr connections = container->subdirectory( "connections", IndexedIO::CreateIfMissing );
int connectionIndex = 0;
for( const Node &node : m_nodes )
{
context->save( node.shader.get(), shaders.get(), node.handle );
for( const Connection &connection : node.inputConnections )
{
InternedString c[4] = {
connection.source.shader,
connection.source.name,
connection.destination.shader,
connection.destination.name
};
connections->write(
std::to_string( connectionIndex ),
c, 4
);
connectionIndex++;
}
}
InternedString o[2] = { m_output.shader, m_output.name };
container->write( "output", o, 2 );
}
示例3: save
void Primitive::save( IECore::Object::SaveContext *context ) const
{
VisibleRenderable::save( context );
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
IndexedIOPtr ioVariables = container->subdirectory( g_variablesEntry, IndexedIO::CreateIfMissing );
for( PrimitiveVariableMap::const_iterator it=variables.begin(); it!=variables.end(); it++ )
{
IndexedIOPtr ioPrimVar = ioVariables->subdirectory( it->first, IndexedIO::CreateIfMissing );
const int i = it->second.interpolation;
ioPrimVar->write( g_interpolationEntry, i );
context->save( it->second.data.get(), ioPrimVar.get(), g_dataEntry );
}
}
示例4: save
void MatrixMotionTransform::save( SaveContext *context ) const
{
Transform::save( context );
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
container = container->subdirectory( g_snapshotsEntry, IndexedIO::CreateIfMissing );
int i = 0;
for( SnapshotMap::const_iterator it=m_snapshots.begin(); it!=m_snapshots.end(); it++ )
{
string is = str( boost::format( "%d" ) % i );
IndexedIOPtr snapshotContainer = container->subdirectory( is, IndexedIO::CreateIfMissing );
snapshotContainer->write( g_timeEntry, it->first );
snapshotContainer->write( g_matrixEntry, it->second.getValue(), 16 );
i++;
}
}
示例5: save
void MotionPrimitive::save( IECore::Object::SaveContext *context ) const
{
VisibleRenderable::save( context );
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
IndexedIOPtr snapshots = container->subdirectory( g_snapshotsEntry, IndexedIO::CreateIfMissing );
int i = 0;
for( SnapshotMap::const_iterator it=m_snapshots.begin(); it!=m_snapshots.end(); it++ )
{
string is = str( boost::format( "%d" ) % i );
IndexedIOPtr snapshot = snapshots->subdirectory( is, IndexedIO::CreateIfMissing );
snapshot->write( g_timeEntry, it->first );
context->save( it->second, snapshot, g_primitiveEntry );
i++;
}
}
示例6:
IndexedIOPtr Object::SaveContext::container( const std::string &typeName, unsigned int ioVersion )
{
IndexedIOPtr typeIO = m_ioInterface->subdirectory( typeName, IndexedIO::CreateIfMissing );
typeIO->write( g_ioVersionEntry, ioVersion );
IndexedIOPtr dataIO = typeIO->subdirectory( g_dataEntry, IndexedIO::CreateIfMissing );
dataIO->removeAll();
return dataIO;
}
示例7: save
void CompoundDataBase::save( SaveContext *context ) const
{
Data::save( context );
IndexedIOPtr container = context->container( staticTypeName(), 0 );
container = container->subdirectory( g_membersEntry, IndexedIO::CreateIfMissing );
const CompoundDataMap &m = readable();
CompoundDataMap::const_iterator it;
for( it=m.begin(); it!=m.end(); it++ )
{
context->save( it->second.get(), container.get(), it->first );
}
}
示例8: save
void ObjectVector::save( SaveContext *context ) const
{
Object::save( context );
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
unsigned int size = m_members.size();
container->write( g_sizeEntry, size );
IndexedIOPtr ioMembers = container->subdirectory( g_membersEntry, IndexedIO::CreateIfMissing );
unsigned i=0;
for( MemberContainer::const_iterator it=m_members.begin(); it!=m_members.end(); it++ )
{
if( *it )
{
std::string name = str( boost::format( "%d" ) % i );
context->save( *it, ioMembers, name );
}
i++;
}
}