remove unused code, clean up formatting

This commit is contained in:
Mark Pictor
2011-09-26 17:26:35 -04:00
parent a0353bcff2
commit 275977dfce
36 changed files with 1385 additions and 3460 deletions
+50 -48
View File
@@ -41,7 +41,7 @@
# Minimum required version of CMake
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
# set CMake project name
@@ -77,22 +77,22 @@ SET(_orig_lc_all $ENV{LC_ALL})
SET(_orig_lc_messages $ENV{LC_MESSAGES})
SET(_orig_lang $ENV{LANG})
IF(_orig_lc_all)
SET(ENV{LC_ALL} C)
SET(ENV{LC_ALL} C)
ENDIF(_orig_lc_all)
IF(_orig_lc_messages)
SET(ENV{LC_MESSAGES} C)
SET(ENV{LC_MESSAGES} C)
ENDIF(_orig_lc_messages)
IF(_orig_lang)
SET(ENV{LANG} C)
SET(ENV{LANG} C)
ENDIF(_orig_lang)
# For NFS volumes, to ensure proper file creation.
IF(NOT WIN32)
IF(NOT UMASK)
EXEC_PROGRAM(umask ARGS 022 OUTPUT_VARIABLE exec_out)
ELSE(NOT UMASK)
EXEC_PROGRAM(umask ARGS ${UMASK} OUTPUT_VARIABLE exec_out)
ENDIF(NOT UMASK)
IF(NOT UMASK)
EXEC_PROGRAM(umask ARGS 022 OUTPUT_VARIABLE exec_out)
ELSE(NOT UMASK)
EXEC_PROGRAM(umask ARGS ${UMASK} OUTPUT_VARIABLE exec_out)
ENDIF(NOT UMASK)
ENDIF(NOT WIN32)
#---------------------------------------------------------------------
@@ -109,7 +109,7 @@ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# the RPATH/INSTALL_NAME_DIR to be used when installing
if (NOT APPLE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif(NOT APPLE)
SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
@@ -121,34 +121,34 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#-----------------------------------------------------------------------------
# Output directories.
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
IF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
ELSE(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(WIN32)
IF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
ELSE(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(WIN32)
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
IF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
ENDIF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
IF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
FOREACH(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
STRING(TOUPPER "${CFG_TYPE}" CFG_TYPE)
IF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
IF(WIN32)
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
ELSE(WIN32)
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(WIN32)
ENDIF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
IF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
ENDIF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
IF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
STRING(TOUPPER "${CFG_TYPE}" CFG_TYPE)
IF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
IF(WIN32)
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
ELSE(WIN32)
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(WIN32)
ENDIF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
IF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
ENDIF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
IF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
ENDFOREACH()
@@ -159,18 +159,18 @@ ENDFOREACH()
# for Windows. Only do this if CMAKE_INSTALL_PREFIX hasn't been set
# already, to try and allow parent builds (if any) some control.
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF(NOT WIN32)
IF ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
SET(CMAKE_INSTALL_PREFIX "/usr")
ELSEIF ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
MESSAGE("setting debug output dir")
SET(CMAKE_INSTALL_PREFIX "${SCL_SOURCE_DIR}/../scl-install")
ELSE("${CMAKE_BUILD_TYPE}" MATCHES "Release")
SET(CMAKE_INSTALL_PREFIX "/usr/local")
ENDIF ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
ENDIF(NOT WIN32)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "SCL install prefix" FORCE)
SET(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0)
IF(NOT WIN32)
IF ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
SET(CMAKE_INSTALL_PREFIX "/usr")
ELSEIF ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
MESSAGE("setting debug output dir")
SET(CMAKE_INSTALL_PREFIX "${SCL_SOURCE_DIR}/../scl-install")
ELSE("${CMAKE_BUILD_TYPE}" MATCHES "Release")
SET(CMAKE_INSTALL_PREFIX "/usr/local")
ENDIF ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
ENDIF(NOT WIN32)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "SCL install prefix" FORCE)
SET(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
OPTION(SCL-BUILD_EXPRESS_ONLY "Only build express parser." OFF)
@@ -200,17 +200,19 @@ CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
CHECK_TYPE_SIZE("ssize_t" SSIZE_T)
# Now that all the tests are done, configure the scl_cf.h file:
configure_file(${SCL_BINARY_DIR}/include/scl_cf.h.in ${SCL_BINARY_DIR}/include/scl_cf.h)
add_definitions(
-DHAVE_CONFIG_H -Wall
)
-DHAVE_CONFIG_H -Wall
)
include_directories(
${SCL_SOURCE_DIR}/include
${SCL_BINARY_DIR}/include
)
${SCL_SOURCE_DIR}/include
${SCL_BINARY_DIR}/include
)
ADD_SUBDIRECTORY(src/express)
ADD_SUBDIRECTORY(src/exppp)
+6 -115
View File
@@ -1,22 +1,7 @@
#ifndef SDAIDAOBJECT_H
#define SDAIDAOBJECT_H 1
/*
#include <sclprefixes.h>
#ifdef PART26
#include <CORBA.h>
#include <corbaIncludes.h>
#else
typedef char* DAObjectID;
#endif
#include <Object.h>
*/
#ifndef PART26
typedef char* SCLP23_NAME(DAObjectID);
#endif
// interface PID (ISO/DIS 10303-23:1996(E) 5.3.10.1)
// Also, CORBA POS specification, Section 5.4
@@ -56,7 +41,6 @@ class SCLP23_NAME(PID) : public SCLP23_NAME(sdaiObject)
SCLP23_NAME(PID)();
virtual ~SCLP23_NAME(PID)();
#ifndef PART26
/*
The Datestore_type attribute shall identify the type of the underlying
datastore.
@@ -68,23 +52,8 @@ class SCLP23_NAME(PID) : public SCLP23_NAME(sdaiObject)
This function shall return a string version of the receiver.
*/
char* get_PIDString();
#else
virtual void datastore_type (const char * x, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ _datastore_type = x; }
virtual char * datastore_type (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ return CORBA::string_dupl(_datastore_type); }
virtual char * get_PIDString (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ return CORBA::string_dupl(_pidstring); }
#endif
};
#ifdef PART26
//DEF_TIE_PID( SCLP23_NAME(PID) )
#endif
typedef SCLP23_NAME(PID)* SCLP23_NAME(PID_ptr);
typedef SCLP23_NAME(PID_ptr) SCLP23_NAME(PID_var);
@@ -132,25 +101,11 @@ class SCLP23_NAME(PID_DA): public SCLP23_NAME(PID)
SCLP23_NAME(PID_DA)();
virtual ~SCLP23_NAME(PID_DA)();
#ifndef PART26
virtual void oid (const SCLP23_NAME(DAObjectID) x) { _oid = x; }
virtual SCLP23_NAME(DAObjectID) oid () const
{ return const_cast<char *>(_oid.c_str()); }
#else
// virtual void oid (const SCLP26(DAObjectID) x, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
virtual void oid (const DAObjectID x, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ _oid = x; }
// virtual SCLP26(DAObjectID) oid (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
virtual DAObjectID oid (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ return CORBA::string_dupl(_oid); }
#endif
};
#ifdef PART26
//DEF_TIE_PID_DA( SCLP23(PID_DA) )
#endif
typedef SCLP23_NAME(PID_DA)* SCLP23_NAME(PID_DA_ptr);
typedef SCLP23_NAME(PID_DA_ptr) SCLP23_NAME(PID_DA_var);
@@ -164,10 +119,6 @@ class SCLP23_NAME(PID_SDAI) : public SCLP23_NAME(PID)
public:
SCLP23_NAME(String) _modelid ;
// static PID_SDAI_ptr _duplicate(PID_SDAI_ptr);
// static PID_SDAI_ptr _narrow(SCLP23_NAME(sdaiObject_ptr));
// static PID_SDAI_ptr _nil();
// constructor/destructor
SCLP23_NAME(PID_SDAI)();
virtual ~SCLP23_NAME(PID_SDAI)();
@@ -178,23 +129,10 @@ class SCLP23_NAME(PID_SDAI) : public SCLP23_NAME(PID)
// the persistent identifier of the cluster of data for the
// Model_contents referred to by this PID.
//
#ifndef PART26
virtual void Modelid (const char * x) { _modelid = x; }
virtual char * Modelid () const { return const_cast<char *>(_modelid.c_str()); }
#else
virtual void Modelid (const char * x, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ _modelid = x; }
virtual char * Modelid (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ return CORBA::string_dupl(_modelid); }
#endif
};
#ifdef PART26
//DEF_TIE_PID_SDAI( SCLP23(PID_SDAI) )
#endif
typedef SCLP23_NAME(PID_SDAI)* SCLP23_NAME(PID_SDAI_ptr);
typedef SCLP23_NAME(PID_SDAI_ptr) SCLP23_NAME(PID_SDAI_var);
@@ -215,14 +153,10 @@ typedef SCLP23_NAME(DAObject)* SCLP23_NAME(DAObject_ptr);
typedef SCLP23_NAME(DAObject_ptr) SCLP23_NAME(DAObject_var);
class SCLP23_NAME(DAObject) : public SCLP23_NAME(sdaiObject)
//class DAObject : public SCLP23_NAME(sdaiObject)
{
public:
SCLP23_NAME(String) _dado_oid;
// static DAObject_ptr _duplicate(DAObject_ptr);
// static DAObject_ptr _narrow(SCLP23_NAME(sdaiObject_ptr));
// static DAObject_ptr _nil();
// dado_same (ISO/DIS 10303-23:1996(E) 5.3.10.5)
//
@@ -238,21 +172,9 @@ class SCLP23_NAME(DAObject) : public SCLP23_NAME(sdaiObject)
SCLP23_NAME(DAObject)();
virtual ~SCLP23_NAME(DAObject)();
#ifdef PART26
// virtual SCLP26(Application_instance_ptr) create_TIE();
virtual IDL_Application_instance_ptr create_TIE();
#endif
#ifndef PART26
Boolean dado_same(SCLP23_NAME(DAObject_ptr) obj)
{
// this will make the compiler happy that we used obj
strcmp(obj->dado_oid(),dado_oid());
return BUnset;
}
#else
virtual Boolean dado_same (SCLP23_NAME(DAObject_ptr) obj, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) { return BUnset; }
#endif
Logical dado_same(SCLP23_NAME(DAObject_ptr) obj) {
return LUnknown;
}
// Get persistent label (ISO/DIS 10303-22:1996(E) 10.11.6)
//
@@ -283,14 +205,8 @@ class SCLP23_NAME(DAObject) : public SCLP23_NAME(sdaiObject)
note that the return value as described in the text above
should be a string type.
*/
#ifndef PART26
SCLP23_NAME(DAObjectID) dado_oid()
{ return const_cast<char *>(_dado_oid.c_str()); }
#else
// virtual SCLP26(DAObjectID) dado_oid (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
virtual DAObjectID dado_oid (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ return CORBA::string_dupl(_dado_oid); }
#endif
// dado_pid
//
@@ -301,13 +217,7 @@ class SCLP23_NAME(DAObject) : public SCLP23_NAME(sdaiObject)
part of interface DAObject in the specification of the
Persistent Object Service.
*/
#ifndef PART26
SCLP23_NAME(PID_DA_ptr) dado_pid()
{ return 0; }
#else
virtual SCLP23_NAME(PID_DA_ptr) dado_pid (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ return 0; }
#endif
SCLP23_NAME(PID_DA_ptr) dado_pid() { return 0; }
// dado_remove (ISO/DIS 10303-23:1996(E) 5.3.10.5)
//
@@ -318,13 +228,7 @@ class SCLP23_NAME(DAObject) : public SCLP23_NAME(sdaiObject)
// POS specification description: This deletes the object from the
// persistent store and deletes the in-memory data object.
//
#ifndef PART26
void dado_remove()
{ }
#else
virtual void dado_remove (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ }
#endif
void dado_remove() { }
// dado_free (ISO/DIS 10303-23:1996(E) 5.3.10.5)
//
@@ -338,14 +242,7 @@ class SCLP23_NAME(DAObject) : public SCLP23_NAME(sdaiObject)
// referenced. This operation is only a hint and is provided to improve
// performance and resource usage.
//
#ifndef PART26
void dado_free()
{ }
#else
virtual void dado_free (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException)
{ }
#endif
void dado_free() { }
};
/*
@@ -356,15 +253,9 @@ class SCLP23_NAME(DAObject_SDAI) : public SCLP23_NAME(DAObject) {
public:
SCLP23_NAME(DAObject_SDAI)();
// SCLP23_NAME(DAObject_SDAI)(const SCLP23_NAME(DAObject_SDAI)&);
virtual ~SCLP23_NAME(DAObject_SDAI)();
#ifdef PART26
// virtual SCLP26(Application_instance_ptr) create_TIE();
virtual IDL_Application_instance_ptr create_TIE();
#endif
/*
5.3.10.1.1 Find entity instance SDAI-model
*/
+9 -9
View File
@@ -31,15 +31,15 @@ set(LIBSTEPCORE_SRCS
)
if(MINGW)
set(LIBDEPEND_SRCS
${SCL_SOURCE_DIR}/src/cldai/sdaiObject.cc
${SCL_SOURCE_DIR}/src/cldai/sdaiDaObject.cc
${SCL_SOURCE_DIR}/src/cleditor/instmgr.cc
${SCL_SOURCE_DIR}/src/cleditor/mgrnode.cc
${SCL_SOURCE_DIR}/src/cleditor/dispnode.cc
${SCL_SOURCE_DIR}/src/cleditor/mgrnodearray.cc
${SCL_SOURCE_DIR}/src/cleditor/needFunc.cc
)
set(LIBDEPEND_SRCS
${SCL_SOURCE_DIR}/src/cldai/sdaiObject.cc
${SCL_SOURCE_DIR}/src/cldai/sdaiDaObject.cc
${SCL_SOURCE_DIR}/src/cleditor/instmgr.cc
${SCL_SOURCE_DIR}/src/cleditor/mgrnode.cc
${SCL_SOURCE_DIR}/src/cleditor/dispnode.cc
${SCL_SOURCE_DIR}/src/cleditor/mgrnodearray.cc
${SCL_SOURCE_DIR}/src/cleditor/needFunc.cc
)
endif(MINGW)
SET(LIBSTEPCORE_PRIVATE_HDRS
+464 -532
View File
File diff suppressed because it is too large Load Diff
+23 -50
View File
@@ -10,18 +10,16 @@
* and is not subject to copyright.
*/
/* $Id: ExpDict.inline.cc,v 3.0.1.5 1997/11/05 21:59:20 sauderd DP3.1 $ */
#include <ExpDict.h>
Dictionary_instance::~Dictionary_instance()
{}
Dictionary_instance::~Dictionary_instance() {
}
Schema::Schema( const char * schemaName )
: _use_interface_list( new Interface_spec__set ),
_ref_interface_list( new Interface_spec__set ),
_function_list( 0 ), _procedure_list( 0 ), _global_rules( 0 ) {
: _use_interface_list( new Interface_spec__set ),
_ref_interface_list( new Interface_spec__set ),
_function_list( 0 ), _procedure_list( 0 ), _global_rules( 0 ) {
_name = schemaName;
}
@@ -57,13 +55,11 @@ Interfaced_item::Interfaced_item( const char * foreign_schema )
Interfaced_item::~Interfaced_item() {
}
const Express_id
Interfaced_item::foreign_schema_() {
const Express_id Interfaced_item::foreign_schema_() {
return _foreign_schema;
}
void
Interfaced_item::foreign_schema_( const Express_id & fs ) {
void Interfaced_item::foreign_schema_( const Express_id & fs ) {
_foreign_schema = fs;
}
@@ -147,8 +143,7 @@ Inverse_attributeList::Inverse_attributeList() {
Inverse_attributeList::~Inverse_attributeList() {
}
Inverse_attributeLinkNode *
Inverse_attributeList::AddNode( Inverse_attribute * ad ) {
Inverse_attributeLinkNode * Inverse_attributeList::AddNode( Inverse_attribute * ad ) {
Inverse_attributeLinkNode * node = ( Inverse_attributeLinkNode * ) NewNode();
node->Inverse_attr( ad );
SingleLinkList::AppendNode( node );
@@ -372,61 +367,45 @@ SchRename::rename( const char * schnm, char * newnm ) const
// AttrDescriptor functions
///////////////////////////////////////////////////////////////////////////////
AttrDescriptor::AttrDescriptor(
const char * name, // i.e. char *
const TypeDescriptor * domainType,
Logical optional, // i.e. F U or T
Logical unique, // i.e. F U or T
AttrType_Enum at, // AttrType_Explicit,AttrType_Inverse,
// AttrType_Deriving,AttrType_Redefining
const EntityDescriptor & owner )
: _name( name ), _domainType( domainType ), _optional( optional ),
_unique( unique ), _attrType( at ),
#ifdef __O3DB__
_owner( &owner )
#else
_owner( ( EntityDescriptor & )owner )
#endif
{
AttrDescriptor::AttrDescriptor( const char * name, const TypeDescriptor * domainType,
Logical optional, Logical unique, AttrType_Enum at,
const EntityDescriptor & owner )
: _name( name ), _domainType( domainType ), _optional( optional ),
_unique( unique ), _attrType( at ), _owner( ( EntityDescriptor & )owner ) {
}
AttrDescriptor::~AttrDescriptor()
{ }
AttrDescriptor::~AttrDescriptor() {
}
Logical
AttrDescriptor::Explicit() const {
Logical AttrDescriptor::Explicit() const {
if( _attrType == AttrType_Explicit ) {
return LTrue;
}
return LFalse;
}
Logical
AttrDescriptor::Inverse() const {
Logical AttrDescriptor::Inverse() const {
if( _attrType == AttrType_Inverse ) {
return LTrue;
}
return LFalse;
}
Logical
AttrDescriptor::Redefining() const {
Logical AttrDescriptor::Redefining() const {
if( _attrType == AttrType_Redefining ) {
return LTrue;
}
return LFalse;
}
Logical
AttrDescriptor::Deriving() const {
Logical AttrDescriptor::Deriving() const {
if( _attrType == AttrType_Deriving ) {
return LTrue;
}
return LFalse;
}
/*
// outdated function
void
AttrDescriptor::Derived( SCLP23( LOGICAL ) x ) {
@@ -456,16 +435,10 @@ AttrDescriptor::Derived( const char * x ) {
_attrType = AttrType_Explicit;
}
}
*/
Derived_attribute::Derived_attribute(
const char * name, // i.e. char *
const TypeDescriptor * domainType,
Logical optional, // i.e. F U or T
Logical unique, // i.e. F U or T
AttrType_Enum at, // AttrType_Explicit,AttrType_Inverse,
// AttrType_Deriving,AttrType_Redefining
const EntityDescriptor & owner )
Derived_attribute::Derived_attribute( const char * name, const TypeDescriptor * domainType,
Logical optional, Logical unique, AttrType_Enum at, const EntityDescriptor & owner )
: AttrDescriptor( name, domainType, optional, unique, at, owner ) {
_initializer = ( const char * )0;
}
File diff suppressed because it is too large Load Diff
+39 -112
View File
@@ -30,9 +30,6 @@ extern STEPaggregate NilSTEPaggregate;
class SingleLinkNode;
/******************************************************************************
**
*****************************************************************************/
typedef STEPaggregate * STEPaggregateH;
typedef STEPaggregate * STEPaggregate_ptr;
@@ -85,15 +82,12 @@ class STEPaggregate : public SingleLinkList
// COPY - defined in subtypes
virtual STEPaggregate& ShallowCopy (const STEPaggregate&);
};
/******************************************************************
** Class: GenericAggregate
** Description: This class supports LIST OF:
/****************************************************************//**
** This class supports LIST OF:
** SELECT_TYPE, BINARY_TYPE, GENERIC_TYPE, ENUM_TYPE, UNKNOWN_TYPE type
******************************************************************/
class GenericAggregate : public STEPaggregate
{
public:
@@ -102,7 +96,6 @@ class GenericAggregate : public STEPaggregate
GenericAggregate();
virtual ~GenericAggregate();
};
typedef GenericAggregate * GenericAggregateH;
typedef GenericAggregate * GenericAggregate_ptr;
@@ -126,16 +119,13 @@ class EntityAggregate : public STEPaggregate
EntityAggregate ();
virtual ~EntityAggregate ();
};
typedef EntityAggregate * EntityAggregateH;
typedef EntityAggregate * EntityAggregate_ptr;
typedef EntityAggregate_ptr EntityAggregate_var;
/******************************************************************
** Class: SelectAggregate
** Description: this is a minimal representions for a collection of
** SCLP23(Select)
/****************************************************************//**
** This is a minimal represention for a collection of SCLP23(Select)
******************************************************************/
class SelectAggregate : public STEPaggregate
{
@@ -151,16 +141,14 @@ class SelectAggregate : public STEPaggregate
SelectAggregate ();
virtual ~SelectAggregate ();
};
typedef SelectAggregate * SelectAggregateH;
typedef SelectAggregate * SelectAggregate_ptr;
typedef SelectAggregate_ptr SelectAggregate_var;
/******************************************************************
** Class: StringAggregate
** Description: This class supports LIST OF STRING type
******************************************************************/
/****************************************************************//**
** This class supports LIST OF STRING type
******************************************************************/
class StringAggregate : public STEPaggregate
{
public:
@@ -169,17 +157,15 @@ class StringAggregate : public STEPaggregate
StringAggregate();
virtual ~StringAggregate();
};
typedef StringAggregate * StringAggregateH;
typedef StringAggregate * StringAggregate_ptr;
typedef StringAggregate_ptr StringAggregate_var;
/******************************************************************
** Class: BinaryAggregate
** Description: This class supports LIST OF BINARY type
******************************************************************/
/****************************************************************//**
** This class supports LIST OF BINARY type
******************************************************************/
class BinaryAggregate : public STEPaggregate
{
public:
@@ -194,11 +180,9 @@ typedef BinaryAggregate * BinaryAggregateH;
typedef BinaryAggregate * BinaryAggregate_ptr;
typedef BinaryAggregate_ptr BinaryAggregate_var;
/******************************************************************
** Class: EnumAggregate
** Description: this is a minimal representions for a collection of
** SCLP23(Enum)
******************************************************************/
/**************************************************************//**
** This is a minimal representions for a collection ofSCLP23(Enum)
******************************************************************/
class EnumAggregate : public STEPaggregate
{
public:
@@ -206,8 +190,7 @@ class EnumAggregate : public STEPaggregate
virtual STEPaggregate& ShallowCopy (const STEPaggregate&);
EnumAggregate ();
virtual ~EnumAggregate ();
virtual ~EnumAggregate ();
};
typedef EnumAggregate * EnumAggregateH;
typedef EnumAggregate * EnumAggregate_ptr;
@@ -220,7 +203,6 @@ class LOGICALS : public EnumAggregate
LOGICALS();
virtual ~LOGICALS();
};
typedef LOGICALS * LogicalsH;
typedef LOGICALS * LOGICALS_ptr;
@@ -235,7 +217,6 @@ class BOOLEANS : public EnumAggregate
BOOLEANS();
virtual ~BOOLEANS();
};
typedef BOOLEANS * BOOLEANS_ptr;
@@ -251,7 +232,6 @@ class RealAggregate : public STEPaggregate {
RealAggregate();
virtual ~RealAggregate();
};
typedef RealAggregate * RealAggregateH;
typedef RealAggregate * RealAggregate_ptr;
@@ -265,7 +245,6 @@ class IntAggregate : public STEPaggregate {
IntAggregate();
virtual ~IntAggregate();
};
typedef IntAggregate * IntAggregateH;
typedef IntAggregate * IntAggregate_ptr;
@@ -273,10 +252,6 @@ typedef IntAggregate_ptr IntAggregate_var;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class STEPnode : public SingleLinkNode {
protected:
int _null;
@@ -299,17 +274,13 @@ class STEPnode : public SingleLinkNode {
};
typedef STEPnode * STEPnodeH;
/******************************************************************
** Class: GenericNode
** Description: This class is for the Nodes of GenericAggregates
******************************************************************/
/**************************************************************//**
** This class is for the Nodes of GenericAggregates
******************************************************************/
class GenericAggrNode : public STEPnode {
public:
SCLundefined value;
public:
// INPUT
virtual Severity StrToVal(const char *s, ErrorDescriptor *err);
virtual Severity StrToVal(istream &in, ErrorDescriptor *err);
@@ -329,7 +300,6 @@ class GenericAggrNode : public STEPnode {
~GenericAggrNode ();
virtual SingleLinkNode * NewNode ();
};
/////////////////////////////////////////////////////////////////////////////
@@ -365,48 +335,37 @@ class EntityNode : public STEPnode {
virtual SingleLinkNode * NewNode ();
// Calling these funtions is an error.
Severity StrToVal(const char *s, ErrorDescriptor *err)
{
Severity StrToVal(const char *s, ErrorDescriptor *err) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return StrToVal(s, err, 0, 0, 0);
}
Severity StrToVal(istream &in, ErrorDescriptor *err)
{
Severity StrToVal(istream &in, ErrorDescriptor *err) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return StrToVal(in, err, 0, 0, 0);
}
Severity STEPread(const char *s, ErrorDescriptor *err)
{
Severity STEPread(const char *s, ErrorDescriptor *err) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return STEPread(s, err, 0, 0, 0);
}
Severity STEPread(istream &in, ErrorDescriptor *err)
{
Severity STEPread(istream &in, ErrorDescriptor *err) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return STEPread(in, err, 0, 0, 0);
}
};
///////////////////////////////////////////////////////////////////////////
/******************************************************************
** Class: SelectNode
** Description: this is a minimal representions for node in lists of
** SCLP23(Select)
******************************************************************/
/**************************************************************//**
** This is a minimal representions for node in lists of SCLP23(Select)
******************************************************************/
class SelectNode : public STEPnode {
public:
SCLP23(Select) * node;
public:
// INPUT
virtual Severity StrToVal(const char *s, ErrorDescriptor *err,
const TypeDescriptor *elem_type,
@@ -436,47 +395,35 @@ class SelectNode : public STEPnode {
virtual SingleLinkNode * NewNode ();
// Calling these funtions is an error.
Severity StrToVal(const char *s, ErrorDescriptor *err)
{
Severity StrToVal(const char *s, ErrorDescriptor *err) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return StrToVal(s, err, 0, 0, 0);
}
Severity StrToVal(istream &in, ErrorDescriptor *err)
{
Severity StrToVal(istream &in, ErrorDescriptor *err) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return StrToVal(in, err, 0, 0, 0);
}
Severity STEPread(const char *s, ErrorDescriptor *err)
{
Severity STEPread(const char *s, ErrorDescriptor *err) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return STEPread(s, err, 0, 0, 0);
}
Severity STEPread(istream &in, ErrorDescriptor *err)
{
Severity STEPread(istream &in, ErrorDescriptor *err) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return STEPread(in, err, 0, 0, 0);
}
};
///////////////////////////////////////////////////////////////////////////
/******************************************************************
** Class: StringNode
** Description: This class is for the Nodes of StringAggregates
******************************************************************/
/**************************************************************//**
** This class is for the Nodes of StringAggregates
******************************************************************/
class StringNode : public STEPnode {
public:
SCLP23(String) value;
public:
// INPUT
virtual Severity StrToVal(const char *s, ErrorDescriptor *err);
virtual Severity StrToVal(istream &in, ErrorDescriptor *err);
@@ -496,22 +443,16 @@ class StringNode : public STEPnode {
~StringNode();
virtual SingleLinkNode * NewNode ();
};
///////////////////////////////////////////////////////////////////////////
/******************************************************************
** Class: BinaryNode
** Description: This class is for the Nodes of BinaryAggregates
******************************************************************/
/**************************************************************//**
** This class is for the Nodes of BinaryAggregates
******************************************************************/
class BinaryNode : public STEPnode {
public:
SCLP23(Binary) value;
public:
// INPUT
virtual Severity StrToVal(const char *s, ErrorDescriptor *err);
virtual Severity StrToVal(istream &in, ErrorDescriptor *err);
@@ -531,21 +472,14 @@ class BinaryNode : public STEPnode {
~BinaryNode();
virtual SingleLinkNode * NewNode ();
};
/******************************************************************
** Class: EnumNode
** Description: this is a minimal representions for node in lists of
** SCLP23(Enum)
******************************************************************/
/**************************************************************//**
** This is a minimal representions for node in lists of SCLP23(Enum)
******************************************************************/
class EnumNode : public STEPnode {
public:
SCLP23(Enum) * node;
public:
// INPUT
virtual Severity StrToVal(const char *s, ErrorDescriptor *err);
virtual Severity StrToVal(istream &in, ErrorDescriptor *err);
@@ -564,14 +498,11 @@ class EnumNode : public STEPnode {
~EnumNode();
virtual SingleLinkNode * NewNode ();
};
class RealNode : public STEPnode {
public:
SCLP23(Real) value; // double
public:
// INPUT
virtual Severity StrToVal(const char *s, ErrorDescriptor *err);
virtual Severity StrToVal(istream &in, ErrorDescriptor *err);
@@ -589,14 +520,11 @@ class RealNode : public STEPnode {
~RealNode();
virtual SingleLinkNode * NewNode ();
};
class IntNode : public STEPnode {
public:
SCLP23(Integer) value; // long int
public:
// INPUT
virtual Severity StrToVal(const char *s, ErrorDescriptor *err);
virtual Severity StrToVal(istream &in, ErrorDescriptor *err);
@@ -614,11 +542,10 @@ class IntNode : public STEPnode {
~IntNode();
virtual SingleLinkNode * NewNode ();
};
/******************************************************************
** The following classes are currently stubs
** FIXME The following classes are currently stubs
**
**/
/*
+76 -320
View File
@@ -22,10 +22,11 @@
// in aggregate real handling (STEPaggregate.cc) -- IMS 6 Jun 95
const int Real_Num_Precision = REAL_NUM_PRECISION;
/******************************************************************
/**************************************************************//**
** \class STEPattribute
** Functions for manipulating attribute
** KNOWN BUGS:
**
** FIXME KNOWN BUGS:
** -- error reporting does not include line number information
** -- null attributes are only handled through the attribute pointer class
** direct access of a null attribute will not indicate whether the
@@ -44,8 +45,7 @@ const int Real_Num_Precision = REAL_NUM_PRECISION;
// the value of the attribute is assigned from the supplied string
******************************************************************/
Severity
STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFileId ) {
Severity STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFileId ) {
if( RedefiningAttr() ) {
return RedefiningAttr()->StrToVal( s, instances, addFileId );
}
@@ -166,7 +166,9 @@ STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFileId ) {
}
break;
// case UNKNOWN_TYPE: // should never have this case
case UNKNOWN_TYPE: // should never have this case
std::cerr << "Error: unknown type in STEPattribute::StrToVal, " << __FILE__ << ":" << __LINE__ << std::endl;
abort();
case GENERIC_TYPE:
default:
// other cases are the same for StrToVal and file
@@ -176,23 +178,23 @@ STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFileId ) {
}
/******************************************************************
** Procedure: STEPread
** Returns: Severity, which indicates success, or failure
** value >= SEVERITY_WARNING means program can continue parsing input,
** value <= SEVERITY_INPUT_ERROR is fatal read error
** Description: the value of the attribute is read from istream
** the format expected is STEP exchange file
** modified to accept '$' as value for OPTIONAL ATTRIBUTE,
** (since this function is used for reading files in both
** formats, the function accepts either '$' (new format),
** or nothing (old format)) 31-Jul-1992
******************************************************************/
// does not read the delimiter separating individual attributes (i.e. ',') or
// the delim separating the last attribute from the end of the entity (')').
Severity
STEPattribute::STEPread( istream & in, InstMgr * instances, int addFileId,
/**************************************************************//**
** \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.
**
** Accepts '$' or nothing as value for OPTIONAL ATTRIBUTE, since
** this function is used for reading files in both old an new
** formats.
**
** Does not read the delimiter separating individual attributes (i.e. ',') or
** the delim separating the last attribute from the end of the entity (')').
**
** \returns Severity, which indicates success or failure
** value >= SEVERITY_WARNING means program can continue parsing input,
** value <= SEVERITY_INPUT_ERROR is fatal read error
******************************************************************/
Severity STEPattribute::STEPread( istream & in, InstMgr * instances, int addFileId,
const char * currSch ) {
char errStr[BUFSIZ];
errStr[0] = '\0';
@@ -213,35 +215,6 @@ STEPattribute::STEPread( istream & in, InstMgr * instances, int addFileId,
in >> c;
in.putback( c ); // leave input stream alone
/*
// This precludes using this attribute to read the value for the redefined
// attr.
// this is redefining another attr, it should not be written in a Part 21
// file. It may be written using an asterisk.
if( aDesc->AttrType() == AttrType_Redefining )
{
if(c == '*')
{
in.get(c); // take * off the istream
_error.severity(SEVERITY_WARNING);
sprintf(errStr, " WARNING: attribute %s of type %s, %s",
aDesc->Name(), aDesc->TypeName(),
"Removing asterisk for redefining attribute.\n");
_error.AppendToDetailMsg(errStr);
CheckRemainingInput(in, &_error, aDesc->TypeName(), ",)");
return _error.severity();
}
else
{ // The redefining attribute should not be mapped to a Part 21 file
// anyway so pretend that this function was not called and don't
// read anything.
_error.severity(SEVERITY_NULL);
return _error.severity();
}
}
*/
if( IsDerived() ) {
if( c == '*' ) {
in.get( c ); // take * off the istream
@@ -271,29 +244,9 @@ STEPattribute::STEPread( istream & in, InstMgr * instances, int addFileId,
} else {
_error.severity( SEVERITY_INCOMPLETE );
sprintf( errStr, " missing and required\n" );
// " Warning: attribute '%s : %s' is missing and required.\n",
// Name(), TypeName());
_error.AppendToDetailMsg( errStr );
}
return _error.severity();
/*
case '*':
{
in.get(c); // take * off the istream
if( IsDerived() )
_error.severity(SEVERITY_NULL);
else if( aDesc->AttrType() == AttrType_Redefining )
_error.severity(SEVERITY_NULL);
else {
_error.severity(SEVERITY_INCOMPLETE);
sprintf(errStr,
" attribute not derived or redefining an attribute\n");
_error.AppendToDetailMsg(errStr);
}
CheckRemainingInput(in, &_error, aDesc->TypeName(), ",)");
return _error.severity();
}
*/
}
PrimitiveType attrBaseType = NonRefType();
@@ -322,7 +275,6 @@ STEPattribute::STEPread( istream & in, InstMgr * instances, int addFileId,
return _error.severity();
}
case BOOLEAN_TYPE: {
// int nullable = (aDesc->Optional().asInt() == OPBOOL(BTrue) );
ptr.e->STEPread( in, &_error, Nullable() );
CheckRemainingInput( in, &_error, "boolean", ",)" );
return _error.severity();
@@ -369,7 +321,6 @@ STEPattribute::STEPread( istream & in, InstMgr * instances, int addFileId,
} else {
*( ptr.c ) = S_ENTITY_NULL;
}
// CheckRemainingInput(in, &_error, "enumeration", ",)");
return _error.severity();
}
@@ -401,20 +352,12 @@ STEPattribute::STEPread( istream & in, InstMgr * instances, int addFileId,
}
}
/*********************************************************************
** Procedure: asStr
** Parameters: currSch - used for select type writes. See commenting
** in SCLP23(Select)::STEPwrite().
** Returns:
** Description: the value of the attribute is returned as a string.
** Side Effects:
/*****************************************************************//**
** \param currSch - used for select type writes. See commenting in SCLP23(Select)::STEPwrite().
** \returns the value of the attribute
** Status: complete 3/91
*********************************************************************/
const char *
STEPattribute::asStr( std::string & str, const char * currSch ) const {
// char attrVal[BUFSIZ];
// attrVal[0] = '\0';
const char * STEPattribute::asStr( std::string & str, const char * currSch ) const {
str.clear();
// The attribute has been derived by a subtype's attribute
@@ -423,18 +366,6 @@ STEPattribute::asStr( std::string & str, const char * currSch ) const {
return const_cast<char *>( str.c_str() );
}
/*
// The attribute is redefining the type of a parent's attribute so...
// If explicitly directed to write the attribute value by the
// redefined attribute then write it - indicated by writeRedefined param.
// If not explicitly directed to write value, write asterisk - see Part 21.
// got rid of param writeRedefined
// see technical corrigendum for Part 21
if (!writeRedefined && (aDesc->AttrType() == AttrType_Redefining) ) {
str = "*";
return str.c_str();
}
*/
// The attribute has been redefined by the attribute pointed
// to by _redefAttr so write the redefined value.
if( _redefAttr ) {
@@ -449,14 +380,12 @@ STEPattribute::asStr( std::string & str, const char * currSch ) const {
switch( NonRefType() ) {
case INTEGER_TYPE:
str += ( *( ptr.i ) );
// sprintf ( attrVal,"%ld",*(ptr.i));
break;
case NUMBER_TYPE:
case REAL_TYPE:
str.append( *( ptr.r ), ( int ) Real_Num_Precision );
// sprintf (attrVal, "%.*G", (int) Real_Num_Precision, *(ptr.r));
break;
case ENTITY_TYPE:
@@ -466,7 +395,6 @@ STEPattribute::asStr( std::string & str, const char * currSch ) const {
break;
} else {
( *( ptr.c ) )->STEPwrite_reference( str );
// strncpy(attrVal, str.c_str(), str.Length()+1);
}
break;
@@ -474,7 +402,6 @@ STEPattribute::asStr( std::string & str, const char * currSch ) const {
if( !( ( ptr.b )->empty() ) ) {
( ptr.b ) -> STEPwrite( str );
}
// strncpy(attrVal, str.c_str(), str.Length()+1);
break;
case STRING_TYPE:
@@ -489,7 +416,6 @@ STEPattribute::asStr( std::string & str, const char * currSch ) const {
case SET_TYPE: // DAS
case LIST_TYPE: // DAS
return ptr.a->asStr( str ) ;
// sprintf ( attrVal, "%s", ptr.a->asStr() );
case ENUM_TYPE:
case BOOLEAN_TYPE:
@@ -499,7 +425,6 @@ STEPattribute::asStr( std::string & str, const char * currSch ) const {
case SELECT_TYPE:
ptr.sh -> STEPwrite( str, currSch );
return const_cast<char *>( str.c_str() );
// strncpy (attrVal, tmp.c_str(), BUFSIZ);
case REFERENCE_TYPE:
case GENERIC_TYPE:
@@ -511,33 +436,19 @@ STEPattribute::asStr( std::string & str, const char * currSch ) const {
default:
return ( ptr.u -> asStr( str ) );
}
// return (attrVal);
return const_cast<char *>( str.c_str() );
}
// The value of the attribute is printed to the output stream specified by out.
// The output is in physical file format.
void
STEPattribute::STEPwrite( ostream & out, const char * currSch ) {
/**
* The value of the attribute is printed to the output stream specified by out.
* The output is in physical file format.
*/
void STEPattribute::STEPwrite( ostream & out, const char * currSch ) {
// The attribute has been derived by a subtype's attribute
if( IsDerived() ) {
out << "*";
return;
}
/*
// The attribute is redefining the type of a parent's attribute so...
// If explicitly directed to write the attribute value by the
// redefined attribute then write it - indicated by writeRedefined param.
// If not explicitly directed to write value, write asterisk - see Part 21.
// got rid of param writeRedefined
// see technical corrigendum for Part 21
if (!writeRedefined && (aDesc->AttrType() == AttrType_Redefining) ) {
out << "*";
return;
}
*/
// The attribute has been redefined by the attribute pointed
// to by _redefAttr so write the redefined value.
if( RedefiningAttr() ) {
@@ -558,51 +469,6 @@ STEPattribute::STEPwrite( ostream & out, const char * currSch ) {
case NUMBER_TYPE:
case REAL_TYPE: {
WriteReal( *( ptr.r ), out );
/*
char rbuf[64];
SCLP23(Real) tmp = *(ptr.r);
// IMS (6 Jun 95):
// Previously, this code was explicitly rounding reals with
// magnitude smaller than 1e-9, by doing the following:
// if(tmp > -.00000001 && tmp < .00000001) out << 0.0;
// else...
// No one's quite sure why this was happening, because the %g
// style output used below should shift such things to e-notation
// automagically.
// out << form("%.*G", (int) Real_Num_Precision,tmp);
// replace the above line with this code so that writing the '.' is
// guaranteed for reals. If you use e or E then you get many
// unnecessary trailing zeros. g and G truncates all trailing zeros
// to save space but when no non-zero precision exists it also
// truncates the decimal. The decimal is required by Part 21.
// Also use G instead of g since G writes uppercase E (E instead of e
// is also required by Part 21) when scientific notation is used - DAS
sprintf(rbuf, "%.*G", (int) Real_Num_Precision,tmp);
if(!strchr(rbuf, '.'))
{
int rindex = strlen(rbuf);
rbuf[rindex] = '.';
rbuf[rindex+1] = '\0';
}
out << rbuf;
*/
// IMS (21 Jul 95)
// Real values, according to Part 21, _must_ have a fractional part.
// So make sure we have one on integral values:
// this works sometimes but doesn't work when the value has enough
// significant digits that the fraction gets truncated (and can't be
// represented) but is not big enough that scientific notation gets
// used. There may be other cases where it doesn't work but one is
// enough. DAS
// if (tmp == int(tmp)) // tmp doesn't have a fraction
// out << ".0";
break;
}
@@ -732,8 +598,7 @@ STEPattribute::STEPwrite( ostream & out, const char * currSch ) {
}
int
STEPattribute::ShallowCopy( STEPattribute * sa ) {
int STEPattribute::ShallowCopy( STEPattribute * sa ) {
if( RedefiningAttr() ) {
return RedefiningAttr()->ShallowCopy( sa );
}
@@ -777,12 +642,12 @@ STEPattribute::ShallowCopy( STEPattribute * sa ) {
return 1;
}
// for a string attribute this means, make it not exist i.e. SCLP23(String)
// will exist in member variable ptr but SCLP23(string) will be told to report
// as not containing a value (even a value of no chars).
Severity
STEPattribute::set_null() {
/**
* for a string attribute this means, make it not exist i.e. SCLP23(String)
* will exist in member variable ptr but SCLP23(string) will be told to report
* as not containing a value (even a value of no chars).
*/
Severity STEPattribute::set_null() {
if( RedefiningAttr() ) {
return RedefiningAttr()->set_null();
}
@@ -856,11 +721,11 @@ STEPattribute::set_null() {
}
}
// For a string value this reports whether the string exists (as reported by
// SCLP23(String) ) not whether SCLP23(String) contains a null string.
int
STEPattribute::is_null() const {
/**
* For a string value this reports whether the string exists (as reported by
* SCLP23(String) ) not whether SCLP23(String) contains a null string.
*/
int STEPattribute::is_null() const {
if( _redefAttr ) {
return _redefAttr->is_null();
}
@@ -912,15 +777,11 @@ STEPattribute::is_null() const {
}
}
/******************************************************************
** Procedure: operator ==
** Parameters: STEPattribute & a1 and a2
** Returns: int -- if 0 => not equal
** Description: evaluates the equality of two attributes
** Side Effects: none
******************************************************************/
// equality for STEPattribute
/**************************************************************//**
** \return int -- if 0 => not equal
** evaluates the equality of two attributes
** Side Effects: none
******************************************************************/
int operator == ( STEPattribute & a1, STEPattribute & a2 ) {
if ( a1.aDesc == a2.aDesc ) {
return 1;
@@ -930,15 +791,13 @@ int operator == ( STEPattribute & a1, STEPattribute & a2 ) {
///////////////////////////////////////////////////////////////////////////////
// returns the severity level that the parameter attrValue would pass if it
// was the value for this attribute.
// *note* for string values - (attrValue = 0) => string value does not exist,
// attrValue exists it is valid.
///////////////////////////////////////////////////////////////////////////////
Severity
STEPattribute::ValidLevel( const char * attrValue, ErrorDescriptor * error,
/**************************************************************//**
* \returns the severity level that the parameter attrValue would pass if it
* was the value for this attribute.
* *note* for string values - (attrValue = 0) => string value does not exist,
* attrValue exists it is valid.
******************************************************************/
Severity STEPattribute::ValidLevel( const char * attrValue, ErrorDescriptor * error,
InstMgr * im, int clearError ) {
if( clearError ) {
ClearErrorMsg();
@@ -1025,33 +884,25 @@ STEPattribute::ValidLevel( const char * attrValue, ErrorDescriptor * error,
}
}
/******************************************************************
** Procedure: operator <<
** Parameters: ostream & out -- output stream
** STEPattribute & a -- attribute to output
** Returns: ostream &
** Description: overloads the output operator to print an attribute
******************************************************************/
/**************************************************************//**
** \param out -- output stream
** \param a -- attribute to output
** Description: overloads the output operator to print an attribute
******************************************************************/
ostream & operator<< ( ostream & out, STEPattribute & a ) {
a.STEPwrite( out );
return out;
}
///////////////////////////// AddErrorInfo() //////////////////////////////////
// This adds prepends attribute information to the detailed error msg. This
// is intended to add information to the error msgs written by Enumerations,
// Aggregates, and SCLP23(String)s which don't know they are a STEPattribute
// value.
///////////////////////////////////////////////////////////////////////////////
void
STEPattribute::AddErrorInfo() {
/**************************************************************//**
* This prepends attribute information to the detailed error msg. This
* is intended to add information to the error msgs written by Enumerations,
* Aggregates, and SCLP23(String)s which don't know they are a STEPattribute
* value.
******************************************************************/
void STEPattribute::AddErrorInfo() {
char errStr[BUFSIZ];
errStr[0] = '\0';
if( SEVERITY_INPUT_ERROR < _error.severity() &&
_error.severity() < SEVERITY_NULL ) {
sprintf( errStr, " Warning: ATTRIBUTE '%s : %s : %d' - ",
@@ -1068,18 +919,13 @@ STEPattribute::AddErrorInfo() {
}
}
///////////////////////////////////////////////////////////////////////////////
// this function reads until it hits eof or one of the StopChars.
// if it hits one of StopChars it puts it back.
// RETURNS: the last char it read.
char
STEPattribute::SkipBadAttr( istream & in, char * StopChars ) {
#if defined(__GNUC__) && (__GNUC__ > 2)
/**************************************************************//**
* this function reads until it hits eof or one of the StopChars.
* if it hits one of StopChars it puts it back.
* RETURNS: the last char it read.
******************************************************************/
char STEPattribute::SkipBadAttr( istream & in, char * StopChars ) {
ios_base::fmtflags flbuf = in.flags();
#else
ios::fmtflags flbuf = in.flags();
#endif
in.unsetf( ios::skipws ); // turn skipping whitespace off
// read bad data until end of this attribute or entity.
@@ -1108,93 +954,3 @@ STEPattribute::SkipBadAttr( istream & in, char * StopChars ) {
in.flags( flbuf ); // set skip whitespace to its original state
return c;
}
/////////////////// READ
#ifdef OBSOLETE
// appends char 'c' to char * 's' starting at index 'index'. 'index' is
// incremented by one and returned. If assigning 'c' will cause 's' to be
// larger than size 'sSize' then 's' is deleted and reallocated and 's' and
// 'sSize' are changed and returned appropriately.
void
AppendChar( char c, int & index, char *&s, int & sSize ) {
if( index >= sSize - 1 ) {
char * tmp = s;
s = new char[sSize * 2];
strcpy( s, tmp );
delete [] tmp;
sSize = sSize * 2;
}
s[index] = c;
index++;
s[index] = '\0';
}
/////////////////// STEPread_reference()
STEPentity *
STEPread_reference( const char * s, ErrorDescriptor * err, InstMgr * instances,
int addFileId ) {
char errStr[BUFSIZ];
errStr[0] = '\0';
int fileId = -1;
int numfound;
if( numfound = sscanf( ( char * )s, " #%d ", &fileId ) ) {
;
} else( numfound = sscanf( ( char * )s, " @%d ", &fileId ) )
;
if( ( numfound != EOF ) && ( numfound > 0 ) ) {
fileId = fileId + addFileId;
if( !instances ) {
sprintf( errStr, "STEPread_reference(): %s - entity #%d %s.\n",
"BUG - cannot read reference without the InstMgr", fileId,
"is unknown to attribute" );
err->AppendToDetailMsg( errStr );
err->GreaterSeverity( SEVERITY_BUG );
return S_ENTITY_NULL;
}
// lookup which object has id as its instance fileId
STEPentity * inst;
/* If there is a ManagerNode it should have a STEPentity */
MgrNode * mn = 0;
mn = instances->FindFileId( fileId );
if( mn ) {
inst = mn->GetSTEPentity() ;
if( inst ) {
return ( inst );
} else {
sprintf( errStr,
"%s - entity #%d %s.\n",
"BUG - MgrNode::GetSTEPentity returned NULL pointer",
fileId, "is unknown to attribute" );
err->AppendToDetailMsg( errStr );
err->GreaterSeverity( SEVERITY_BUG );
return S_ENTITY_NULL;
}
} else {
sprintf( errStr, "Reference to non-existent ENTITY #%d.\n", fileId );
err->AppendToDetailMsg( errStr );
err->GreaterSeverity( SEVERITY_WARNING );
return S_ENTITY_NULL;
}
} else {
numfound = sscanf( ( char * )s, " %*s " );
if( numfound == EOF ) {
err->GreaterSeverity( SEVERITY_INCOMPLETE );
} else {
sprintf( errStr, " Invalid entity identifier # %s.\n", s );
err->AppendToDetailMsg( errStr );
err->GreaterSeverity( SEVERITY_WARNING );
}
return S_ENTITY_NULL;
}
}
#endif
+75 -86
View File
@@ -1,5 +1,5 @@
#ifndef STEPATTRIBUTE_H
#define STEPATTRIBUTE_H 1
#define STEPATTRIBUTE_H 1
/*
* NIST STEP Core Class Library
@@ -38,97 +38,87 @@ class EntityDescriptor;
#include <sstream>
extern int SetErrOnNull(const char *attrValue, ErrorDescriptor *error);
////////////////////
////////////////////
extern Severity
CheckRemainingInput(istream &in, ErrorDescriptor *err,
const char *typeName, // used in error message
const char *tokenList); // e.g. ",)"
extern Severity CheckRemainingInput(istream &in, ErrorDescriptor *err,
const char *typeName, // used in error message
const char *tokenList); // e.g. ",)"
extern SCLP23(Application_instance) *
ReadEntityRef(istream &in, ErrorDescriptor *err, const char *tokenList,
InstMgr * instances, int addFileId);
extern SCLP23(Application_instance) * ReadEntityRef(istream &in, ErrorDescriptor *err, const char *tokenList,
InstMgr * instances, int addFileId);
extern SCLP23(Application_instance) *
ReadEntityRef(const char * s, ErrorDescriptor *err, const char *tokenList,
InstMgr * instances, int addFileId);
extern SCLP23(Application_instance) * ReadEntityRef(const char * s, ErrorDescriptor *err, const char *tokenList,
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)
ErrorDescriptor *err);
extern Severity EntityValidLevel(SCLP23(Application_instance) *se,
const TypeDescriptor *ed, // entity type that entity se needs
// to match. (this must be an
// EntityDescriptor)
ErrorDescriptor *err);
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)
ErrorDescriptor *err, InstMgr *im, int clearError);
/**
* \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)
ErrorDescriptor *err, InstMgr *im, int clearError);
////////////////////
////////////////////
extern SCLP23(Application_instance) *STEPread_reference (const char * s, ErrorDescriptor *err,
InstMgr * instances, int addFileId);
InstMgr * instances, int addFileId);
////////////////////
extern int QuoteInString(istream& in);
extern int QuoteInString(istream& in);
extern void AppendChar(char c, int& index, char *&s, int& sSize);
extern void AppendChar(char c, int& index, char *&s, int& sSize);
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);
class STEPattribute {
friend ostream &operator<< ( ostream&, STEPattribute& );
// The CenterLine compiler couldn't handle this friend declaration.
// Here is the error
// "../../../src/clstepcore/STEPattribute.h", line 118: internal << AT&T C++ Translator 3.0.2 - ObjectCenter Version 2.1>> error: cannot find friend P23::Application_instance
// We may want to change the next two lines back at some point? DAS FIXME
// friend class SCLP23(Application_instance);
// protected:
public:
friend class SCLP23(Application_instance);
protected:
ErrorDescriptor _error;
unsigned int _derive : 1;
int Derive (unsigned int n =1) { return _derive =n; }
STEPattribute *_redefAttr;
void RedefiningAttr(STEPattribute *a) { _redefAttr = a; }
public:
const AttrDescriptor * aDesc;
// 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
// class in the generated schema class library (the entity class is
// inherited from SCLP23(Application_instance))
/**
** 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
** class in the generated schema class library (the entity class is
** inherited from SCLP23(Application_instance))
*/
union {
SCLP23(String) *S;// STRING_TYPE
SCLP23(Integer) *i; // INTEGER_TYPE (Integer is a long int)
SCLP23(Binary) *b; // BINARY_TYPE
SCLP23(Real) *r; // REAL_TYPE and NUMBER_TYPE (Real is a double)
SCLP23(Application_instance)* *c; // ENTITY_TYPE
STEPaggregate *a; // AGGREGATE_TYPE
SCLP23(Enum) *e; // ENUM_TYPE, BOOLEAN_TYPE, and LOGICAL_TYPE
SCLP23(Select) *sh; // SELECT_TYPE
SCLundefined *u; // UNKNOWN_TYPE
void *p;
} ptr;
SCLP23(String) *S; // STRING_TYPE
SCLP23(Integer) *i; // INTEGER_TYPE (Integer is a long int)
SCLP23(Binary) *b; // BINARY_TYPE
SCLP23(Real) *r; // REAL_TYPE and NUMBER_TYPE (Real is a double)
SCLP23(Application_instance)* *c; // ENTITY_TYPE
STEPaggregate *a; // AGGREGATE_TYPE
SCLP23(Enum) *e; // ENUM_TYPE, BOOLEAN_TYPE, and LOGICAL_TYPE
SCLP23(Select) *sh; // SELECT_TYPE
SCLundefined *u; // UNKNOWN_TYPE
void *p;
} ptr;
protected:
char SkipBadAttr(istream& in, char *StopChars);
@@ -139,9 +129,9 @@ class STEPattribute {
///////////// Read, Write, Assign attr value
Severity StrToVal(const char *s, InstMgr *instances =0,
int addFileId =0);
int addFileId =0);
Severity STEPread(istream& in = cin, InstMgr *instances =0,
int addFileId =0, const char * =NULL);
int addFileId =0, const char * =NULL);
const char * asStr(std::string&, const char * =0) const;
// return the attr value as a string
@@ -153,50 +143,49 @@ class STEPattribute {
////////////// Return info on attr
int Nullable() const; // may this attribute be null?
int is_null () const; // is this attribute null?
int IsDerived () const { return _derive; }
int Nullable() const; // may this attribute be null?
int is_null () const; // is this attribute null?
int IsDerived () const { return _derive; }
STEPattribute *RedefiningAttr() { return _redefAttr; }
const char * Name() const;
const char * TypeName() const;
const BASE_TYPE Type() const;
const BASE_TYPE NonRefType() const;
const BASE_TYPE BaseType() const;
const char * Name() const;
const char * TypeName() const;
const BASE_TYPE Type() const;
const BASE_TYPE NonRefType() const;
const BASE_TYPE BaseType() const;
const TypeDescriptor *ReferentType() const;
ErrorDescriptor &Error() { return _error; }
void ClearErrorMsg() { _error.ClearErrorMsg(); }
ErrorDescriptor &Error() { return _error; }
void ClearErrorMsg() { _error.ClearErrorMsg(); }
Severity ValidLevel (const char *attrValue, ErrorDescriptor *error,
InstMgr *im, int clearError = 1);
InstMgr *im, int clearError = 1);
public:
////////////////// Constructors
STEPattribute (const STEPattribute& a);
STEPattribute () {};
~STEPattribute () {};
// INTEGER
// INTEGER
STEPattribute (const class AttrDescriptor& d, SCLP23(Integer) *p);
// BINARY
// BINARY
STEPattribute (const class AttrDescriptor& d, SCLP23(Binary) *p);
// STRING
// STRING
STEPattribute (const class AttrDescriptor& d, SCLP23(String) *p);
// REAL & NUMBER
// REAL & NUMBER
STEPattribute (const class AttrDescriptor& d, SCLP23(Real) *p);
// ENTITY
// ENTITY
STEPattribute (const class AttrDescriptor& d, SCLP23(Application_instance)* *p);
// AGGREGATE
// AGGREGATE
STEPattribute (const class AttrDescriptor& d, STEPaggregate *p);
// ENUMERATION and Logical
// ENUMERATION and Logical
STEPattribute (const class AttrDescriptor& d, SCLP23(Enum) *p);
// SELECT
// SELECT
STEPattribute (const class AttrDescriptor& d, SCLP23(Select) *p);
// UNDEFINED
// UNDEFINED
STEPattribute (const class AttrDescriptor& d, SCLundefined *p);
friend int operator == (STEPattribute &a1, STEPattribute &a2);
+7 -14
View File
@@ -78,53 +78,46 @@ STEPattribute::STEPattribute( const class AttrDescriptor & d, SCLundefined * p )
// name is the same even if redefined
const char *
STEPattribute::Name() const {
const char * STEPattribute::Name() const {
return aDesc->Name();
}
const char *
STEPattribute::TypeName() const {
const char * STEPattribute::TypeName() const {
if( _redefAttr ) {
return _redefAttr->TypeName();
}
return aDesc->TypeName();
}
const BASE_TYPE
STEPattribute::Type() const {
const BASE_TYPE STEPattribute::Type() const {
if( _redefAttr ) {
return _redefAttr->Type();
}
return aDesc->Type();
}
const BASE_TYPE
STEPattribute::NonRefType() const {
const BASE_TYPE STEPattribute::NonRefType() const {
if( _redefAttr ) {
return _redefAttr->NonRefType();
}
return aDesc->NonRefType();
}
const BASE_TYPE
STEPattribute::BaseType() const {
const BASE_TYPE STEPattribute::BaseType() const {
if( _redefAttr ) {
return _redefAttr->BaseType();
}
return aDesc->BaseType();
}
const TypeDescriptor *
STEPattribute::ReferentType() const {
const TypeDescriptor * STEPattribute::ReferentType() const {
if( _redefAttr ) {
return _redefAttr->ReferentType();
}
return aDesc->ReferentType();
}
int
STEPattribute::Nullable() const {
int STEPattribute::Nullable() const {
if( _redefAttr ) {
return _redefAttr->Nullable();
}
-5
View File
@@ -10,13 +10,9 @@
* and is not subject to copyright.
*/
/* $Id: STEPattributeList.cc,v 3.0.1.3 1997/11/05 21:59:26 sauderd DP3.1 $ */
#include <STEPattributeList.h>
#include <STEPattribute.h>
//#include <stdlib.h>
AttrListNode::AttrListNode( STEPattribute * a ) {
attr = a;
}
@@ -44,7 +40,6 @@ STEPattribute & STEPattributeList::operator []( int n ) {
return *( a->attr );
}
// else
cerr << "\nERROR in STEP Core library: " << __FILE__ << ":"
<< __LINE__ << "\n" << _POC_ << "\n\n";
abort();
+9 -28
View File
@@ -13,22 +13,10 @@
* and is not subject to copyright.
*/
/* $Id: STEPattributeList.h,v 3.0.1.3 1997/11/05 21:59:25 sauderd DP3.1 $ */
#ifdef __O3DB__
#include <OpenOODB.h>
#endif
//#ifndef _STEPattribute_typedefs
//#define _STEPattribute_typedefs 1
//#include <STEPattribute.h>
class STEPattribute;
#include <SingleLinkList.h>
//class STEPattribute;
class STEPattributeList;
//class AttrListNode;
class AttrListNode : public SingleLinkNode
{
@@ -54,23 +42,16 @@ class STEPattributeList : public SingleLinkList
void push(STEPattribute *a);
};
/*****************************************************************
** **
** This file defines the type STEPattributeList -- a list **
** of pointers to STEPattribute objects. The nodes on the **
/*************************************************************//**
** \file STEPattributeList.h
** This file defines the type STEPattributeList -- a list
** of pointers to STEPattribute objects. The nodes on the
** list point to STEPattributes.
** **
USED TO BE - DAS
** The file was generated by using GNU's genclass.sh **
** script with the List prototype definitions. The **
** command to generate it was as follows: **
genclass.sh STEPattribute ref List STEPattribute
** The file is dependent on the file "STEPattribute.h" **
** which contains the definition of STEPattribute. **
** **
** 1/15/91 kcm **
**
** The file is dependent on the file "STEPattribute.h"
** which contains the definition of STEPattribute.
**
** 1/15/91 kcm
*****************************************************************/
#endif
+46 -89
View File
@@ -6,18 +6,11 @@
#include <STEPattribute.h>
#include <sstream>
extern const char *
ReadStdKeyword( istream & in, std::string & buf, int skipInitWS );
extern const char * ReadStdKeyword( istream & in, std::string & buf, int skipInitWS );
STEPcomplex::STEPcomplex( Registry * registry, int fileid )
: SCLP23( Application_instance )( fileid, 1 ), sc( 0 ), head( this ), _registry( registry ), visited( 0 ) {
/*
_complex = 1;
_registry = registry;
sc = 0;
visited = 0;
*/
}
STEPcomplex::STEPcomplex( Registry * registry, const std::string ** names,
@@ -44,9 +37,7 @@ STEPcomplex::STEPcomplex( Registry * registry, const char ** names, int fileid,
Initialize( names, schnm );
}
void
STEPcomplex::Initialize( const char ** names, const char * schnm )
/*
/**
* Called by the STEPcomplex constructors to validate the names in our
* list, see if they represent a legal entity combination, and build the
* complex list. schnm is the name of the current schema if applicable.
@@ -57,7 +48,7 @@ STEPcomplex::Initialize( const char ** names, const char * schnm )
* A and renames it to Y.) Registry::FindEntity() below knows how to
* search using the current name of each entity based on schnm.
*/
{
void STEPcomplex::Initialize( const char ** names, const char * schnm ) {
// Create an EntNode list consisting of all the names in the complex ent:
EntNode * ents = new EntNode( names ),
*eptr = ents, *prev = NULL, *enext;
@@ -155,8 +146,7 @@ STEPcomplex::~STEPcomplex() {
}
}
void
STEPcomplex::AssignDerives() {
void STEPcomplex::AssignDerives() {
STEPattribute * a = 0;
STEPcomplex * scomp1 = head;
STEPcomplex * scomp2;
@@ -165,9 +155,6 @@ STEPcomplex::AssignDerives() {
AttrDescLinkNode * attrPtr;
const AttrDescriptor * ad;
// find out how many attrs there are
// int attrCount = attrList->EntryCount();
while( scomp1 && scomp1->eDesc ) {
a = 0;
attrList = &( scomp1->eDesc->ExplicitAttr() );
@@ -189,14 +176,11 @@ STEPcomplex::AssignDerives() {
scomp2 = head;
while( scomp2 && !a ) {
if( scomp1 != scomp2 ) {
// scomp2->MakeDerived ( ad->Name() );
scomp2->MakeDerived( attrNm );
// a = scomp2->GetSTEPattribute( ad->Name() );
a = scomp2->GetSTEPattribute( attrNm );
}
scomp2 = scomp2->sc;
}
// if (a) a ->Derive ();
}
// increment attr
attrPtr = ( AttrDescLinkNode * )attrPtr->NextNode();
@@ -205,11 +189,11 @@ STEPcomplex::AssignDerives() {
}
}
// this function should only be called for the head entity
// in the list of entity parts.
void
STEPcomplex::AddEntityPart( const char * name ) {
/** \fn STEPcomplex::AddEntityPart
** this function should only be called for the head entity
** in the list of entity parts.
*/
void STEPcomplex::AddEntityPart( const char * name ) {
STEPcomplex * scomplex;
if( name ) {
@@ -217,7 +201,6 @@ STEPcomplex::AddEntityPart( const char * name ) {
scomplex->BuildAttrs( name );
if( scomplex->eDesc ) {
scomplex->head = this;
// scomplex->STEPfile_id = STEPfile_id;
AppendEntity( scomplex );
} else {
cout << scomplex->_error.DetailMsg() << endl;
@@ -226,8 +209,7 @@ STEPcomplex::AddEntityPart( const char * name ) {
}
}
STEPcomplex *
STEPcomplex::EntityPart( const char * name, const char * currSch ) {
STEPcomplex * STEPcomplex::EntityPart( const char * name, const char * currSch ) {
STEPcomplex * scomp = head;
std::string s1, s2;
while( scomp ) {
@@ -243,18 +225,17 @@ STEPcomplex::EntityPart( const char * name, const char * currSch ) {
return 0;
}
int
STEPcomplex::EntityExists( const char * name, const char * currSch ) {
int STEPcomplex::EntityExists( const char * name, const char * currSch ) {
return ( EntityPart( name, currSch ) ? 1 : 0 );
}
// Check if a given entity (by descriptor) is the same as this one.
// For a complex entity, we'll check the EntityDescriptor of each entity
// in the complex 'chain'
const EntityDescriptor *
STEPcomplex::IsA( const EntityDescriptor * ed ) const {
/**
** Check if a given entity (by descriptor) is the same as this one.
** For a complex entity, we'll check the EntityDescriptor of each entity
** in the complex 'chain'
*/
const EntityDescriptor * STEPcomplex::IsA( const EntityDescriptor * ed ) const {
const EntityDescriptor * return_ed = eDesc->IsA( ed );
if( !return_ed && sc ) {
return sc->IsA( ed );
} else {
@@ -262,15 +243,13 @@ STEPcomplex::IsA( const EntityDescriptor * ed ) const {
}
}
Severity
STEPcomplex::ValidLevel( ErrorDescriptor * error, InstMgr * im,
Severity STEPcomplex::ValidLevel( ErrorDescriptor * error, InstMgr * im,
int clearError ) {
cout << "STEPcomplex::ValidLevel() not implemented.\n";
return SEVERITY_NULL;
}
void
STEPcomplex::AppendEntity( STEPcomplex * stepc ) {
void STEPcomplex::AppendEntity( STEPcomplex * stepc ) {
if( sc ) {
sc->AppendEntity( stepc );
} else {
@@ -279,8 +258,7 @@ STEPcomplex::AppendEntity( STEPcomplex * stepc ) {
}
// READ
Severity
STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
istream & in, const char * currSch, int useTechCor ) {
char c;
std::string typeNm;
@@ -342,10 +320,10 @@ STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
return _error.severity();
}
//FIXME delete this?
#ifdef buildwhileread
// READ
Severity
STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
istream & in, const char * currSch ) {
ClearError( 1 );
STEPfile_id = id;
@@ -371,7 +349,6 @@ STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
in >> ws;
in.get( c );
}
// STEPcomplex *EntityPart(const char *name);
if( c != '(' ) {
_error.AppendToDetailMsg(
@@ -429,8 +406,7 @@ STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
#endif
void
STEPcomplex::BuildAttrs( const char * s ) {
void STEPcomplex::BuildAttrs( const char * s ) {
// assign inherited member variable
eDesc = ( class EntityDescriptor * )_registry->FindEntity( s );
@@ -511,14 +487,6 @@ STEPcomplex::BuildAttrs( const char * s ) {
a -> set_null();
attributes.push( a );
}
/* // for when inverse information is included
else if( (LOGICAL)( ad->Inverse() ) == sdaiTRUE)
{
str.Append('(');
endchar = ')';
}
*/
attrPtr = ( AttrDescLinkNode * )attrPtr->NextNode();
}
} else {
@@ -527,22 +495,19 @@ STEPcomplex::BuildAttrs( const char * s ) {
}
}
void
STEPcomplex::STEPread_error( char c, int index, istream & in ) {
void STEPcomplex::STEPread_error( char c, int index, istream & in ) {
cout << "STEPcomplex::STEPread_error() \n";
}
// WRITE
// These functions take into account the current schema, so that if an entity
// or attribute type is renamed in this schema (using the USE/REF clause) the
// new name is written out. They do not, however, comply with the requirement
// in the standard that the entity parts of a complex entity must be printed in
// alphabetical order. The nodes are sorted alphabetically according to their
// original names but not according to their renamed names (DAR 6/5/97).
void
STEPcomplex::STEPwrite( ostream & out, const char * currSch, int writeComment ) {
/**
** These functions take into account the current schema, so that if an entity
** or attribute type is renamed in this schema (using the USE/REF clause) the
** new name is written out. They do not, however, comply with the requirement
** in the standard that the entity parts of a complex entity must be printed in
** alphabetical order. The nodes are sorted alphabetically according to their
** original names but not according to their renamed names (DAR 6/5/97).
*/
void STEPcomplex::STEPwrite( ostream & out, const char * currSch, int writeComment ) {
if( writeComment && p21Comment && !p21Comment->empty() ) {
out << p21Comment->c_str();
}
@@ -551,8 +516,7 @@ STEPcomplex::STEPwrite( ostream & out, const char * currSch, int writeComment )
out << ");\n";
}
const char *
STEPcomplex::STEPwrite( std::string & buf, const char * currSch ) {
const char * STEPcomplex::STEPwrite( std::string & buf, const char * currSch ) {
buf.clear();
stringstream ss;
@@ -566,8 +530,8 @@ STEPcomplex::STEPwrite( std::string & buf, const char * currSch ) {
return const_cast<char *>( buf.c_str() );
}
void
STEPcomplex::WriteExtMapEntities( ostream & out, const char * currSch ) {
/** \copydoc STEPcomplex::STEPwrite */
void STEPcomplex::WriteExtMapEntities( ostream & out, const char * currSch ) {
std::string tmp;
out << StrToUpper( EntityName( currSch ), tmp );
out << "(";
@@ -585,12 +549,10 @@ STEPcomplex::WriteExtMapEntities( ostream & out, const char * currSch ) {
}
}
const char *
STEPcomplex::WriteExtMapEntities( std::string & buf, const char * currSch ) {
/** \copydoc STEPcomplex::STEPwrite */
const char * STEPcomplex::WriteExtMapEntities( std::string & buf, const char * currSch ) {
std::string tmp;
// sprintf(instanceInfo, "%s(", (char *)StrToUpper( EntityName(), tmp ) );
// buf.Append(instanceInfo);
buf.append( ( char * )StrToUpper( EntityName( currSch ), tmp ) );
buf.append( "i" );
@@ -613,8 +575,7 @@ STEPcomplex::WriteExtMapEntities( std::string & buf, const char * currSch ) {
return const_cast<char *>( buf.c_str() );
}
void
STEPcomplex::CopyAs( SCLP23( Application_instance ) *se ) {
void STEPcomplex::CopyAs( SCLP23( Application_instance ) *se ) {
if( !se->IsComplex() ) {
char errStr[BUFSIZ];
cerr << "STEPcomplex::CopyAs() called with non-complex entity: "
@@ -628,8 +589,6 @@ STEPcomplex::CopyAs( SCLP23( Application_instance ) *se ) {
_error.GreaterSeverity( SEVERITY_BUG );
return;
} else {
// STEPcomplex * sc = 0;
STEPcomplex * scpartCpyTo = head;
STEPcomplex * scpartCpyFrom = ( ( STEPcomplex * )se )->head;
while( scpartCpyTo && scpartCpyFrom ) {
@@ -638,11 +597,9 @@ STEPcomplex::CopyAs( SCLP23( Application_instance ) *se ) {
scpartCpyFrom = scpartCpyFrom->sc;
}
}
// cout << "ERROR: STEPcomplex::CopyAs() not implemented.\n";
}
SCLP23( Application_instance ) *
STEPcomplex::Replicate() {
SCLP23( Application_instance ) * STEPcomplex::Replicate() {
if( !IsComplex() ) {
return SCLP23( Application_instance )::Replicate();
} else if( !_registry ) {
@@ -679,11 +636,11 @@ STEPcomplex::Replicate() {
seNew -> CopyAs( this );
return seNew;
// need to:
// get registry
// create list of entity names
// send them to constructor for STEPcomplex
// implement STEPcomplex::CopyAs()
// call seNew->CopyAs()
// TODO need to:
// get registry
// create list of entity names
// send them to constructor for STEPcomplex
// implement STEPcomplex::CopyAs()
// call seNew->CopyAs()
}
}
+15 -92
View File
@@ -10,37 +10,30 @@
* and is not subject to copyright.
*/
/* $Id: STEPundefined.cc,v 3.0.1.2 1997/11/05 21:59:29 sauderd DP3.1 $ */
#include <stdio.h> // to get the BUFSIZ #define
#include <STEPundefined.h>
#include <STEPattribute.h>
/******************************************************************
** helping functions for reading unknown types **/
/** \class SCLundefined
** helper functions for reading unknown types
*/
Severity
SCLundefined::StrToVal( const char * s, ErrorDescriptor * err ) {
Severity SCLundefined::StrToVal( const char * s, ErrorDescriptor * err ) {
val = s;
return SEVERITY_NULL;
}
Severity
SCLundefined::StrToVal( istream & in, ErrorDescriptor * err ) {
Severity SCLundefined::StrToVal( istream & in, ErrorDescriptor * err ) {
return STEPread( in, err );
}
Severity
SCLundefined::STEPread( const char * s, ErrorDescriptor * err ) {
Severity SCLundefined::STEPread( const char * s, ErrorDescriptor * err ) {
istringstream in( ( char * ) s );
return STEPread( in, err );
}
Severity
SCLundefined::STEPread( istream & in, ErrorDescriptor * err ) {
Severity SCLundefined::STEPread( istream & in, ErrorDescriptor * err ) {
char c = '\0';
ostringstream ss;
std::string str;
@@ -98,25 +91,21 @@ SCLundefined::STEPread( istream & in, ErrorDescriptor * err ) {
terminal = 1;
c = '\0';
}
// if (!in.readable ()) terminal =1;
}
ss << ends;
/*** val = ss.str(); ***/
val = &( ss.str()[0] );
err->GreaterSeverity( SEVERITY_NULL );
return SEVERITY_NULL;
}
const char *
SCLundefined::asStr( std::string & s ) const {
const char * SCLundefined::asStr( std::string & s ) const {
s = val.c_str();
return const_cast<char *>( s.c_str() );
}
const char *
SCLundefined::STEPwrite( std::string & s ) {
const char * SCLundefined::STEPwrite( std::string & s ) {
if ( val.empty() ) {
s = "$";
} else {
@@ -125,8 +114,7 @@ SCLundefined::STEPwrite( std::string & s ) {
return const_cast<char *>( s.c_str() );
}
void
SCLundefined:: STEPwrite( ostream & out ) {
void SCLundefined:: STEPwrite( ostream & out ) {
if( val.empty()) {
out << "$";
} else {
@@ -134,15 +122,13 @@ SCLundefined:: STEPwrite( ostream & out ) {
}
}
SCLundefined &
SCLundefined::operator= ( const SCLundefined & x ) {
SCLundefined & SCLundefined::operator= ( const SCLundefined & x ) {
std::string tmp;
val = x.asStr( tmp );
return *this;
}
SCLundefined &
SCLundefined::operator= ( const char * str ) {
SCLundefined & SCLundefined::operator= ( const char * str ) {
if( !str ) {
val.clear();
} else {
@@ -157,74 +143,11 @@ SCLundefined::SCLundefined() {
SCLundefined::~SCLundefined() {
}
int
SCLundefined::set_null() {
int SCLundefined::set_null() {
val = "";
return 1;
}
int
SCLundefined::is_null() {
int SCLundefined::is_null() {
return ( val.empty() );
}
/*
int
SCLundefined::STEPread(istream& in )
{
char c ='\0';
char buf [BUFSIZ];
int i =0;
int open_paren =0;
int terminal = 0;
while (!terminal)
{
in >> c;
switch (c)
{
case '(':
++open_paren;
break;
case ')':
if (open_paren) {
--open_paren;
break;
}
// otherwise treat it like a comma
case ',':
if (!open_paren) {
terminal =1;
in.putback (c);
c = '\0';
}
break;
case '\0':
terminal =1;
break;
}
if (!in)
{
terminal =1;
c = '\0';
}
if (i < BUFSIZ) buf [i] = c;
// BUG: read up to BUFSIZ -1 number of characters
// if more characters, NULL terminate and ignore the rest of input
if ((++i == BUFSIZ) && !terminal) {
cerr << "WARNING: information lost -- value of undefined type is too long\n";
buf [i] = '\0';
}
}
if (i < BUFSIZ) buf [i+1] = '\0';
val = buf;
return i;
}
*/
}
+3 -10
View File
@@ -12,12 +12,6 @@
* and is not subject to copyright.
*/
/* $Id: STEPundefined.h,v 3.0.1.2 1997/11/05 21:59:28 sauderd DP3.1 $ */
#ifdef __O3DB__
#include <OpenOODB.h>
#endif
#include <errordesc.h>
#include <string>
#include <read_func.h>
@@ -27,14 +21,14 @@ class SCLundefined {
std::string val;
public:
// INPUT
// INPUT
virtual Severity StrToVal(const char *s, ErrorDescriptor *err);
virtual Severity StrToVal(istream &in, ErrorDescriptor *err);
virtual Severity STEPread(const char *s, ErrorDescriptor *err);
virtual Severity STEPread(istream &in, ErrorDescriptor *err);
// OUTPUT
// OUTPUT
virtual const char *asStr(std::string& s) const;
virtual const char *STEPwrite(std::string& s);
virtual void STEPwrite (ostream& out =cout);
@@ -45,7 +39,6 @@ class SCLundefined {
SCLundefined& operator= (const char *str);
SCLundefined ();
virtual ~SCLundefined ();
}
;
};
#endif
-28
View File
@@ -1,28 +0,0 @@
#include <string>
class Select {
public:
std::string _underlying_typename;
Select();
//Select(const Select&);
virtual ~Select();
virtual char * Underlying_typeName const
{ return _underlying_typename.c_str(); }
// const Named_type_ptr Underlying_type() const;
// return 0 if unset, otherwise return 1
virtual int exists() const=0;
// change the receiver to an unset state.
virtual void nullify() =0;
// Set the type of the select's immediate underlying type. This function
// shall only be used for the special case of a complex select which
// contains at least two underlying types which ultimately resolve to
// the same EXPRESS type.
// void SetUnderlying_type(const char * typename);
};
+3 -8
View File
@@ -10,12 +10,9 @@
* and is not subject to copyright.
*/
/* $Id: SingleLinkList.cc,v 3.0.1.4 1997/11/05 21:59:23 sauderd DP3.1 $ */
#include <SingleLinkList.h>
void
SingleLinkList::DeleteFollowingNodes( SingleLinkNode * item ) {
void SingleLinkList::DeleteFollowingNodes( SingleLinkNode * item ) {
if( head ) {
SingleLinkNode * trailer = 0;
SingleLinkNode * leader = head;
@@ -46,8 +43,7 @@ SingleLinkList::DeleteFollowingNodes( SingleLinkNode * item ) {
}
}
void
SingleLinkList::AppendNode( SingleLinkNode * item ) {
void SingleLinkList::AppendNode( SingleLinkNode * item ) {
if( head ) {
tail -> next = item;
tail = item;
@@ -57,8 +53,7 @@ SingleLinkList::AppendNode( SingleLinkNode * item ) {
item->owner = this;
}
void
SingleLinkList::DeleteNode( SingleLinkNode * item ) {
void SingleLinkList::DeleteNode( SingleLinkNode * item ) {
if( head ) {
SingleLinkNode * trailer = 0;
SingleLinkNode * leader = head;
+2 -8
View File
@@ -1,5 +1,5 @@
#ifndef singlelinklist_h
#define singlelinklist_h
#define singlelinklist_h
/*
* NIST STEP Core Class Library
@@ -12,16 +12,10 @@
* and is not subject to copyright.
*/
/* $Id: SingleLinkList.h,v 3.0.1.4 1997/11/05 21:59:22 sauderd DP3.1 $ */
#ifdef __O3DB__
#include <OpenOODB.h>
#endif
class SingleLinkList {
// node which represents the value is contained in the subclass
// since it may have different types for different lists
// since it may have different types for different lists
protected:
+3 -8
View File
@@ -10,8 +10,6 @@
* and is not subject to copyright.
*/
/* $Id: SingleLinkList.inline.cc,v 3.0.1.2 1997/11/05 21:59:23 sauderd DP3.1 $ */
#include <SingleLinkList.h>
#include <iostream>
@@ -28,8 +26,7 @@ SingleLinkList::~SingleLinkList() {
Empty();
}
void
SingleLinkList::Empty() {
void SingleLinkList::Empty() {
SingleLinkNode * tmp = head;
while( tmp ) {
tmp = head -> NextNode();
@@ -38,16 +35,14 @@ SingleLinkList::Empty() {
}
}
SingleLinkNode *
SingleLinkList::NewNode() {
SingleLinkNode * SingleLinkList::NewNode() {
// defined in subtypes
std::cerr << "\n\n******BUG****** a virtually defined function should \n"
<< "be called for SingleLinkList::NewNode()\n\n";
return new SingleLinkNode();
}
SingleLinkNode *
SingleLinkList::GetHead() const {
SingleLinkNode * SingleLinkList::GetHead() const {
return ( head );
}
+27 -33
View File
@@ -1,5 +1,5 @@
#ifndef BASETYPE_H
#define BASETYPE_H
#define BASETYPE_H
/*
* NIST STEP Core Class Library
@@ -12,37 +12,31 @@
* and is not subject to copyright.
*/
/* $Id: baseType.h,v 3.0.1.2 1997/11/05 21:59:29 sauderd DP3.1 $ */
#ifdef __O3DB__
#include <OpenOODB.h>
#endif
// ************** TYPES of attributes
// ************** TYPES of attributes
// IMS, 9 Aug 95: changed values to make these values usable in a bitmask
enum PrimitiveType {
sdaiINTEGER = 0x0001,
sdaiREAL = 0x0002,
sdaiBOOLEAN = 0x0004,
sdaiLOGICAL = 0x0008,
sdaiSTRING = 0x0010,
sdaiBINARY = 0x0020,
sdaiENUMERATION = 0x0040,
sdaiSELECT = 0x0080,
sdaiINSTANCE = 0x0100,
sdaiAGGR = 0x0200,
sdaiNUMBER = 0x0400,
sdaiINTEGER = 0x0001,
sdaiREAL = 0x0002,
sdaiBOOLEAN = 0x0004,
sdaiLOGICAL = 0x0008,
sdaiSTRING = 0x0010,
sdaiBINARY = 0x0020,
sdaiENUMERATION = 0x0040,
sdaiSELECT = 0x0080,
sdaiINSTANCE = 0x0100,
sdaiAGGR = 0x0200,
sdaiNUMBER = 0x0400,
// The elements defined below are not part of part 23
// (IMS: these should not be used as bitmask fields)
ARRAY_TYPE, // DAS
BAG_TYPE, // DAS
SET_TYPE, // DAS
LIST_TYPE, // DAS
GENERIC_TYPE,
REFERENCE_TYPE,
UNKNOWN_TYPE
ARRAY_TYPE, // DAS
BAG_TYPE, // DAS
SET_TYPE, // DAS
LIST_TYPE, // DAS
GENERIC_TYPE,
REFERENCE_TYPE,
UNKNOWN_TYPE
};
// for backwards compatibility with our previous implementation
@@ -62,13 +56,13 @@ typedef PrimitiveType BASE_TYPE;
#define NUMBER_TYPE sdaiNUMBER
/* not defined in part 23
ARRAY_TYPE, // DAS
BAG_TYPE, // DAS
SET_TYPE, // DAS
LIST_TYPE, // DAS
GENERIC_TYPE,
REFERENCE_TYPE,
UNKNOWN_TYPE
ARRAY_TYPE, // DAS
BAG_TYPE, // DAS
SET_TYPE, // DAS
LIST_TYPE, // DAS
GENERIC_TYPE,
REFERENCE_TYPE,
UNKNOWN_TYPE
*/
#endif
-75
View File
@@ -1,6 +1,3 @@
#ifdef __O3DB__
#include <OpenOODB.h>
#endif
#include <errordesc.h>
#include <stdio.h>
@@ -197,44 +194,6 @@ WriteReal( SCLP23( Real ) val, ostream & out ) {
std::string s;
out << WriteReal( val, s );
#if 0
char rbuf[64];
// out << form("%.*G", (int) Real_Num_Precision,tmp);
// replace the above line with this code so that writing the '.' is
// guaranteed for reals. If you use e or E then you get many
// unnecessary trailing zeros. g and G truncates all trailing zeros
// to save space but when no non-zero precision exists it also
// truncates the decimal. The decimal is required by Part 21.
// Also use G instead of g since G writes uppercase E (E instead of e
// is also required by Part 21) when scientific notation is used - DAS
sprintf( rbuf, "%.*G", ( int ) RealNumPrecision, val );
if( !strchr( rbuf, '.' ) ) {
if( strchr( rbuf, 'E' ) || strchr( rbuf, 'e' ) ) {
char * expon = strchr( rbuf, 'E' );
if( !expon ) {
expon = strchr( rbuf, 'e' );
}
*expon = '\0';
s = rbuf;
s.Append( '.' );
s.Append( 'E' );
expon++;
s.Append( expon );
} else {
int rindex = strlen( rbuf );
rbuf[rindex] = '.';
rbuf[rindex + 1] = '\0';
s = rbuf;
}
} else {
s = rbuf;
}
out << ( char * )( s.c_str() );
#endif
}
///////////////////////////////////////////////////////////////////////////////
@@ -345,21 +304,14 @@ ReadReal( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
}
buf[i] = '\0';
/*
int success = 0;
success = sscanf(buf," %G", &d);
*/
istringstream in2( ( char * )buf );
// now that we have the real the stream will be able to salvage reading
// whatever kind of format was used to represent the real.
in2 >> d;
// cout << "buffer: " << buf << endl << "value: " << d << endl << endl;
int valAssigned = 0;
// PrintErrorState(err);
// if(success > 0)
if( !in2.fail() ) {
valAssigned = 1;
val = d;
@@ -371,24 +323,6 @@ ReadReal( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
CheckRemainingInput( in, err, "Real", tokenList );
return valAssigned;
/* old way - much easier but not thorough enough */
/*
in >> d;
// IStreamState(in);
int valAssigned = 0;
// PrintErrorState(err);
if(!in.fail())
{
valAssigned = 1;
val = d;
}
Severity s = CheckRemainingInput(in, err, "Real", tokenList);
return valAssigned;
*/
}
///////////////////////////////////////////////////////////////////////////////
@@ -480,8 +414,6 @@ ReadNumber( SCLP23( Real ) &val, istream & in, ErrorDescriptor * err,
in >> ws;
in >> d;
// IStreamState(in);
int valAssigned = 0;
if( !in.fail() ) {
valAssigned = 1;
@@ -657,7 +589,6 @@ FindStartOfInstance( istream & in, std::string & inst ) {
char c = 0;
ErrorDescriptor errs;
SCLP23( String ) tmp;
// std::string tmp;
while( in.good() ) {
in >> c;
@@ -670,9 +601,6 @@ FindStartOfInstance( istream & in, std::string & inst ) {
in.putback( c );
tmp.STEPread( in, &errs );
inst.append( tmp );
// PushPastString(in, tmp, &errs);
// inst.Append( tmp->c_str() );
break;
case '\0': // problem in input ?
@@ -695,7 +623,6 @@ SkipInstance( istream & in, std::string & inst ) {
char c = 0;
ErrorDescriptor errs;
SCLP23( String ) tmp;
// std::string tmp;
while( in.good() ) {
in >> c;
@@ -708,8 +635,6 @@ SkipInstance( istream & in, std::string & inst ) {
tmp.STEPread( in, &errs );
inst.append( tmp );
// PushPastString(in, tmp, &errs);
// inst.Append( tmp->c_str() );
break;
case '\0': // problem in input ?
+1 -1
View File
@@ -8,7 +8,7 @@
// LONG_MAX: ex MAXLONG
// FLT_MIN: ex MINFLOAT
const char * SCLversion = "STEP Class Library version 3.1";
const char * SCLversion = "STEP Class Library, github.com/mpictor/StepClassLibrary";
const SCLP23( Integer ) SCLP23( INT_NULL ) = LONG_MAX;
const SCLP23( Real ) SCLP23( REAL_NULL ) = FLT_MIN;
+1 -101
View File
@@ -18,27 +18,13 @@
* values for the EXPRESS base types.
*/
/* $Id: sdai.h,v 3.0.1.12 1997/11/05 22:52:58 sauderd DP3.1 $ */
#ifdef HAVE_CONFIG_H
# include <scl_cf.h>
#endif
#include <scl_cf.h>
extern const char *SCLversion;
#include <ctype.h>
//#include <stdio.h>
//#include <strstream.h>
#include <string>
#ifdef PART26
// Change the name of the include file defining the defs for Bool and Logical
// inside the file corbaIncludes.h
#include <corbaIncludes.h>
#endif
#include <sclprefixes.h>
#include <dictdefs.h>
@@ -48,13 +34,6 @@ extern const char *SCLversion;
typedef std::string Express_id;
#ifdef __O3DB__
/* OpenOODB.h must be the first include file. */
#include <OpenOODB.h>
#endif
//#include <read_func.h>
class TypeDescriptor;
class EntityDescriptor;
class SelectTypeDescriptor;
@@ -77,18 +56,9 @@ class STEPattribute;
#define S_STRING_NULL ""
#ifndef CC_NO_NESTED_CLASSES
#ifndef PART26
struct P23_NAMESPACE {
#endif // PART26
#endif // CC_NO_NESTED_CLASSES
// INTEGER
//typedef long Integer;
//typedef short Short;
//typedef unsigned short UShort;
//typedef unsigned long ULong;
typedef long SCLP23_NAME(Integer);
typedef short SCLP23_NAME(Short);
typedef unsigned short SCLP23_NAME(UShort);
@@ -114,24 +84,6 @@ typedef double SCLP23_NAME(Real);
static const SCLP23_NAME(Real) SCLP23_NAME(NUMBER_NULL);
#endif
#endif
/*
// C++ from values.h DAS PORT
//static const Integer INT_NULL = MAXLONG;
static const Integer INT_NULL;
// REAL
typedef double Real;
// C++ from values.h DAS PORT
//static const Real REAL_NULL = MINFLOAT;
static const Real REAL_NULL;
// NUMBER
// arbitrary choice by me for number DAS
// C++ from values.h DAS PORT
//static const Real NUMBER_NULL = MINFLOAT;
static const Real NUMBER_NULL;
*/
enum SCLP23_NAME(Access_type) {
SCLP23_NAME(sdaiRO),
@@ -221,58 +173,6 @@ typedef char * SCLP23_NAME(Time_stamp);
typedef char * SCLP23_NAME(Entity_name);
typedef char * SCLP23_NAME(Schema_name);
/*
enum Access_type {sdaiRO, sdaiRW};
enum Commit_mode {sdaiCOMMIT, sdaiABORT} ;
enum AttrFlag { sdaiSET, sdaiUNSET } ;
enum ImplementationClass { sdaiCLASS1, sdaiCLASS2, sdaiCLASS3, sdaiCLASS4, sdaiCLASS5 }; // conflict with part 22 EXPRESS:
enum Error_id {
sdaiNO_ERR = 0 , // No error
sdaiSS_OPN = 10, // Session open
sdaiSS_NAVL = 20, // Session not available
sdaiSS_NOPN = 30, // Session is not open
sdaiRP_NEXS = 40, // Repository does not exist
sdaiRP_NAVL = 50, // Repository not available
sdaiRP_OPN = 60, // Repository already opened
sdaiRP_NOPN = 70, // Repository not open
sdaiTR_EXS = 80, // Transaction exists
sdaiTR_NRO = 90, // Transaction not read-only
sdaiTR_NRW = 100, // Transaction not read-write
sdaiTR_NEXS = 110, // Transaction does not exist
sdaiSD_NDEF = 120, // Schema definition is not defined
sdaiMO_NEXS = 130, // SDAI-model does not exist
sdaiMO_NAVL = 140, // SDAI-model is not active
sdaiMX_NVLD = 150, // SDAI-model access invalid
sdaiMX_NRO = 160, // SDAI-model not read-only
sdaiMX_NRW = 170, // SDAI-model not read-write
sdaiMX_NDEF = 180, // SDAI-model access is not defined
sdaiMO_NVLD = 190, // SDAI-model invalid
sdaiMO_DUP = 200, // SDAI-model duplicate
sdaiED_NDEF = 210, // Entity definition not defined
sdaiTY_NDEF = 220, // Type not defined
sdaiTY_NVLD = 230, // Type invalid
sdaiRU_NEXS = 240, // Rule does not exist
sdaiFN_NAVL = 250, // Function not available
sdaiEI_NEXS = 260, // Entity instance does not exist
sdaiAT_NDEF = 270, // Attribute not defined
sdaiSI_DUP = 280, // Schema instance duplicate
sdaiVT_NVLD = 290, // Value type invalid
sdaiAG_NEXS = 300, // Aggregate does not exist
sdaiIR_NEXS = 310, // Iterator does not exist
sdaiAG_NSET = 320, // Aggregate is empty
sdaiIR_NSET = 330, // Current member is not defined
sdaiAD_NVLD = 340, // Aggregate definition invalid
sdaiVA_NSET = 350, // Value not set
sdaiIX_NVLD = 360, // Index invalid
sdaiED_NAVL = 370, // Entity definition is not available
sdaiSI_NEXS = 380, // Schema instance does not exist
sdaiEI_NAVL = 390, // Entity instance not available
sdaiSC_DUP = 400, // Scope duplicate
sdaiEI_NEXP = 410, // Entity instance not exported
sdaiMO_NINT = 420, // SDAI-model not interoperable
sdaiSY_ERR = 1000 // Underlying system error
};
*/
#include <sdaiString.h>
#include <sdaiBinary.h>
+95 -389
View File
@@ -18,16 +18,16 @@
SCLP23( Application_instance ) NilSTEPentity;
/******************************************************************
** Functions for manipulating entities
/**************************************************************//**
** \file sdaiApplication_instance.cc Functions for manipulating entities
**
** KNOWN BUGs: the SCLP23(Application_instance) is not aware of the STEPfile;
** therefore it can not read comments which may be embedded in the instance.
** The following are known problems:
** -- does not handle comments embedded in an instance ==> bombs
** -- ignores embedded entities ==> does not bomb
** -- error reporting does not include line number information
**/
*/
SCLP23( Application_instance )::SCLP23_NAME( Application_instance )()
: _cur( 0 ), STEPfile_id( 0 ), p21Comment( 0 ), headMiEntity( 0 ), nextMiEntity( 0 ),
@@ -40,11 +40,7 @@ SCLP23( Application_instance )::SCLP23_NAME( Application_instance )( int fileid,
}
SCLP23( Application_instance )::~SCLP23_NAME( Application_instance )() {
// STEPattribute * next = 0;
ResetAttributes();
// while( ( next = NextAttribute() ) ) {
// delete next; //FIXME: causes SIGABRT double free or corruption
// }
if( MultipleInheritance() ) {
delete nextMiEntity;
@@ -52,8 +48,7 @@ SCLP23( Application_instance )::~SCLP23_NAME( Application_instance )() {
delete p21Comment;
}
SCLP23( Application_instance ) *
SCLP23( Application_instance )::Replicate() {
SCLP23( Application_instance ) * SCLP23( Application_instance )::Replicate() {
char errStr[BUFSIZ];
if( IsComplex() ) {
cerr << "STEPcomplex::Replicate() should be called: " << __FILE__
@@ -88,8 +83,7 @@ void SCLP23( Application_instance )::AddP21Comment( const char * s, int replace
}
}
void
SCLP23( Application_instance )::AddP21Comment( std::string & s, int replace ) {
void SCLP23( Application_instance )::AddP21Comment( std::string & s, int replace ) {
if( replace ) {
delete p21Comment;
p21Comment = 0;
@@ -104,21 +98,18 @@ SCLP23( Application_instance )::AddP21Comment( std::string & s, int replace ) {
}
}
void
SCLP23( Application_instance )::STEPwrite_reference( ostream & out ) {
void SCLP23( Application_instance )::STEPwrite_reference( ostream & out ) {
out << "#" << STEPfile_id;
}
const char *
SCLP23( Application_instance )::STEPwrite_reference( std::string & buf ) {
const char * SCLP23( Application_instance )::STEPwrite_reference( std::string & buf ) {
char tmp[64];
sprintf( tmp, "#%d", STEPfile_id );
buf = tmp;
return const_cast<char *>( buf.c_str() );
}
void
SCLP23( Application_instance )::AppendMultInstance( SCLP23( Application_instance ) *se ) {
void SCLP23( Application_instance )::AppendMultInstance( SCLP23( Application_instance ) *se ) {
if( nextMiEntity == 0 ) {
nextMiEntity = se;
} else {
@@ -132,10 +123,9 @@ SCLP23( Application_instance )::AppendMultInstance( SCLP23( Application_instance
}
}
// BUG implement this
// BUG implement this -- FIXME function is never used
SCLP23( Application_instance ) *
SCLP23( Application_instance )::GetMiEntity( char * EntityName ) {
SCLP23( Application_instance ) * SCLP23( Application_instance )::GetMiEntity( char * EntityName ) {
std::string s1, s2;
const EntityDescLinkNode * edln = 0;
@@ -162,8 +152,7 @@ SCLP23( Application_instance )::GetMiEntity( char * EntityName ) {
STEPattribute *
SCLP23( Application_instance )::GetSTEPattribute( const char * nm ) {
STEPattribute * SCLP23( Application_instance )::GetSTEPattribute( const char * nm ) {
if( !nm ) {
return 0;
}
@@ -178,8 +167,7 @@ SCLP23( Application_instance )::GetSTEPattribute( const char * nm ) {
return a;
}
STEPattribute *
SCLP23( Application_instance )::MakeRedefined( STEPattribute * redefiningAttr, const char * nm ) {
STEPattribute * SCLP23( Application_instance )::MakeRedefined( STEPattribute * redefiningAttr, const char * nm ) {
// find the attribute being redefined
STEPattribute * a = GetSTEPattribute( nm );
@@ -190,8 +178,7 @@ SCLP23( Application_instance )::MakeRedefined( STEPattribute * redefiningAttr, c
return a;
}
STEPattribute *
SCLP23( Application_instance )::MakeDerived( const char * nm ) {
STEPattribute * SCLP23( Application_instance )::MakeDerived( const char * nm ) {
STEPattribute * a = GetSTEPattribute( nm );
if( a ) {
a ->Derive();
@@ -199,8 +186,7 @@ SCLP23( Application_instance )::MakeDerived( const char * nm ) {
return a;
}
void
SCLP23( Application_instance )::CopyAs( SCLP23( Application_instance ) * other ) {
void SCLP23( Application_instance )::CopyAs( SCLP23( Application_instance ) * other ) {
int numAttrs = AttributeCount();
ResetAttributes();
other -> ResetAttributes();
@@ -215,23 +201,21 @@ SCLP23( Application_instance )::CopyAs( SCLP23( Application_instance ) * other )
}
const char *
SCLP23( Application_instance )::EntityName( const char * schnm ) const {
const char * SCLP23( Application_instance )::EntityName( const char * schnm ) const {
return eDesc->Name( schnm );
}
/*****************************************************************
Checks if a given SCLP23(Application_instance) is the same type as this one
****************************************************************/
/**
* Checks if a given SCLP23(Application_instance) is the same
* type as this one
*/
const EntityDescriptor * SCLP23( Application_instance )::IsA( const EntityDescriptor * ed ) const {
return ( eDesc->IsA( ed ) );
}
/******************************************************************
// Checks the validity of the current attribute values for the entity
******************************************************************/
/**
* Checks the validity of the current attribute values for the entity
*/
Severity SCLP23( Application_instance )::ValidLevel( ErrorDescriptor * error, InstMgr * im,
int clearError ) {
ErrorDescriptor err;
@@ -248,9 +232,9 @@ Severity SCLP23( Application_instance )::ValidLevel( ErrorDescriptor * error, In
return error->severity();
}
/******************************************************************
// clears all attr's errors
******************************************************************/
/**
* clears all attr's errors
*/
void SCLP23( Application_instance )::ClearAttrError() {
int n = attributes.list_length();
for( int i = 0 ; i < n; i++ ) {
@@ -258,10 +242,9 @@ void SCLP23( Application_instance )::ClearAttrError() {
}
}
/******************************************************************
// clears entity's error and optionally all attr's errors
******************************************************************/
/**
* clears entity's error and optionally all attr's errors
*/
void SCLP23( Application_instance )::ClearError( int clearAttrs ) {
_error.ClearErrorMsg();
if( clearAttrs ) {
@@ -269,31 +252,12 @@ void SCLP23( Application_instance )::ClearError( int clearAttrs ) {
}
}
/******************************************************************
******************************************************************/
/*
void SCLP23(Application_instance)::EnforceOptionality(int on)
{
Enforcement e;
if(on) e = ENFORCE_OPTIONALITY;
else e = ENFORCE_OFF;
Error().enforcement(e);
int n = attributes.list_length();
for (int i = 0 ; i < n; i++) {
attributes[i].Error().enforcement(e);
}
}
*/
/******************************************************************
** Procedure: beginSTEPwrite
** Parameters: ostream& out -- stream to write to
** Returns:
** Side Effects: writes out the SCOPE section for an entity
** Status: stub
******************************************************************/
/**************************************************************//**
** \param out -- stream to write to
** \details
** Side Effects: writes out the SCOPE section for an entity
** Status: stub FIXME
*******************************************************************/
void SCLP23( Application_instance )::beginSTEPwrite( ostream & out ) {
out << "begin STEPwrite ... \n" ;
out.flush();
@@ -307,18 +271,15 @@ void SCLP23( Application_instance )::beginSTEPwrite( ostream & out ) {
}
}
/******************************************************************
** Procedure: STEPwrite
** Parameters: ostream& out -- stream to write to
** Returns:
** Side Effects: writes out the data associated with an instance
in STEP format
** Problems: does not print out the SCOPE section of an entity
**
******************************************************************/
void
SCLP23( Application_instance )::STEPwrite( ostream & out, const char * currSch,
/**************************************************************//**
** \param out -- stream to write to
** \details
** Side Effects: writes out the data associated with an instance
** in STEP format
** Problems: does not print out the SCOPE section of an entity
**
*******************************************************************/
void SCLP23( Application_instance )::STEPwrite( ostream & out, const char * currSch,
int writeComments ) {
std::string tmp;
if( writeComments && p21Comment && !p21Comment->empty() ) {
@@ -344,52 +305,11 @@ void SCLP23( Application_instance )::endSTEPwrite( ostream & out ) {
out.flush();
}
void
SCLP23( Application_instance )::WriteValuePairs( ostream & out,
void SCLP23( Application_instance )::WriteValuePairs( ostream & out,
const char * currSch,
int writeComments, int mixedCase ) {
/*
const EntityDescriptorList &edl = eDesc->Supertypes();
EntityDescItr &edi((EntityDescriptorList &)(eDesc->Supertypes()));
int count = 1;
const EntityDescriptor * ed = 0;
while(ed = edi.NextEntityDesc())
{
if(count > 1)
{
out << "&";
}
out << ed->Name();
count++;
}
*/
// const AttrDescriptorList& adl = ed->ExplicitAttr();
/*
out << "Attributes are: " << endl;
edi.ResetItr();
AttrDescItr *adi = 0;
const AttrDescriptor * ad;
while(ed = edi.NextEntityDesc())
{
adi = new AttrDescItr((AttrDescriptorList&)ed->ExplicitAttr());
ad = 0;
while(ad = adi->NextAttrDesc())
{
out << ed->Name() << "." << ad->Name() << endl;
}
delete adi;
}
out << endl;
out << "finished writing attribute names." << endl;
edi.ResetItr();
*/
std::string s;
// out << eDesc->QualifiedName(s) << endl;
std::string tmp, tmp2;
std::string s, tmp, tmp2;
if( writeComments && p21Comment && !p21Comment->empty() ) {
out << p21Comment->c_str();
}
@@ -404,7 +324,6 @@ SCLP23( Application_instance )::WriteValuePairs( ostream & out,
for( int i = 0 ; i < n; i++ ) {
if( !( attributes[i].aDesc->AttrType() == AttrType_Redefining ) ) {
// if (i > 0) out << ",";
if( mixedCase ) {
out << "\t"
<< attributes[i].aDesc->Owner().Name( s.c_str() )
@@ -422,14 +341,10 @@ SCLP23( Application_instance )::WriteValuePairs( ostream & out,
}
/******************************************************************
** Procedure: STEPwrite
/**************************************************************//**
** Problems: does not print out the SCOPE section of an entity
**
******************************************************************/
const char *
SCLP23( Application_instance )::STEPwrite( std::string & buf, const char * currSch ) {
const char * SCLP23( Application_instance )::STEPwrite( std::string & buf, const char * currSch ) {
buf.clear();
char instanceInfo[BUFSIZ];
@@ -454,8 +369,7 @@ SCLP23( Application_instance )::STEPwrite( std::string & buf, const char * currS
return const_cast<char *>( buf.c_str() );
}
void
SCLP23( Application_instance )::PrependEntityErrMsg() {
void SCLP23( Application_instance )::PrependEntityErrMsg() {
char errStr[BUFSIZ];
errStr[0] = '\0';
@@ -467,18 +381,15 @@ SCLP23( Application_instance )::PrependEntityErrMsg() {
}
}
/******************************************************************
** Procedure: SCLP23(Application_instance)::STEPread_error
** Parameters: char c -- character which caused error
** int i -- index of attribute which caused error
** istream& in -- input stream for recovery
** Returns:
** Description: reports the error found, reads until it finds the end of an
/**************************************************************//**
** \param c -- character which caused error
** \param i -- index of attribute which caused error
** \param in -- input stream for recovery
** \details reports the error found, reads until it finds the end of an
** instance. i.e. a close quote followed by a semicolon optionally having
** whitespace between them.
******************************************************************/
void
SCLP23( Application_instance )::STEPread_error( char c, int i, istream & in ) {
void SCLP23( Application_instance )::STEPread_error( char c, int i, istream & in ) {
char errStr[BUFSIZ];
errStr[0] = '\0';
@@ -489,9 +400,6 @@ SCLP23( Application_instance )::STEPread_error( char c, int i, istream & in ) {
_error.PrependToDetailMsg( errStr );
}
/* sprintf(errStr, " for instance #%d : %s\n", STEPfile_id, EntityName());*/
/* _error.AppendToDetailMsg(errStr);*/
if( ( i >= 0 ) && ( i < attributes.list_length() ) ) { // i is an attribute
Error().GreaterSeverity( SEVERITY_WARNING );
sprintf( errStr, " invalid data before type \'%s\'\n",
@@ -509,65 +417,26 @@ SCLP23( Application_instance )::STEPread_error( char c, int i, istream & in ) {
tmp.c_str() );
_error.AppendToDetailMsg( errStr );
// _error.AppendToDetailMsg(" data lost looking for end of entity:");
// scan over the rest of the instance and echo it
// cerr << " ERROR Trying to find the end of the ENTITY to recover...\n";
// cerr << " skipping the following input:\n";
#ifdef OBSOLETE
in.clear();
int foundEnd = 0;
tmp = "";
// Search until a close paren is found followed by (skipping optional
// whitespace) a semicolon
while( in.good() && !foundEnd ) {
while( in.good() && ( c != ')' ) ) {
in.get( c );
tmp.Append( c );
// cerr << c;
}
if( in.good() && ( c == ')' ) ) {
in >> ws; // skip whitespace
in.get( c );
tmp.Append( c );
// cerr << c;
// cerr << "\n";
if( c == ';' ) {
foundEnd = 1;
}
}
}
_error.AppendToDetailMsg( tmp.c_str() );
#endif
sprintf( errStr, "\nfinished reading #%d\n", STEPfile_id );
_error.AppendToDetailMsg( errStr );
return;
}
/******************************************************************
** Procedure: STEPread
** Returns: Severity, error information
** SEVERITY_NULL - no errors
** SEVERITY_USERMSG - checked as much as possible, could still
** be error - e.g. entity didn't match base entity type.
** SEVERITY_INCOMPLETE - data is missing and required.
** SEVERITY_WARNING - errors, but can recover
** <= SEVERITY_INPUT_ERROR - fatal error, can't recover
** Description: reads the values for an entity from an input stream
** in STEP file format starting at the open paren and
** ending with the semi-colon
** Parameters: int id
** int idIncrement
** InstMgr instances
** istream& in
/**************************************************************//**
** \returns Severity, error information
** SEVERITY_NULL - no errors
** SEVERITY_USERMSG - checked as much as possible, could still
** be error - e.g. entity didn't match base entity type.
** SEVERITY_INCOMPLETE - data is missing and required.
** SEVERITY_WARNING - errors, but can recover
** <= SEVERITY_INPUT_ERROR - fatal error, can't recover
** \details reads the values for an entity from an input stream
** in STEP file format starting at the open paren and
** ending with the semi-colon
** Side Effects: gobbles up input stream
** Status:
******************************************************************/
Severity
SCLP23( Application_instance )::STEPread( int id, int idIncr,
Severity SCLP23( Application_instance )::STEPread( int id, int idIncr,
InstMgr * instance_set, istream & in,
const char * currSch, int useTechCor ) {
STEPfile_id = id;
@@ -619,23 +488,6 @@ SCLP23( Application_instance )::STEPread( int id, int idIncr,
_error.AppendToUserMsg(
"Since using pre-technical corrigendum... missing asterisk for redefined attr. " );
}
/*
if( ! ( (c == ',') || (c == ')') ) )
{ // input is not a delimiter - an error
PrependEntityErrMsg();
_error.AppendToDetailMsg(
"Delimiter expected after redefined asterisk attribute encoding (since using pre-technical corregendum.\n");
CheckRemainingInput(in, &_error, "ENTITY", ",)");
if(!in.good())
return _error.severity();
if(_error.severity() <= SEVERITY_INPUT_ERROR)
{
// STEPread_error(c,i,in);
return _error.severity();
}
}
*/
} else { // using technical corrigendum
// should be nothing to do except loop again unless...
// if at end need to have read the closing paren.
@@ -648,7 +500,6 @@ SCLP23( Application_instance )::STEPread( int id, int idIncr,
}
// increment counter to read following attr since these attrs
// aren't written or read => there won't be a delimiter either
// i++;
} else {
attributes[i].STEPread( in, instance_set, idIncr, currSch );
in >> c; // read the , or ) following the attr read
@@ -668,16 +519,6 @@ SCLP23( Application_instance )::STEPread( int id, int idIncr,
}
}
/*
if(severe <= SEVERITY_INPUT_ERROR)
{ // attribute\'s error is non-recoverable
// I believe if this error occurs then you cannot recover
// TODO: can you just read to the next comma and try to continue ?
STEPread_error(c,i,in);
return _error.severity();
}
*/
// if technical corrigendum redefined, input is at next attribute value
// if pre-technical corrigendum redefined, don't process
if( ( !( attributes[i].aDesc->AttrType() == AttrType_Redefining ) ||
@@ -698,7 +539,6 @@ SCLP23( Application_instance )::STEPread( int id, int idIncr,
return _error.severity();
}
if( _error.severity() <= SEVERITY_INPUT_ERROR ) {
// STEPread_error(c,i,in);
return _error.severity();
}
} else if( c == ')' ) {
@@ -718,7 +558,7 @@ SCLP23( Application_instance )::STEPread( int id, int idIncr,
}
STEPread_error( c, i, in );
// code fragment imported from STEPread_error
// for some currently unknown reason it was commented out of STEPread_error
// for some unknown reason it was commented out of STEPread_error
errStr[0] = '\0';
in.clear();
int foundEnd = 0;
@@ -731,14 +571,11 @@ SCLP23( Application_instance )::STEPread( int id, int idIncr,
while( in.good() && ( c != ')' ) ) {
in.get( c );
tmp += c;
// cerr << c;
}
if( in.good() && ( c == ')' ) ) {
in >> ws; // skip whitespace
in.get( c );
tmp += c;
// cerr << c;
// cerr << "\n";
if( c == ';' ) {
foundEnd = 1;
}
@@ -751,12 +588,8 @@ SCLP23( Application_instance )::STEPread( int id, int idIncr,
return _error.severity();
}
///////////////////////////////////////////////////////////////////////////////
// read an entity reference and return a pointer to the SCLP23(Application_instance)
///////////////////////////////////////////////////////////////////////////////
SCLP23( Application_instance ) *
ReadEntityRef( istream & in, ErrorDescriptor * err, const char * tokenList,
/// read an entity reference and return a pointer to the SCLP23(Application_instance)
SCLP23( Application_instance ) * ReadEntityRef( istream & in, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId ) {
char c;
char errStr[BUFSIZ];
@@ -774,7 +607,6 @@ ReadEntityRef( istream & in, ErrorDescriptor * err, const char * tokenList,
int id = -1;
in >> id;
if( in.fail() ) { // there's been an error in input
// in.clear();
sprintf( errStr, "Invalid entity reference value.\n" );
err->AppendToDetailMsg( errStr );
err->AppendToUserMsg( errStr );
@@ -840,23 +672,15 @@ ReadEntityRef( istream & in, ErrorDescriptor * err, const char * tokenList,
}
}
///////////////////////////////////////////////////////////////////////////////
// same as above but reads from a const char *
///////////////////////////////////////////////////////////////////////////////
SCLP23( Application_instance ) *
ReadEntityRef( const char * s, ErrorDescriptor * err, const char * tokenList,
/// read an entity reference and return a pointer to the SCLP23(Application_instance)
SCLP23( Application_instance ) * ReadEntityRef( const char * s, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId ) {
istringstream in( ( char * )s );
return ReadEntityRef( in, err, tokenList, instances, addFileId );
}
///////////////////////////////////////////////////////////////////////////////
// return SEVERITY_NULL if se's entity type matches the supplied entity type
///////////////////////////////////////////////////////////////////////////////
Severity
EntityValidLevel( SCLP23( Application_instance ) *se,
/// return SEVERITY_NULL if se's entity type matches the supplied entity type
Severity EntityValidLevel( SCLP23( Application_instance ) *se,
const TypeDescriptor * ed, // entity type that entity se needs
// to match. (this must be an
// EntityDescriptor)
@@ -903,21 +727,6 @@ EntityValidLevel( SCLP23( Application_instance ) *se,
if( sc->EntityExists( ed->Name() ) ) {
return SEVERITY_NULL;
}
/*
*/
// This way checks to see if it is an ed based on the dictionary
// It is much less efficient but does not depend on the instance
// having all the parts it needs to be valid.
/*
STEPcomplex *sc = ((STEPcomplex *)se)->sc;
while (sc)
{
if( sc->eDesc->IsA(ed) )
return SEVERITY_NULL;
sc = sc->sc;
}
*/
}
err->GreaterSeverity( SEVERITY_WARNING );
sprintf( messageBuf,
@@ -940,41 +749,29 @@ EntityValidLevel( SCLP23( Application_instance ) *se,
}
}
///////////////////////////////////////////////////////////////////////////////
// return 1 if attrValue has the equivalent of a null value.
///////////////////////////////////////////////////////////////////////////////
int
SetErrOnNull( const char * attrValue, ErrorDescriptor * error ) {
// DAVE: Is this needed will sscanf return 1 if assignment suppression is used?
/**
* return 1 if attrValue has the equivalent of a null value.
* DAVE: Is this needed will sscanf return 1 if assignment suppression is used?
*/
int SetErrOnNull( const char * attrValue, ErrorDescriptor * error ) {
char scanBuf[BUFSIZ];
scanBuf[0] = '\0';
int numFound = sscanf( ( char * )attrValue, " %s", scanBuf );
if( numFound == EOF ) {
/*
if(Nullable()) {
error->GreaterSeverity (SEVERITY_NULL);
}
else {
error->GreaterSeverity (SEVERITY_INCOMPLETE);
}
*/
error->GreaterSeverity( SEVERITY_INCOMPLETE );
return 1;
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// return SEVERITY_NULL if attrValue has a valid entity reference
// This function accepts an entity reference in two forms that is with or
// without the # sign: e.g. either #23 or 23 will be read.
// If non-whitespace characters follow the entity reference an error is set.
///////////////////////////////////////////////////////////////////////////////
Severity
EntityValidLevel( const char * attrValue, // string contain entity ref
/**
** return SEVERITY_NULL if attrValue has a valid entity reference
** This function accepts an entity reference in two forms that is with or
** without the # sign: e.g. either #23 or 23 will be read.
** If non-whitespace characters follow the entity reference an error is set.
*/
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
@@ -989,13 +786,6 @@ EntityValidLevel( const char * attrValue, // string contain entity ref
err->ClearErrorMsg();
}
/*
// the problem with doing this is that it will require having a # in front
// of the entity ref.
SCLP23(Application_instance) se = ReadEntityRef(attrValue, err, 0, im, 0);
return EntityValidLevel(se, ed, err);
*/
int fileId;
MgrNode * mn = 0;
@@ -1040,17 +830,13 @@ EntityValidLevel( const char * attrValue, // string contain entity ref
return SEVERITY_WARNING;
}
/******************************************************************
** Procedure: NextAttribute
** Parameters:
** Returns: reference to an attribute pointer
** Description: used to cycle through the list of attributes
** Side Effects: increments the current position in the attribute list
** Status: untested 7/31/90
******************************************************************/
STEPattribute *
SCLP23( Application_instance )::NextAttribute() {
/**************************************************************//**
** Description: used to cycle through the list of attributes
** Side Effects: increments the current position in the attribute list
** Status: untested 7/31/90
** \Returns reference to an attribute pointer
******************************************************************/
STEPattribute * SCLP23( Application_instance )::NextAttribute() {
int i = AttributeCount();
++_cur;
if( i < _cur ) {
@@ -1060,86 +846,6 @@ SCLP23( Application_instance )::NextAttribute() {
}
int
SCLP23( Application_instance )::AttributeCount() {
int SCLP23( Application_instance )::AttributeCount() {
return attributes.list_length();
}
#ifdef OBSOLETE
Severity
SCLP23( Application_instance )::ReadAttrs( int id, int addFileId,
class InstMgr * instance_set, istream & in ) {
char c = '\0';
char errStr[BUFSIZ];
errStr[0] = '\0';
Severity severe;
ClearError( 1 );
int n = attributes.list_length();
for( int i = 0 ; i < n; i++ ) {
attributes[i].STEPread( in, instance_set, addFileId );
severe = attributes[i].Error().severity();
if( severe <= SEVERITY_USERMSG ) {
// if there\'s some type of error
if( _error.severity() == SEVERITY_NULL ) {
// if there is not an error already
sprintf( errStr, "\nERROR: ENTITY #%d %s\n", GetFileId(),
EntityName() );
_error.PrependToDetailMsg( errStr );
}
// set the severity for this entity
sprintf( errStr, " %s : ", attributes[i].Name() );
_error.AppendToDetailMsg( errStr );
_error.GreaterSeverity( severe );
_error.AppendToDetailMsg( ( char * )
attributes[i].Error().DetailMsg() );
_error.AppendToUserMsg( ( char * )attributes[i].Error().UserMsg() );
}
/*
if(severe <= SEVERITY_INPUT_ERROR)
{ // attribute\'s error is non-recoverable
// I believe if this error occurs then you cannot recover
// TODO: can you just read to the next comma and try to continue ?
STEPread_error(c,i,in);
return _error.severity();
}
*/
in >> c;
if( !( ( c == ',' ) || ( c == ')' ) ) ) { // input is not a delimiter
if( _error.severity() == SEVERITY_NULL ) {
// if there is not an error already
sprintf( errStr, "\nERROR: ENTITY #%d %s\n", GetFileId(),
EntityName() );
_error.PrependToDetailMsg( errStr );
}
_error.AppendToDetailMsg(
"delimiter expected after attribute value.\n" );
CheckRemainingInput( in, &_error, "ENTITY", ",)" );
if( !in.good() ) {
return _error.severity();
}
if( _error.severity() <= SEVERITY_INPUT_ERROR ) {
STEPread_error( c, i, in );
return _error.severity();
}
} else if( c == ')' ) {
in >> ws;
char z = in.peek();
if( z == ';' ) {
in.get( c );
return _error.severity();
}
}
}
if( c != ')' ) {
STEPread_error( c, i, in );
return _error.severity();
}
return SEVERITY_NULL;
}
#endif
+17 -42
View File
@@ -16,13 +16,12 @@
///////////////////////////////////////////////////////////////////////////////
// SCLP23(Application_instance) used to be STEPentity
//class SCLP23_NAME(Application_instance) /* : public SCLP23(DAObject_SDAI) */
class SCLP23_NAME(Application_instance) : public SCLP23_NAME(DAObject_SDAI)
{
private:
int _cur; // provides a built-in way of accessing attributes in order.
public:
public:
STEPattributeList attributes;
int STEPfile_id;
ErrorDescriptor _error;
@@ -30,13 +29,15 @@ class SCLP23_NAME(Application_instance) : public SCLP23_NAME(DAObject_SDAI)
// registry additions
EntityDescriptor *eDesc;
// head entity for multiple inheritance. If it is null then this
// SCLP23_NAME(Application_instance) is not part of a multiply inherited entity. If it
// points to a SCLP23_NAME(Application_instance) then this SCLP23_NAME(Application_instance) is part of a mi entity
// and head points at the root SCLP23_NAME(Application_instance) of the primary inheritance
// path (the one that is the root of the leaf entity).
/**
** head entity for multiple inheritance. If it is null then this
** SCLP23_NAME(Application_instance) is not part of a multiply inherited entity. If it
** points to a SCLP23_NAME(Application_instance) then this SCLP23_NAME(Application_instance) is part of a mi entity
** and head points at the root SCLP23_NAME(Application_instance) of the primary inheritance
** path (the one that is the root of the leaf entity).
*/
SCLP23_NAME(Application_instance) *headMiEntity;
// these form a chain of other entity parents for multiple inheritance
/// these form a chain of other entity parents for multiple inheritance
SCLP23_NAME(Application_instance) *nextMiEntity;
protected:
@@ -56,12 +57,13 @@ class SCLP23_NAME(Application_instance) : public SCLP23_NAME(DAObject_SDAI)
void AddP21Comment(const char *s, int replace = 1);
void DeleteP21Comment() { delete p21Comment; p21Comment = 0; }
// guaranteed a string (may be null string)
/// guaranteed a string (may be null string)
const char *P21Comment()
{ return ( p21Comment ? const_cast<char *>(p21Comment->c_str()) : "" ); }
// returns null if no comment exists
// Note: Jul-24-2011, confirm that we want to change p21Comment->rep() to
/** returns null if no comment exists
// NOTE: Jul-24-2011, confirm that we want to change p21Comment->rep() to
// const_cast<char *>(p21Comment->c_str())
*/
const char *P21CommentRep()
{ return ( p21Comment ? const_cast<char *>(p21Comment->c_str()) : 0 ); }
@@ -76,7 +78,6 @@ class SCLP23_NAME(Application_instance) : public SCLP23_NAME(DAObject_SDAI)
void ClearError(int clearAttrs = 1);
// clears all attr's errors
void ClearAttrError();
// void EnforceOptionality(int on = 1);
virtual SCLP23_NAME(Application_instance) *Replicate();
@@ -103,7 +104,7 @@ class SCLP23_NAME(Application_instance) : public SCLP23_NAME(DAObject_SDAI)
void STEPwrite_reference (ostream& out =cout);
const char * STEPwrite_reference (std::string &buf);
void beginSTEPwrite(ostream& out =cout); // writes out the SCOPE section
void beginSTEPwrite(ostream& out =cout); ///< writes out the SCOPE section
void endSTEPwrite(ostream& out =cout);
// MULTIPLE INHERITANCE
@@ -125,42 +126,16 @@ class SCLP23_NAME(Application_instance) : public SCLP23_NAME(DAObject_SDAI)
virtual void CopyAs (SCLP23_NAME(Application_instance) *);
void PrependEntityErrMsg();
public:
// these functions are going to go away in the future.
// TODO these functions are going to go away in the future.
int SetFileId(int fid) { return STEPfile_id = fid; }
int GetFileId() const { return STEPfile_id; }
int FileId (int fid) { return STEPfile_id = fid; }
int FileId() const { return STEPfile_id; }
}
;
};
// current style of CORBA handles for Part 23
// current style of CORBA handles for Part 23 - NOTE - used for more than CORBA
typedef SCLP23_NAME(Application_instance)* SCLP23_NAME(Application_instance_ptr);
typedef SCLP23_NAME(Application_instance_ptr) SCLP23_NAME(Application_instance_var);
// Everything below has been moved to sdai.h
/*
//#ifdef PART26
//DEF_TIE_P26_IDL_Application_instance(SCLP23_NAME(Application_instance))
//#endif
*/
///////////////////////////////////////////////////////////////////////////////
//extern SCLP23_NAME(Application_instance) NilSTEPentity;
//#define ENTITY_NULL &NilSTEPentity
//#define NULL_ENTITY &NilSTEPentity
//typedef SCLP23_NAME(Application_instance)* STEPentity_ptr;
//typedef STEPentity_ptr STEPentity_var;
//typedef SCLP23_NAME(Application_instance)* STEPentityPtr;
//typedef SCLP23_NAME(Application_instance)* STEPentityH;
//extern SCLP23_NAME(Application_instance) *
//ReadEntityRef(istream &in, ErrorDescriptor *err, char *tokenList,
// InstMgr * instances, int addFileId);
//typedef SCLP23_NAME(Application_instance) * (* Creator) () const;
//typedef SCLP23_NAME(Application_instance) * (* Creator) () ;
#endif
+31 -158
View File
@@ -9,25 +9,19 @@
* and is not subject to copyright.
*/
/* $Id: sdaiBinary.cc,v */
#include <sstream>
#include <sdai.h>
extern Severity
CheckRemainingInput( istream & in, ErrorDescriptor * err,
extern Severity CheckRemainingInput( istream & in, ErrorDescriptor * err,
const char * typeName, // used in error message
const char * tokenList ); // e.g. ",)"
SCLP23( Binary ) &
SCLP23( Binary )::operator= ( const char * s ) {
SCLP23( Binary ) & SCLP23( Binary )::operator= ( const char * s ) {
std::string::operator= ( s );
return *this;
}
void
SCLP23( Binary )::STEPwrite( ostream & out ) const {
void SCLP23( Binary )::STEPwrite( ostream & out ) const {
const char * str = 0;
if( empty() ) {
out << "$";
@@ -42,11 +36,9 @@ SCLP23( Binary )::STEPwrite( ostream & out ) const {
}
}
const char *
SCLP23( Binary )::STEPwrite( std::string & s ) const {
const char * SCLP23( Binary )::STEPwrite( std::string & s ) const {
const char * str = 0;
if( empty() ) {
// s.set_null(); // this would free up space? nope
s = "$";
} else {
s = "\"";
@@ -60,8 +52,7 @@ SCLP23( Binary )::STEPwrite( std::string & s ) const {
return const_cast<char *>( s.c_str() );
}
Severity
SCLP23( Binary )::ReadBinary( istream & in, ErrorDescriptor * err, int AssignVal,
Severity SCLP23( Binary )::ReadBinary( istream & in, ErrorDescriptor * err, int AssignVal,
int needDelims ) {
if( AssignVal ) {
clear();
@@ -120,14 +111,6 @@ SCLP23( Binary )::ReadBinary( istream & in, ErrorDescriptor * err, int AssignVal
err->AppendToDetailMsg( messageBuf );
err->AppendToUserMsg( messageBuf );
}
/*
else if ( !isspace(b[0]) && (b[0] != '\0') )
{
err->GreaterSeverity(SEVERITY_WARNING);
sprintf(messageBuf, "Invalid binary value.\n");
err->AppendToDetailMsg(messageBuf);
}
*/
} else {
err->GreaterSeverity( SEVERITY_WARNING );
sprintf( messageBuf, "Invalid binary value.\n" );
@@ -140,152 +123,43 @@ SCLP23( Binary )::ReadBinary( istream & in, ErrorDescriptor * err, int AssignVal
return err->severity();
}
Severity
SCLP23( Binary )::StrToVal( const char * s, ErrorDescriptor * err ) {
Severity SCLP23( Binary )::StrToVal( const char * s, ErrorDescriptor * err ) {
istringstream in( ( char * )s ); // sz defaults to length of s
return ReadBinary( in, err, 1, 0 );
}
/*
operator= (s);
if (! strcmp (chars (), s)) return SEVERITY_NULL ;
else return SEVERITY_INPUT_ERROR;
*/
/////////////////////////////////////////////////
#ifdef bpzdofbqlvzbfxck
set_null();
char messageBuf[BUFSIZ];
messageBuf[0] = '\0';
int validDelimiters = 1;
char * start = 0;
char * b = s;
while( *b && isspace( *b ) ) {
b++;
}
if( *b ) {
if( ( b[0] == '\"' ) || isxdigit( b[0] ) ) {
if( b[0] == '\"' ) {
b++; // push past the delimiter
// since found a valid delimiter it is now invalid until the
// matching ending delim is found
validDelimiters = 0;
}
if( isxdigit( b[0] ) ) {
start = b;
}
while( isxdigit( b[0] ) ) {
b++;
}
if( b[0] == '\"' ) { // if found ending delimiter
// if expecting delim (i.e. validDelimiter == 0)
if( !validDelimiters ) {
validDelimiters = 1; // everything is fine
b++; // push past closing quote
} else { // found ending delimiter but no initial delimiter
validDelimiters = 0;
}
}
// didn't find any delimiters at all and need them.
else if( NeedDelims ) {
validDelimiters = 0;
}
if( !validDelimiters ) {
err->GreaterSeverity( SEVERITY_WARNING );
sprintf( messageBuf,
"Binary value missing double quote delimiters. \n" );
} else if( !isspace( b[0] ) && ( b[0] != '\0' ) ) {
err->GreaterSeverity( SEVERITY_WARNING );
sprintf( messageBuf, "Invalid binary value.\n" );
err->AppendToDetailMsg( messageBuf );
}
} else {
err->GreaterSeverity( SEVERITY_WARNING );
sprintf( messageBuf, "Invalid binary value.\n" );
err->AppendToDetailMsg( messageBuf );
}
} else {
err->GreaterSeverity( SEVERITY_INCOMPLETE );
}
return b;
#endif
// STEPread reads a binary in exchange file format
// delimited by double quotes
Severity
SCLP23( Binary )::STEPread( istream & in, ErrorDescriptor * err ) {
/// reads a binary in exchange file format delimited by double quotes
Severity SCLP23( Binary )::STEPread( istream & in, ErrorDescriptor * err ) {
return ReadBinary( in, err, 1, 1 );
/*
int foundEndQuote = 0; // need so this string is not ok: 'hi''
set_null (); // clear the old string
char c;
in >> ws; // skip white space
in >> c;
// remember the current format state to restore the previous settings
long int flags = in.flags();
in.unsetf(ios::skipws);
if (c == BINARY_DELIM)
{
while( in.good() && in.get(c) && (c != BINARY_DELIM) )
{
Append (c);
}
Append ('\0');
if(c == BINARY_DELIM)
return SEVERITY_NULL;
else
{ // non-recoverable error
err->AppendToDetailMsg("Missing closing quote on binary value.\n");
err->AppendToUserMsg("Missing closing quote on binary value.\n");
err->GreaterSeverity(SEVERITY_INPUT_ERROR);
return SEVERITY_INPUT_ERROR;
}
}
// otherwise there was not a quote
in.putback (c);
in.flags(flags); // set the format state back to previous settings
return err -> GreaterSeverity (SEVERITY_INCOMPLETE);
*/
}
Severity
SCLP23( Binary )::STEPread( const char * s, ErrorDescriptor * err ) {
Severity SCLP23( Binary )::STEPread( const char * s, ErrorDescriptor * err ) {
istringstream in( ( char * )s );
return STEPread( in, err );
}
///////////////////////////////////////////////////////////////////////////////
// * attrValue is validated.
// * err is set if there is an error
// * If optional is 1 then a missing value will be valid otherwise severity
// incomplete will be set.
// * If you don\'t know if the value may be optional then set it false and
// check to see if SEVERITY_INCOMPLETE is set. You can change it later to
// SEVERITY_NULL if it is valid for the value to be missing. No error
// 'message' will be associated with the value being missing so you won\'t
// have to worry about undoing an error message.
// * tokenList contains characters that terminate the expected value.
// * If tokenList is not zero then the value is expected to terminate before
// a character found in tokenlist. All values read up to the
// terminating character (delimiter) must be valid or err will be set with an
// appropriate error message. White space between the value and the
// terminating character is not considered to be invalid. If tokenList is
// null then attrValue must only contain a valid value and nothing else
// following.
///////////////////////////////////////////////////////////////////////////////
Severity
SCLP23( Binary )::BinaryValidLevel( istream & in, ErrorDescriptor * err,
/***************************************************************************//**
** * attrValue is validated.
** * err is set if there is an error
** * If optional is 1 then a missing value will be valid otherwise severity
** incomplete will be set.
** * If you don't know if the value may be optional then set it false and
** check to see if SEVERITY_INCOMPLETE is set. You can change it later to
** SEVERITY_NULL if it is valid for the value to be missing. No error
** 'message' will be associated with the value being missing so you won\'t
** have to worry about undoing an error message.
** * tokenList contains characters that terminate the expected value.
** * If tokenList is not zero then the value is expected to terminate before
** a character found in tokenlist. All values read up to the
** terminating character (delimiter) must be valid or err will be set with an
** appropriate error message. White space between the value and the
** terminating character is not considered to be invalid. If tokenList is
** null then attrValue must only contain a valid value and nothing else
** following.
******************************************************************************/
Severity SCLP23( Binary )::BinaryValidLevel( istream & in, ErrorDescriptor * err,
int optional, char * tokenList,
int needDelims, int clearError ) {
if( clearError ) {
@@ -320,8 +194,7 @@ SCLP23( Binary )::BinaryValidLevel( istream & in, ErrorDescriptor * err,
return err->severity();
}
Severity
SCLP23( Binary )::BinaryValidLevel( const char * value, ErrorDescriptor * err,
Severity SCLP23( Binary )::BinaryValidLevel( const char * value, ErrorDescriptor * err,
int optional, char * tokenList,
int needDelims, int clearError ) {
istringstream in( ( char * )value );
+6 -9
View File
@@ -1,5 +1,5 @@
#ifndef SDAIBINARY_H
#define SDAIBINARY_H 1
#define SDAIBINARY_H 1
#include <string>
@@ -13,8 +13,6 @@
* and is not subject to copyright.
*/
/* $Id: sdaiBinary.h,v */
class SCLP23_NAME(Binary) : public std::string
{
public:
@@ -23,7 +21,6 @@ class SCLP23_NAME(Binary) : public std::string
SCLP23_NAME(Binary) (const char * str = 0, int max =0)
: std::string (str,max) { }
//Josh L, 3/28/95
SCLP23_NAME(Binary) (const std::string& s) : std::string (s) { }
@@ -42,15 +39,15 @@ class SCLP23_NAME(Binary) : public std::string
Severity STEPread (const char *s, ErrorDescriptor *err);
Severity BinaryValidLevel (const char *value, ErrorDescriptor *err,
int optional, char *tokenList,
int needDelims = 0, int clearError = 1);
int optional, char *tokenList,
int needDelims = 0, int clearError = 1);
Severity BinaryValidLevel (istream &in, ErrorDescriptor *err,
int optional, char *tokenList,
int needDelims = 0, int clearError = 1);
int optional, char *tokenList,
int needDelims = 0, int clearError = 1);
protected:
Severity ReadBinary(istream& in, ErrorDescriptor *err, int AssignVal = 1,
int needDelims = 1);
int needDelims = 1);
};
#endif
+78 -419
View File
@@ -1,12 +1,9 @@
//#include <Enum.h>
//#include <Enumeration.h>
#include <sdai.h>
/*
* NIST STEP Core Class Library
* clstepcore/Enumeration.cc
* clstepcore/sdaiEnum.cc
* April 1997
* K. C. Morris
* David Sauder
@@ -15,28 +12,8 @@
* and is not subject to copyright.
*/
/* $Id: sdaiEnum.cc,v 1.5 1997/11/05 21:59:14 sauderd DP3.1 $ */
//static char rcsid[] ="$Id: sdaiEnum.cc,v 1.5 1997/11/05 21:59:14 sauderd DP3.1 $";
#include <sstream>
//#ifndef SCLP23(TRUE)
//#ifndef SCLP23(FALSE)
// Josh L, 3/31/95
// These constants have to be initialized outside the SDAI struct. They
// are initialized here instead of in the header file in order to avoid
// multiple inclusions when building SCL applications.
/*
const SCLP23(BOOLEAN) SCLP23(TRUE)( BTrue );
const SCLP23(BOOLEAN) SCLP23(FALSE)( BFalse );
const SCLP23(BOOLEAN) SCLP23(UNSET)( BUnset );
const SCLP23(LOGICAL) SCLP23(UNKNOWN)( LUnknown );
*/
//#endif
//#endif
///////////////////////////////////////////////////////////////////////////////
// class Logical
///////////////////////////////////////////////////////////////////////////////
@@ -61,28 +38,18 @@ SCLP23( LOGICAL )::SCLP23_NAME( LOGICAL )( int i ) {
}
}
/*
SCLP23(LOGICAL)::SCLP23_NAME(LOGICAL) (const BOOLEAN& boo)
{
v = boo.asInt();
}
*/
SCLP23( LOGICAL )::~SCLP23_NAME( LOGICAL )() {
}
const char *
SCLP23( LOGICAL )::Name() const {
const char * SCLP23( LOGICAL )::Name() const {
return "Logical";
}
int
SCLP23( LOGICAL )::no_elements() const {
int SCLP23( LOGICAL )::no_elements() const {
return 3;
}
const char *
SCLP23( LOGICAL )::element_at( int n ) const {
const char * SCLP23( LOGICAL )::element_at( int n ) const {
switch( n ) {
case LUnknown :
return "U";
@@ -95,42 +62,14 @@ SCLP23( LOGICAL )::element_at( int n ) const {
}
}
int
SCLP23( LOGICAL )::exists() const { // return 0 if unset otherwise return 1
int SCLP23( LOGICAL )::exists() const { // return 0 if unset otherwise return 1
return !( v == 2 );
}
void
SCLP23( LOGICAL )::nullify() { // change the receiver to an unset status
void SCLP23( LOGICAL )::nullify() { // change the receiver to an unset status
v = 2;
}
#if 0
SCLP23( LOGICAL )::operator int () const {
// anything other than BFalse should return 1 according to Part 23
if( v == LFalse ) {
return 0;
}
//#endif
else {
return 1;
}
/*
switch (v) {
case LFalse: return 0;
case LTrue: return 1;
case LUnknown:
case LUnset: // BUnset or anything other than t or f should set error
// sdaiVA_NSET i.e. value unset
default: return 1;
}
*/
}
#endif
SCLP23( LOGICAL )::operator Logical() const {
switch( v ) {
case LFalse :
@@ -147,8 +86,7 @@ SCLP23( LOGICAL )::operator Logical() const {
SCLP23( LOGICAL ) &
SCLP23( LOGICAL )::operator= ( const SCLP23( LOGICAL )& t ) {
SCLP23( LOGICAL ) & SCLP23( LOGICAL )::operator= ( const SCLP23( LOGICAL )& t ) {
set_value( t.asInt() );
return *this;
}
@@ -160,8 +98,7 @@ SCLP23( LOGICAL ) SCLP23( LOGICAL )::operator ==( const SCLP23( LOGICAL )& t ) c
return LFalse ;
}
int
SCLP23( LOGICAL )::set_value( const int i ) {
int SCLP23( LOGICAL )::set_value( const int i ) {
if( i > no_elements() + 1 ) {
v = 2;
return v;
@@ -175,14 +112,10 @@ SCLP23( LOGICAL )::set_value( const int i ) {
<< " for " << Name() << "\n";
DebugDisplay();
return no_elements() + 1 ;
// return ENUM_NULL ;
}
int
SCLP23( LOGICAL )::set_value( const char * n ) {
int SCLP23( LOGICAL )::set_value( const char * n ) {
// assigns the appropriate value based on n
// if ( !n || (!strcmp (n, "")) ) return set_value (ENUM_NULL);
if( !n || ( !strcmp( n, "" ) ) ) {
nullify();
return asInt();
@@ -197,16 +130,13 @@ SCLP23( LOGICAL )::set_value( const char * n ) {
if( ( no_elements() + 1 ) == i ) { // exhausted all the possible values
nullify();
return v;
// return set_value (ENUM_NULL);
}
v = i;
return v;
}
Severity
SCLP23( LOGICAL )::ReadEnum( istream & in, ErrorDescriptor * err, int AssignVal,
Severity SCLP23( LOGICAL )::ReadEnum( istream & in, ErrorDescriptor * err, int AssignVal,
int needDelims ) {
if( AssignVal ) {
set_null();
@@ -329,8 +259,7 @@ SCLP23( LOGICAL )::ReadEnum( istream & in, ErrorDescriptor * err, int AssignVal,
// class BOOLEAN Jan 97
///////////////////////////////////////////////////////////////////////////////
const char *
SCLP23( BOOLEAN )::Name() const {
const char * SCLP23( BOOLEAN )::Name() const {
return "Bool";
}
@@ -349,8 +278,7 @@ SCLP23( BOOLEAN )::SCLP23_NAME( BOOLEAN )( const SCLP23_NAME( BOOLEAN )& source
SCLP23( BOOLEAN )::~SCLP23_NAME( BOOLEAN )() {
}
int
SCLP23( BOOLEAN )::no_elements() const {
int SCLP23( BOOLEAN )::no_elements() const {
return 2;
}
@@ -383,51 +311,17 @@ SCLP23( BOOLEAN )::operator Boolean() const {
}
}
SCLP23( BOOLEAN ) &
SCLP23( BOOLEAN )::operator= ( const SCLP23( LOGICAL )& t ) {
SCLP23( BOOLEAN ) & SCLP23( BOOLEAN )::operator= ( const SCLP23( LOGICAL )& t ) {
set_value( t.asInt() );
return *this;
}
SCLP23( BOOLEAN ) &
SCLP23( BOOLEAN )::operator= ( const Boolean t ) {
SCLP23( BOOLEAN ) & SCLP23( BOOLEAN )::operator= ( const Boolean t ) {
v = t;
return *this;
}
#if 0
SCLP23( BOOLEAN )::operator int () const {
// anything other than BFalse should return 1 according to Part 23
switch( v ) {
case BFalse :
return 0;
case BTrue :
return 1;
case BUnset : // BUnset or anything other than t or f should set
// error sdaiVA_NSET i.e. value unset
default:
return 1;
}
}
SCLP23( BOOLEAN )::operator Logical() const {
switch( v ) {
case BFalse :
return LFalse ;
case BTrue :
return LTrue ;
case BUnset :
return LUnset ;
default:
return LUnknown ;
}
}
#endif
const char *
SCLP23( BOOLEAN )::element_at( int n ) const {
const char * SCLP23( BOOLEAN )::element_at( int n ) const {
switch( n ) {
case BFalse :
return "F";
@@ -454,39 +348,38 @@ SCLP23( Enum )::SCLP23_NAME( Enum )() {
SCLP23( Enum )::~SCLP23_NAME( Enum )() {
}
int
SCLP23( Enum )::put( int val ) {
/**
* \copydoc set_value( const char * n )
*/
int SCLP23( Enum )::put( int val ) {
return set_value( val );
}
int
SCLP23( Enum )::put( const char * n ) {
/**
* \copydoc set_value( const char * n )
*/
int SCLP23( Enum )::put( const char * n ) {
return set_value( n );
}
int
SCLP23( Enum )::exists() const { // return 0 if unset otherwise return 1
/// return 0 if unset otherwise return 1
int SCLP23( Enum )::exists() const {
return !( v > no_elements() );
}
void
SCLP23( Enum )::nullify() // change the receiver to an unset status
// unset is generated to be 1 greater than last element
{
/**
* change the receiver to an unset status
* unset is generated to be 1 greater than last element
*/
void SCLP23( Enum )::nullify() {
set_value( no_elements() + 1 );
}
/******************************************************************
** Procedure: DebugDisplay
** Parameters: ostream& out
** Returns:
** Description: prints out some information on the enumerated
** item for debugging purposes
** Side Effects:
/**************************************************************//**
** prints out some information on the enumerated item for
** debugging purposes
** Status: ok 2/1/91
******************************************************************/
void
SCLP23( Enum )::DebugDisplay( ostream & out ) const {
void SCLP23( Enum )::DebugDisplay( ostream & out ) const {
std::string tmp;
out << "Current " << Name() << " value: " << endl
<< " cardinal: " << v << endl
@@ -504,22 +397,22 @@ SCLP23( Enum )::DebugDisplay( ostream & out ) const {
out << "\n";
}
// Read an Enumeration value
// ENUMERATION = "." UPPER { UPPER | DIGIT } "."
// *note* UPPER is defined as alpha or underscore.
// returns: Severity of the error.
// error message and error Severity is written to ErrorDescriptor *err.
// int AssignVal is:
// true => value is assigned to the SCLP23(Enum);
// true or false => value is read and appropriate error info is set and
// returned.
// int needDelims is:
// false => absence of the period delimiters is not an error;
// true => delimiters must be valid;
// true or false => non-matching delimiters are flagged as an error
Severity
SCLP23( Enum )::ReadEnum( istream & in, ErrorDescriptor * err, int AssignVal,
/**
** Read an Enumeration value
** ENUMERATION = "." UPPER { UPPER | DIGIT } "."
** *note* UPPER is defined as alpha or underscore.
**
** \returns Severity of the error.
** \param err error message and error Severity is written to ErrorDescriptor *err.
** \param AssignVal is:
** true => value is assigned to the SCLP23(Enum);
** true or false => value is read and appropriate error info is set and returned.
** \param int needDelims is:
** false => absence of the period delimiters is not an error;
** true => delimiters must be valid;
** true or false => non-matching delimiters are flagged as an error
*/
Severity SCLP23( Enum )::ReadEnum( istream & in, ErrorDescriptor * err, int AssignVal,
int needDelims ) {
if( AssignVal ) {
set_null();
@@ -638,17 +531,7 @@ SCLP23( Enum )::ReadEnum( istream & in, ErrorDescriptor * err, int AssignVal,
return err->severity();
}
/*
Severity
SCLP23(Enum)::StrToVal (const char * s)
{
put (s);
return SEVERITY_NULL;
}
*/
Severity
SCLP23( Enum )::StrToVal( const char * s, ErrorDescriptor * err, int optional ) {
Severity SCLP23( Enum )::StrToVal( const char * s, ErrorDescriptor * err, int optional ) {
istringstream in( ( char * )s ); // sz defaults to length of s
ReadEnum( in, err, 1, 0 );
@@ -659,16 +542,14 @@ SCLP23( Enum )::StrToVal( const char * s, ErrorDescriptor * err, int optional )
return err->severity();
}
// reads an enumerated value in STEP file format
Severity
SCLP23( Enum )::STEPread( const char * s, ErrorDescriptor * err, int optional ) {
/// reads an enumerated value in STEP file format
Severity SCLP23( Enum )::STEPread( const char * s, ErrorDescriptor * err, int optional ) {
istringstream in( ( char * )s );
return STEPread( in, err, optional );
}
// reads an enumerated value in STEP file format
Severity
SCLP23( Enum )::STEPread( istream & in, ErrorDescriptor * err, int optional ) {
/// reads an enumerated value in STEP file format
Severity SCLP23( Enum )::STEPread( istream & in, ErrorDescriptor * err, int optional ) {
ReadEnum( in, err, 1, 1 );
if( ( err->severity() == SEVERITY_INCOMPLETE ) && optional ) {
err->severity( SEVERITY_NULL );
@@ -677,21 +558,15 @@ SCLP23( Enum )::STEPread( istream & in, ErrorDescriptor * err, int optional ) {
return err->severity();
}
const char *
SCLP23( Enum )::asStr( std::string & s ) const {
// if (v != ENUM_NULL)
const char * SCLP23( Enum )::asStr( std::string & s ) const {
if( exists() ) {
// s = elements[v];
return const_cast<char *>( ( s = element_at( v ) ).c_str() );
// return s.c_str();
} else {
return "";
}
}
void
SCLP23( Enum )::STEPwrite( ostream & out ) const {
void SCLP23( Enum )::STEPwrite( ostream & out ) const {
if( is_null() ) {
out << '$';
} else {
@@ -700,8 +575,7 @@ SCLP23( Enum )::STEPwrite( ostream & out ) const {
}
}
const char *
SCLP23( Enum )::STEPwrite( std::string & s ) const {
const char * SCLP23( Enum )::STEPwrite( std::string & s ) const {
if( is_null() ) {
s.clear();
} else {
@@ -713,27 +587,7 @@ SCLP23( Enum )::STEPwrite( std::string & s ) const {
return const_cast<char *>( s.c_str() );
}
//SCLP23(Enum)::SCLP23_NAME(Enum) (const char * const e)
//: elements (e)
//{
//}
/******************************************************************
** Procedure: set_elements
** Parameters:
** Returns:
** Description:
** Side Effects:
** Status:
******************************************************************/
#ifdef OBSOLETE
void
SCLP23( Enum )::set_elements( const char * const e [] ) {
elements = e;
}
#endif
Severity
SCLP23( Enum )::EnumValidLevel( istream & in, ErrorDescriptor * err,
Severity SCLP23( Enum )::EnumValidLevel( istream & in, ErrorDescriptor * err,
int optional, char * tokenList,
int needDelims, int clearError ) {
if( clearError ) {
@@ -770,91 +624,26 @@ SCLP23( Enum )::EnumValidLevel( istream & in, ErrorDescriptor * err,
return err->severity();
}
Severity
SCLP23( Enum )::EnumValidLevel( const char * value, ErrorDescriptor * err,
Severity SCLP23( Enum )::EnumValidLevel( const char * value, ErrorDescriptor * err,
int optional, char * tokenList,
int needDelims, int clearError ) {
istringstream in( ( char * )value );
return EnumValidLevel( in, err, optional, tokenList, needDelims,
clearError );
/*
char messageBuf[BUFSIZ];
messageBuf[0] = '\0';
if(attrValue)
{
int len = strlen (attrValue);
char *valstart = new char [len + 1];
char *val = valstart;
int numFound = sscanf(attrValue," %s", val);
if(numFound != EOF)
{
int i = 0;
if(val [0] == '.') // strip the delims
{
val++;
char * pos = strchr(val, '.');
if (pos)
*pos = '\0';
else
{
err->AppendToDetailMsg(
"Missing ending period delimiter for enumerated value.\n");
err->AppendToUserMsg(
"Missing ending period delimiter for enumerated value.\n");
err->GreaterSeverity(SEVERITY_WARNING);
}
}
std::string tmp;
while((i < no_elements() ) &&
(strcmp( (char *)StrToUpper(val, tmp), element_at (i) ) != 0))
++i;
if(no_elements() == i) // exhausted all the possible values
{
err->GreaterSeverity(SEVERITY_WARNING);
sprintf(messageBuf,
"attribute %s: Invalid enumeration value: '%s'",
Name(), val);
err->AppendToUserMsg(messageBuf);
err->AppendToDetailMsg(messageBuf);
// DebugDisplay ();
return SEVERITY_WARNING;
}
err->GreaterSeverity(SEVERITY_NULL);
return SEVERITY_NULL;
}
delete [] valstart;
}
if(optional)
{
err->GreaterSeverity(SEVERITY_NULL);
return SEVERITY_NULL;
}
else
{
err->GreaterSeverity(SEVERITY_INCOMPLETE);
return SEVERITY_INCOMPLETE;
}
*/
}
/******************************************************************
** Procedure: set_value
** Parameters: char * n OR in i -- value to be set
** Returns: value set
** Description: sets the value of an enumerated attribute
** case is not important in the character based version
** if value is not acceptable, a warning is printed and
** processing continues
** Side Effects:
** Status: ok 2.91
******************************************************************/
int
SCLP23( Enum )::set_value( const char * n ) {
/**************************************************************//**
** sets the value of an enumerated attribute case is not important
** in the character based version if value is not acceptable, a
** warning is printed and processing continues
**
** set_value is the same function as put
**
** Parameter: value to be set
** Status: ok 2.91
** \returns: value set
******************************************************************/
int SCLP23( Enum )::set_value( const char * n ) {
// assigns the appropriate value based on n
// if ( !n || (!strcmp (n, "")) ) return set_value (ENUM_NULL);
if( !n || ( !strcmp( n, "" ) ) ) {
@@ -870,22 +659,16 @@ SCLP23( Enum )::set_value( const char * n ) {
}
if( no_elements() == i ) { // exhausted all the possible values
return v = no_elements() + 1; // defined as UNSET
// return set_value (ENUM_NULL);
}
v = i;
return v;
}
// set_value is the same function as put
int
SCLP23( Enum )::set_value( const int i ) {
/*
if (i == ENUM_NULL) {
v = ENUM_NULL;
return ENUM_NULL;
}
*/
/**
* \copydoc set_value( const char * n )
*/
int SCLP23( Enum )::set_value( const int i ) {
if( i > no_elements() ) {
v = no_elements() + 1;
return v;
@@ -899,18 +682,15 @@ SCLP23( Enum )::set_value( const int i ) {
<< " for " << Name() << "\n";
DebugDisplay();
return no_elements() + 1 ;
// return ENUM_NULL ;
}
SCLP23( Enum ) &
SCLP23( Enum )::operator= ( const int i ) {
SCLP23( Enum ) & SCLP23( Enum )::operator= ( const int i ) {
put( i );
return *this;
}
SCLP23( Enum ) &
SCLP23( Enum )::operator= ( const SCLP23( Enum )& Senum ) {
SCLP23( Enum ) & SCLP23( Enum )::operator= ( const SCLP23( Enum )& Senum ) {
put( Senum.asInt() );
return *this;
}
@@ -921,124 +701,3 @@ ostream & operator<< ( ostream & out, const SCLP23( Enum )& a ) {
return out;
}
#ifdef pojoldStrToValNstepRead
Severity
SCLP23( Enum )::StrToVal( const char * s, ErrorDescriptor * err, int optional ) {
const char * sPtr = s;
while( isspace( *sPtr ) ) {
sPtr++;
}
if( *sPtr == '\0' ) {
if( optional ) {
err->GreaterSeverity( SEVERITY_NULL );
return SEVERITY_NULL;
} else {
err->GreaterSeverity( SEVERITY_INCOMPLETE );
return SEVERITY_INCOMPLETE;
}
} else if( *sPtr == '.' ) { // look for initial period delimiter
return STEPread( sPtr, err );
} else {
// look for ending period delimiter (an error)
char * periodLoc = strchr( sPtr, '.' );
if( periodLoc ) {
// found an ending period w/out initial period
char * tmp = new char[strlen( sPtr ) + 1];
strcpy( tmp, sPtr );
tmp[periodLoc - sPtr] = '\0'; // write over ending period
err->GreaterSeverity( SEVERITY_WARNING );
err->AppendToDetailMsg(
"Ending period delimiter without initial period delimiter.\n" );
err->AppendToUserMsg(
"Ending period delimiter without initial period delimiter.\n" );
delete [] tmp;
if( ValidLevel( sPtr, err, optional ) ) {
// remaining value is valid so assign it
put( tmp );
return SEVERITY_WARNING;
} else {
err->AppendToDetailMsg( "Invalid Enumerated value.\n" );
err->AppendToUserMsg( "Invalid Enumerated value.\n" );
return SEVERITY_WARNING;
}
}
// no surrounding delimiters
else if( ValidLevel( sPtr, err, optional ) ) {
// value is valid so assign it
put( sPtr );
return SEVERITY_NULL;
} else {
err->AppendToDetailMsg( "Invalid Enumerated value.\n" );
err->AppendToUserMsg( "Invalid Enumerated value.\n" );
return SEVERITY_WARNING;
}
}
}
Severity
SCLP23( Enum )::STEPread( istream & in, ErrorDescriptor * err, int optional ) {
char enumValue [BUFSIZ];
char c;
char errStr[BUFSIZ];
errStr[0] = '\0';
err->severity( SEVERITY_NULL ); // assume ok until error happens
in >> c;
switch( c ) {
case '.':
in.getline( enumValue, BUFSIZ, '.' ); // reads but does not store the .
/*
// gcc 2.3.3 - It does and should read the . It doesn't store it DAS 4/27/93
char * pos = index(enumValue, '.');
if (pos) *pos = '\0';
// NON-STANDARD (GNUism) getline should not retrieve .
// function gcount is unavailable
*/
if( in.fail() ) {
err->GreaterSeverity( SEVERITY_WARNING );
err->AppendToUserMsg(
"Missing ending period delimiter for enumerated value.\n" );
err->AppendToDetailMsg(
"Missing ending period delimiter for enumerated value.\n" );
}
if( ValidLevel( enumValue, err, optional ) == SEVERITY_NULL ) {
set_value( enumValue );
} else {
err->AppendToDetailMsg( "Invalid enumerated value.\n" );
err->GreaterSeverity( SEVERITY_WARNING );
set_value( ENUM_NULL );
}
break;
case ',': // for next attribute or next aggregate value?
case ')': // for end of aggregate value?
default:
in.putback( c );
set_value( ENUM_NULL );
if( optional ) {
err->GreaterSeverity( SEVERITY_NULL );
} else {
err->GreaterSeverity( SEVERITY_INCOMPLETE );
}
break;
/*
default:
set_value (ENUM_NULL);
// read didn't know what to do
err->GreaterSeverity(SEVERITY_INPUT_ERROR);
sprintf(errStr,
"SCLP23(Enum)::STEPread(): warning : poorly delimited %s %s",
Name(), "enumerated value was ignored.");
err->AppendToDetailMsg(errStr);
*/
}
return err->severity();
}
#endif
+16 -84
View File
@@ -1,5 +1,5 @@
#ifndef P23ENUM_H
#define P23ENUM_H
#define P23ENUM_H
/*
* NIST STEP Core Class Library
@@ -12,35 +12,12 @@
* and is not subject to copyright.
*/
/* $Id: sdaiEnum.h,v 1.5 1997/11/05 21:59:14 sauderd DP3.1 $ */
#if 0
#ifdef PART26
// Change the name of the include file defining the defs for Bool and Logical
// inside the file corbaIncludes.h
#include <corbaIncludes.h>
#endif
#ifdef __O3DB__
#include <OpenOODB.h>
#endif
#include <sclprefixes.h>
#include <Str.h>
#include <errordesc.h>
#endif
//#define ENUM_NULL -1
//class STEPenumeration {
class SCLP23_NAME(Enum) {
friend ostream &operator<< ( ostream&, const SCLP23_NAME(Enum)& );
protected:
int v; // integer value of enumeration instance
// mapped to a symbolic value in the elements
int v; // integer value of enumeration instance
// mapped to a symbolic value in the elements
virtual int set_value (const char * n);
virtual int set_value (const int n);
@@ -50,7 +27,7 @@ class SCLP23_NAME(Enum) {
public:
void PrintContents(ostream &out = cout) const
{ DebugDisplay(out); }
{ DebugDisplay(out); }
virtual int no_elements () const =0;
virtual const char * Name () const =0;
@@ -58,14 +35,14 @@ class SCLP23_NAME(Enum) {
virtual const char * element_at (int n) const =0;
Severity EnumValidLevel(const char *value, ErrorDescriptor *err,
int optional, char *tokenList,
int needDelims = 0, int clearError = 1);
int optional, char *tokenList,
int needDelims = 0, int clearError = 1);
Severity EnumValidLevel(istream &in, ErrorDescriptor *err,
int optional, char *tokenList,
int needDelims = 0, int clearError = 1);
int optional, char *tokenList,
int needDelims = 0, int clearError = 1);
const int asInt () const { return v; }
const int asInt () const { return v; }
const char * asStr (std::string& s) const;
void STEPwrite (ostream& out = cout) const;
@@ -78,60 +55,28 @@ class SCLP23_NAME(Enum) {
virtual int put (int val);
virtual int put (const char * n);
int is_null () const
{ return ! (exists()); }
{ return ! (exists()); }
void set_null() { nullify(); }
SCLP23_NAME(Enum)& operator= (const int);
SCLP23_NAME(Enum)& operator= (const SCLP23_NAME(Enum)&);
// operator ULong() const { return v; } // return the integer equivalent
virtual int exists() const; // return 0 if unset otherwise return 1
virtual void nullify(); // change the receiver to an unset status
// unset is generated to be 1 greater than last element
virtual int exists() const;
virtual void nullify();
void DebugDisplay (ostream& out =cout) const;
protected:
virtual Severity ReadEnum(istream& in, ErrorDescriptor *err,
int AssignVal = 1, int needDelims = 1);
int AssignVal = 1, int needDelims = 1);
};
//struct P23_NAMESPACE {
#ifndef _ODI_OSSG_
class SCLP23_NAME(LOGICAL);
class SCLP23_NAME(BOOLEAN);
#endif
// If NO_BOOLS_LOGS is defined then Boolean and Logical need to be defined
// elsewhere. Namely they are specified by Part 26 to be defined within the
// context of CORBA in IDL. That means they need to have code generated for
// them by the IDL compiler so that they are understood by the compiler in the
// IDL generated code. Of course that means they can't be defined here. It also
// means that their definition needs to be included here. That is done by
// changing the file included above as #include <corbaIncludes.h> Go to that
// file and change the name of the file included there.
// If NO_BOOL_LOGS is not defined they will be defined here and must be
// prefixed with or parameterized macro when used. (see
// clstepcore/sclprefixes.h)
// If you need Logical and Bool to be prefixed with something else because it
// is defined in another name space:
// 1. define NO_BOOLS_LOGS (so they are not defined here)
// 2. change the definition of the macros defining the parameterized
// macros (SCLBOOL, SCLBOOL_H, SCLLOG, and SCLLOG_H) in
// clstepcore/sclprefixes.h
// DAS
/* #ifndef NO_BOOLS_LOGS */
/* enum SCLBOOL_H(Boolean) { SCLBOOL_H(BFalse), SCLBOOL_H(BTrue), SCLBOOL_H(BUnset) }; */
/* enum SCLLOG_H(Logical) { SCLLOG_H(LFalse), SCLLOG_H(LTrue), SCLLOG_H(LUnset), SCLLOG_H(LUnknown) }; */
/* #endif */
enum Boolean { BFalse, BTrue, BUnset };
enum Logical { LFalse, LTrue, LUnset, LUnknown };
// old SCL definition
//enum LOGICAL { sdaiFALSE, sdaiTRUE, sdaiUNKNOWN };
class SCLP23_NAME(LOGICAL) :
public SCLP23_NAME(Enum) {
public:
@@ -142,19 +87,11 @@ public SCLP23_NAME(Enum) {
SCLP23_NAME(LOGICAL) (const SCLP23_NAME(LOGICAL)& source);
SCLP23_NAME(LOGICAL) (int i);
// this is to avoid a bug? in the ossg utility for ObjectStore
#ifndef _ODI_OSSG_
// this causes an error with sun C++ because SCLP23_NAME(BOOLEAN) is not a completely
// specified type. (this is supposed to be SDAI?) DAS
// SCLP23_NAME(LOGICAL) (const SCLP23_NAME(BOOLEAN)& boo);
#endif
virtual ~SCLP23_NAME(LOGICAL) ();
virtual int no_elements () const;
virtual const char * element_at (int n) const;
// operator int () const;
operator Logical () const;
SCLP23_NAME(LOGICAL)& operator=(const SCLP23_NAME(LOGICAL)& t);
@@ -168,10 +105,9 @@ public SCLP23_NAME(Enum) {
virtual int set_value (const int n);
virtual int set_value (const char * n);
virtual Severity ReadEnum(istream& in, ErrorDescriptor *err,
int AssignVal = 1, int needDelims = 1);
int AssignVal = 1, int needDelims = 1);
}
;
};
class SCLP23_NAME(BOOLEAN) :
public SCLP23_NAME(Enum) {
@@ -192,18 +128,14 @@ public SCLP23_NAME(Enum) {
SCLP23_NAME(BOOLEAN)& operator=(const SCLP23_NAME(LOGICAL)& t);
SCLP23_NAME(BOOLEAN)& operator=(const Boolean t);
// operator int () const;
// operator Logical () const;
SCLP23_NAME(LOGICAL) operator==( const SCLP23_NAME(LOGICAL)& t ) const;
}
;
};
static const SCLP23_NAME(BOOLEAN) SCLP23_NAME(TRUE);
static const SCLP23_NAME(BOOLEAN) SCLP23_NAME(FALSE);
static const SCLP23_NAME(BOOLEAN) SCLP23_NAME(UNSET);
static const SCLP23_NAME(LOGICAL) SCLP23_NAME(UNKNOWN);
//}; // end struct P23_NAMESPACE
#endif
+74 -78
View File
@@ -37,29 +37,24 @@ SCLP23( Select )::~SCLP23_NAME( Select )() {
}
Severity SCLP23( Select )::severity() const {
/** fn Severity **/
return _error.severity();
} /** end function **/
}
Severity SCLP23( Select )::severity( Severity s ) {
/** fn Severity **/
return _error.severity( s );
} /** end function **/
}
const std::string SCLP23( Select )::Error() {
/** fn Error **/
return _error.DetailMsg();
} /** end function **/
}
void SCLP23( Select )::Error( const char * e ) {
/** fn Error **/
_error.DetailMsg( e );
} /** end function **/
}
void SCLP23( Select )::ClearError() {
/** end function **/
_error.ClearErrorMsg();
} /** end function **/
}
const TypeDescriptor *
SCLP23( Select )::CanBe( const char * n ) const {
@@ -132,8 +127,6 @@ SCLP23( Select )::SetUnderlyingType( const TypeDescriptor * td ) {
}
bool SCLP23( Select )::exists() const {
// instead of returning the address as 'true' or NULL as false, lets reduce
// this down to a bool.
return underlying_type != NULL;
}
@@ -141,26 +134,18 @@ void SCLP23( Select )::nullify() {
underlying_type = 0;
}
Severity
SCLP23( Select )::SelectValidLevel( const char * attrValue, ErrorDescriptor * err,
Severity SCLP23( Select )::SelectValidLevel( const char * attrValue, ErrorDescriptor * err,
InstMgr * im, int clearError ) {
SCLP23( Select ) * tmp = NewSelect();
Severity s = SEVERITY_NULL;
// COMMENTED OUT TO ALLOW FOR TYPE RESOLUTION WHEN TYPE CHANGES
// if (CurrentUnderlyingType ())
// s = tmp -> StrToVal
// (attrValue, CurrentUnderlyingType () -> Name (), err, im);
// else
istringstream strtmp( attrValue );
s = tmp -> STEPread( strtmp, err, im );
delete tmp;
return s;
}
Severity
SCLP23( Select )::StrToVal( const char * Val, const char * selectType,
Severity SCLP23( Select )::StrToVal( const char * Val, const char * selectType,
ErrorDescriptor * err, InstMgr * instances ) {
severity( SEVERITY_NULL );
if( SetUnderlyingType( CanBe( selectType ) ) )
@@ -219,9 +204,10 @@ SCLP23( Select )::StrToVal( const char * Val, const char * selectType,
return SEVERITY_INPUT_ERROR;
}
// updated to Technical Corrigendum. DAS 2/4/97
Severity
SCLP23( Select )::STEPread( istream & in, ErrorDescriptor * err,
/** updated to Technical Corrigendum. DAS 2/4/97
* This function does the following:
*/
Severity SCLP23( Select )::STEPread( istream & in, ErrorDescriptor * err,
InstMgr * instances, const char * utype,
int addFileId, const char * currSch ) {
char c = '\0';
@@ -233,11 +219,13 @@ SCLP23( Select )::STEPread( istream & in, ErrorDescriptor * err,
// find out what case we have
// NOTE case C falls out of recursive calls in cases A and B
// This section of code is used to read a value belonging to a select
// contained in another select. If you have read the text part of the
// TYPED_PARAMETER and it needs to fall down thru some levels of contained
// select types, then the text is passed down to each select in the utype
// parameter as STEPread is called on each contained select type.DAS 2/4/97
/**
** This section of code is used to read a value belonging to a select
** contained in another select. If you have read the text part of the
** TYPED_PARAMETER and it needs to fall down thru some levels of contained
** select types, then the text is passed down to each select in the utype
** parameter as STEPread is called on each contained select type.DAS 2/4/97
*/
if( utype ) {
if( SetUnderlyingType( CanBeSet( utype, currSch ) ) ) {
// assign the value to the underlying type
@@ -256,23 +244,24 @@ SCLP23( Select )::STEPread( istream & in, ErrorDescriptor * err,
}
in >> ws;
in >> c;
// c = in.peek();
// the if part of this code reads a value according to the Technical
// Corrigendum for Part 21 (except for Entity instance refs which are read
// in the else part - everything else in the else stmt is invalid). The
// idea here is to read text and find out if it is specifying the final
// type or is a simple defined type which is typed to be a select some
// number of levels down. The first case will cause the value to be read
// directly by STEPread_content() or will cause STEPread_content() to pass
// the text naming the type to the underlying Select containing it. When
// the latter is the case, STEPread_content calls STEPread for the
// contained select and passes in the text. The convoluted case is when
// the text describes a simple defined type that translates directly into
// a select some number of levels down. In this case there will be more
// text inside the containing parens to indicate the type. Since the text
// specifying the type still needs to be read utype is passed as null which
// will cause the contained Select STEPread function to read it. DAS 2/4/97
/**
** the if part of this code reads a value according to the Technical
** Corrigendum for Part 21 (except for Entity instance refs which are read
** in the else part - everything else in the else stmt is invalid). The
** idea here is to read text and find out if it is specifying the final
** type or is a simple defined type which is typed to be a select some
** number of levels down. The first case will cause the value to be read
** directly by STEPread_content() or will cause STEPread_content() to pass
** the text naming the type to the underlying Select containing it. When
** the latter is the case, STEPread_content calls STEPread for the
** contained select and passes in the text. The convoluted case is when
** the text describes a simple defined type that translates directly into
** a select some number of levels down. In this case there will be more
** text inside the containing parens to indicate the type. Since the text
** specifying the type still needs to be read utype is passed as null which
** will cause the contained Select STEPread function to read it. DAS 2/4/97
*/
if( isalpha( c ) ) { // case B
int eot = 0; // end of token flag
@@ -288,34 +277,40 @@ SCLP23( Select )::STEPread( istream & in, ErrorDescriptor * err,
// check for valid type and set the underlying type
if( SetUnderlyingType( CanBeSet( tmp.c_str(), currSch ) ) ) {
// Assign the value to the underlying type. CanBeSet() is a
// slightly modified CanBe(). It ensures that a renamed select
// type (see big comment below) "CantBe" one of its member items.
// This is because such a select type requires its own name to
// appear first ("selX("), so even if we read a valid element of
// selX, selX can't be the underlying type. That can only be the
// case if "selX" appears first and is what we just read.
/**
** Assign the value to the underlying type. CanBeSet() is a
** slightly modified CanBe(). It ensures that a renamed select
** type (see big comment below) "CantBe" one of its member items.
** This is because such a select type requires its own name to
** appear first ("selX("), so even if we read a valid element of
** selX, selX can't be the underlying type. That can only be the
** case if "selX" appears first and is what we just read.
*/
in >> ws; // skip white space
if( ( underlying_type->Type() == REFERENCE_TYPE ) &&
( underlying_type->NonRefType() == sdaiSELECT ) ) {
// This means (1) that the underlying type is itself a select
// (cond 2), and (2) it's not defined in the EXPRESS as a
// select, but as a renamed select. (E.g., TYPE sel2 = sel1.)
// In such a case, according to the TC, "sel2(" must appear in
// the text. (We must have found one for SetUnderlyingType()
// above to set underlying_type to sel2.) If all of the above
// is true, we read "sel2" but not the value of sel2. We
// therefore do not pass down what we read to STEPread_content
// below, so that we can still read the value of sel2. If,
// however, under_type was a non-renamed select, no "sel1"
// would appear (according to TC) and we already read the value
// of sel1. If so, we pass the already-read value down.
/**
* This means (1) that the underlying type is itself a select
** (cond 2), and (2) it's not defined in the EXPRESS as a
** select, but as a renamed select. (E.g., TYPE sel2 = sel1.)
** In such a case, according to the TC, "sel2(" must appear in
** the text. (We must have found one for SetUnderlyingType()
** above to set underlying_type to sel2.) If all of the above
** is true, we read "sel2" but not the value of sel2. We
** therefore do not pass down what we read to STEPread_content
** below, so that we can still read the value of sel2. If,
** however, under_type was a non-renamed select, no "sel1"
** would appear (according to TC) and we already read the value
** of sel1. If so, we pass the already-read value down.
*/
STEPread_content( in, instances, 0, addFileId, currSch );
} else {
// In most cases (see above note), we've already read the value
// we're interested in.
// This also handles all other cases? other than the if part
// above and elements of type entity ref?
/**
** In most cases (see above note), we've already read the value
** we're interested in.
** This also handles all other cases? other than the if part
** above and elements of type entity ref?
*/
STEPread_content( in, instances, tmp.c_str(), addFileId,
currSch );
// STEPread_content uses the ErrorDesc data member from the
@@ -356,13 +351,15 @@ SCLP23( Select )::STEPread( istream & in, ErrorDescriptor * err,
}
}
}
// NOTE **** anything that gets read below here is invalid according to the
// Technical Corrigendum for Part 21 (except for reading an entity instance
// where below is the only place they get read). I am leaving all of this
// here since it is valuable to 'read what you can' and flag an error which
// is what it does (for every type but entity instance refs). DAS 2/4/97
/**
** NOTE **** anything that gets read below here is invalid according to the
** Technical Corrigendum for Part 21 (except for reading an entity instance
** where below is the only place they get read). I am leaving all of this
** here since it is valuable to 'read what you can' and flag an error which
** is what it does (for every type but entity instance refs). DAS 2/4/97
*/
else { // case A
else { /// case A
switch( c ) {
case '$':
nullify();
@@ -515,9 +512,8 @@ SCLP23( Select )::STEPread( istream & in, ErrorDescriptor * err,
}
// updated to Technical Corrigendum DAS Feb 4, 1997
void
SCLP23( Select )::STEPwrite( ostream & out, const char * currSch ) const {
/// updated to Technical Corrigendum DAS Feb 4, 1997
void SCLP23( Select )::STEPwrite( ostream & out, const char * currSch ) const {
if( !exists() ) {
out << "$";
return;
+42 -42
View File
@@ -12,54 +12,54 @@
* and is not subject to copyright.
*/
/**********
class definition for the select superclass SCLP23_NAME(Select).
**********/
/**
** \file sdaiSelect.h class definition for the select superclass SCLP23_NAME(Select).
**/
class SCLP23_NAME(Select) {
protected:
const SelectTypeDescriptor *_type;
const TypeDescriptor * underlying_type;
BASE_TYPE base_type; // used by the subtypes
BASE_TYPE base_type; // used by the subtypes
// it looks like this member, val, is not used anywhere 9/27/96 - DAS
SCLP23_NAME(String) val;
ErrorDescriptor _error;
// it looks like this member, val, is not used anywhere 9/27/96 - DAS
SCLP23_NAME(String) val;
ErrorDescriptor _error;
const TypeDescriptor * SetUnderlyingType (const TypeDescriptor *);
const TypeDescriptor * CanBe (const char *) const;
const TypeDescriptor * CanBe (BASE_TYPE) const;
const TypeDescriptor * CanBe (const TypeDescriptor * td) const;
const TypeDescriptor * CanBeSet (const char *, const char *) const;
const TypeDescriptor * CanBe (const TypeDescriptor * td) const;
const TypeDescriptor * CanBeSet (const char *, const char *) const;
const int IsUnique(const BASE_TYPE bt) const;
virtual const TypeDescriptor * AssignEntity (SCLP23_NAME(Application_instance) * se) =0;
virtual SCLP23_NAME(Select) * NewSelect () =0;
virtual const TypeDescriptor * AssignEntity (SCLP23_NAME(Application_instance) * se) =0;
virtual SCLP23_NAME(Select) * NewSelect () =0;
public:
Severity severity() const;
Severity severity( Severity );
const std::string Error();
void Error( const char * );
// clears select's error
void ClearError();
// clears error
Severity severity() const;
Severity severity( Severity );
const std::string Error();
void Error( const char * );
// clears select's error
void ClearError();
// clears error
virtual BASE_TYPE ValueType() const =0;
// constructors
SCLP23_NAME(Select) (const SelectTypeDescriptor * s =0,
const TypeDescriptor * td =0);
virtual ~SCLP23_NAME(Select) ();
const TypeDescriptor * td =0);
virtual ~SCLP23_NAME(Select) ();
// from SDAI binding
SCLP23_NAME(String) UnderlyingTypeName () const;
const TypeDescriptor * CurrentUnderlyingType() const;
bool exists() const;
void nullify();
const TypeDescriptor * CurrentUnderlyingType() const;
bool exists() const;
void nullify();
Severity SelectValidLevel(const char *attrValue, ErrorDescriptor *err,
InstMgr *im, int clearError);
Severity SelectValidLevel(const char *attrValue, ErrorDescriptor *err,
InstMgr *im, int clearError);
// reading and writing
const char * STEPwrite (std::string& s, const char *currSch =0) const;
@@ -67,34 +67,34 @@ class SCLP23_NAME(Select) {
// IMS 8/2/95: added as part of new select implementation
virtual void STEPwrite_verbose (ostream& out =cout, const char * =0)
const;
const;
virtual void STEPwrite_content (ostream& out, const char * =0) const =0;
// char * asStr() const;
// char * asStr() const;
Severity StrToVal(const char *val, const char *selectType,
ErrorDescriptor *err, InstMgr * instances =0);
Severity StrToVal(const char *val, const char *selectType,
ErrorDescriptor *err, InstMgr * instances =0);
virtual Severity StrToVal_content (const char *,
InstMgr * instances =0) =0;
InstMgr * instances =0) =0;
Severity STEPread(istream& in, ErrorDescriptor *err,
InstMgr * instances =0, const char* utype =0,
int addFileId =0, const char * =NULL);
Severity STEPread(istream& in, ErrorDescriptor *err,
InstMgr * instances =0, const char* utype =0,
int addFileId =0, const char * =NULL);
// abstract function
// abstract function
virtual Severity STEPread_content (istream& in =cin,
InstMgr * instances =0,
const char *utype =0,
int addFileId =0,
const char *currSch =0) =0;
InstMgr * instances =0,
const char *utype =0,
int addFileId =0,
const char *currSch =0) =0;
virtual SCLP23_NAME(Select)& operator =( const SCLP23_NAME(Select)& ) =0;
virtual SCLP23_NAME(Select)& operator =( const SCLP23_NAME(Select)& ) =0;
int set_null();
int is_null();
int set_null();
int is_null();
}; /** end class **/
}; /** end class **/
typedef SCLP23_NAME(Select) * SCLP23_NAME(Select_ptr) ;
typedef SCLP23_NAME(Select_ptr) SCLP23_NAME(Select_var) ;
+13 -21
View File
@@ -9,30 +9,23 @@
* and is not subject to copyright.
*/
/* $Id: sdaiString.cc,v 1.4 1997/11/05 21:59:17 sauderd DP3.1 $ */
#include <sdai.h>
#include <sstream>
SCLP23( String ) &
SCLP23( String )::operator= ( const char * s ) {
SCLP23( String ) & SCLP23( String )::operator= ( const char * s ) {
std::string::operator= ( s );
return *this;
}
void
SCLP23( String )::STEPwrite( ostream & out ) const {
void SCLP23( String )::STEPwrite( ostream & out ) const {
out << c_str();
}
void
SCLP23( String )::STEPwrite( std::string & s ) const {
void SCLP23( String )::STEPwrite( std::string & s ) const {
s += c_str();
}
Severity
SCLP23( String )::StrToVal( const char * s ) {
Severity SCLP23( String )::StrToVal( const char * s ) {
operator= ( s );
if( ! strcmp( c_str(), s ) ) {
return SEVERITY_NULL ;
@@ -41,17 +34,14 @@ SCLP23( String )::StrToVal( const char * s ) {
}
}
// STEPread reads a string in exchange file format
// starting with a single quote
Severity
SCLP23( String )::STEPread( istream & in, ErrorDescriptor * err ) {
/**
* STEPread reads a string in exchange file format
* starting with a single quote
*/
Severity SCLP23( String )::STEPread( istream & in, ErrorDescriptor * err ) {
clear(); // clear the old string
// remember the current format state to restore the previous settings
#if defined(__GNUC__) && (__GNUC__ > 2)
ios_base::fmtflags flags = in.flags();
#else
ios::fmtflags flags = in.flags();
#endif
in.unsetf( ios::skipws );
// extract the string from the inputstream
@@ -76,8 +66,10 @@ SCLP23( String )::STEPread( istream & in, ErrorDescriptor * err ) {
return sev;
}
Severity
SCLP23( String )::STEPread( const char * s, ErrorDescriptor * err ) {
/**
* \copydoc STEPread( istream & in, ErrorDescriptor * err )
*/
Severity SCLP23( String )::STEPread( const char * s, ErrorDescriptor * err ) {
istringstream in( ( char * )s );
return STEPread( in, err );
}
+3 -7
View File
@@ -11,30 +11,26 @@
* and is not subject to copyright.
*/
/* $Id: sdaiString.h,v 1.4 1997/11/05 21:59:16 sauderd DP3.1 $ */
class SCLP23_NAME(String) : public std::string {
public:
//constructor(s) & destructor
SCLP23_NAME(String) (const char * str = 0, int max =0) : std::string (str,max)
{ }
SCLP23_NAME(String) (const char * str = 0, int max =0) : std::string (str,max) { }
SCLP23_NAME(String) (const std::string& s) : std::string (s) { }
SCLP23_NAME(String) (const SCLP23_NAME(String)& s) : std::string (s) { }
~SCLP23_NAME(String) () { }
~SCLP23_NAME(String) () { }
// operators
SCLP23_NAME(String)& operator= (const char* s);
// format for STEP
const char* asStr(std::string& s) const { return s.c_str(); }
const char* asStr(std::string& s) const { return s.c_str(); }
void STEPwrite (ostream& out =cout) const;
void STEPwrite (std::string &s) const;
Severity StrToVal (const char *s);
Severity STEPread (istream& in, ErrorDescriptor *err);
Severity STEPread (const char *s, ErrorDescriptor *err);
};
#endif
-2
View File
@@ -38,8 +38,6 @@
#include <string.h>
#include <sys/param.h>
#include <scldir.h>
#include <string>
+5 -5
View File
@@ -2,10 +2,10 @@ set(LIBEXPPP_SOURCES
exppp.c
)
SET(EXPPP_SOURCES
${SCL_SOURCE_DIR}/src/express/fedex.c
exppp-main.c
)
# SET(EXPPP_SOURCES
# ${SCL_SOURCE_DIR}/src/express/fedex.c
# exppp-main.c
# )
include_directories(
${SCL_SOURCE_DIR}/include
@@ -19,5 +19,5 @@ add_definitions(
SCL_ADDLIB(libexppp "${LIBEXPPP_SOURCES}" express)
set_target_properties(libexppp PROPERTIES PREFIX "")
SCL_ADDEXEC(exppp "${EXPPP_SOURCES}" "libexppp express")
#SCL_ADDEXEC(exppp "${EXPPP_SOURCES}" "libexppp express")
+6 -5
View File
@@ -47,9 +47,9 @@ set(EXPRESS_SOURCES
express.c
)
SET(FEDEX_SOURCES
fedex.c
)
# SET(FEDEX_SOURCES
# fedex.c
# )
SET(EXPRESS_PRIVATE_HDRS
conf.h
@@ -68,8 +68,9 @@ add_definitions(
SCL_ADDLIB(express "${EXPRESS_SOURCES}" "")
SCL_ADDEXEC(fedex "${FEDEX_SOURCES}" express)
if(APPLE)
set_target_properties(express PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)
#disable fedex because we don't use it
# SCL_ADDEXEC(fedex "${FEDEX_SOURCES}" express)