cleanup, inline some fcts
This commit is contained in:
@@ -12,10 +12,7 @@
|
||||
* and is not subject to copyright.
|
||||
*/
|
||||
|
||||
/* $Id: Registry.h,v 3.0.1.7 1997/11/05 21:59:19 sauderd DP3.1 $ */
|
||||
|
||||
#include <sdai.h>
|
||||
//#include <STEPentity.h>
|
||||
#include <errordesc.h>
|
||||
#include <scl_hash.h>
|
||||
#include <Str.h>
|
||||
@@ -52,7 +49,7 @@ class Registry {
|
||||
void DeleteContents (); // CAUTION: calls delete on all the descriptors
|
||||
|
||||
const EntityDescriptor* FindEntity (const char *, const char * =0,
|
||||
int check_case =0) const;
|
||||
int check_case =0) const;
|
||||
const Schema* FindSchema (const char *, int check_case =0) const;
|
||||
const TypeDescriptor* FindType (const char *, int check_case =0) const;
|
||||
|
||||
@@ -80,7 +77,7 @@ class Registry {
|
||||
void SetCompCollect( ComplexCollect *c ) { col = c; }
|
||||
|
||||
SCLP23(Application_instance)* ObjCreate (const char * nm, const char * =0,
|
||||
int check_case =0) const;
|
||||
int check_case =0) const;
|
||||
};
|
||||
|
||||
#endif /* _REGISTRY_H */
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
* and is not subject to copyright.
|
||||
*/
|
||||
|
||||
/* $Id: Registry.inline.cc,v 3.0.1.9 1997/11/05 21:59:19 sauderd DP3.1 $ */
|
||||
|
||||
#include <ExpDict.h>
|
||||
#include <Registry.h>
|
||||
|
||||
@@ -26,8 +24,6 @@ static int uniqueNames( const char *, const SchRename * );
|
||||
|
||||
Registry::Registry( CF_init initFunct )
|
||||
: col( 0 ), entity_cnt( 0 ), all_ents_cnt( 0 ) {
|
||||
// if(NilSTEPentity == 0)
|
||||
// NilSTEPentity = new SCLP23(Application_instance);
|
||||
|
||||
/* Registry tables aren't always initialized */
|
||||
HASHinitialize();
|
||||
@@ -64,15 +60,12 @@ Registry::Registry( CF_init initFunct )
|
||||
0, // Originating Schema
|
||||
"Number" );
|
||||
|
||||
/* t_GENERIC_TYPE = new TypeDescriptor("GENERIC", GENERIC_TYPE, "Generic");*/
|
||||
|
||||
initFunct( *this );
|
||||
HASHlistinit( active_types, &cur_type );
|
||||
HASHlistinit( primordialSwamp, &cur_entity ); // initialize cur\'s
|
||||
HASHlistinit( active_schemas, &cur_schema );
|
||||
}
|
||||
|
||||
/* inline */
|
||||
Registry::~Registry() {
|
||||
HASHdestroy( primordialSwamp );
|
||||
HASHdestroy( active_schemas );
|
||||
@@ -80,8 +73,7 @@ Registry::~Registry() {
|
||||
delete col;
|
||||
}
|
||||
|
||||
void
|
||||
Registry::DeleteContents() {
|
||||
void Registry::DeleteContents() {
|
||||
// entities first
|
||||
HASHlistinit( primordialSwamp, &cur_entity );
|
||||
while( HASHlist( &cur_entity ) ) {
|
||||
@@ -98,9 +90,7 @@ Registry::DeleteContents() {
|
||||
|
||||
}
|
||||
|
||||
/* inline */ const EntityDescriptor *
|
||||
Registry::FindEntity( const char * e, const char * schNm, int check_case ) const
|
||||
/*
|
||||
/**
|
||||
* schNm refers to the current schema. This will have a value if we are
|
||||
* reading from a Part 21 file (using a STEPfile object), and the file
|
||||
* declares a schema name in the File_Schema section of the Header. (If
|
||||
@@ -109,6 +99,7 @@ Registry::FindEntity( const char * e, const char * schNm, int check_case ) const
|
||||
* entity A from schema Y and renames it to B, X should only refer to A as
|
||||
* B. Thus, if schNm here = "X", only e="B" would be valid but not e="A".
|
||||
*/
|
||||
inline const EntityDescriptor * Registry::FindEntity( const char * e, const char * schNm, int check_case ) const
|
||||
{
|
||||
const EntityDescriptor * entd;
|
||||
const SchRename * altlist;
|
||||
@@ -149,8 +140,7 @@ Registry::FindEntity( const char * e, const char * schNm, int check_case ) const
|
||||
return entd;
|
||||
}
|
||||
|
||||
/* inline */ const Schema *
|
||||
Registry::FindSchema( const char * n, int check_case ) const {
|
||||
inline const Schema * Registry::FindSchema( const char * n, int check_case ) const {
|
||||
if( check_case ) {
|
||||
return ( const Schema * ) HASHfind( active_schemas, ( char * ) n );
|
||||
}
|
||||
@@ -159,8 +149,7 @@ Registry::FindSchema( const char * n, int check_case ) const {
|
||||
( char * )PrettyTmpName( n ) );
|
||||
}
|
||||
|
||||
/* inline */ const TypeDescriptor *
|
||||
Registry::FindType( const char * n, int check_case ) const {
|
||||
inline const TypeDescriptor * Registry::FindType( const char * n, int check_case ) const {
|
||||
if( check_case ) {
|
||||
return ( const TypeDescriptor * ) HASHfind( active_types, ( char * ) n );
|
||||
}
|
||||
@@ -168,21 +157,18 @@ Registry::FindType( const char * n, int check_case ) const {
|
||||
( char * )PrettyTmpName( n ) );
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::ResetTypes() {
|
||||
inline void Registry::ResetTypes() {
|
||||
HASHlistinit( active_types, &cur_type );
|
||||
}
|
||||
|
||||
/* inline */ const TypeDescriptor *
|
||||
Registry::NextType() {
|
||||
inline const TypeDescriptor * Registry::NextType() {
|
||||
if( 0 == HASHlist( &cur_type ) ) {
|
||||
return 0;
|
||||
}
|
||||
return ( const TypeDescriptor * ) cur_type.e->data;
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::AddEntity( const EntityDescriptor & e ) {
|
||||
void Registry::AddEntity( const EntityDescriptor & e ) {
|
||||
HASHinsert( primordialSwamp, ( char * ) e.Name(), ( EntityDescriptor * ) &e );
|
||||
++entity_cnt;
|
||||
++all_ents_cnt;
|
||||
@@ -190,25 +176,22 @@ Registry::AddEntity( const EntityDescriptor & e ) {
|
||||
}
|
||||
|
||||
|
||||
/* inline */ void
|
||||
Registry::AddSchema( const Schema & d ) {
|
||||
void Registry::AddSchema( const Schema & d ) {
|
||||
HASHinsert( active_schemas, ( char * ) d.Name(), ( Schema * ) &d );
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::AddType( const TypeDescriptor & d ) {
|
||||
void Registry::AddType( const TypeDescriptor & d ) {
|
||||
HASHinsert( active_types, ( char * ) d.Name(), ( TypeDescriptor * ) &d );
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::AddClones( const EntityDescriptor & e )
|
||||
/*
|
||||
/**
|
||||
* Purpose is to insert e into the registry hashed according to all its
|
||||
* alternate names (the names it was renamed with when other schemas USEd
|
||||
* or REFERENCEd it). This will make these names available to the Registry
|
||||
* so that if we comes across one of them in a Part 21 file, we'll recog-
|
||||
* nize it.
|
||||
*/
|
||||
inline void Registry::AddClones( const EntityDescriptor & e )
|
||||
{
|
||||
const SchRename * alts = e.AltNameList();
|
||||
|
||||
@@ -220,14 +203,13 @@ Registry::AddClones( const EntityDescriptor & e )
|
||||
all_ents_cnt += uniqueNames( e.Name(), e.AltNameList() );
|
||||
}
|
||||
|
||||
static int
|
||||
uniqueNames( const char * entnm, const SchRename * altlist )
|
||||
/*
|
||||
/**
|
||||
* Returns the number of unique names in an entity's _altname list. If
|
||||
* schema B uses ent xx from schema A and renames it to yy, and schema C
|
||||
* does the same (or if C simply uses yy from B), altlist will contain 2
|
||||
* entries with the same alt name.
|
||||
*/
|
||||
static int uniqueNames( const char * entnm, const SchRename * altlist )
|
||||
{
|
||||
int cnt = 0;
|
||||
const SchRename * alt = altlist;
|
||||
@@ -250,8 +232,7 @@ uniqueNames( const char * entnm, const SchRename * altlist )
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::RemoveEntity( const char * n ) {
|
||||
inline void Registry::RemoveEntity( const char * n ) {
|
||||
const EntityDescriptor * e = FindEntity( n );
|
||||
struct Element tmp;
|
||||
|
||||
@@ -263,25 +244,22 @@ Registry::RemoveEntity( const char * n ) {
|
||||
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::RemoveSchema( const char * n ) {
|
||||
inline void Registry::RemoveSchema( const char * n ) {
|
||||
struct Element tmp;
|
||||
tmp.key = ( char * ) n;
|
||||
HASHsearch( active_schemas, &tmp, HASH_DELETE );
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::RemoveType( const char * n ) {
|
||||
inline void Registry::RemoveType( const char * n ) {
|
||||
struct Element tmp;
|
||||
tmp.key = ( char * ) n;
|
||||
HASHsearch( active_types, &tmp, HASH_DELETE );
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::RemoveClones( const EntityDescriptor & e )
|
||||
/*
|
||||
/**
|
||||
* Remove all the "clones", or rename values of e.
|
||||
*/
|
||||
inline void Registry::RemoveClones( const EntityDescriptor & e )
|
||||
{
|
||||
const SchRename * alts = e.AltNameList();
|
||||
struct Element * tmp;
|
||||
@@ -295,8 +273,7 @@ Registry::RemoveClones( const EntityDescriptor & e )
|
||||
}
|
||||
|
||||
|
||||
SCLP23( Application_instance ) *
|
||||
Registry::ObjCreate( const char * nm, const char * schnm, int check_case ) const {
|
||||
SCLP23( Application_instance ) * Registry::ObjCreate( const char * nm, const char * schnm, int check_case ) const {
|
||||
const EntityDescriptor * entd = FindEntity( nm, schnm, check_case );
|
||||
if( entd ) {
|
||||
SCLP23( Application_instance ) *se =
|
||||
@@ -317,32 +294,27 @@ Registry::ObjCreate( const char * nm, const char * schnm, int check_case ) const
|
||||
}
|
||||
|
||||
|
||||
/* inline */ int
|
||||
Registry::GetEntityCnt() {
|
||||
inline int Registry::GetEntityCnt() {
|
||||
return entity_cnt;
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::ResetEntities() {
|
||||
inline void Registry::ResetEntities() {
|
||||
HASHlistinit( primordialSwamp, &cur_entity );
|
||||
|
||||
}
|
||||
|
||||
/* inline */ const EntityDescriptor *
|
||||
Registry::NextEntity() {
|
||||
inline const EntityDescriptor * Registry::NextEntity() {
|
||||
if( 0 == HASHlist( &cur_entity ) ) {
|
||||
return 0;
|
||||
}
|
||||
return ( const EntityDescriptor * ) cur_entity.e->data;
|
||||
}
|
||||
|
||||
/* inline */ void
|
||||
Registry::ResetSchemas() {
|
||||
inline void Registry::ResetSchemas() {
|
||||
HASHlistinit( active_schemas, &cur_schema );
|
||||
}
|
||||
|
||||
/* inline */ const Schema *
|
||||
Registry::NextSchema() {
|
||||
inline const Schema * Registry::NextSchema() {
|
||||
if( 0 == HASHlist( &cur_schema ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user