本文整理汇总了C++中Registry::NextEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ Registry::NextEntity方法的具体用法?C++ Registry::NextEntity怎么用?C++ Registry::NextEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::NextEntity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
// This has to be done before anything else. This initializes
// all of the registry information for the schema you are using.
// The SchemaInit() function is generated by exp2cxx... see
// extern statement above.
Registry * registry = new Registry( SchemaInit );
// The nifty thing about the Registry is that it basically keeps a list
// of everything in your schema. What this means is that we can go
// through the Registry and instantiate, say, one of everything, without
// knowing at coding-time what entities there are to instantiate. So,
// this test could be linked with other class libraries produced from
// other schema, rather than the example, and run happily.
InstMgr instance_list;
// Here's what's going to happen below: we're going to figure out
// how many different entities there are, instantiate one of each and
// keep an array of pointers to each. We'll stick some random data in
// them as we go. When we're done, we'll print out everything by walking
// the array, and then write out the STEPfile information to the screen.
// Figure outhow many entities there are, then allocate an array
// to store a pointer to one of each.
int num_ents = registry->GetEntityCnt();
STEPentity ** SEarray = new STEPentity*[num_ents];
// "Reset" the Schema and Entity hash tables... this sets things up
// so we can walk through the table using registry->NextEntity()
registry->ResetSchemas();
registry->ResetEntities();
// Print out what schema we're running through.
const SchemaDescriptor * schema = registry->NextSchema();
cout << "Entities in schema " << schema->Name() << ":\n";
// "Loop" through the schema, building one of each entity type.
const EntityDescriptor * ent; // needs to be declared const...
for ( int i = 0; i < num_ents; i++ ) {
ent = registry->NextEntity();
// Build object, using its name, through the registry
SEarray[i] = registry->ObjCreate( ent->Name() );
// Add each realized entity to the instance list
instance_list.Append( SEarray[i], completeSE );
// Put some data into each instance
PrintEntity( SEarray[i] );
}
// Print out all entities
SEarrIterator SEitr( ( const STEPentity ** ) SEarray, num_ents );
exit( 0 );
}