finish cleanup in src/clstepcore

This commit is contained in:
Mark Pictor
2011-09-26 18:20:59 -04:00
parent 07d8791829
commit f9b93831dd
27 changed files with 646 additions and 1100 deletions
+146 -340
View File
@@ -10,58 +10,15 @@
* and is not subject to copyright.
*/
/* $Id: ExpDict.cc,v 3.0.1.7 1998/02/17 19:19:15 sauderd DP3.1 $ */
#ifdef HAVE_CONFIG_H
# include <scl_cf.h>
#endif
#include <scl_cf.h>
#include <memory.h>
#include <math.h>
#include <stdio.h>
// to help ObjectCenter
#ifndef HAVE_MEMMOVE
extern "C"
{
void * memmove( void * __s1, const void * __s2, size_t __n );
}
#endif
#include <ExpDict.h>
#include <STEPaggregate.h>
/*
const TypeDescriptor * const t_INTEGER_TYPE = & TypeDescriptor
("INTEGER", // Name
INTEGER_TYPE, // FundamentalType
"INTEGER"); // Description
extern const TypeDescriptor _t_INTEGER_TYPE
("INTEGER", // Name
INTEGER_TYPE, // FundamentalType
"INTEGER"); // Description
*/
/*const TypeDescriptor * const t_INTEGER_TYPE = &_t_INTEGER_TYPE;*/
/*extern const TypeDescriptor _t_REAL_TYPE ("REAL", REAL_TYPE, "Real");*/
/*const TypeDescriptor * const t_REAL_TYPE = &_t_REAL_TYPE;*/
/*extern const TypeDescriptor _t_STRING_TYPE ("STRING", STRING_TYPE, "String");*/
/*const TypeDescriptor * const t_STRING_TYPE = &_t_STRING_TYPE;*/
/*extern const TypeDescriptor _t_BINARY_TYPE ("BINARY", BINARY_TYPE, "Binary") ;*/
/*const TypeDescriptor * const t_BINARY_TYPE = &_t_BINARY_TYPE;*/
/*extern const TypeDescriptor _t_BOOLEAN_TYPE ("BOOLEAN", BOOLEAN_TYPE, "Boolean") ;*/
/*const TypeDescriptor * const t_BOOLEAN_TYPE = &_t_BOOLEAN_TYPE;*/
/*extern const TypeDescriptor _t_LOGICAL_TYPE ("LOGICAL", LOGICAL_TYPE, "Logical") ;*/
/*const TypeDescriptor * const t_LOGICAL_TYPE = &_t_LOGICAL_TYPE;*/
/*extern const TypeDescriptor _t_NUMBER_TYPE ("NUMBER", NUMBER_TYPE, "Number") ;*/
/*const TypeDescriptor * const t_NUMBER_TYPE = &_t_NUMBER_TYPE;*/
/*extern const TypeDescriptor _t_GENERIC_TYPE ("GENERIC", GENERIC_TYPE, "Generic") ;*/
/*const TypeDescriptor * const t_GENERIC_TYPE = &_t_GENERIC_TYPE;*/
Explicit_item_id__set::Explicit_item_id__set( int defaultSize ) {
_bufsize = defaultSize;
@@ -138,18 +95,15 @@ int Explicit_item_id__set::Index( Explicit_item_id_ptr v ) {
Explicit_item_id_ptr & Explicit_item_id__set::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
Explicit_item_id__set::Count() {
int Explicit_item_id__set::Count() {
return _count;
}
void
Explicit_item_id__set::Clear() {
void Explicit_item_id__set::Clear() {
_count = 0;
}
@@ -230,18 +184,15 @@ int Implicit_item_id__set::Index( Implicit_item_id_ptr v ) {
Implicit_item_id_ptr & Implicit_item_id__set::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
Implicit_item_id__set::Count() {
int Implicit_item_id__set::Count() {
return _count;
}
void
Implicit_item_id__set::Clear() {
void Implicit_item_id__set::Clear() {
_count = 0;
}
@@ -322,18 +273,15 @@ int Interface_spec__set::Index( Interface_spec_ptr v ) {
Interface_spec_ptr & Interface_spec__set::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
Interface_spec__set::Count() {
int Interface_spec__set::Count() {
return _count;
}
void
Interface_spec__set::Clear() {
void Interface_spec__set::Clear() {
_count = 0;
}
@@ -344,7 +292,7 @@ Interface_spec::Interface_spec()
_implicit_items( 0 ), _all_objects( 0 ) {
}
// not tested
/// not tested
Interface_spec::Interface_spec( Interface_spec & is ) {
_explicit_items = new Explicit_item_id__set;
int count = is._explicit_items->Count();
@@ -372,38 +320,34 @@ Interface_spec::~Interface_spec() {
}
//////////////////////////////////////////////////////////////////////////////
void
Schema::AddFunction( const char * f ) {
void Schema::AddFunction( const char * f ) {
if( _function_list == 0 ) {
_function_list = new scl_char_str__list;
}
_function_list->Append( ( char * )f );
}
void
Schema::AddGlobal_rule( Global_rule_ptr gr ) {
void Schema::AddGlobal_rule( Global_rule_ptr gr ) {
if( _global_rules == 0 ) {
_global_rules = new Global_rule__set;
}
_global_rules->Append( gr );
}
// not implemented
void
Schema::global_rules_( Global_rule__set_var & grs ) {
/// not implemented
void Schema::global_rules_( Global_rule__set_var & grs ) {
}
void
Schema::AddProcedure( const char * p ) {
void Schema::AddProcedure( const char * p ) {
if( _procedure_list == 0 ) {
_procedure_list = new scl_char_str__list;
}
_procedure_list->Append( ( char * )p );
}
// the whole schema
void
Schema::GenerateExpress( ostream & out ) const {
/// the whole schema
void Schema::GenerateExpress( ostream & out ) const {
std::string tmp;
out << endl << "(* Generating: " << Name() << " *)" << endl;
out << endl << "SCHEMA " << StrToLower( Name(), tmp ) << ";" << endl;
@@ -441,9 +385,8 @@ Schema::GenerateExpress( ostream & out ) const {
out << endl << "END_SCHEMA;" << endl;
}
// USE, REFERENCE definitions
void
Schema::GenerateUseRefExpress( ostream & out ) const {
/// USE, REFERENCE definitions
void Schema::GenerateUseRefExpress( ostream & out ) const {
int i, k;
int intf_count;
int count;
@@ -461,8 +404,6 @@ Schema::GenerateUseRefExpress( ostream & out ) const {
// count is # of USE items in interface
count = is->explicit_items_()->Count();
//Explicit_item_id__set_var eiis = is->explicit_items_();
if( count > 0 ) {
out << endl << " USE FROM "
<< StrToLower( is->foreign_schema_id_().c_str(), tmp ) << endl;
@@ -504,8 +445,6 @@ Schema::GenerateUseRefExpress( ostream & out ) const {
if( count > 0 ) {
// out << " REFERENCE FROM " << (*(is->explicit_items_()))[0]->foreign_schema_() << endl;
out << endl << " REFERENCE FROM "
<< StrToLower( is->foreign_schema_id_().c_str(), tmp ) << endl;
out << " (";
@@ -536,9 +475,8 @@ Schema::GenerateUseRefExpress( ostream & out ) const {
}
}
// TYPE definitions
void
Schema::GenerateTypesExpress( ostream & out ) const {
/// TYPE definitions
void Schema::GenerateTypesExpress( ostream & out ) const {
TypeDescItr tdi( _typeList );
tdi.ResetItr();
std::string tmp;
@@ -550,9 +488,8 @@ Schema::GenerateTypesExpress( ostream & out ) const {
}
}
// Entity definitions
void
Schema::GenerateEntitiesExpress( ostream & out ) const {
/// Entity definitions
void Schema::GenerateEntitiesExpress( ostream & out ) const {
EntityDescItr edi( _entList );
edi.ResetItr();
std::string tmp;
@@ -598,8 +535,7 @@ IntAggregate * create_IntAggregate() {
return new IntAggregate;
}
const EntityDescriptor *
EntityDescItr::NextEntityDesc() {
const EntityDescriptor * EntityDescItr::NextEntityDesc() {
if( cur ) {
const EntityDescriptor * ed = cur->EntityDesc();
cur = ( EntityDescLinkNode * )( cur->NextNode() );
@@ -608,8 +544,7 @@ EntityDescItr::NextEntityDesc() {
return 0;
}
const AttrDescriptor *
AttrDescItr::NextAttrDesc() {
const AttrDescriptor * AttrDescItr::NextAttrDesc() {
if( cur ) {
const AttrDescriptor * ad = cur->AttrDesc();
cur = ( AttrDescLinkNode * )( cur->NextNode() );
@@ -618,8 +553,7 @@ AttrDescItr::NextAttrDesc() {
return 0;
}
const Inverse_attribute *
InverseAItr::NextInverse_attribute() {
const Inverse_attribute * InverseAItr::NextInverse_attribute() {
if( cur ) {
const Inverse_attribute * ia = cur->Inverse_attr();
cur = ( Inverse_attributeLinkNode * )( cur->NextNode() );
@@ -628,8 +562,7 @@ InverseAItr::NextInverse_attribute() {
return 0;
}
const TypeDescriptor *
TypeDescItr::NextTypeDesc() {
const TypeDescriptor * TypeDescItr::NextTypeDesc() {
if( cur ) {
const TypeDescriptor * td = cur->TypeDesc();
cur = ( TypeDescLinkNode * )( cur->NextNode() );
@@ -642,8 +575,7 @@ TypeDescItr::NextTypeDesc() {
// AttrDescriptor functions
///////////////////////////////////////////////////////////////////////////////
const char *
AttrDescriptor::AttrExprDefStr( std::string & s ) const {
const char * AttrDescriptor::AttrExprDefStr( std::string & s ) const {
std::string buf;
s = Name();
@@ -657,63 +589,57 @@ AttrDescriptor::AttrExprDefStr( std::string & s ) const {
return const_cast<char *>( s.c_str() );
}
const PrimitiveType
AttrDescriptor::BaseType() const {
const PrimitiveType AttrDescriptor::BaseType() const {
if( _domainType ) {
return _domainType->BaseType();
}
return UNKNOWN_TYPE;
}
int
AttrDescriptor::IsAggrType() const {
int AttrDescriptor::IsAggrType() const {
return ReferentType()->IsAggrType();
}
const PrimitiveType
AttrDescriptor::AggrElemType() const {
const PrimitiveType AttrDescriptor::AggrElemType() const {
if( IsAggrType() ) {
return ReferentType()->AggrElemType();
}
return UNKNOWN_TYPE;
}
const TypeDescriptor *
AttrDescriptor::AggrElemTypeDescriptor() const {
const TypeDescriptor * AttrDescriptor::AggrElemTypeDescriptor() const {
if( IsAggrType() ) {
return ReferentType()->AggrElemTypeDescriptor();
}
return 0;
}
const TypeDescriptor *
AttrDescriptor::NonRefTypeDescriptor() const {
const TypeDescriptor * AttrDescriptor::NonRefTypeDescriptor() const {
if( _domainType ) {
return _domainType->NonRefTypeDescriptor();
}
return 0;
}
const PrimitiveType
AttrDescriptor::NonRefType() const {
const PrimitiveType AttrDescriptor::NonRefType() const {
if( _domainType ) {
return _domainType->NonRefType();
}
return UNKNOWN_TYPE;
}
const PrimitiveType
AttrDescriptor::Type() const {
const PrimitiveType AttrDescriptor::Type() const {
if( _domainType ) {
return _domainType->Type();
}
return UNKNOWN_TYPE;
}
// right side of attr def
// NOTE this returns a \'const char * \' instead of an std::string
const char *
AttrDescriptor::TypeName() const {
/**
* right side of attr def
* NOTE this returns a \'const char * \' instead of an std::string
*/
const char * AttrDescriptor::TypeName() const {
std::string buf;
if( _domainType ) {
@@ -723,9 +649,8 @@ AttrDescriptor::TypeName() const {
}
}
// an expanded right side of attr def
const char *
AttrDescriptor::ExpandedTypeName( std::string & s ) const {
/// an expanded right side of attr def
const char * AttrDescriptor::ExpandedTypeName( std::string & s ) const {
s.clear();
if( Derived() == LTrue ) {
s = "DERIVE ";
@@ -738,22 +663,10 @@ AttrDescriptor::ExpandedTypeName( std::string & s ) const {
}
}
const char *
AttrDescriptor::GenerateExpress( std::string & buf ) const {
const char * AttrDescriptor::GenerateExpress( std::string & buf ) const {
std::string sstr;
buf = AttrExprDefStr( sstr );
buf.append( ";\n" );
/*
// buf = "";
buf.Append(StrToLower(Name(),tmp));
buf.Append(" : ");
if(_optional == LTrue) {
buf.Append("OPTIONAL ");
}
buf.Append(TypeName());
buf.Append(";\n");
*/
return const_cast<char *>( buf.c_str() );
}
@@ -761,8 +674,7 @@ AttrDescriptor::GenerateExpress( std::string & buf ) const {
// Derived_attribute functions
///////////////////////////////////////////////////////////////////////////////
const char *
Derived_attribute::AttrExprDefStr( std::string & s ) const {
const char * Derived_attribute::AttrExprDefStr( std::string & s ) const {
std::string buf;
s.clear();
@@ -771,10 +683,6 @@ Derived_attribute::AttrExprDefStr( std::string & s ) const {
}
s.append( Name() );
s.append( " : " );
/*
if(_optional.asInt() == LTrue)
s.append( "OPTIONAL ");
*/
if( DomainType() ) {
s.append( DomainType()->AttrTypeName( buf ) );
}
@@ -789,8 +697,7 @@ Derived_attribute::AttrExprDefStr( std::string & s ) const {
// Inverse_attribute functions
///////////////////////////////////////////////////////////////////////////////
const char *
Inverse_attribute::AttrExprDefStr( std::string & s ) const {
const char * Inverse_attribute::AttrExprDefStr( std::string & s ) const {
std::string buf;
s = Name();
@@ -816,8 +723,7 @@ EnumTypeDescriptor::EnumTypeDescriptor( const char * nm, PrimitiveType ft,
: TypeDescriptor( nm, ft, origSchema, d ), CreateNewEnum( f ) {
}
SCLP23( Enum ) *
EnumTypeDescriptor::CreateEnum() {
SCLP23( Enum ) * EnumTypeDescriptor::CreateEnum() {
if( CreateNewEnum ) {
return CreateNewEnum();
} else {
@@ -825,8 +731,7 @@ EnumTypeDescriptor::CreateEnum() {
}
}
const char *
EnumTypeDescriptor::GenerateExpress( std::string & buf ) const {
const char * EnumTypeDescriptor::GenerateExpress( std::string & buf ) const {
char tmp[BUFSIZ];
buf = "TYPE ";
buf.append( StrToLower( Name(), tmp ) );
@@ -885,13 +790,6 @@ EnumTypeDescriptor::GenerateExpress( std::string & buf ) const {
EntityDescriptor::EntityDescriptor( )
: _abstractEntity( LUnknown ), _extMapping( LUnknown ),
_uniqueness_rules( ( Uniqueness_rule__set_var )0 ), NewSTEPentity( 0 ) {
// _derivedAttr = new StringAggregate;
/*
_subtypes = 0;
_supertypes = 0;
_explicitAttr = 0;
_inverseAttr = 0;
*/
}
EntityDescriptor::EntityDescriptor( const char * name, // i.e. char *
@@ -899,32 +797,17 @@ EntityDescriptor::EntityDescriptor( const char * name, // i.e. char *
Logical abstractEntity, // F U or T
Logical extMapping,
Creator f
/*
EntityDescriptorList *subtypes,
EntityDescriptorList *supertypes,
AttrDescriptorList *explicitAttr,
StringAggregate *derivedAttr,
Inverse_attributeList *inverseAttr
*/
)
: TypeDescriptor( name, ENTITY_TYPE, origSchema, name ),
_abstractEntity( abstractEntity ), _extMapping( extMapping ),
_uniqueness_rules( ( Uniqueness_rule__set_var )0 ), NewSTEPentity( f ) {
/*
_subtypes = subtypes;
_supertypes = supertypes;
_explicitAttr = explicitAttr;
_derivedAttr = derivedAttr;
_inverseAttr = inverseAttr;
*/
}
EntityDescriptor::~EntityDescriptor() {
delete _uniqueness_rules;
}
const char *
EntityDescriptor::GenerateExpress( std::string & buf ) const {
const char * EntityDescriptor::GenerateExpress( std::string & buf ) const {
std::string sstr;
int count;
int i;
@@ -939,26 +822,6 @@ EntityDescriptor::GenerateExpress( std::string & buf ) const {
buf.append( _supertype_stmt.c_str() );
const EntityDescriptor * ed = 0;
/*
EntityDescItr edi_sub(_subtypes);
edi_sub.ResetItr();
ed = edi_sub.NextEntityDesc();
int subtypes = 0;
if(ed) {
buf.Append("\n SUPERTYPE OF (ONEOF(");
buf.Append(StrToLower(ed->Name(),sstr));
subtypes = 1;
}
ed = edi_sub.NextEntityDesc();
while (ed) {
buf.Append(",\n\t\t");
buf.Append(StrToLower(ed->Name(),sstr));
ed = edi_sub.NextEntityDesc();
}
if(subtypes) {
buf.Append("))");
}
*/
EntityDescItr edi_super( _supertypes );
edi_super.ResetItr();
@@ -1089,8 +952,7 @@ EntityDescriptor::GenerateExpress( std::string & buf ) const {
return const_cast<char *>( buf.c_str() );
}
const char *
EntityDescriptor::QualifiedName( std::string & s ) const {
const char * EntityDescriptor::QualifiedName( std::string & s ) const {
s.clear();
EntityDescItr edi( _supertypes );
@@ -1110,8 +972,7 @@ EntityDescriptor::QualifiedName( std::string & s ) const {
return const_cast<char *>( s.c_str() );
}
const TypeDescriptor *
EntityDescriptor::IsA( const TypeDescriptor * td ) const {
const TypeDescriptor * EntityDescriptor::IsA( const TypeDescriptor * td ) const {
if( td -> NonRefType() == ENTITY_TYPE ) {
return IsA( ( EntityDescriptor * ) td );
} else {
@@ -1119,8 +980,7 @@ EntityDescriptor::IsA( const TypeDescriptor * td ) const {
}
}
const EntityDescriptor *
EntityDescriptor::IsA( const EntityDescriptor * other ) const {
const EntityDescriptor * EntityDescriptor::IsA( const EntityDescriptor * other ) const {
const EntityDescriptor * found = 0;
const EntityDescLinkNode * link = ( const EntityDescLinkNode * )( GetSupertypes().GetHead() );
@@ -1135,29 +995,7 @@ EntityDescriptor::IsA( const EntityDescriptor * other ) const {
return found;
}
/*
EntityDescriptor::FindLongestAttribute()
{
AttrDescLinkNode *attrPtr =
(AttrDescLinkNode *)(ed->ExplicitAttr().GetHead());
while( attrPtr != 0)
{
if(attrPtr->AttrDesc()->IsEntityType())
maxAttrLen = max(maxAttrLen,
(strlen(attrPtr->AttrDesc()->EntityType()->Name()) +
strlen(attrPtr->AttrDesc()->Name()) + 3
)
);
else
maxAttrLen = max(maxAttrLen,
(strlen(attrPtr->AttrDesc()->DomainType()->NameOrDescription()) +
strlen(attrPtr->AttrDesc()->Name()) + 3
)
);
attrPtr = (AttrDescLinkNode *)attrPtr->NextNode();
}
}
*/
///////////////////////////////////////////////////////////////////////////////
Type_or_rule::Type_or_rule() {
}
@@ -1168,6 +1006,7 @@ Type_or_rule::Type_or_rule( const Type_or_rule & tor ) {
Type_or_rule::~Type_or_rule() {
}
///////////////////////////////////////////////////////////////////////////////
Where_rule::Where_rule() {
_type_or_rule = 0;
@@ -1259,18 +1098,15 @@ int Where_rule__list::Index( Where_rule_ptr v ) {
Where_rule_ptr & Where_rule__list::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
Where_rule__list::Count() {
int Where_rule__list::Count() {
return _count;
}
void
Where_rule__list::Clear() {
void Where_rule__list::Clear() {
_count = 0;
}
@@ -1367,18 +1203,15 @@ int Uniqueness_rule__set::Index( Uniqueness_rule_ptr v ) {
Uniqueness_rule_ptr & Uniqueness_rule__set::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
Uniqueness_rule__set::Count() {
int Uniqueness_rule__set::Count() {
return _count;
}
void
Uniqueness_rule__set::Clear() {
void Uniqueness_rule__set::Clear() {
_count = 0;
}
@@ -1393,7 +1226,7 @@ Global_rule::Global_rule( const char * n, Schema_ptr parent_sch, const char * rt
_rule_text( rt ) {
}
// not fully implemented
/// not fully implemented
Global_rule::Global_rule( Global_rule & gr ) {
_name = gr._name;
_parent_schema = gr._parent_schema;
@@ -1404,12 +1237,10 @@ Global_rule::~Global_rule() {
delete _where_rules;
}
void
Global_rule::entities_( const Entity__set_var & e ) {
void Global_rule::entities_( const Entity__set_var & e ) {
}
void
Global_rule::where_rules_( const Where_rule__list_var & wrl ) {
void Global_rule::where_rules_( const Where_rule__list_var & wrl ) {
}
///////////////////////////////////////////////////////////////////////////////
@@ -1489,18 +1320,15 @@ int Global_rule__set::Index( Global_rule_ptr v ) {
Global_rule_ptr & Global_rule__set::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
Global_rule__set::Count() {
int Global_rule__set::Count() {
return _count;
}
void
Global_rule__set::Clear() {
void Global_rule__set::Clear() {
_count = 0;
}
@@ -1509,15 +1337,13 @@ Global_rule__set::Clear() {
// TypeDescriptor functions
///////////////////////////////////////////////////////////////////////////////
const char *
TypeDescriptor::AttrTypeName( std::string & buf, const char * schnm ) const {
const char * TypeDescriptor::AttrTypeName( std::string & buf, const char * schnm ) const {
std::string sstr;
buf = Name( schnm ) ? StrToLower( Name( schnm ), sstr ) : _description;
return const_cast<char *>( buf.c_str() );
}
const char *
TypeDescriptor::GenerateExpress( std::string & buf ) const {
const char * TypeDescriptor::GenerateExpress( std::string & buf ) const {
char tmp[BUFSIZ];
buf = "TYPE ";
buf.append( StrToLower( Name(), tmp ) );
@@ -1569,20 +1395,16 @@ TypeDescriptor::GenerateExpress( std::string & buf ) const {
buf.append( "END_TYPE;\n" );
return const_cast<char *>( buf.c_str() );
// buf.append(Description());
// buf.append("\nEND_TYPE;\n");
}
///////////////////////////////////////////////////////////////////////
// This is a fully expanded description of the type.
// This returns a string like the _description member variable
// except it is more thorough of a description where possible
// e.g. if the description contains a TYPE name it will also
// be explained.
///////////////////////////////////////////////////////////////////////
const char *
TypeDescriptor::TypeString( std::string & s ) const {
/**
* This is a fully expanded description of the type.
* This returns a string like the _description member variable
* except it is more thorough of a description where possible
* e.g. if the description contains a TYPE name it will also
* be explained.
*/
const char * TypeDescriptor::TypeString( std::string & s ) const {
switch( Type() ) {
case REFERENCE_TYPE:
if( Name() ) {
@@ -1708,16 +1530,14 @@ TypeDescriptor::TypeString( std::string & s ) const {
}
const TypeDescriptor *
TypeDescriptor::IsA( const TypeDescriptor * other ) const {
const TypeDescriptor * TypeDescriptor::IsA( const TypeDescriptor * other ) const {
if( this == other ) {
return other;
}
return 0;
}
const TypeDescriptor *
TypeDescriptor::IsA( const char * other ) const {
const TypeDescriptor * TypeDescriptor::IsA( const char * other ) const {
if( !Name() ) {
return 0;
}
@@ -1727,18 +1547,16 @@ TypeDescriptor::IsA( const char * other ) const {
return ( ReferentType() ? ReferentType() -> IsA( other ) : 0 );
}
///////////////////////////////////////////////////////////////////////
// the first PrimitiveType that is not REFERENCE_TYPE (the first
// TypeDescriptor *_referentType that does not have REFERENCE_TYPE
// for it's fundamentalType variable). This would return the same
// as BaseType() for fundamental types. An aggregate type
// would return AGGREGATE_TYPE then you could find out the type of
// an element by calling AggrElemType(). Select types
// would work the same?
///////////////////////////////////////////////////////////////////////
const PrimitiveType
TypeDescriptor::NonRefType() const {
/**
* the first PrimitiveType that is not REFERENCE_TYPE (the first
* TypeDescriptor *_referentType that does not have REFERENCE_TYPE
* for it's fundamentalType variable). This would return the same
* as BaseType() for fundamental types. An aggregate type
* would return AGGREGATE_TYPE then you could find out the type of
* an element by calling AggrElemType(). Select types
* would work the same?
*/
const PrimitiveType TypeDescriptor::NonRefType() const {
const TypeDescriptor * td = NonRefTypeDescriptor();
if( td ) {
return td->FundamentalType();
@@ -1747,8 +1565,7 @@ TypeDescriptor::NonRefType() const {
}
const TypeDescriptor *
TypeDescriptor::NonRefTypeDescriptor() const {
const TypeDescriptor * TypeDescriptor::NonRefTypeDescriptor() const {
const TypeDescriptor * td = this;
while( td->ReferentType() ) {
@@ -1761,11 +1578,7 @@ TypeDescriptor::NonRefTypeDescriptor() const {
return td;
}
///////////////////////////////////////////////////////////////////////
// This returns the PrimitiveType of the first non-aggregate element of
// an aggregate
///////////////////////////////////////////////////////////////////////
/// This returns the PrimitiveType of the first non-aggregate element of an aggregate
int TypeDescriptor::IsAggrType() const {
switch( NonRefType() ) {
case AGGREGATE_TYPE:
@@ -1780,8 +1593,7 @@ int TypeDescriptor::IsAggrType() const {
}
}
const PrimitiveType
TypeDescriptor::AggrElemType() const {
const PrimitiveType TypeDescriptor::AggrElemType() const {
const TypeDescriptor * aggrElemTD = AggrElemTypeDescriptor();
if( aggrElemTD ) {
return aggrElemTD->Type();
@@ -1789,8 +1601,7 @@ TypeDescriptor::AggrElemType() const {
return UNKNOWN_TYPE;
}
const TypeDescriptor *
TypeDescriptor::AggrElemTypeDescriptor() const {
const TypeDescriptor * TypeDescriptor::AggrElemTypeDescriptor() const {
const TypeDescriptor * aggrTD = NonRefTypeDescriptor();
const TypeDescriptor * aggrElemTD = aggrTD->ReferentType();
if( aggrElemTD ) {
@@ -1799,19 +1610,17 @@ TypeDescriptor::AggrElemTypeDescriptor() const {
return aggrElemTD;
}
////////////////////////////////////////////////////////////
// This is the underlying type of this type. For instance:
// TYPE count = INTEGER;
// TYPE ref_count = count;
// TYPE count_set = SET OF ref_count;
// each of the above will generate a TypeDescriptor and for
// each one, PrimitiveType BaseType() will return INTEGER_TYPE
// TypeDescriptor *BaseTypeDescriptor() returns the TypeDescriptor
// for Integer
////////////////////////////////////////////////////////////
const PrimitiveType
TypeDescriptor::BaseType() const {
/**
* This is the underlying type of this type. For instance:
* TYPE count = INTEGER;
* TYPE ref_count = count;
* TYPE count_set = SET OF ref_count;
* each of the above will generate a TypeDescriptor and for
* each one, PrimitiveType BaseType() will return INTEGER_TYPE
* TypeDescriptor *BaseTypeDescriptor() returns the TypeDescriptor
* for Integer
*/
const PrimitiveType TypeDescriptor::BaseType() const {
const TypeDescriptor * td = BaseTypeDescriptor();
if( td ) {
return td->FundamentalType();
@@ -1820,8 +1629,7 @@ TypeDescriptor::BaseType() const {
}
}
const TypeDescriptor *
TypeDescriptor::BaseTypeDescriptor() const {
const TypeDescriptor * TypeDescriptor::BaseTypeDescriptor() const {
const TypeDescriptor * td = this;
while( td -> ReferentType() ) {
@@ -1829,20 +1637,23 @@ TypeDescriptor::BaseTypeDescriptor() const {
}
return td;
}
#ifdef NOT_YET
///////////////////////////////////////////////////////////////////////////////
// EnumerationTypeDescriptor functions
///////////////////////////////////////////////////////////////////////////////
EnumerationTypeDescriptor::EnumerationTypeDescriptor( ) {
_elements = new StringAggregate;
}
#endif
/** FIXME
* #ifdef NOT_YET
///////////////////////////////////////////////////////////////////////////////
// EnumerationTypeDescriptor functions
///////////////////////////////////////////////////////////////////////////////
EnumerationTypeDescriptor::EnumerationTypeDescriptor( ) {
_elements = new StringAggregate;
}
* #endif
*/
///////////////////////////////////////////////////////////////////////////////
// SelectTypeDescriptor functions
///////////////////////////////////////////////////////////////////////////////
SCLP23( Select ) *
SelectTypeDescriptor::CreateSelect() {
SCLP23( Select ) * SelectTypeDescriptor::CreateSelect() {
if( CreateNewSelect ) {
return CreateNewSelect();
} else {
@@ -1850,18 +1661,16 @@ SelectTypeDescriptor::CreateSelect() {
}
}
const TypeDescriptor *
SelectTypeDescriptor::IsA( const TypeDescriptor * other ) const {
const TypeDescriptor * SelectTypeDescriptor::IsA( const TypeDescriptor * other ) const {
return TypeDescriptor::IsA( other );
}
// returns the td among the choices of tds describing elements of this select
// type but only at this unexpanded level. The td ultimately describing the
// type may be an element of a td for a select that is returned.
const TypeDescriptor *
SelectTypeDescriptor::CanBe( const TypeDescriptor * other ) const {
// const TypeDescriptor * found =0;
/**
* returns the td among the choices of tds describing elements of this select
* type but only at this unexpanded level. The td ultimately describing the
* type may be an element of a td for a select that is returned.
*/
const TypeDescriptor * SelectTypeDescriptor::CanBe( const TypeDescriptor * other ) const {
TypeDescItr elements( GetElements() ) ;
const TypeDescriptor * td = 0;
@@ -1869,7 +1678,6 @@ SelectTypeDescriptor::CanBe( const TypeDescriptor * other ) const {
return other;
}
while( ( td = elements.NextTypeDesc() ) ) {
// if (found = (td -> CanBe (other))) return found;
if( td -> CanBe( other ) ) {
return td;
}
@@ -1877,12 +1685,12 @@ SelectTypeDescriptor::CanBe( const TypeDescriptor * other ) const {
return 0;
}
// returns the td among the choices of tds describing elements of this select
// type but only at this unexpanded level. The td ultimately describing the
// type may be an element of a td for a select that is returned.
const TypeDescriptor *
SelectTypeDescriptor::CanBe( const char * other ) const {
/**
* returns the td among the choices of tds describing elements of this select
* type but only at this unexpanded level. The td ultimately describing the
* type may be an element of a td for a select that is returned.
*/
const TypeDescriptor * SelectTypeDescriptor::CanBe( const char * other ) const {
TypeDescItr elements( GetElements() ) ;
const TypeDescriptor * td = 0;
@@ -1896,31 +1704,30 @@ SelectTypeDescriptor::CanBe( const char * other ) const {
if( td -> CanBe( other ) ) {
return td;
}
// if (found = (td -> CanBe (other))) return found;
}
return 0;
}
// A modified CanBe, used to determine if "other", a string we have just read,
// is a possible type-choice of this. (I.e., our select "CanBeSet" to this
// choice.) This deals with the following issue, based on the Tech Corrigendum
// to Part 21: Say our select ("selP") has an item which is itself a select
// ("selQ"). Say it has another select item which is a redefinition of another
// select ("TYPE selR = selS;"). According to the T.C., if selP is set to one
// of the members of selQ, "selQ(...)" may not appear in the instantiation.
// If, however, selP is set to a member of selR, "selR(...)" must appear first.
// The code below checks if "other" = one of our possible choices. If one of
// our choices is a select like selQ, we recurse to see if other matches a
// member of selQ (and don't look for "selQ"). If we have a choice like selR,
// we check if other = "selR", but do not look at selR's members. This func-
// tion also takes into account schNm, the name of the current schema. If
// schNm does not = the schema in which this type was declared, it's possible
// that it should be referred to with a different name. This would be the case
// if schNm = a schema which USEs or REFERENCEs this and renames it (e.g., "USE
// from XX (A as B)").
const TypeDescriptor *
SelectTypeDescriptor::CanBeSet( const char * other, const char * schNm ) const {
/**
* A modified CanBe, used to determine if "other", a string we have just read,
* is a possible type-choice of this. (I.e., our select "CanBeSet" to this
* choice.) This deals with the following issue, based on the Tech Corrigendum
* to Part 21: Say our select ("selP") has an item which is itself a select
* ("selQ"). Say it has another select item which is a redefinition of another
* select ("TYPE selR = selS;"). According to the T.C., if selP is set to one
* of the members of selQ, "selQ(...)" may not appear in the instantiation.
* If, however, selP is set to a member of selR, "selR(...)" must appear first.
* The code below checks if "other" = one of our possible choices. If one of
* our choices is a select like selQ, we recurse to see if other matches a
* member of selQ (and don't look for "selQ"). If we have a choice like selR,
* we check if other = "selR", but do not look at selR's members. This func-
* tion also takes into account schNm, the name of the current schema. If
* schNm does not = the schema in which this type was declared, it's possible
* that it should be referred to with a different name. This would be the case
* if schNm = a schema which USEs or REFERENCEs this and renames it (e.g., "USE
* from XX (A as B)").
*/
const TypeDescriptor * SelectTypeDescriptor::CanBeSet( const char * other, const char * schNm ) const {
TypeDescItr elements( GetElements() ) ;
const TypeDescriptor * td = 0;
@@ -1941,8 +1748,7 @@ SelectTypeDescriptor::CanBeSet( const char * other, const char * schNm ) const {
// AggrTypeDescriptor functions
///////////////////////////////////////////////////////////////////////////////
STEPaggregate *
AggrTypeDescriptor::CreateAggregate() {
STEPaggregate * AggrTypeDescriptor::CreateAggregate() {
if( CreateNewAggr ) {
return CreateNewAggr();
} else {
+133 -152
View File
@@ -563,14 +563,11 @@ private:
typedef Uniqueness_rule__set* Uniqueness_rule__set_ptr;
typedef Uniqueness_rule__set_ptr Uniqueness_rule__set_var;
///////////////////////////////////////////////////////////////////////////////
// Schema (was SchemaDescriptor) - a class of this type is generated and
// contains schema info.
///////////////////////////////////////////////////////////////////////////////
typedef SCLP23(Model_contents_ptr) (* ModelContentsCreator) () ;
/**
* \class Schema (was SchemaDescriptor) - a class of this type is generated and contains schema info.
*/
class Schema : public Dictionary_instance {
protected:
@@ -729,12 +726,11 @@ class InverseAItr
const Inverse_attribute * NextInverse_attribute();
};
///////////////////////////////////////////////////////////////////////////////
// AttrDescriptor
// An instance of this class will be generated for each attribute for
// an Entity. They will be pointed to by the EntityTypeDescriptors.
///////////////////////////////////////////////////////////////////////////////
/**
* \class AttrDescriptor
* An instance of this class will be generated for each attribute for
* an Entity. They will be pointed to by the EntityTypeDescriptors.
*/
class AttrDescriptor {
protected:
@@ -854,7 +850,7 @@ class AttrDescriptor {
///////////////////////////////////////////////////////////////////////////////
// Inverse_attribute
// Derived_attribute
///////////////////////////////////////////////////////////////////////////////
class Derived_attribute : public AttrDescriptor {
@@ -895,7 +891,6 @@ class Inverse_attribute : public AttrDescriptor {
TypeDescriptor *domainType,
Logical optional, // i.e. F U or T*/
Logical unique, // i.e. F U or T
// AttrType_Enum at, // will always be AttrType_Inverse
const EntityDescriptor & owner,
const char *inverted_attr_id =0
) : AttrDescriptor( name, domainType, optional, unique,
@@ -919,7 +914,7 @@ class Inverse_attribute : public AttrDescriptor {
void inverted_entity_id_(const char *iei )
{ _inverted_entity_id = iei; }
// not implemented
/// FIXME not implemented
class AttrDescriptor * inverted_attr_()
{ return _inverted_attr; }
@@ -933,18 +928,17 @@ class Inverse_attribute : public AttrDescriptor {
{ _inverted_attr = invAttr; }
};
///////////////////////////////////////////////////////////////////////////////
// SchRename is a structure which partially support the concept of USE and RE-
// FERENCE in EXPRESS. Say schema A USEs object X from schema B and renames it
// to Y (i.e., "USE (X as Y);"). SchRename stores the name of the schema (B)
// plus the new object name for that schema (Y). Each TypeDescriptor has a
// SchRename object (actually a linked list of SchRenames) corresponding to all
// the possible different names of itself depending on the current schema (the
// schema which is currently reading or writing this object). (The current
// schema is determined by the file schema section of the header section of a
// part21 file (the _headerInstances of STEPfile).
///////////////////////////////////////////////////////////////////////////////
/** \class SchRename
* SchRename is a structure which partially support the concept of USE and RE-
* FERENCE in EXPRESS. Say schema A USEs object X from schema B and renames it
* to Y (i.e., "USE (X as Y);"). SchRename stores the name of the schema (B)
* plus the new object name for that schema (Y). Each TypeDescriptor has a
* SchRename object (actually a linked list of SchRenames) corresponding to all
* the possible different names of itself depending on the current schema (the
* schema which is currently reading or writing this object). (The current
* schema is determined by the file schema section of the header section of a
* part21 file (the _headerInstances of STEPfile).
*/
class SchRename {
public:
SchRename( const char *sch="\0", const char *newnm="\0" ) : next(0)
@@ -964,87 +958,92 @@ class SchRename {
char newName[BUFSIZ];
};
///////////////////////////////////////////////////////////////////////////////
// TypeDescriptor
// This class and the classes inherited from this class are used to describe
// all types (base types and created types). There will be an instance of this
// class generated for each type found in the schema.
// A TypeDescriptor will be generated in three contexts:
// 1) to describe a base type - e.g. INTEGER, REAL, STRING. There is only one
// TypeDescriptor created for each Express base type. Each of these will
// be pointed to by several other AttrDescriptors and TypeDescriptors)
// 2) to describe a type created by an Express TYPE statement.
// e.g. TYPE label = STRING END_TYPE;
// These TypeDescriptors will be pointed to by other AttrDescriptors (and
// TypeDescriptors) representing attributes (and Express TYPEs) that are
// of the type created by this Express TYPE.
// 3) to describe a type created in an attribute definition
// e.g. part_label_grouping : ARRAY [1.10] label;
// or part_codes : ARRAY [1.10] INTEGER;
// In this #3 context there will not be a name associated with the type.
// The TypeDescriptor created in this case will only be pointed to by the
// single AttrDescriptor associated with the attribute it was created for.
///////////////////////////////////////////////////////////////////////////////
///// _name is the name of the type.
// In the case of the TypeDescriptors representing the Express base
// types this will be the name of the base type.
// In the case where this TypeDescriptor is representing an Express
// TYPE it is the LEFT side of an Express TYPE statement (i.e. label
// as in TYPE label = STRING END_TYPE;) This name would in turn be
// found on the RIGHT side of an Express attribute definition (e.g.
// attr defined as part_label : label; )
// In the case where this TypeDescriptor was generated to describe a
// type created in an attr definition, it will be a null pointer (e.g
// attr defined as part_label_grouping : ARRAY [1..10] label)
///// _fundamentalType is the 'type' of the type being represented by
// the TypeDescriptor . i.e. the following 2 stmts
// would cause 2 TypeDescriptors to be generated - the 1st having
// _fundamentalType set to STRING_TYPE and for the 2nd to
// REFERENCE_TYPE.
// TYPE label = STRING END_TYPE;
// TYPE part_label = label END_TYPE;
// part_label and label would be the value of the respective
// _name member variables for the 2 TypeDescriptors.
///// _referentType will point at another TypeDescriptor furthur specifying
// the type in all cases except when the type is directly
// an enum or select. i.e. in the following... _referentType for
// the 1st type does not point at anything and for the 2nd it does:
// TYPE color = ENUMERATION OF (red, blue); END_TYPE;
// TYPE color_ref = color; END_TYPE;
////// _fundamentalType being REFERENCE_TYPE (as would be the case for
// part_label and color_ref above) means that the _referentType
// member variable points at a TypeDescriptor representing a type
// that has been defined in an Express TYPE stmt.
// Otherwise _fundamental type reflects
// the type directly as in the type label above. type label above
// has a _referentType that points at a TypeDescriptor for STRING
// described in the next sentence (also see #1 above).
// A TypeDescriptor would be generated for each of the EXPRESS base
// types (int, string, real, etc) having _fundamentalType member
// variables set to match the EXPRESS base type being represented.
//////_referentType
// For the TypeDescriptors describing the EXPRESS base types this will
// be a null pointer. For all other TypeDescriptors this will point
// to another TypeDescriptor which furthur describes the type. e.g.
// TYPE part_label = label END_TYPE; TYPE label = STRING END_TYPE;
// part_label's _referentType will point to the TypeDescriptor for
// label. label's _referentType will point to the TypeDescriptor
// for STRING. The _fundamentalType for part_label will be
// REFERENCE_TYPE and for label will be STRING_TYPE.
// The _fundamentalType for the EXPRESS base type STRING's
// TypeDescriptor will be STRING_TYPE.
// The _referentType member variable will in most cases point to
// a subtype of TypeDescriptor.
//////_description
// This is the string description of the type as found in the
// EXPRESS file. e.g. aggr of [aggr of ...] [list of ...] someType
// It is the RIGHT side of an Express TYPE statement
// (i.e. LIST OF STRING as in
// TYPE label_group = LIST OF STRING END_TYPE;)
// It is the same as _name for EXPRESS base types TypeDescriptors (with
// the possible exception of upper or lower case differences).
/**
* TypeDescriptor
* This class and the classes inherited from this class are used to describe
* all types (base types and created types). There will be an instance of this
* class generated for each type found in the schema.
* A TypeDescriptor will be generated in three contexts:
* 1) to describe a base type - e.g. INTEGER, REAL, STRING. There is only one
* TypeDescriptor created for each Express base type. Each of these will
* be pointed to by several other AttrDescriptors and TypeDescriptors)
* 2) to describe a type created by an Express TYPE statement.
* e.g. TYPE label = STRING END_TYPE;
* These TypeDescriptors will be pointed to by other AttrDescriptors (and
* TypeDescriptors) representing attributes (and Express TYPEs) that are
* of the type created by this Express TYPE.
* 3) to describe a type created in an attribute definition
* e.g. part_label_grouping : ARRAY [1.10] label;
* or part_codes : ARRAY [1.10] INTEGER;
* In this #3 context there will not be a name associated with the type.
* The TypeDescriptor created in this case will only be pointed to by the
* single AttrDescriptor associated with the attribute it was created for.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* \var _name
* \brief the name of the type.
* In the case of the TypeDescriptors representing the Express base
* types this will be the name of the base type.
* In the case where this TypeDescriptor is representing an Express
* TYPE it is the LEFT side of an Express TYPE statement (i.e. label
* as in TYPE label = STRING END_TYPE;) This name would in turn be
* found on the RIGHT side of an Express attribute definition (e.g.
* attr defined as part_label : label; )
* In the case where this TypeDescriptor was generated to describe a
* type created in an attr definition, it will be a null pointer (e.g
* attr defined as part_label_grouping : ARRAY [1..10] label)
* \var _fundamentalType
* the 'type' of the type being represented by
* the TypeDescriptor . i.e. the following 2 stmts
* would cause 2 TypeDescriptors to be generated - the 1st having
* _fundamentalType set to STRING_TYPE and for the 2nd to
* REFERENCE_TYPE.
* TYPE label = STRING END_TYPE;
* TYPE part_label = label END_TYPE;
* part_label and label would be the value of the respective
* _name member variables for the 2 TypeDescriptors.
* \var _referentType
* will point at another TypeDescriptor furthur specifying
* the type in all cases except when the type is directly
* an enum or select. i.e. in the following... _referentType for
* the 1st type does not point at anything and for the 2nd it does:
* TYPE color = ENUMERATION OF (red, blue); END_TYPE;
* TYPE color_ref = color; END_TYPE;
** var _fundamentalType
* being REFERENCE_TYPE (as would be the case for
* part_label and color_ref above) means that the _referentType
* member variable points at a TypeDescriptor representing a type
* that has been defined in an Express TYPE stmt.
* Otherwise _fundamental type reflects
* the type directly as in the type label above. type label above
* has a _referentType that points at a TypeDescriptor for STRING
* described in the next sentence (also see #1 above).
* A TypeDescriptor would be generated for each of the EXPRESS base
* types (int, string, real, etc) having _fundamentalType member
* variables set to match the EXPRESS base type being represented.
** var _referentType
* For the TypeDescriptors describing the EXPRESS base types this will
* be a null pointer. For all other TypeDescriptors this will point
* to another TypeDescriptor which furthur describes the type. e.g.
* TYPE part_label = label END_TYPE; TYPE label = STRING END_TYPE;
* part_label's _referentType will point to the TypeDescriptor for
* label. label's _referentType will point to the TypeDescriptor
* for STRING. The _fundamentalType for part_label will be
* REFERENCE_TYPE and for label will be STRING_TYPE.
* The _fundamentalType for the EXPRESS base type STRING's
* TypeDescriptor will be STRING_TYPE.
* The _referentType member variable will in most cases point to
* a subtype of TypeDescriptor.
* \var _description
* This is the string description of the type as found in the
* EXPRESS file. e.g. aggr of [aggr of ...] [list of ...] someType
* It is the RIGHT side of an Express TYPE statement
* (i.e. LIST OF STRING as in
* TYPE label_group = LIST OF STRING END_TYPE;)
* It is the same as _name for EXPRESS base types TypeDescriptors (with
* the possible exception of upper or lower case differences).
*/
class TypeDescriptor {
protected:
@@ -1232,16 +1231,16 @@ class EnumTypeDescriptor : public TypeDescriptor {
};
///////////////////////////////////////////////////////////////////////////////
// EntityDescriptor
// An instance of this class will be generated for each entity type
// found in the schema. This should probably be derived from the
// CreatorEntry class (see sdaiApplicaton_instance.h). Then the binary tree
// that the current software builds up containing the entities in the schema
// will be building the same thing but using the new schema info.
// nodes (i.e. EntityDesc nodes) for each entity.
///////////////////////////////////////////////////////////////////////////////
/**
* EntityDescriptor
* An instance of this class will be generated for each entity type
* found in the schema. This should probably be derived from the
* CreatorEntry class (see sdaiApplicaton_instance.h). Then the binary tree
* that the current software builds up containing the entities in the schema
* will be building the same thing but using the new schema info.
* nodes (i.e. EntityDesc nodes) for each entity.
*/
class EntityDescriptor : public TypeDescriptor {
protected:
@@ -1334,17 +1333,16 @@ class EntityDescriptor : public TypeDescriptor {
};
///////////////////////////////////////////////////////////////////////////////
// EnumerationTypeDescriptor
///////////////////////////////////////////////////////////////////////////////
/** \class EnumerationTypeDescriptor
* FIXME not implemented
*/
#ifdef NOT_YET
class EnumerationTypeDescriptor : public TypeDescriptor {
class EnumerationTypeDescriptor : public TypeDescriptor {
protected:
protected:
StringAggregate *_elements ; // of (null)
public:
public:
EnumerationTypeDescriptor ( );
virtual ~EnumerationTypeDescriptor () { }
@@ -1390,18 +1388,17 @@ RealAggregate * create_RealAggregate();
IntAggregate * create_IntAggregate();
///////////////////////////////////////////////////////////////////////////////
// AggrTypeDescriptor
// I think we decided on a simplistic representation of aggr. types for now?
// i.e. just have one AggrTypeDesc for Array of [list of] [set of] someType
// the inherited variable _referentType will point to the TypeDesc for someType
// So I don't believe this class was necessary. If we were to retain
// info for each of the [aggr of]'s in the example above then there would be
// one of these for each [aggr of] above and they would be strung
// together by the _aggrDomainType variables. If you can make this
// work then go for it.
///////////////////////////////////////////////////////////////////////////////
/**
* \class AggrTypeDescriptor
* I think we decided on a simplistic representation of aggr. types for now?
* i.e. just have one AggrTypeDesc for Array of [list of] [set of] someType
* the inherited variable _referentType will point to the TypeDesc for someType
* So I don't believe this class was necessary. If we were to retain
* info for each of the [aggr of]'s in the example above then there would be
* one of these for each [aggr of] above and they would be strung
* together by the _aggrDomainType variables. If you can make this
* work then go for it.
*/
class AggrTypeDescriptor : public TypeDescriptor {
protected:
@@ -1451,7 +1448,6 @@ class AggrTypeDescriptor : public TypeDescriptor {
///////////////////////////////////////////////////////////////////////////////
// ArrayTypeDescriptor
///////////////////////////////////////////////////////////////////////////////
class ArrayTypeDescriptor : public AggrTypeDescriptor {
protected:
@@ -1482,20 +1478,6 @@ class ListTypeDescriptor : public AggrTypeDescriptor {
protected:
public:
/* void AssignAggrCreator(ListAggregateCreator f = 0)
{
CreateNewAggr = f;
}
STEPaggregate *CreateListAggregate()
{
if(CreateNewAggr)
return CreateNewAggr();
else
return 0;
}
*/
ListTypeDescriptor ( ) { }
ListTypeDescriptor (const char * nm, PrimitiveType ft,
Schema *origSchema, const char * d,
@@ -1562,7 +1544,6 @@ class SelectTypeDescriptor : public TypeDescriptor {
TypeDescriptorList& Elements() { return _elements; }
const TypeDescriptorList& GetElements() const { return _elements; }
// void Elements (TypeDescriptorList x);
int UniqueElements () const { return _unique_elements; }
virtual const TypeDescriptor * IsA (const TypeDescriptor *) const;
virtual const TypeDescriptor * IsA (const char * n) const
+20 -67
View File
@@ -206,14 +206,10 @@ TypeDescriptor::TypeDescriptor
const char * d )
: _name( nm ), altNames( 0 ), _fundamentalType( ft ),
_originatingSchema( origSchema ), _referentType( 0 ), _description( d ),
_where_rules( 0 )
{
_where_rules( 0 ) {
}
const char *
TypeDescriptor::Name( const char * schnm ) const
/*
/**
* Determines the current name of this. Normally, this is simply _name.
* If "schnm" is set to a value, however, then this function becomes a
* request for our name when referenced by schnm. (This will be diff from
@@ -223,7 +219,7 @@ TypeDescriptor::Name( const char * schnm ) const
* and returns the new name if found. (See header comments to function
* SchRename::rename().)
*/
{
const char * TypeDescriptor::Name( const char * schnm ) const {
if( schnm == NULL ) {
return _name;
}
@@ -235,13 +231,11 @@ TypeDescriptor::Name( const char * schnm ) const
return _name;
}
const char *
TypeDescriptor::BaseTypeName() const {
const char * TypeDescriptor::BaseTypeName() const {
return BaseTypeDescriptor() ? BaseTypeDescriptor() -> Name() : 0;
}
const TypeDescriptor *
TypeDescriptor::BaseTypeIsA( const TypeDescriptor * td ) const {
const TypeDescriptor * TypeDescriptor::BaseTypeIsA( const TypeDescriptor * td ) const {
switch( NonRefType() ) {
case AGGREGATE_TYPE:
return AggrElemTypeDescriptor() -> IsA( td );
@@ -250,12 +244,9 @@ TypeDescriptor::BaseTypeIsA( const TypeDescriptor * td ) const {
default:
return IsA( td );
}
}
int
TypeDescriptor::CurrName( const char * other, const char * schNm ) const
/*
/**
* Check if our "current" name = other. CurrName may be different from
* _name if schNm tells us the current schema is a different one from the
* one in which we're defined. If so, we may have an alternate name for
@@ -263,7 +254,7 @@ TypeDescriptor::CurrName( const char * other, const char * schNm ) const
* case if schNm USEs or REFERENCEs type and renames it in the process
* (e.g., "USE (X as Y)".
*/
{
int TypeDescriptor::CurrName( const char * other, const char * schNm ) const {
if( !schNm || *schNm == '\0' ) {
// If there's no current schema, accept any possible name of this.
// (I.e., accept its actual name or any substitute):
@@ -280,35 +271,29 @@ TypeDescriptor::CurrName( const char * other, const char * schNm ) const
}
}
int
TypeDescriptor::PossName( const char * nm ) const
/*
/**
* return TRUE if nm is either our name or one of the possible alternates.
*/
{
int TypeDescriptor::PossName( const char * nm ) const {
return ( OurName( nm ) || AltName( nm ) );
}
int
TypeDescriptor::OurName( const char * nm ) const {
int TypeDescriptor::OurName( const char * nm ) const {
return !StrCmpIns( nm, _name );
}
int
TypeDescriptor::AltName( const char * nm ) const {
int TypeDescriptor::AltName( const char * nm ) const {
if( altNames ) {
return ( altNames->choice( nm ) );
}
return 0;
}
void
TypeDescriptor::addAltName( const char * schnm, const char * newnm )
/*
/**
* Creates a SchRename consisting of schnm & newnm. Places it in alphabe-
* tical order in this's altNames list.
*/
{
void TypeDescriptor::addAltName( const char * schnm, const char * newnm ) {
SchRename * newpair = new SchRename( schnm, newnm ),
*node = ( SchRename * )altNames, *prev = NULL;
@@ -327,13 +312,11 @@ TypeDescriptor::addAltName( const char * schnm, const char * newnm )
}
}
int
SchRename::choice( const char * nm ) const
/*
/**
* See if nm = one of our choices (either ours or that of a SchRename
* later in the list.
*/
{
int SchRename::choice( const char * nm ) const {
if( !StrCmpIns( nm, newName ) ) {
return 1;
}
@@ -343,16 +326,14 @@ SchRename::choice( const char * nm ) const
return 0;
}
char *
SchRename::rename( const char * schnm, char * newnm ) const
/*
/**
* Check if this SchRename represents the rename of its owning TypeDesc for
* schema schnm. (This will be the case if schnm = schName.) If so, the
* new name is returned and copied into newnm. If not, ::rename is called
* on next. Thus, this function will tell us if this or any later SchRe-
* name in this list provide a new name for TypeDesc for schema schnm.
*/
{
char * SchRename::rename( const char * schnm, char * newnm ) const {
if( !StrCmpIns( schnm, schName ) ) {
strcpy( newnm, newName );
return newnm;
@@ -405,37 +386,9 @@ Logical AttrDescriptor::Deriving() const {
return LFalse;
}
/*
// outdated function
void
AttrDescriptor::Derived( SCLP23( LOGICAL ) x ) {
if( x.asInt() ) {
_attrType = AttrType_Deriving;
} else {
_attrType = AttrType_Explicit;
}
}
// outdated function
void
AttrDescriptor::Derived( Logical x ) {
if( x == LTrue ) {
_attrType = AttrType_Deriving;
} else {
_attrType = AttrType_Explicit;
}
}
// outdated function
void
AttrDescriptor::Derived( const char * x ) {
if( !strcmp( x, "LTrue" ) || !strcmp( x, "T" ) ) {
_attrType = AttrType_Deriving;
} else {
_attrType = AttrType_Explicit;
}
}
*/
///////////////////////////////////////////////////////////////////////////////
// Derived_attribute functions
///////////////////////////////////////////////////////////////////////////////
Derived_attribute::Derived_attribute( const char * name, const TypeDescriptor * domainType,
Logical optional, Logical unique, AttrType_Enum at, const EntityDescriptor & owner )
+1 -1
View File
@@ -62,7 +62,7 @@ Registry::Registry( CF_init initFunct )
initFunct( *this );
HASHlistinit( active_types, &cur_type );
HASHlistinit( primordialSwamp, &cur_entity ); // initialize cur\'s
HASHlistinit( primordialSwamp, &cur_entity ); // initialize cur's
HASHlistinit( active_schemas, &cur_schema );
}
+13 -15
View File
@@ -48,7 +48,7 @@ STEPaggregate & STEPaggregate::ShallowCopy( const STEPaggregate & a ) {
return *this;
}
// do not require exchange file format
/// do not require exchange file format
Severity STEPaggregate::AggrValidLevel( const char * value, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int optional, char * tokenList, int addFileId,
@@ -68,7 +68,7 @@ Severity STEPaggregate::AggrValidLevel( const char * value, ErrorDescriptor * er
return err->severity();
}
// require exchange file format
/// require exchange file format
Severity STEPaggregate::AggrValidLevel( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int optional, char * tokenList, int addFileId,
@@ -86,7 +86,7 @@ Severity STEPaggregate::AggrValidLevel( istream & in, ErrorDescriptor * err,
return err->severity();
}
// if exchangeFileFormat == 1 then paren delims are required.
/// if exchangeFileFormat == 1 then paren delims are required.
Severity STEPaggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
@@ -454,7 +454,7 @@ EntityAggregate::~EntityAggregate() {
}
// if exchangeFileFormat == 1 then delims are required.
/// if exchangeFileFormat == 1 then delims are required.
Severity EntityAggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, int assignVal,
@@ -692,7 +692,7 @@ SelectAggregate::~SelectAggregate() {
}
// if exchangeFileFormat == 1 then delims are required.
/// if exchangeFileFormat == 1 then delims are required.
Severity SelectAggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, int assignVal,
@@ -813,8 +813,7 @@ STEPaggregate & SelectAggregate::ShallowCopy( const STEPaggregate & a ) {
}
SingleLinkNode *
SelectAggregate::NewNode() {
SingleLinkNode * SelectAggregate::NewNode() {
return new SelectNode();
}
@@ -1118,7 +1117,7 @@ void BinaryNode::STEPwrite( ostream & out ) {
// EnumAggregate
///////////////////////////////////////////////////////////////////////////////
// COPY
/// COPY
STEPaggregate & EnumAggregate::ShallowCopy( const STEPaggregate & a ) {
const EnumNode * tmp = ( const EnumNode * ) a.GetHead();
EnumNode * to;
@@ -1174,19 +1173,18 @@ EnumNode::EnumNode() {
EnumNode::~EnumNode() {
}
/// defined in subclass
SingleLinkNode * EnumNode::NewNode() {
// defined in subclass
cerr << "Internal error: " << __FILE__ << ": " << __LINE__ << "\n" ;
cerr << "function: EnumNode::NewNode () called instead of virtual function. \n"
<< _POC_ << "\n";
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// non-whitespace chars following s are considered garbage and is an error.
// a valid value will still be assigned if it exists before the garbage.
///////////////////////////////////////////////////////////////////////////////
/**
* non-whitespace chars following s are considered garbage and is an error.
* a valid value will still be assigned if it exists before the garbage.
*/
Severity EnumNode::StrToVal( const char * s, ErrorDescriptor * err ) {
return STEPread( s, err );
}
@@ -1316,7 +1314,7 @@ SingleLinkNode * IntAggregate::NewNode() {
return new IntNode();
}
// COPY
/// COPY
STEPaggregate & IntAggregate::ShallowCopy( const STEPaggregate & a ) {
const IntNode * tmp = ( const IntNode * ) a.GetHead();
IntNode * to;
+10
View File
@@ -85,6 +85,7 @@ class STEPaggregate : public SingleLinkList
};
/****************************************************************//**
** \class GenericAggregate
** This class supports LIST OF:
** SELECT_TYPE, BINARY_TYPE, GENERIC_TYPE, ENUM_TYPE, UNKNOWN_TYPE type
******************************************************************/
@@ -125,6 +126,7 @@ typedef EntityAggregate * EntityAggregate_ptr;
typedef EntityAggregate_ptr EntityAggregate_var;
/****************************************************************//**
** \class SelectAggregate
** This is a minimal represention for a collection of SCLP23(Select)
******************************************************************/
class SelectAggregate : public STEPaggregate
@@ -147,6 +149,7 @@ typedef SelectAggregate * SelectAggregate_ptr;
typedef SelectAggregate_ptr SelectAggregate_var;
/****************************************************************//**
** \class StringAggregate
** This class supports LIST OF STRING type
******************************************************************/
class StringAggregate : public STEPaggregate
@@ -164,6 +167,7 @@ typedef StringAggregate_ptr StringAggregate_var;
/****************************************************************//**
** \class BinaryAggregate
** This class supports LIST OF BINARY type
******************************************************************/
class BinaryAggregate : public STEPaggregate
@@ -181,6 +185,7 @@ typedef BinaryAggregate * BinaryAggregate_ptr;
typedef BinaryAggregate_ptr BinaryAggregate_var;
/**************************************************************//**
** \class EnumAggregate
** This is a minimal representions for a collection ofSCLP23(Enum)
******************************************************************/
class EnumAggregate : public STEPaggregate
@@ -275,6 +280,7 @@ class STEPnode : public SingleLinkNode {
typedef STEPnode * STEPnodeH;
/**************************************************************//**
** \class GenericAggregate
** This class is for the Nodes of GenericAggregates
******************************************************************/
class GenericAggrNode : public STEPnode {
@@ -361,6 +367,7 @@ class EntityNode : public STEPnode {
///////////////////////////////////////////////////////////////////////////
/**************************************************************//**
** \class SelectNode
** This is a minimal representions for node in lists of SCLP23(Select)
******************************************************************/
class SelectNode : public STEPnode {
@@ -419,6 +426,7 @@ class SelectNode : public STEPnode {
};
/**************************************************************//**
** \class StringNode
** This class is for the Nodes of StringAggregates
******************************************************************/
class StringNode : public STEPnode {
@@ -448,6 +456,7 @@ class StringNode : public STEPnode {
///////////////////////////////////////////////////////////////////////////
/**************************************************************//**
** \class BinaryNode
** This class is for the Nodes of BinaryAggregates
******************************************************************/
class BinaryNode : public STEPnode {
@@ -475,6 +484,7 @@ class BinaryNode : public STEPnode {
};
/**************************************************************//**
** \class EnumNode
** This is a minimal representions for node in lists of SCLP23(Enum)
******************************************************************/
class EnumNode : public STEPnode {
+4 -5
View File
@@ -41,10 +41,7 @@ const int Real_Num_Precision = REAL_NUM_PRECISION;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/******************************************************************
// the value of the attribute is assigned from the supplied string
******************************************************************/
/// the value of the attribute is assigned from the supplied string
Severity STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFileId ) {
if( RedefiningAttr() ) {
return RedefiningAttr()->StrToVal( s, instances, addFileId );
@@ -179,6 +176,7 @@ Severity STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFi
/**************************************************************//**
** \fn STEPread
** \brief Reads attribute value from in, formatted as P21 file.
** The value of the attribute is read from istream. The format
** expected is STEP exchange file.
@@ -353,6 +351,7 @@ Severity STEPattribute::STEPread( istream & in, InstMgr * instances, int addFile
}
/*****************************************************************//**
** \fn asStr
** \param currSch - used for select type writes. See commenting in SCLP23(Select)::STEPwrite().
** \returns the value of the attribute
** Status: complete 3/91
@@ -778,9 +777,9 @@ int STEPattribute::is_null() const {
}
/**************************************************************//**
** \return int -- if 0 => not equal
** evaluates the equality of two attributes
** Side Effects: none
** \return int -- if 0 => not equal
******************************************************************/
int operator == ( STEPattribute & a1, STEPattribute & a2 ) {
if ( a1.aDesc == a2.aDesc ) {
+10 -18
View File
@@ -20,8 +20,10 @@
#include <sdai.h>
// this is used to set a const int Real_Num_Precision
// in STEPaggregate.cc and STEPattribute.cc
/** \def REAL_NUM_PRECISION
* this is used to set a const int Real_Num_Precision
* in STEPaggregate.cc and STEPattribute.cc
*/
#define REAL_NUM_PRECISION 15
typedef double real;
@@ -50,23 +52,13 @@ extern SCLP23(Application_instance) * ReadEntityRef(const char * s, ErrorDescrip
InstMgr * instances, int addFileId);
extern Severity EntityValidLevel(SCLP23(Application_instance) *se,
const TypeDescriptor *ed, // entity type that entity se needs
// to match. (this must be an
// EntityDescriptor)
const TypeDescriptor *ed, ///< entity type that entity se needs to match. (this must be an EntityDescriptor)
ErrorDescriptor *err);
/**
* \arg attrValue string containing entity ref
* \arg ed entity type that entity in attrValue (if it exists) needs to match. (this must be an EntityDescriptor)
* \arg err
* \arg im
* \arg clearError
*/
extern Severity EntityValidLevel(const char *attrValue, // string contain entity ref
const TypeDescriptor *ed, // entity type that entity in
// attrValue (if it exists) needs
// to match. (this must be an
// EntityDescriptor)
extern Severity EntityValidLevel(const char *attrValue, ///< string containing entity ref
const TypeDescriptor *ed, /**< entity type that entity in attrValue (if it exists) needs
* to match. (this must be an EntityDescriptor)
*/
ErrorDescriptor *err, InstMgr *im, int clearError);
////////////////////
@@ -99,7 +91,7 @@ class STEPattribute {
public:
const AttrDescriptor * aDesc;
/**
/** \union ptr
** You know which of these to use based on the return value of
** NonRefType() - see below. BASE_TYPE is defined in baseType.h
** This variable points to an appropriate member variable in the entity
+11 -13
View File
@@ -14,70 +14,68 @@
#include <sdai.h>
#include <ExpDict.h>
// This is needed so that STEPattribute's can be passed as
// references to inline functions
/// This is needed so that STEPattribute's can be passed as references to inline functions
STEPattribute::STEPattribute( const STEPattribute & a )
: _derive( 0 ), _redefAttr( 0 ), aDesc( a.aDesc ) {}
// INTEGER
/// INTEGER
STEPattribute::STEPattribute( const class AttrDescriptor & d, SCLP23( Integer ) *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.i = p;
}
// BINARY
/// BINARY
STEPattribute::STEPattribute( const class AttrDescriptor & d, SCLP23( Binary ) *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.b = p;
}
// STRING
/// STRING
STEPattribute::STEPattribute( const class AttrDescriptor & d, SCLP23( String ) *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.S = p;
}
// REAL & NUMBER
/// REAL & NUMBER
STEPattribute::STEPattribute( const class AttrDescriptor & d, SCLP23( Real ) *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.r = p;
}
// ENTITY
/// ENTITY
STEPattribute::STEPattribute( const class AttrDescriptor & d,
SCLP23( Application_instance )* *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.c = p;
}
// AGGREGATE
/// AGGREGATE
STEPattribute::STEPattribute( const class AttrDescriptor & d, STEPaggregate * p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.a = p;
}
// ENUMERATION and Logical
/// ENUMERATION and Logical
STEPattribute::STEPattribute( const class AttrDescriptor & d, SCLP23( Enum ) *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.e = p;
}
// SELECT
/// SELECT
STEPattribute::STEPattribute( const class AttrDescriptor & d,
class SCLP23( Select ) *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.sh = p;
}
// UNDEFINED
/// UNDEFINED
STEPattribute::STEPattribute( const class AttrDescriptor & d, SCLundefined * p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ) {
ptr.u = p;
}
// name is the same even if redefined
/// name is the same even if redefined
const char * STEPattribute::Name() const {
return aDesc->Name();
}
+1 -1
View File
@@ -244,7 +244,7 @@ const EntityDescriptor * STEPcomplex::IsA( const EntityDescriptor * ed ) const {
}
Severity STEPcomplex::ValidLevel( ErrorDescriptor * error, InstMgr * im,
int clearError ) {
int clearError ) {
cout << "STEPcomplex::ValidLevel() not implemented.\n";
return SEVERITY_NULL;
}
+1 -1
View File
@@ -12,7 +12,7 @@ class STEPcomplex : public SCLP23(Application_instance) {
STEPcomplex * sc;
STEPcomplex * head;
Registry * _registry;
int visited; // used when reading (or as you wish?)
int visited; ///< used when reading (or as you wish?)
public:
STEPcomplex(Registry *registry, int fileid);
+10 -14
View File
@@ -1,5 +1,5 @@
/*****************************************************************************
* collect.cc *
/*************************************************************************//**
* collect.cc \class ComplexCollect *
* *
* Description: ComplexCollect is the container structure for all ofthe com- *
* plex entity information in a schema. It contains a list of *
@@ -13,12 +13,11 @@
#include "complexSupport.h"
void ComplexCollect::insert( ComplexList * c )
/*
/**
* Inserts a new ComplexList to our list. The ComplexLists are ordered by
* supertype name. Increments count.
*/
{
void ComplexCollect::insert( ComplexList * c ) {
ComplexList * prev = NULL, *cl = clists;
while( cl && *cl < *c ) {
@@ -38,8 +37,7 @@ void ComplexCollect::insert( ComplexList * c )
count++;
}
void ComplexCollect::remove( ComplexList * c )
/*
/**
* Removes the ComplexList whose supertype name = supername. "Removing"
* deletes the list and removes it from this, but does not delete its
* subtype structure. This is done when a subtype of other supertypes
@@ -47,7 +45,7 @@ void ComplexCollect::remove( ComplexList * c )
* be able to find it, and now that all its supers have accessed it, we
* remove it from the Collect.
*/
{
void ComplexCollect::remove( ComplexList * c ) {
ComplexList * cl = clists, *prev = NULL;
while( cl && *cl < *c ) {
@@ -69,11 +67,10 @@ void ComplexCollect::remove( ComplexList * c )
count--;
}
ComplexList * ComplexCollect::find( char * name )
/*
/**
* Searches for and returns the ComplexList whose supertype name = name.
*/
{
ComplexList * ComplexCollect::find( char * name ) {
ComplexList * cl = clists;
while( cl && *cl < name ) {
@@ -85,8 +82,7 @@ ComplexList * ComplexCollect::find( char * name )
return NULL;
}
int ComplexCollect::supports( EntNode * ents ) const
/*
/**
* Determines if the parent schema supports the instantiation of a complex
* type consisting of the the entities named in ents. Does so by attempt-
* ing to match ents against the ComplexLists in clists. If one of the
@@ -94,7 +90,7 @@ int ComplexCollect::supports( EntNode * ents ) const
* should be included in >1 CList. A more complicated algorithm is applied
* to match it, as described in the commenting.
*/
{
int ComplexCollect::supports( EntNode * ents ) const {
EntNode * node = ents, *nextnode;
AndList * alist = 0;
ComplexList * clist = clists, *cl = NULL, *current;
+60 -53
View File
@@ -17,32 +17,29 @@
#include <iostream>
#include <fstream>
using namespace std;
/*
extern "C"
{
#include <stdio.h>
#include <string.h>
#include <ctype.h>
}
*/
#include "Str.h"
#define FALSE 0
#define TRUE 1
#define LISTEND 999
// LISTEND signifies that an OrList has gone beyond its last viable choice
// among its children.
/** \def LISTEND
* signifies that an OrList has gone beyond its last viable choice
* among its children. FIXME is 999 high enough? Maybe use -1?
*/
enum MarkType {
NOMARK, ORMARK, MARK
};
/** \enum MarkType
// MARK is the usual value we'd mark with. If we mark with ORMARK, it means
// an OrList marked this node, so we'll know it may become unmarked later if
// we try another choice.
*/
enum MatchType {
UNKNOWN, UNSATISFIED, SATISFIED, MATCHSOME, MATCHALL, NEWCHOICE, NOMORE
};
/** \enum MatchType
// These are the conditions the EntList::match() functions may return. They
// are also the assigned values to EntList::viable.
//
@@ -61,6 +58,7 @@ enum MatchType {
// value signifies that we have found another choice.
// NOMORE - Special case - when trying alternate OR paths, this return
// value signifies that no more alternates within this path.
*/
enum JoinType {
SIMPLE, AND, OR, ANDOR
@@ -85,8 +83,8 @@ class EntNode {
public:
EntNode( const char *nm="" ) : next(0), mark(NOMARK), multSupers(0)
{ StrToLower( nm, name ); }
EntNode( const char ** ); // given a list, create a
~EntNode() { if ( next ) delete next; } // linked list of EntNodes
EntNode( const char ** ); ///< given a list, create a linked list of EntNodes
~EntNode() { if ( next ) delete next; }
operator const char *() { return name; }
int operator== ( EntNode &ent )
{ return ( strcmp( name, ent.name ) == 0 ); }
@@ -101,7 +99,7 @@ class EntNode {
void markAll( MarkType=MARK );
void unmarkAll() { markAll( NOMARK ); }
int marked( MarkType base=ORMARK ) { return ( mark >= base ); }
int allMarked(); // returns TRUE if all nodes in list are marked
int allMarked(); ///< returns TRUE if all nodes in list are marked
int unmarkedCount();
int multSuprs() { return multSupers; }
void multSuprs( int j ) { multSupers = j; }
@@ -112,8 +110,8 @@ class EntNode {
private:
MarkType mark;
char name[BUFSIZ];
int multSupers; // do I correspond to an entity with >1 supertype?
EntNode *lastSmaller( EntNode * ); // used by ::sort()
int multSupers; ///< do I correspond to an entity with >1 supertype?
EntNode *lastSmaller( EntNode * ); ///< used by ::sort()
};
class EntList {
@@ -157,12 +155,14 @@ class EntList {
protected:
MatchType viable;
// How does this EntList match the complex type. Used especially if Ent-
// List's parent is an OrList or AndOrList to record if this child is an
// acceptable choice or not. For an AndOr, viable children are accepted
// right away. For Or, only one is accepted, but we keep track of the
// other possible solutions in case we'll want to try them.
int level; // How many levels deep are we (main use for printing).
/** \var viable
* How does this EntList match the complex type. Used especially if Ent-
* List's parent is an OrList or AndOrList to record if this child is an
* acceptable choice or not. For an AndOr, viable children are accepted
* right away. For Or, only one is accepted, but we keep track of the
* other possible solutions in case we'll want to try them.
*/
int level; ///< How many levels deep are we (main use for printing).
};
class SimpleList : public EntList {
@@ -184,13 +184,15 @@ class SimpleList : public EntList {
void reset() { viable = UNKNOWN; I_marked = NOMARK; }
private:
char name[BUFSIZ]; // Name of entity we correspond to.
MarkType I_marked; // Did I mark, and with what type of mark.
char name[BUFSIZ]; ///< Name of entity we correspond to.
MarkType I_marked; ///< Did I mark, and with what type of mark.
};
/** \class MultList
* Supports concepts and functionality common to all the compound list
* types, especially AND and ANDOR.
*/
class MultList : public EntList {
// Supports concepts and functionality common to all the compound list
// types, especially AND and ANDOR.
friend class ComplexList;
friend class ComplexCollect;
@@ -209,7 +211,6 @@ class MultList : public EntList {
virtual MatchType tryNext( EntNode * );
int childCount() { return numchildren; }
// EntList *operator[]( int );
EntList *getChild( int );
EntList *getLast() { return ( getChild( numchildren-1 ) ); }
void unmarkAll( EntNode * );
@@ -217,18 +218,22 @@ class MultList : public EntList {
void reset();
protected:
int supertype; // do I represent a supertype?
int supertype; ///< do I represent a supertype?
int numchildren;
EntList *childList;
// Points to a list of "children" of this EntList. E.g., if join =
// AND, it would point to a list of the entity types we are AND'ing.
// The children may be SIMPLE EntLists (contain entity names) or may
// themselves be And-, Or-, or AndOrLists.
/** \var childList
* Points to a list of "children" of this EntList. E.g., if join =
* AND, it would point to a list of the entity types we are AND'ing.
* The children may be SIMPLE EntLists (contain entity names) or may
* themselves be And-, Or-, or AndOrLists.
*/
};
/** \class JoinList
* A specialized MultList, super for subtypes AndOrList and AndList, or
* ones which join their multiple children.
*/
class JoinList : public MultList {
// A specialized MultList, super for subtypes AndOrList and AndList, or
// ones which join their multiple children.
public:
JoinList( JoinType j ) : MultList(j) {}
~JoinList() {}
@@ -271,15 +276,16 @@ class OrList : public MultList {
void reset() { choice = -1; choice1 = -2; choiceCount = 0; MultList::reset(); }
private:
int choice, choice1, choiceCount;
// Which choice of our childList did we select from this OrList; what's
// the first viable choice; and how many choices are there entirely.
int choice; ///< Which choice of our childList did we select from this OrList
int choice1; ///< what's the first viable choice
int choiceCount; ///< how many choices are there entirely.
};
/** \class ComplexList
* Contains the entire list of EntLists which describe the set of
* instantiable complex entities defined by an EXPRESS expression.
*/
class ComplexList {
// Contains the entire list of EntLists which describe the set of
// instantiable complex entities defined by an EXPRESS expression.
friend class ultList;
friend class ComplexCollect;
friend ostream & operator<< ( ostream &, ComplexList & );
@@ -298,15 +304,18 @@ class ComplexList {
int operator== ( char *name )
{ return ( strcmp( supertype(), name ) == 0 ); }
const char *supertype() { return ((SimpleList *)head->childList)->name; }
// Based on knowledge that ComplexList always created by ANDing supertype
// with subtypes.
/** \fn supertype
* Based on knowledge that ComplexList always created by ANDing supertype
* with subtypes.
*/
int toplevel( const char * );
int contains( EntNode * );
int matches( EntNode * );
EntNode *list; // List of all entities contained in this complex type,
// regardless of how. (Used as a quick way of determining
// if this List *may* contain a certain complex type.)
EntNode *list; /**< List of all entities contained in this complex type,
* regardless of how. (Used as a quick way of determining
* if this List *may* contain a certain complex type.)
*/
AndList *head;
ComplexList *next;
int Dependent() { return dependent; }
@@ -314,28 +323,26 @@ class ComplexList {
private:
void addChildren( EntList * );
int hitMultNodes( EntNode * );
int abstract; // is our supertype abstract?
int dependent; // is our supertype also a subtype of other supertype(s)?
int multSupers; // am I a combo-CList created to test a subtype which has
}; // >1 supertypes?
int abstract; ///< is our supertype abstract?
int dependent; ///< is our supertype also a subtype of other supertype(s)?
int multSupers; ///< am I a combo-CList created to test a subtype which has >1 supertypes?
};
/// The collection of all the ComplexLists defined by the current schema.
class ComplexCollect {
// The collection of all the ComplexLists defined by the current schema.
public:
ComplexCollect( ComplexList *c = NULL ) : clists(c)
{ count = ( c ? 1 : 0 ); }
~ComplexCollect() { delete clists; }
void insert( ComplexList * );
void remove( ComplexList * );
// Remove this list but don't delete its hierarchy structure, because
// it's used elsewhere.
void remove( ComplexList * ); ///< Remove this list but don't delete its hierarchy structure, because it's used elsewhere.
ComplexList *find( char * );
int supports( EntNode * ) const;
ComplexList *clists;
private:
int count; // # of clist children
int count; ///< # of clist children
};
#endif
+18 -25
View File
@@ -1,5 +1,5 @@
/*****************************************************************************
* complexlist.cc *
/*************************************************************************//**
* complexlist.cc \class ComplexList *
* *
* Description: ComplexList is a class type which represents inheritance *
* information for a set of entities related through supertype *
@@ -12,11 +12,10 @@
#include "complexSupport.h"
ComplexList::~ComplexList()
/*
/**
* Destructor for ComplexList.
*/
{
ComplexList::~ComplexList() {
if( next ) {
delete next;
}
@@ -24,28 +23,27 @@ ComplexList::~ComplexList()
delete list;
}
void ComplexList::remove()
/*
/**
* Delete myself but don't take my sublist too. Done when a ComplexList
* was temporarily created to represent a complex structure which later
* became a subtype of other supertypes. After being incorporated into
* the supertypes' ComplexLists, this temp one can be deleted. Its sub-
* structure, however, cannot be deleted since it's still being used.
*/
void ComplexList::remove()
{
head = NULL;
// Only the overall AND will be deleted.
delete this;
}
int ComplexList::toplevel( const char * name )
/*
/**
* Returns TRUE if name is already contained at the top level of our
* EntList hierarchy. By top level, we mean the level under head. This
* is a highly specialized function which is used during the building of
* a temporary CList to test entities which are subtypes of >1 supertype.
*/
{
int ComplexList::toplevel( const char * name ) {
EntList * slist = head->childList;
while( slist ) {
@@ -60,8 +58,7 @@ int ComplexList::toplevel( const char * name )
return FALSE;
}
void ComplexList::buildList()
/*
/**
* Constructs this's list member. Contains an alphabetically-ordered
* linked list of EntNodes corresponding to all the leaf nodes in this.
* Used as a quick method of determining if this *may* allow a complex
@@ -69,7 +66,7 @@ void ComplexList::buildList()
* entity which contains an entity which is not contained in list, this
* ComplexList certainly can't support it.
*/
{
void ComplexList::buildList() {
EntList * sibling = head->childList->next;
// sibling = the first EntList (below the overall AND) after the supertype.
@@ -92,12 +89,11 @@ void ComplexList::buildList()
}
void ComplexList::addChildren( EntList * ent )
/*
/**
* Recursive function to add all the SimpleList descendents of ent into
* this's list.
*/
{
void ComplexList::addChildren( EntList * ent ) {
EntList * child;
char * nm;
EntNode * prev = list, *prev2 = NULL, *newnode;
@@ -134,15 +130,14 @@ void ComplexList::addChildren( EntList * ent )
}
}
int ComplexList::contains( EntNode * ents )
/*
/**
* Does a simple search to determine if this contains all the nodes of an
* EntNode list. If not, there's no way this will match ents. If so,
* we'll have to run matches() (below) to check more closely. This func-
* tion is simplified greatly because both EntNodes are ordered alphabeti-
* cally.
*/
{
int ComplexList::contains( EntNode * ents ) {
EntNode * ours = list, *theirs = ents;
while( theirs != NULL ) {
@@ -162,14 +157,13 @@ int ComplexList::contains( EntNode * ents )
return TRUE;
}
int ComplexList::matches( EntNode * ents )
/*
/**
* Receives as input an EntNode list, corresponding to a user request to
* instantiate the corresponding complex type. Returns TRUE if such a list
* can be instantiated based on the list of EntLists which were generated
* when the schema was read; FALSE otherwise.
*/
{
int ComplexList::matches( EntNode * ents ) {
MatchType retval, otherChoices = NEWCHOICE;
int result = FALSE;
@@ -215,8 +209,7 @@ int ComplexList::matches( EntNode * ents )
return result;
}
int ComplexList::hitMultNodes( EntNode * ents )
/*
/**
* This function has a specialized application. If the user wants to
* instantiate a complex type containing an entity with >1 supertype (call
* it C), we temporarily join all the ComplexLists together corresponding
@@ -229,7 +222,7 @@ int ComplexList::hitMultNodes( EntNode * ents )
* valid. (This function is actually slightly more complicated because it
* also deals with the possibility that >1 entities like C exist.)
*/
{
int ComplexList::hitMultNodes( EntNode * ents ) {
EntNode * node;
EntList * child;
+1 -23
View File
@@ -26,17 +26,11 @@ class TypeDescriptorList;
// These all match up to the new (CD2) Part 23 spec
// Some classes don't exist in our old dictionary implementation so they are
// currently commented out. The underlying class names should be updated
// currently commented out. FIXME The underlying class names should be updated
// when the new dictionary is integrated. DAS
//typedef class Named_type* Named_type_ptr;
//typedef Named_type_ptr Named_type_var;
//typedef class Dictionary_instance* Dictionary_instance_ptr;
//typedef Dictionary_instance_ptr Dictionary_instance_var;
typedef class Schema* Schema_ptr;
typedef Schema_ptr Schema_var;
//typedef class Defined_type* Defined_type_ptr;
//typedef Defined_type_ptr Defined_type_var;
typedef class EntityDescriptor* Entity_ptr;
typedef Entity_ptr Entity_var;
typedef class AttrDescriptor* Attribute_ptr;
@@ -53,24 +47,10 @@ typedef class EnumTypeDescriptor* Enumeration_type_ptr;
typedef Enumeration_type_ptr Enumeration_type_var;
typedef class SelectTypeDescriptor* Select_type_ptr;
typedef Select_type_ptr Select_type_var;
//typedef class Global_rule* Global_rule_ptr;
//typedef Global_rule_ptr Global_rule_var;
//typedef class Simple_type* Simple_type_ptr;
//typedef Simple_type_ptr Simple_type_var;
//typedef class Number_type* Number_type_ptr;
//typedef Number_type_ptr Number_type_var;
//typedef class IntTypeDescriptor* Integer_type_ptr;
//typedef Integer_type_ptr Integer_type_var;
typedef class RealTypeDescriptor* Real_type_ptr;
typedef Real_type_ptr Real_type_var;
typedef class StringTypeDescriptor* String_type_ptr;
typedef String_type_ptr String_type_var;
//typedef class BinaryTypeDescriptor* Binary_type_ptr;
//typedef Binary_type_ptr Binary_type_var;
//typedef class LogicalTypeDescriptor* Logical_type_ptr;
//typedef Logical_type_ptr Logical_type_var;
//typedef class BooleanTypeDescriptor* Boolean_type_ptr;
//typedef Boolean_type_ptr Boolean_type_var;
typedef class AggrTypeDescriptor* Aggr_type_ptr;
typedef Aggr_type_ptr Aggr_type_var;
typedef class SetTypeDescriptor* Set_type_ptr;
@@ -82,8 +62,6 @@ typedef List_type_ptr List_type_var;
typedef class ArrayTypeDescriptor* Array_type_ptr;
typedef Array_type_ptr Array_type_var;
//#include <ExpDict.h>
// the following exist until everything is updated
typedef EntityDescriptor Entity;
+16 -23
View File
@@ -1,5 +1,5 @@
/*****************************************************************************
* entlist.cc *
/*************************************************************************//**
* entlist.cc \class EntList *
* *
* Description: EntList is a class type which supports the concept of com- *
* plex inheritance. EntLists capture information on the *
@@ -15,12 +15,11 @@
#include "complexSupport.h"
int EntList::siblings()
/*
/**
* Returns the number of EntLists in this's list (EntList->next, next->next
* etc.) including this.
*/
{
int EntList::siblings() {
int count;
EntList * el;
@@ -30,11 +29,10 @@ int EntList::siblings()
return count;
}
EntList * EntList::firstNot( JoinType j )
/*
/**
* Returns the first EntList not of type join, starting from this.
*/
{
EntList * EntList::firstNot( JoinType j ) {
EntList * sibling = this;
while( sibling != NULL && sibling->join == j ) {
@@ -43,11 +41,10 @@ EntList * EntList::firstNot( JoinType j )
return sibling; // (may = NULL)
}
EntList * EntList::firstWanted( MatchType match )
/*
/**
* Returns the first EntList where viable = match, starting from this.
*/
{
EntList * EntList::firstWanted( MatchType match ) {
EntList * sibling = this;
while( sibling != NULL && sibling->viable != match ) {
@@ -56,12 +53,11 @@ EntList * EntList::firstWanted( MatchType match )
return sibling; // (may = NULL)
}
EntList * EntList::lastNot( JoinType j )
/*
/**
* Returns the last EntList not of type join, searching backwards from
* this.
*/
{
EntList * EntList::lastNot( JoinType j ) {
EntList * sibling = this;
while( sibling != NULL && sibling->join == j ) {
@@ -70,12 +66,11 @@ EntList * EntList::lastNot( JoinType j )
return sibling; // (may = NULL)
}
EntList * EntList::lastWanted( MatchType match )
/*
/**
* Returns the last EntList where viable = match, searching backwards from
* this.
*/
{
EntList * EntList::lastWanted( MatchType match ) {
EntList * sibling = this;
while( sibling != NULL && sibling->viable != match ) {
@@ -85,12 +80,11 @@ EntList * EntList::lastWanted( MatchType match )
}
void SimpleList::unmarkAll( EntNode * ents )
/*
/**
* Unmarks the node that was marked by this List. Normally called when
* undoing an OR choice to try out another.
*/
{
void SimpleList::unmarkAll( EntNode * ents ) {
EntNode * eptr = ents;
int comp = -1;
@@ -111,14 +105,13 @@ void SimpleList::unmarkAll( EntNode * ents )
I_marked = NOMARK;
}
int SimpleList::acceptChoice( EntNode * ents )
/*
/**
* Marks whichever node we can mark. We assume there is a match because
* this function is only called by a parent MultList if its child had a
* viable val of MATCHSOME. Return TRUE if we mark a previously unmarked
* node; otherwise FALSE.
*/
{
int SimpleList::acceptChoice( EntNode * ents ) {
EntNode * eptr = ents;
int comp;
+16 -23
View File
@@ -1,5 +1,5 @@
/*****************************************************************************
* entnode.cc *
/*************************************************************************//**
* entnode.cc \class EntNode *
* *
* Description: The EntNode class is used to store a collection of entity *
* names. It stores them in alphabetical order. It is the key *
@@ -13,15 +13,14 @@
#include "complexSupport.h"
EntNode::EntNode( const char ** names )
/*
/**
* Given a list of entity names, creates a sorted linked list of EntNodes
* corresponding to the list. A name which = "*" is a dummy trailer
* implying the list has been completed. This function first builds the
* list, then sets this to the first element, and then deletes the first
* element. This ensures that `this' points to the start of the list.
*/
{
EntNode::EntNode( const char ** names ) {
int j = 1, comp;
EntNode * prev, *prev2 = NULL, // prev2 - the one before prev
*newnode, *firstnode;
@@ -67,11 +66,10 @@ EntNode::EntNode( const char ** names )
delete firstnode;
}
EntNode & EntNode::operator= ( EntNode & ent )
/*
/**
* Copies all of ent's values here.
*/
{
EntNode & EntNode::operator= ( EntNode & ent ) {
Name( ent.name );
setmark( ent.mark );
multSuprs( ent.multSupers );
@@ -79,11 +77,10 @@ EntNode & EntNode::operator= ( EntNode & ent )
return *this;
}
void EntNode::markAll( MarkType stamp )
/*
/**
* Marks/unmarks all the nodes in this's list (default is to mark).
*/
{
void EntNode::markAll( MarkType stamp ) {
EntNode * node = this;
while( node != NULL ) {
@@ -92,11 +89,10 @@ void EntNode::markAll( MarkType stamp )
}
}
int EntNode::allMarked()
/*
/**
* Returns TRUE if this and all nodes following it are marked.
*/
{
int EntNode::allMarked() {
EntNode * node = this;
while( node != NULL ) {
@@ -108,11 +104,10 @@ int EntNode::allMarked()
return TRUE;
}
int EntNode::unmarkedCount()
/*
/**
* Returns the number of unmarked nodes in this's list.
*/
{
int EntNode::unmarkedCount() {
int count = 0;
EntNode * node = this;
@@ -125,12 +120,11 @@ int EntNode::unmarkedCount()
return count;
}
EntNode * EntNode::lastSmaller( EntNode * ent )
/*
/**
* Starting from `this', search for the last node (along our next's) which
* alphabetically precedes ent.
*/
{
EntNode * EntNode::lastSmaller( EntNode * ent ) {
EntNode * eptr = next, *prev = this;
if( *this > *ent ) {
@@ -143,8 +137,7 @@ EntNode * EntNode::lastSmaller( EntNode * ent )
return prev;
}
void EntNode::sort( EntNode ** first )
/*
/**
* Check if our nodes are in order. If not, re-sort. The earlier part of
* the list has been sorted but not necessarily the remainder. This algo-
* rithm sorts our nodes in chunks, and is fairly efficient when we know
@@ -153,7 +146,7 @@ void EntNode::sort( EntNode ** first )
* few of the nodes. The nodes at first were in order; only the renamed
* ones may be out of place.)
*/
{
void EntNode::sort( EntNode ** first ) {
EntNode * eptr1, *eptr2, *temp1, *temp2;
while( next && *this > *next ) {
+8 -11
View File
@@ -1,5 +1,5 @@
/*****************************************************************************
* match-ors.cc *
/*************************************************************************//**
* \file match-ors.cc *
* *
* Description: Contains the matchORs() functions for the EntList descen- *
* dants. The matchORs() of AndOrList and AndList recursively *
@@ -15,8 +15,7 @@
#include "complexSupport.h"
MatchType AndOrList::matchORs( EntNode * ents )
/*
/**
* Loops through descendants of this, invoking their matchOR functions.
* Returns the status of how well this's OR descendants match the nodes of
* ents. We only check our children whose viable values = UNKNOWN. This
@@ -25,7 +24,7 @@ MatchType AndOrList::matchORs( EntNode * ents )
* OR descendants we didn't test. Thus, UNKNOWN tells us that this child
* is an OR, or has an OR somewhere beneath it which we must process now.
*/
{
MatchType AndOrList::matchORs( EntNode * ents ) {
EntList * child = childList->firstWanted( UNKNOWN );
while( child != NULL ) {
@@ -46,14 +45,13 @@ MatchType AndOrList::matchORs( EntNode * ents )
return viable;
}
MatchType AndList::matchORs( EntNode * ents )
/*
/**
* Loops through the descendants of this with viable val = UNKNOWN, invo-
* king their matchOR functions. Returns the status of how well this's OR
* descendants match the nodes of ents. We only take UNKNOWN's because
* they will lead us to OR's, as explained in AndOrList::matchORs().
*/
{
MatchType AndList::matchORs( EntNode * ents ) {
EntList * child = childList->firstWanted( UNKNOWN );
while( child != NULL ) {
@@ -73,8 +71,7 @@ MatchType AndList::matchORs( EntNode * ents )
return viable;
}
MatchType OrList::matchORs( EntNode * ents )
/*
/**
* Checks the branches of an OrList to search for a match to the nodes of
* ents. This function searches this's children and marks all the viable
* paths, or paths which mark off at least some of the remaining nodes of
@@ -82,7 +79,7 @@ MatchType OrList::matchORs( EntNode * ents )
* retain the info that these were only conditionally marked. Also, if a
* MATCHALL solution was found, that is returned immediately.
*/
{
MatchType OrList::matchORs( EntNode * ents ) {
int count;
EntList * child = childList;
MatchType retval = UNKNOWN;
+26 -39
View File
@@ -1,6 +1,6 @@
/*****************************************************************************
/*************************************************************************//**
* multlist.cc *
* *
* \class MultList *
* Description: MultList is a class type derived from EntList which is the *
* parent class to the compound list types, AND, OR and ANDOR. *
* It supports the concepts and functionality which is shared *
@@ -14,11 +14,10 @@
#include "complexSupport.h"
MultList::~MultList()
/*
/**
* Deletes the childList of this, before this is deleted.
*/
{
MultList::~MultList() {
EntList * child = childList, *cnext;
while( child ) {
@@ -28,12 +27,11 @@ MultList::~MultList()
}
}
void MultList::setLevel( int l )
/*
/**
* Sets this's level, and tells all its children to set their level to our
* level +1.
*/
{
void MultList::setLevel( int l ) {
EntList * child = childList;
level = l;
@@ -42,11 +40,10 @@ void MultList::setLevel( int l )
}
}
int MultList::contains( char * nm )
/*
/**
* Check if one of this's descendants matches nm.
*/
{
int MultList::contains( char * nm ) {
EntList * child = childList;
while( child ) {
@@ -58,13 +55,11 @@ int MultList::contains( char * nm )
return FALSE;
}
int MultList::hit( char * nm )
/*
/**
* Check if one of our descendants matches nm.
*/
{
int MultList::hit( char * nm ) {
EntList * child = childList;
while( child ) {
if( child->viable > UNSATISFIED && child->hit( nm ) ) {
// For most child->join types ruling out UNSATs just saves us
@@ -79,11 +74,10 @@ int MultList::hit( char * nm )
return FALSE;
}
EntList * MultList::getChild( int num )
/*
/**
* Returns a pointer to the num'th child of MultList.
*/
{
EntList * MultList::getChild( int num ) {
EntList * child = childList;
int j;
@@ -97,12 +91,11 @@ EntList * MultList::getChild( int num )
return child;
}
void MultList::appendList( EntList * ent )
/*
/**
* Appends a new entry into this's childList. The siblings of ent (ent->
* next ...) are automatically also appended.
*/
{
void MultList::appendList( EntList * ent ) {
EntList * eprev;
if( numchildren == 0 ) {
@@ -115,12 +108,11 @@ void MultList::appendList( EntList * ent )
numchildren += ent->siblings();
}
EntList * MultList::copyList( EntList * ent )
/*
/**
* Makes a copy of ent (and its children if it's a MultList) and appends it
* to the end of our list.
*/
{
EntList * MultList::copyList( EntList * ent ) {
EntList * newlist = 0, *child;
switch( ent->join ) {
@@ -149,13 +141,12 @@ EntList * MultList::copyList( EntList * ent )
return newlist;
}
void MultList::unmarkAll( EntNode * ents )
/*
/**
* Unmarks all nodes of ents marked by any of the descendants of this.
* This function is invoked by AndList and AndOrList. It is redefined for
* OrList.
*/
{
void MultList::unmarkAll( EntNode * ents ) {
EntList * child = childList;
while( child != NULL ) {
@@ -164,12 +155,11 @@ void MultList::unmarkAll( EntNode * ents )
}
}
void MultList::reset()
/*
/**
* Resets this to default values. Iterates through child list, calling
* each child's reset function.
*/
{
void MultList::reset() {
EntList * child;
viable = UNKNOWN;
@@ -178,8 +168,7 @@ void MultList::reset()
}
}
void JoinList::setViableVal( EntNode * ents )
/*
/**
* Sets this's viable value based on the value of its children. This is
* called at the end of matchNonOR() and matchOR() to determine the result
* of the matching. Since matchNonOR() is always called first and it
@@ -189,7 +178,7 @@ void JoinList::setViableVal( EntNode * ents )
* children which are UNSATISFIED and return UNSAT if found, we don't
* worry about coming across them down here.
*/
{
void JoinList::setViableVal( EntNode * ents ) {
EntList * child = childList;
viable = UNKNOWN;
@@ -214,13 +203,12 @@ void JoinList::setViableVal( EntNode * ents )
}
}
int JoinList::acceptChoice( EntNode * ents )
/*
/**
* Accept the path we're a part of: Mark all nodes of ents we can. Mark
* value will = mark (either MARK or ORMARK). Return TRUE if we mark any-
* thing; FALSE otherwise.
*/
{
int JoinList::acceptChoice( EntNode * ents ) {
EntList * child;
int result = FALSE;
@@ -245,13 +233,12 @@ int JoinList::acceptChoice( EntNode * ents )
return result;
}
int MultList::prevKnown( EntList * desc )
/*
/**
* Specialized function to test that none of the children prior to desc
* (a pointer to one of the EntLists of childList) have viable = UNKNOWN.
* Used in MatchNonORs() (see).
*/
{
int MultList::prevKnown( EntList * desc ) {
EntList * child = childList;
while( child != NULL && child != desc ) {
+8 -11
View File
@@ -1,5 +1,5 @@
/*****************************************************************************
* non-ors.cc *
/*************************************************************************//**
* \file non-ors.cc *
* *
* Description: Contains the matchNonORs() functions for the EntList descen- *
* dants. matchNonORs() functions loop through the EntList *
@@ -12,14 +12,13 @@
#include "complexSupport.h"
MatchType SimpleList::matchNonORs( EntNode * ents )
/*
/**
* Checks if we match the nodes of ents. If only one unmarked is left
* and we match it, return MATCHALL. More likely, we'll return one of the
* other return values. (See descript of MatchType values in complex-
* Support.h.)
*/
{
MatchType SimpleList::matchNonORs( EntNode * ents ) {
EntNode * eptr = ents;
int comp;
@@ -67,15 +66,14 @@ MatchType SimpleList::matchNonORs( EntNode * ents )
return UNSATISFIED;
}
MatchType AndOrList::matchNonORs( EntNode * ents )
/*
/**
* Loop through the children of this matching as many of the nodes of ents
* as we can. We skip all OrList descendants. Those are processed later
* only after all the non-conditional descendants, so that when we start
* processing them we'll be able to tell which OR choices are viable, and
* which are unnec.
*/
{
MatchType AndOrList::matchNonORs( EntNode * ents ) {
EntList * child = childList->firstNot( OR );
MatchType retval;
@@ -120,12 +118,11 @@ MatchType AndOrList::matchNonORs( EntNode * ents )
return viable;
}
MatchType AndList::matchNonORs( EntNode * ents )
/*
/**
* Checks if the AndList contains the set of nodes in ents. Skip OrList
* descendants.
*/
{
MatchType AndList::matchNonORs( EntNode * ents ) {
EntList * child = childList->firstNot( OR );
while( child != NULL ) {
+6 -8
View File
@@ -12,8 +12,7 @@
#include "complexSupport.h"
int OrList::hit( char * nm )
/*
/**
* Check if we matched nm. We have two possibilities here: If we have a
* choice selected, we only check the selected choice. Say we're an OR
* between SimpleLists C and D, and nm = C. If choice = D, we can't check
@@ -25,7 +24,7 @@ int OrList::hit( char * nm )
* context of a sub w/ >1 super, in which case we build a combo-CList and
* may need to check if all sub-CLists matched the multi-sub, C.)
*/
{
int OrList::hit( char * nm ) {
EntList * child = getChild( choice );
if( child ) {
@@ -44,11 +43,10 @@ int OrList::hit( char * nm )
return FALSE;
}
void OrList::unmarkAll( EntNode * ents )
/*
/**
* Unmarks all the nodes of ents marked by the descendants of this.
*/
{
void OrList::unmarkAll( EntNode * ents ) {
EntList * child;
if( ( child = getChild( choice ) ) != NULL ) {
@@ -57,13 +55,13 @@ void OrList::unmarkAll( EntNode * ents )
}
}
int OrList::acceptChoice( EntNode * ents )
/*
/**
* Accepts the first choice of our childList which marks any unmarked
* nodes. If none of our current choices mark anything, choice is set to
* LISTEND. If choice was set to LISTEND before calling aC(), we reset
* choice to choice1, and search again.
*/
int OrList::acceptChoice( EntNode * ents )
{
EntList * child;
+10 -15
View File
@@ -12,11 +12,10 @@
// Local function prototypes:
static char * joinText( JoinType, char * );
ostream & operator << ( ostream & os, ComplexList & clist )
/*
/**
* Prints out a ComplexList, by iterating through its children.
*/
{
ostream & operator << ( ostream & os, ComplexList & clist ) {
os << "ComplexList - \"" << *( SimpleList * )clist.head->childList
<< "\" supertype\n";
// head->childList will call << for head's 1st child. We know by def
@@ -25,11 +24,10 @@ ostream & operator << ( ostream & os, ComplexList & clist )
return os;
}
ostream & operator << ( ostream & os, EntList & list )
/*
/**
* Prints out an EntList. Calls appropriate function based on JoinType.
*/
{
ostream & operator << ( ostream & os, EntList & list ) {
if( list.join == SIMPLE ) {
os << *( SimpleList * )&list;
} else {
@@ -38,20 +36,18 @@ ostream & operator << ( ostream & os, EntList & list )
return os;
}
ostream & operator << ( ostream & os, SimpleList & slist )
/*
/**
* Prints out a SimpleList.
*/
{
ostream & operator << ( ostream & os, SimpleList & slist ) {
os << slist.name;
return os;
}
ostream & operator << ( ostream & os, MultList & mlist )
/*
/**
* Prints out a MultList.
*/
{
ostream & operator << ( ostream & os, MultList & mlist ) {
char jointype[7];
int k, lastSimple = 0;
// lastSimple - is the last child simple? If so, we need to print another
@@ -90,11 +86,10 @@ ostream & operator << ( ostream & os, MultList & mlist )
return os;
}
static char * joinText( JoinType j, char * buf )
/*
/**
* Copies and returns the string equivalent of a JoinType.
*/
{
static char * joinText( JoinType j, char * buf ) {
switch( j ) {
case SIMPLE:
strcpy( buf, "SIMPLE" );
+60 -106
View File
@@ -67,9 +67,7 @@ void IStreamState( istream & in ) {
// by any characters other than white space (i.e. EOF must happen)
//
///////////////////////////////////////////////////////////////////////////////
int
ReadInteger( SCLP23( Integer ) &val, istream & in, ErrorDescriptor * err,
int ReadInteger( SCLP23( Integer ) &val, istream & in, ErrorDescriptor * err,
const char * tokenList ) {
SCLP23( Integer ) i = 0;
in >> ws;
@@ -77,8 +75,6 @@ ReadInteger( SCLP23( Integer ) &val, istream & in, ErrorDescriptor * err,
int valAssigned = 0;
// IStreamState(in);
if( !in.fail() ) {
valAssigned = 1;
val = i;
@@ -87,12 +83,8 @@ ReadInteger( SCLP23( Integer ) &val, istream & in, ErrorDescriptor * err,
return valAssigned;
}
///////////////////////////////////////////////////////////////////////////////
// same as above but reads from a const char *
///////////////////////////////////////////////////////////////////////////////
int
ReadInteger( SCLP23( Integer ) &val, const char * s, ErrorDescriptor * err,
/// same as above but reads from a const char *
int ReadInteger( SCLP23( Integer ) &val, const char * s, ErrorDescriptor * err,
const char * tokenList ) {
istringstream in( ( char * )s );
return ReadInteger( val, in, err, tokenList );
@@ -117,9 +109,7 @@ ReadInteger( SCLP23( Integer ) &val, const char * s, ErrorDescriptor * err,
// null then attrValue must only contain a valid value and nothing else
// following.
///////////////////////////////////////////////////////////////////////////////
Severity
IntValidLevel( const char * attrValue, ErrorDescriptor * err,
Severity IntValidLevel( const char * attrValue, ErrorDescriptor * err,
int clearError, int optional, char * tokenList ) {
if( clearError ) {
err->ClearErrorMsg();
@@ -188,8 +178,7 @@ std::string WriteReal( SCLP23( Real ) val ) {
return s;
}
void
WriteReal( SCLP23( Real ) val, ostream & out ) {
void WriteReal( SCLP23( Real ) val, ostream & out ) {
out << WriteReal( val );
}
@@ -211,16 +200,14 @@ WriteReal( SCLP23( Real ) val, ostream & out ) {
// space between the value and the terminating character is not considered
// to be invalid. If tokenList is null then the value must not be followed
// by any characters other than white space (i.e. EOF must happen)
//
// skip any leading whitespace characters
// read: optional sign, at least one decimal digit, required decimal point,
// zero or more decimal digits, optional letter e or E (but lower case e is
// an error), optional sign, at least one decimal digit if there is an E.
//
///////////////////////////////////////////////////////////////////////////////
int
ReadReal( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
int ReadReal( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
const char * tokenList ) {
SCLP23( Real ) d = 0;
@@ -274,7 +261,6 @@ ReadReal( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
if( c == 'e' ) {
// this is incorrectly specified and thus is an error
e.GreaterSeverity( SEVERITY_WARNING );
// e.GreaterSeverity(SEVERITY_USERMSG); // not flagged as an error
e.AppendToDetailMsg(
"Reals using scientific notation must use upper case E.\n" );
}
@@ -322,12 +308,8 @@ ReadReal( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
return valAssigned;
}
///////////////////////////////////////////////////////////////////////////////
// same as above but reads from a const char *
///////////////////////////////////////////////////////////////////////////////
int
ReadReal( SCLP23( Real ) &val, const char * s, ErrorDescriptor * err,
/// same as above but reads from a const char *
int ReadReal( SCLP23( Real ) &val, const char * s, ErrorDescriptor * err,
const char * tokenList ) {
istringstream in( ( char * )s );
return ReadReal( val, in, err, tokenList );
@@ -352,9 +334,7 @@ ReadReal( SCLP23( Real ) &val, const char * s, ErrorDescriptor * err,
// null then attrValue must only contain a valid value and nothing else
// following.
///////////////////////////////////////////////////////////////////////////////
Severity
RealValidLevel( const char * attrValue, ErrorDescriptor * err,
Severity RealValidLevel( const char * attrValue, ErrorDescriptor * err,
int clearError, int optional, char * tokenList ) {
if( clearError ) {
err->ClearErrorMsg();
@@ -403,9 +383,7 @@ RealValidLevel( const char * attrValue, ErrorDescriptor * err,
// to be invalid. If tokenList is null then the value must not be followed
// by any characters other than white space (i.e. EOF must happen)
///////////////////////////////////////////////////////////////////////////////
int
ReadNumber( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
int ReadNumber( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
const char * tokenList ) {
SCLP23( Real ) d = 0;
in >> ws;
@@ -420,12 +398,8 @@ ReadNumber( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
return valAssigned;
}
///////////////////////////////////////////////////////////////////////////////
// same as above but reads from a const char *
///////////////////////////////////////////////////////////////////////////////
int
ReadNumber( SCLP23( Real ) &val, const char * s, ErrorDescriptor * err,
/// same as above but reads from a const char *
int ReadNumber( SCLP23( Real ) &val, const char * s, ErrorDescriptor * err,
const char * tokenList ) {
istringstream in( ( char * )s );
return ReadNumber( val, in, err, tokenList );
@@ -451,9 +425,7 @@ ReadNumber( SCLP23( Real ) &val, const char * s, ErrorDescriptor * err,
// null then attrValue must only contain a valid value and nothing else
// following.
///////////////////////////////////////////////////////////////////////////////
Severity
NumberValidLevel( const char * attrValue, ErrorDescriptor * err,
Severity NumberValidLevel( const char * attrValue, ErrorDescriptor * err,
int clearError, int optional, char * tokenList ) {
if( clearError ) {
err->ClearErrorMsg();
@@ -483,21 +455,16 @@ NumberValidLevel( const char * attrValue, ErrorDescriptor * err,
return err->severity();
}
// assign 's' so that it contains an exchange file format string read from
// 'in'.
void
PushPastString( istream & in, std::string & s, ErrorDescriptor * err ) {
/// assign 's' so that it contains an exchange file format string read from 'in'.
void PushPastString( istream & in, std::string & s, ErrorDescriptor * err ) {
s = ToExpressStr(in, err);
}
// assign 's' so that it contains an exchange file format aggregate read from
// 'in'.
// This is used to read aggregates that are part of multidimensional
// aggregates.
void
PushPastImbedAggr( istream & in, std::string & s, ErrorDescriptor * err ) {
/**
* assign 's' so that it contains an exchange file format aggregate read from 'in'.
* This is used to read aggregates that are part of multidimensional aggregates.
*/
void PushPastImbedAggr( istream & in, std::string & s, ErrorDescriptor * err ) {
char messageBuf[BUFSIZ];
messageBuf[0] = '\0';
@@ -531,14 +498,12 @@ PushPastImbedAggr( istream & in, std::string & s, ErrorDescriptor * err ) {
}
}
// assign 's' so that it contains an exchange file format aggregate read from
// 'in'.
// This is used to read a single dimensional aggregate (i.e. it is not allowed
// to contain an aggregate as an element.
void
PushPastAggr1Dim( istream & in, std::string & s, ErrorDescriptor * err ) {
/**
* assign 's' so that it contains an exchange file format aggregate read from 'in'.
* This is used to read a single dimensional aggregate (i.e. it is not allowed
* to contain an aggregate as an element.
*/
void PushPastAggr1Dim( istream & in, std::string & s, ErrorDescriptor * err ) {
char messageBuf[BUFSIZ];
messageBuf[0] = '\0';
@@ -575,14 +540,12 @@ PushPastAggr1Dim( istream & in, std::string & s, ErrorDescriptor * err ) {
}
}
/***************************
/**
* FindStartOfInstance reads to the beginning of an instance marked by #
* it copies what is read to the std::string inst. It leaves the # on the
* istream.
***************************/
Severity
FindStartOfInstance( istream & in, std::string & inst ) {
*/
Severity FindStartOfInstance( istream & in, std::string & inst ) {
char c = 0;
ErrorDescriptor errs;
SCLP23( String ) tmp;
@@ -610,13 +573,11 @@ FindStartOfInstance( istream & in, std::string & inst ) {
return SEVERITY_INPUT_ERROR;
}
/***************************
/**
* SkipInstance reads in an instance terminated with ;. it copies
* what is read to the std::string inst.
***************************/
Severity
SkipInstance( istream & in, std::string & inst ) {
*/
Severity SkipInstance( istream & in, std::string & inst ) {
char c = 0;
ErrorDescriptor errs;
SCLP23( String ) tmp;
@@ -645,16 +606,14 @@ SkipInstance( istream & in, std::string & inst ) {
}
/***************************
/**
// This reads a simple record. It is used when parsing externally mapped
// entities to skip to the next entity type name part of the externally mapped
// record. It does not expect a semicolon at the end since the pieces in an
// external mapping don't have them. If you are reading a simple record in the
// form of an internal mapping you will have to read the semicolon.
***************************/
const char *
SkipSimpleRecord( istream & in, std::string & buf, ErrorDescriptor * err ) {
*/
const char * SkipSimpleRecord( istream & in, std::string & buf, ErrorDescriptor * err ) {
char c;
std::string s;
@@ -688,14 +647,12 @@ SkipSimpleRecord( istream & in, std::string & buf, ErrorDescriptor * err ) {
return const_cast<char *>( buf.c_str() );
}
/***************************
/**
// This reads a part 21 definition of keyword. This includes the name of
// entity types. To read a user-defined keyword: read the '!' then call
// this function with skipInitWS turned off.
***************************/
const char *
ReadStdKeyword( istream & in, std::string & buf, int skipInitWS ) {
**/
const char * ReadStdKeyword( istream & in, std::string & buf, int skipInitWS ) {
char c;
if( skipInitWS ) {
in >> ws;
@@ -726,8 +683,7 @@ of an entity of a specific type. They shall consist of uppercase letters,
digits, underscore characters, and possibly an exclamation mark.
The "!" shall appear only once, and only as the first character.
***************************/
const char *
GetKeyword( istream & in, const char * delims, ErrorDescriptor & err ) {
const char * GetKeyword( istream & in, const char * delims, ErrorDescriptor & err ) {
char c;
int sz = 1;
static std::string str;
@@ -758,22 +714,23 @@ GetKeyword( istream & in, const char * delims, ErrorDescriptor & err ) {
return const_cast<char *>( str.c_str() );
}
// return 1 if found the keyword 'ENDSEC' with optional space and a ';'
// otherwise return 0. This gobbles up the input stream until it knows
// that it does or does not have the ENDSEC keyword (and semicolon). i.e.
// the first character that stops matching the keyword ENDSEC; (including the
// semicolon) will be put back onto the istream, everything else will remain
// read. It is this way so that checking for the keywd the next time will
// start with the correct char or if it doesn't find it the non-matching char
// may be what you are looking for next (e.g. someone typed in END; and the
// next chars are DATA; for the beginning of the data section).
int
FoundEndSecKywd( istream & in, ErrorDescriptor & err ) {
/**
* return 1 if found the keyword 'ENDSEC' with optional space and a ';'
* otherwise return 0. This gobbles up the input stream until it knows
* that it does or does not have the ENDSEC keyword (and semicolon). i.e.
* the first character that stops matching the keyword ENDSEC; (including the
* semicolon) will be put back onto the istream, everything else will remain
* read. It is this way so that checking for the keywd the next time will
* start with the correct char or if it doesn't find it the non-matching char
* may be what you are looking for next (e.g. someone typed in END; and the
* next chars are DATA; for the beginning of the data section).
* FIXME putback() doesn't work well on all platforms
*/
int FoundEndSecKywd( istream & in, ErrorDescriptor & err ) {
char c;
in >> ws;
in.get( c );
if( c == 'E' ) {
in.get( c );
if( c == 'N' ) {
@@ -869,10 +826,9 @@ const char * ReadComment( std::string & ss, const char * s ) {
* If first char from 'in' is a slash it will remain read
* whether or not there was a comment. If there is no comment
* only the slash will be read from 'in'.
***************************/
const char *
ReadComment( istream & in, std::string & s ) {
* FIXME putback() doesn't work well on all platforms
***************************/
const char * ReadComment( istream & in, std::string & s ) {
char c = '\0';
int commentLength = 0;
in >> ws;
@@ -927,8 +883,7 @@ ReadComment( istream & in, std::string & s ) {
** "\F\" == formfeed
** "\N\" == newline
***************************/
Severity
ReadPcd( istream & in ) {
Severity ReadPcd( istream & in ) {
char c;
in.get( c );
if( c == '\\' ) {
@@ -955,8 +910,7 @@ and comments.
Part 21 considers the blank to be the space character,
but this function considers blanks to be the return value of isspace(c)
******************************/
void
ReadTokenSeparator( istream & in, std::string * comments ) {
void ReadTokenSeparator( istream & in, std::string * comments ) {
char c;
std::string s; // used if need to read a comment
+33 -52
View File
@@ -1,5 +1,5 @@
#ifndef READ_FUNC_H
#define READ_FUNC_H
#define READ_FUNC_H
#include <sdai.h>
@@ -11,89 +11,70 @@ extern void PrintErrorState(ErrorDescriptor &err);
// print istream error information for debugging purposes
extern void IStreamState(istream &in);
extern int
ReadInteger(SCLP23(Integer) &val, istream &in, ErrorDescriptor *err,
const char *tokenList);
extern int ReadInteger(SCLP23(Integer) &val, istream &in, ErrorDescriptor *err,
const char *tokenList);
extern int
ReadInteger(SCLP23(Integer) &val, const char *s, ErrorDescriptor *err,
const char *tokenList);
extern int ReadInteger(SCLP23(Integer) &val, const char *s, ErrorDescriptor *err,
const char *tokenList);
extern Severity
IntValidLevel (const char *attrValue, ErrorDescriptor *err,
int clearError, int optional, char *tokenList);
extern Severity IntValidLevel (const char *attrValue, ErrorDescriptor *err,
int clearError, int optional, char *tokenList);
extern std::string WriteReal(SCLP23(Real) val );
extern void
WriteReal(SCLP23(Real) val, ostream &out);
extern void WriteReal(SCLP23(Real) val, ostream &out);
extern int
ReadReal(SCLP23(Real) &val, istream &in, ErrorDescriptor *err,
const char *tokenList);
extern int ReadReal(SCLP23(Real) &val, istream &in, ErrorDescriptor *err,
const char *tokenList);
extern int
ReadReal(SCLP23(Real) &val, const char *s, ErrorDescriptor *err,
const char *tokenList);
extern int ReadReal(SCLP23(Real) &val, const char *s, ErrorDescriptor *err,
const char *tokenList);
extern Severity
RealValidLevel (const char *attrValue, ErrorDescriptor *err,
int clearError, int optional, char *tokenList);
extern Severity RealValidLevel (const char *attrValue, ErrorDescriptor *err,
int clearError, int optional, char *tokenList);
extern int
ReadNumber(SCLP23(Real) &val, istream &in, ErrorDescriptor *err,
const char *tokenList);
extern int ReadNumber(SCLP23(Real) &val, istream &in, ErrorDescriptor *err,
const char *tokenList);
extern int
ReadNumber(SCLP23(Real) &val, const char *s, ErrorDescriptor *err,
const char *tokenList);
extern int ReadNumber(SCLP23(Real) &val, const char *s, ErrorDescriptor *err,
const char *tokenList);
extern Severity
NumberValidLevel (const char *attrValue, ErrorDescriptor *err,
int clearError, int optional, char *tokenList);
extern Severity NumberValidLevel (const char *attrValue, ErrorDescriptor *err,
int clearError, int optional, char *tokenList);
////////////////////
extern int QuoteInString(istream& in);
extern void
PushPastString (istream& in, std::string &s, ErrorDescriptor *err);
extern void PushPastString (istream& in, std::string &s, ErrorDescriptor *err);
extern void
PushPastImbedAggr (istream& in, std::string &s, ErrorDescriptor *err);
extern void PushPastImbedAggr (istream& in, std::string &s, ErrorDescriptor *err);
extern void
PushPastAggr1Dim(istream& in, std::string &s, ErrorDescriptor *err);
extern void PushPastAggr1Dim(istream& in, std::string &s, ErrorDescriptor *err);
////////////////////
extern Severity
FindStartOfInstance(istream& in, std::string& inst);
extern Severity FindStartOfInstance(istream& in, std::string& inst);
// used for instances that aren\'t valid - reads to next \';\'
extern Severity
SkipInstance (istream& in, std::string & inst);
/// used for instances that aren\'t valid - reads to next \';\'
extern Severity SkipInstance (istream& in, std::string & inst);
extern const char *
SkipSimpleRecord(istream &in, std::string &buf, ErrorDescriptor *err);
extern const char * SkipSimpleRecord(istream &in, std::string &buf, ErrorDescriptor *err);
// this includes entity names
extern const char *
ReadStdKeyword(istream& in, std::string &buf, int skipInitWS = 1);
/// this includes entity names
extern const char * ReadStdKeyword(istream& in, std::string &buf, int skipInitWS = 1);
extern const char*
GetKeyword(istream& in, const char* delims, ErrorDescriptor &err);
extern const char* GetKeyword(istream& in, const char* delims, ErrorDescriptor &err);
extern int
FoundEndSecKywd(istream& in, ErrorDescriptor &err);
extern int FoundEndSecKywd(istream& in, ErrorDescriptor &err);
extern const char *ReadComment(std::string &ss, const char *s);
extern const char *ReadComment(istream& in, std::string &s);
extern Severity ReadPcd(istream& in); //print control directive
extern Severity ReadPcd(istream& in); //print control directive
extern void ReadTokenSeparator(istream& in, std::string *comments = 0);
extern void ReadTokenSeparator(istream& in, std::string *comments = 0);
#endif
-5
View File
@@ -3,11 +3,6 @@
#include <sdai.h>
// The values used here to represent NULL values for numeric types come from
// the ANSI C standard
// LONG_MAX: ex MAXLONG
// FLT_MIN: ex MINFLOAT
const char * SCLversion = "STEP Class Library, github.com/mpictor/StepClassLibrary";
const SCLP23( Integer ) SCLP23( INT_NULL ) = LONG_MAX;
+14 -65
View File
@@ -1,5 +1,5 @@
#ifndef P23SDAI_H
#define P23SDAI_H
#define P23SDAI_H
/*
* NIST STEP Core Class Library
@@ -52,12 +52,9 @@ class STEPattribute;
#define STRING_DELIM '\''
#endif
// STRING
#define S_STRING_NULL ""
// STRING
#define S_STRING_NULL ""
#ifndef CC_NO_NESTED_CLASSES
struct P23_NAMESPACE {
#endif // CC_NO_NESTED_CLASSES
typedef long SCLP23_NAME(Integer);
typedef short SCLP23_NAME(Short);
@@ -66,24 +63,11 @@ typedef unsigned long SCLP23_NAME(ULong);
typedef double SCLP23_NAME(Real);
// C++ from values.h DAS PORT
#ifdef CC_NO_NESTED_CLASSES
extern const SCLP23_NAME(Integer) SCLP23_NAME(INT_NULL);
extern const SCLP23_NAME(Real) SCLP23_NAME(REAL_NULL);
// arbitrary choice by me for number DAS
extern const SCLP23_NAME(Real) SCLP23_NAME(NUMBER_NULL);
#else
#ifdef PART26
extern const SCLP23_NAME(Integer) SCLP23_NAME(INT_NULL);
extern const SCLP23_NAME(Real) SCLP23_NAME(REAL_NULL);
// arbitrary choice by me for number DAS
extern const SCLP23_NAME(Real) SCLP23_NAME(NUMBER_NULL);
#else
static const SCLP23_NAME(Integer) SCLP23_NAME(INT_NULL);
static const SCLP23_NAME(Real) SCLP23_NAME(REAL_NULL);
// arbitrary choice by me for number DAS
static const SCLP23_NAME(Real) SCLP23_NAME(NUMBER_NULL);
#endif
#endif
extern const SCLP23_NAME(Integer) SCLP23_NAME(INT_NULL);
extern const SCLP23_NAME(Real) SCLP23_NAME(REAL_NULL);
// arbitrary choice by me for number DAS
extern const SCLP23_NAME(Real) SCLP23_NAME(NUMBER_NULL);
enum SCLP23_NAME(Access_type) {
SCLP23_NAME(sdaiRO),
@@ -218,8 +202,6 @@ SELECT
******************************************************************************/
#include <sdaiSelect.h>
//typedef char * SCLP23_NAME(Entity_name);
class SCLP23_NAME(Model_contents);
typedef SCLP23_NAME(Model_contents) * SCLP23_NAME(Model_contents_ptr);
typedef SCLP23_NAME(Model_contents_ptr) SCLP23_NAME(Model_contents_var);
@@ -231,30 +213,13 @@ typedef SCLP23_NAME(Model_contents_ptr) SCLP23_NAME(Model_contents_var);
#include <sdaiEntity_extent_set.h>
#include <sdaiModel_contents.h>
#ifndef CC_NO_NESTED_CLASSES
#ifndef PART26
}; // end struct P23_NAMESPACE
#endif // PART26
#endif // CC_NO_NESTED_CLASSES
#ifdef PART26
//#define SDAI_DEF_TIE_P26_Application_instance(x) DEF_TIE_P26_Application_instance(x)
#define Application_instance_i SCLP23(Application_instance)
DEF_TIE_IDL_Application_instance(Application_instance_i)
//DEF_TIE_P26_Application_instance(Application_instance_i)
//DEF_TIE_IDL_Application_instance(SCLP23(Application_instance))
#endif
// ENTITY
// ENTITY
extern SCLP23(Application_instance) NilSTEPentity;
#define ENTITY_NULL &NilSTEPentity
#define NULL_ENTITY &NilSTEPentity
#define S_ENTITY_NULL &NilSTEPentity
#define ENTITY_NULL &NilSTEPentity
#define NULL_ENTITY &NilSTEPentity
#define S_ENTITY_NULL &NilSTEPentity
//#define STEPentity SCLP23_NAME(Application_instance);
typedef SCLP23(Application_instance) STEPentity;
typedef SCLP23(Application_instance)* STEPentity_ptr;
typedef STEPentity_ptr STEPentity_var;
@@ -264,7 +229,7 @@ typedef SCLP23(Application_instance)* STEPentityH;
extern SCLP23(Application_instance) *
ReadEntityRef(istream &in, ErrorDescriptor *err, const char *tokenList,
InstMgr * instances, int addFileId);
InstMgr * instances, int addFileId);
#define SdaiInteger SCLP23(Integer)
#define SdaiReal SCLP23(Real)
@@ -274,7 +239,7 @@ ReadEntityRef(istream &in, ErrorDescriptor *err, const char *tokenList,
#define SdaiString SCLP23(String)
#define SdaiBinary SCLP23(Binary)
#define S_INT_NULL SCLP23(INT_NULL)
#define S_INT_NULL SCLP23(INT_NULL)
#define S_REAL_NULL SCLP23(REAL_NULL)
#define S_NUMBER_NULL SCLP23(NUMBER_NULL)
@@ -294,20 +259,4 @@ inline SCLP23(LOGICAL) *create_LOGICAL() { return new SCLP23(LOGICAL) ; }
// below is outdated
typedef SCLP23(Select) * SdaiSelectH;
//#define INT_NULL MAXLONG
// C from limits.h
//#define S_INT_NULL LONG_MAX
//#define S_REAL_NULL 10 ** DBL_MAX_10_EXP
//#define FLT_MIN 1E-37 - port 29-Mar-1994 kcm
// C++ from values.h DAS PORT
//#define REAL_NULL MINFLOAT
// C from float.h
//#define S_REAL_NULL FLT_MIN
//#define NUMBER_NULL MINFLOAT
// C from float.h
//#define S_NUMBER_NULL FLT_MIN
#endif
+10 -14
View File
@@ -1,5 +1,5 @@
/*****************************************************************************
* trynext.cc *
/*************************************************************************//**
* \file trynext.cc *
* *
* Description: Contains the tryNext() functions for the EntList descen- *
* dants. Their purpose is to search for additional branches *
@@ -17,8 +17,7 @@
static EntList * firstCandidate( EntList * );
static EntList * nextCandidate( EntList * );
MatchType MultList::tryNext( EntNode * ents )
/*
/**
* Loops backwards through the children of this, recursively searching for
* alternate solutions (i.e., OR's which have alternate paths we haven't
* tried yet). We loop through all MultList type children which may have
@@ -28,7 +27,7 @@ MatchType MultList::tryNext( EntNode * ents )
* (reasons discussed in notes, 10/17). This function is the tryNext()
* for AND and ANDOR; the OR version is redefined.
*/
{
MatchType MultList::tryNext( EntNode * ents ) {
MatchType retval;
EntList * child = getLast();
@@ -59,13 +58,12 @@ MatchType MultList::tryNext( EntNode * ents )
return NOMORE;
}
static EntList * firstCandidate( EntList * child )
/*
/**
* Finds an EntList from child's list which may have an OR with more
* choices below it. The acceptable choices are described in commenting
* below.
*/
{
static EntList * firstCandidate( EntList * child ) {
EntList * ent = child->lastNot( SIMPLE );
while( ent != NULL ) {
@@ -80,11 +78,10 @@ static EntList * firstCandidate( EntList * child )
return ent;
}
static EntList * nextCandidate( EntList * child )
/*
/**
* Same as prev function, searches forwards from ent after child.
*/
{
static EntList * nextCandidate( EntList * child ) {
EntList * ent = child->nextNot( SIMPLE );
while( ent != NULL ) {
@@ -96,13 +93,12 @@ static EntList * nextCandidate( EntList * child )
return ent;
}
MatchType OrList::tryNext( EntNode * ents )
/*
/**
* Tries out the next choice of this. Basic algorithm is to first recurse
* to check for other solutions in the descendants of the current choice,
* and then to try our next choice.
*/
{
MatchType OrList::tryNext( EntNode * ents ) {
MatchType retval;
EntList * child;