本文整理汇总了C++中IndexedIOPtr类的典型用法代码示例。如果您正苦于以下问题:C++ IndexedIOPtr类的具体用法?C++ IndexedIOPtr怎么用?C++ IndexedIOPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IndexedIOPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: staticTypeName
void Shader::save( SaveContext *context ) const
{
StateRenderable::save( context );
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
container->write( g_nameEntry, m_name );
container->write( g_typeEntry, m_type );
context->save( m_parameters.get(), container.get(), g_parametersEntry );
}
示例3:
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;
}
示例4: staticTypeName
void TypedData< TimePeriod >::save( SaveContext *context ) const
{
Data::save( context );
IndexedIOPtr container = context->container( staticTypeName(), 0 );
container->write( g_beginEntry, boost::posix_time::to_iso_string( readable().begin() ) );
container->write( g_endEntry, boost::posix_time::to_iso_string( readable().end() ) );
}
示例5: contains
bool AttributeCache::contains( const ObjectHandle &obj, const AttributeHandle &attr )
{
IndexedIOPtr object = m_objectsIO->subdirectory( obj, IndexedIO::NullIfMissing );
if ( !object )
{
return false;
}
return object->hasEntry(attr);
}
示例6: staticTypeName
void Display::save( SaveContext *context ) const
{
PreWorldRenderable::save( context );
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
container->write( g_nameEntry, m_name );
container->write( g_typeEntry, m_type );
container->write( g_dataEntry, m_data );
context->save( m_parameters.get(), container.get(), g_parametersEntry );
}
示例7: staticTypeName
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 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 );
}
示例9: CompoundObject
CompoundObjectPtr AttributeCache::read( const ObjectHandle &obj )
{
CompoundObjectPtr dict = new CompoundObject();
IndexedIO::EntryIDList directories;
IndexedIOPtr object = m_objectsIO->subdirectory( obj );
object->entryIds( directories, IndexedIO::Directory );
for (IndexedIO::EntryIDList::const_iterator it = directories.begin(); it != directories.end(); ++it)
{
ObjectPtr data = Object::load( object, *it );
dict->members()[ *it ] = data;
}
return dict;
}
示例10: assert
void ImagePrimitive::save(IECore::Object::SaveContext *context) const
{
assert( context );
Primitive::save(context);
IndexedIOPtr container = context->container(staticTypeName(), m_ioVersion);
container->write(g_displayWindowMinXEntry, m_displayWindow.min.x);
container->write(g_displayWindowMinYEntry, m_displayWindow.min.y);
container->write(g_displayWindowMaxXEntry, m_displayWindow.max.x);
container->write(g_displayWindowMaxYEntry, m_displayWindow.max.y);
container->write(g_dataWindowMinXEntry, m_dataWindow.min.x);
container->write(g_dataWindowMinYEntry, m_dataWindow.min.y);
container->write(g_dataWindowMaxXEntry, m_dataWindow.max.x);
container->write(g_dataWindowMaxYEntry, m_dataWindow.max.y);
}
示例11: staticTypeName
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++;
}
}
示例12: staticTypeName
void PathMatcherData::save( SaveContext *context ) const
{
Data::save( context );
IndexedIOPtr container = context->container( staticTypeName(), g_ioVersion );
std::vector<InternedString> strings;
std::vector<unsigned int> pathLengths;
std::vector<unsigned char> exactMatches;
for( PathMatcher::RawIterator it = readable().begin(), eIt = readable().end(); it != eIt; ++it )
{
pathLengths.push_back( it->size() );
if( it->size() )
{
strings.push_back( it->back() );
}
exactMatches.push_back( it.exactMatch() );
}
container->write( "strings", strings.data(), strings.size() );
container->write( "pathLengths", pathLengths.data(), pathLengths.size() );
container->write( "exactMatches", exactMatches.data(), exactMatches.size() );
}
示例13: staticTypeName
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 );
}
}
示例14: staticTypeName
void SmoothSkinningData::save( IECore::Object::SaveContext *context ) const
{
Data::save(context);
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
context->save( m_influenceNames.get(), container.get(), g_influenceNamesEntry );
context->save( m_influencePose.get(), container.get(), g_influencePoseEntry );
context->save( m_pointIndexOffsets.get(), container.get(), g_pointIndexOffsetsEntry );
context->save( m_pointInfluenceCounts.get(), container.get(), g_pointInfluenceCountsEntry );
context->save( m_pointInfluenceIndices.get(), container.get(), g_pointInfluenceIndicesEntry );
context->save( m_pointInfluenceWeights.get(), container.get(), g_pointInfluenceWeightsEntry );
}
示例15: staticTypeName
void CurvesPrimitive::save( IECore::Object::SaveContext *context ) const
{
Primitive::save(context);
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
container->write( g_basisMatrixEntry, m_basis.matrix.getValue(), 16 );
container->write( g_basisStepEntry, m_basis.step );
int p = m_periodic;
container->write( g_periodicEntry, p );
context->save( m_vertsPerCurve.get(), container.get(), g_verticesPerCurveEntry );
// we could recompute these on loading, but it'd take a while and the overhead
// of storing them isn't great.
container->write( g_numVertsEntry, m_numVerts );
container->write( g_numFaceVaryingEntry, m_numFaceVarying );
}