Compare commits
11 commits
master
...
incomplete
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ec8e778a6 | ||
|
|
133f503960 | ||
|
|
89d941d63c | ||
|
|
fe53db9cee | ||
|
|
a9c13f7434 | ||
|
|
77c0b266c4 | ||
|
|
5ef9cc9798 | ||
|
|
3e8050465e | ||
|
|
45ace10eb6 | ||
|
|
a2c83eacf9 | ||
|
|
70f45a9096 |
14 changed files with 2545 additions and 39 deletions
|
|
@ -27,7 +27,7 @@ class SC_LAZYFILE_EXPORT headerSectionReader: public sectionReader {
|
||||||
return _headerInstances;
|
return _headerInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
~headerSectionReader() {
|
virtual ~headerSectionReader() {
|
||||||
//FIXME delete each instance?! maybe add to clear, since it iterates over everything already
|
//FIXME delete each instance?! maybe add to clear, since it iterates over everything already
|
||||||
//enum clearHow { rawData, deletePointers }
|
//enum clearHow { rawData, deletePointers }
|
||||||
_headerInstances->clear();
|
_headerInstances->clear();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "lazyTypes.h"
|
#include "lazyTypes.h"
|
||||||
#include "lazyInstMgr.h"
|
#include "lazyInstMgr.h"
|
||||||
#include "Registry.h"
|
#include "Registry.h"
|
||||||
|
#include <SubSuperIterators.h>
|
||||||
#include "SdaiSchemaInit.h"
|
#include "SdaiSchemaInit.h"
|
||||||
#include "instMgrHelper.h"
|
#include "instMgrHelper.h"
|
||||||
|
|
||||||
|
|
@ -10,6 +11,7 @@ lazyInstMgr::lazyInstMgr() {
|
||||||
_lazyInstanceCount = 0;
|
_lazyInstanceCount = 0;
|
||||||
_loadedInstanceCount = 0;
|
_loadedInstanceCount = 0;
|
||||||
_longestTypeNameLen = 0;
|
_longestTypeNameLen = 0;
|
||||||
|
_mainRegistry = 0;
|
||||||
_errors = new ErrorDescriptor();
|
_errors = new ErrorDescriptor();
|
||||||
_ima = new instMgrAdapter( this );
|
_ima = new instMgrAdapter( this );
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +40,7 @@ sectionID lazyInstMgr::registerDataSection( lazyDataSectionReader * sreader ) {
|
||||||
|
|
||||||
void lazyInstMgr::addLazyInstance( namedLazyInstance inst ) {
|
void lazyInstMgr::addLazyInstance( namedLazyInstance inst ) {
|
||||||
_lazyInstanceCount++;
|
_lazyInstanceCount++;
|
||||||
assert( inst.loc.begin > 0 && inst.loc.instance > 0 && inst.loc.section >= 0 );
|
assert( inst.loc.begin > 0 && inst.loc.instance > 0 );
|
||||||
int len = strlen( inst.name );
|
int len = strlen( inst.name );
|
||||||
if( len > _longestTypeNameLen ) {
|
if( len > _longestTypeNameLen ) {
|
||||||
_longestTypeNameLen = len;
|
_longestTypeNameLen = len;
|
||||||
|
|
@ -46,8 +48,12 @@ void lazyInstMgr::addLazyInstance( namedLazyInstance inst ) {
|
||||||
}
|
}
|
||||||
_instanceTypes->insert( inst.name, inst.loc.instance );
|
_instanceTypes->insert( inst.name, inst.loc.instance );
|
||||||
/* store 16 bits of section id and 48 of instance offset into one 64-bit int
|
/* store 16 bits of section id and 48 of instance offset into one 64-bit int
|
||||||
* TODO: check and warn if anything is lost (in calling code?)
|
** TODO: check and warn if anything is lost (in calling code?)
|
||||||
* does 32bit need anything special?
|
** does 32bit need anything special?
|
||||||
|
**
|
||||||
|
** create conversion class?
|
||||||
|
** could then initialize conversion object with number of bits
|
||||||
|
** also a good place to check for data loss
|
||||||
*/
|
*/
|
||||||
positionAndSection ps = inst.loc.section;
|
positionAndSection ps = inst.loc.section;
|
||||||
ps <<= 48;
|
ps <<= 48;
|
||||||
|
|
@ -90,10 +96,9 @@ void lazyInstMgr::openFile( std::string fname ) {
|
||||||
|
|
||||||
SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id ) {
|
SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id ) {
|
||||||
assert( _mainRegistry && "Main registry has not been initialized. Do so with initRegistry() or setRegistry()." );
|
assert( _mainRegistry && "Main registry has not been initialized. Do so with initRegistry() or setRegistry()." );
|
||||||
SDAI_Application_instance * inst = 0;
|
|
||||||
positionAndSection ps;
|
positionAndSection ps;
|
||||||
sectionID sid;
|
sectionID sid;
|
||||||
inst = _instancesLoaded.find( id );
|
SDAI_Application_instance * inst = _instancesLoaded.find( id );
|
||||||
instanceStreamPos_t::cvector * cv;
|
instanceStreamPos_t::cvector * cv;
|
||||||
if( !inst && 0 != ( cv = _instanceStreamPos.find( id ) ) ) {
|
if( !inst && 0 != ( cv = _instanceStreamPos.find( id ) ) ) {
|
||||||
//FIXME _instanceStreamPos.find( id ) can return nonzero for nonexistent key?!
|
//FIXME _instanceStreamPos.find( id ) can return nonzero for nonexistent key?!
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,11 @@ class instMgrAdapter;
|
||||||
|
|
||||||
class lazyInstMgr {
|
class lazyInstMgr {
|
||||||
protected:
|
protected:
|
||||||
/** map from instance number to instances that it refers to
|
/** multimap from instance number to instances that it refers to
|
||||||
* \sa instanceRefs_pair
|
* \sa instanceRefs_pair
|
||||||
*/
|
*/
|
||||||
instanceRefs_t _fwdInstanceRefs;
|
instanceRefs_t _fwdInstanceRefs;
|
||||||
/** map from instance number to instances that refer to it
|
/** multimap from instance number to instances that refer to it - the majority of these will not be inverse references!
|
||||||
* \sa instanceRefs_pair
|
* \sa instanceRefs_pair
|
||||||
*/
|
*/
|
||||||
instanceRefs_t _revInstanceRefs;
|
instanceRefs_t _revInstanceRefs;
|
||||||
|
|
@ -39,11 +39,15 @@ class lazyInstMgr {
|
||||||
|
|
||||||
/** map from instance number to instance pointer (loaded instances only)
|
/** map from instance number to instance pointer (loaded instances only)
|
||||||
* \sa instancesLoaded_pair
|
* \sa instancesLoaded_pair
|
||||||
|
*
|
||||||
|
* TODO should be multimap to allow use of instances in multiple data sections?
|
||||||
|
* a unique instance ID (containing sectionID and instanceID) would also work
|
||||||
*/
|
*/
|
||||||
instancesLoaded_t _instancesLoaded;
|
instancesLoaded_t _instancesLoaded;
|
||||||
|
|
||||||
/** map from instance number to beginning and end positions and the data section
|
/** map from instance number to beginning and end positions and the data section
|
||||||
* \sa instanceStreamPos_pair
|
* \sa instanceStreamPos_pair
|
||||||
|
*
|
||||||
* FIXME to save memory, modify judyL2Array to not use a vector until there are several
|
* FIXME to save memory, modify judyL2Array to not use a vector until there are several
|
||||||
* instances with the same instanceID. This will help elsewhere as well.
|
* instances with the same instanceID. This will help elsewhere as well.
|
||||||
*/
|
*/
|
||||||
|
|
@ -65,7 +69,6 @@ class lazyInstMgr {
|
||||||
public:
|
public:
|
||||||
lazyInstMgr();
|
lazyInstMgr();
|
||||||
~lazyInstMgr();
|
~lazyInstMgr();
|
||||||
void addSchema( void ( *initFn )() ); //?
|
|
||||||
void openFile( std::string fname );
|
void openFile( std::string fname );
|
||||||
|
|
||||||
void addLazyInstance( namedLazyInstance inst );
|
void addLazyInstance( namedLazyInstance inst );
|
||||||
|
|
@ -80,8 +83,14 @@ class lazyInstMgr {
|
||||||
instanceRefs_t * getRevRefs() {
|
instanceRefs_t * getRevRefs() {
|
||||||
return & _revInstanceRefs;
|
return & _revInstanceRefs;
|
||||||
}
|
}
|
||||||
/// returns two iterators delimiting the instances that match `type`
|
/// returns a vector containing the instances that match `type`
|
||||||
instanceTypes_t::cvector * getInstances( std::string type ) { /*const*/
|
instanceTypes_t::cvector * getInstances( std::string type, bool caseSensitive = false ) { /*const*/
|
||||||
|
if( !caseSensitive ) {
|
||||||
|
std::string::iterator it = type.begin();
|
||||||
|
for( ; it != type.end(); ++it ) {
|
||||||
|
*it = toupper( *it );
|
||||||
|
}
|
||||||
|
}
|
||||||
return _instanceTypes->find( type.c_str() );
|
return _instanceTypes->find( type.c_str() );
|
||||||
}
|
}
|
||||||
/// get the number of instances of a certain type
|
/// get the number of instances of a certain type
|
||||||
|
|
@ -149,19 +158,25 @@ class lazyInstMgr {
|
||||||
SDAI_Application_instance * loadInstance( instanceID id );
|
SDAI_Application_instance * loadInstance( instanceID id );
|
||||||
|
|
||||||
// TODO implement these
|
// TODO implement these
|
||||||
//list all instances that one instance depends on (recursive)
|
|
||||||
//std::vector<instanceID> instanceDependencies( instanceID id ); //set is faster?
|
|
||||||
|
|
||||||
/* * the opposite of instanceDependencies() - all instances that are *not* dependencies of one particular instance
|
// add another schema to registry
|
||||||
|
//void addSchema( void ( *initFn )() );
|
||||||
|
|
||||||
|
//list all instances that one instance depends on (recursive)
|
||||||
|
//std::vector<instanceID> instanceDependencies( instanceID id ); //set is faster?
|
||||||
|
|
||||||
|
/* * the opposite of instanceDependencies() - all instances that are *not* dependencies of one particular instance
|
||||||
same as above, but with list of instances */
|
same as above, but with list of instances */
|
||||||
//std::vector<instanceID> notDependencies(...)
|
//std::vector<instanceID> notDependencies(...)
|
||||||
|
|
||||||
//renumber instances so that they are numbered 1..N where N is the total number of instances
|
//renumber instances so that they are numbered 1..N where N is the total number of instances
|
||||||
//void normalizeInstanceIds();
|
//void normalizeInstanceIds();
|
||||||
//find data that is repeated and eliminate, if possible
|
|
||||||
//void eliminateDuplicates();
|
//find data that is repeated and eliminate, if possible
|
||||||
//tell instMgr to use instances from this section
|
//void eliminateDuplicates();
|
||||||
//void useDataSection( sectionID id );
|
|
||||||
|
//tell instMgr to use instances from this section
|
||||||
|
//void useDataSection( sectionID id );
|
||||||
|
|
||||||
// TODO support references from one file to another
|
// TODO support references from one file to another
|
||||||
};
|
};
|
||||||
|
|
|
||||||
99
src/cllazyfile/lazyRefs.h
Normal file
99
src/cllazyfile/lazyRefs.h
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
#ifndef LAZYREFS_H
|
||||||
|
#define LAZYREFS_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <set>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "lazyTypes.h"
|
||||||
|
#include "ExpDict.h"
|
||||||
|
#include "sdaiApplication_instance.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class lazyRefs {
|
||||||
|
public:
|
||||||
|
//typedefs
|
||||||
|
typedef std::set<std::string> * entityTypeSet;
|
||||||
|
typedef std::pair< EntityDescriptor *, const char * > attrPair; //EntityDescriptor and attr name
|
||||||
|
typedef std::vector< STEPattribute * > attrVec;
|
||||||
|
protected:
|
||||||
|
/* don't need this - the default comparator of std::set, std::less, should work
|
||||||
|
///functor to compare std::pair<> of pointers; in this case, those in attrPair
|
||||||
|
struct pairCmp {
|
||||||
|
bool operator()( const attrPair & lhs, const attrPair & rhs ) const {
|
||||||
|
if( lhs.first == rhs.first && lhs.second == rhs.second ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
typedef std::set< attrPair, pairCmp > attrVec; //set of attrPair's, and comparison functor
|
||||||
|
*/
|
||||||
|
|
||||||
|
///find any inverse attributes, put in `attrs`
|
||||||
|
/// attrs not necessarily in order!
|
||||||
|
void getInverseAttrs( attrVec & attrs, EntityDescriptor * ed ) {
|
||||||
|
attrs.clear();
|
||||||
|
supertypesIterator supersIter( ed );
|
||||||
|
InverseAItr invAttrIter;
|
||||||
|
Inverse_attribute * invAttr;
|
||||||
|
for( ; !supersIter.empty(); ++supersIter ) {
|
||||||
|
//look at attrs of *si
|
||||||
|
invAttrIter( *supersIter );
|
||||||
|
while( 0 != ( invAttr = invAttrIter.NextInverse_attribute() ) ) {
|
||||||
|
attrs.push_back( invAttr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// look at our own attrs
|
||||||
|
invAttrIter( *ed );
|
||||||
|
while( 0 != ( invAttr = invAttrIter.NextInverse_attribute() ) ) {
|
||||||
|
attrs.push_back( invAttr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadPossibleInverseRefs( instanceID id ) {
|
||||||
|
EntityDescriptor * eDesc = getEntityDescriptor( id );
|
||||||
|
//it would be nice to be able to check the type of each potential reference and only load those for which there is an inverse attr
|
||||||
|
//however, that would require that we build a list of all types with inverse reference *and* all of their children
|
||||||
|
//that requires looking up each type in the registry and iterating over its supertypes
|
||||||
|
//slow? faster if results are cached, perhaps in std::set<std::string>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* need to look for hits in _revInstanceRefs, then check the type of each
|
||||||
|
* however, we must also check their supertypes - use checkIfEntityTypeMatch() (**** faster to compare entities with a subtype list instead? ****)
|
||||||
|
* also, we must check which entity type actually declares the attr, and use that as the type name to match
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//for each inverse attr, add that type and its subtypes to a set
|
||||||
|
attrVec invAttrs;
|
||||||
|
getInverseAttrs( invAttrs, eDesc );
|
||||||
|
attrVec::iterator iAiter = invAttrs.begin();
|
||||||
|
for( ; iAiter != invAttrs.end(); ++iAiter ) {
|
||||||
|
// const char * _inverted_attr_id;
|
||||||
|
// const char * _inverted_entity_id;
|
||||||
|
|
||||||
|
iAiter->_inverted_attr_id;
|
||||||
|
iAiter->_inverted_entity_id;
|
||||||
|
iAiter->Owner();
|
||||||
|
}
|
||||||
|
|
||||||
|
//find possible referring instances and loop over them, checking each, loading instances of types that may have matching refs
|
||||||
|
instanceRefs_t::cvector * possRefs = _revInstanceRefs.find( id );
|
||||||
|
const instanceRefs_t::cvector::iterator it = possRefs->cbegin();
|
||||||
|
for( ; it != possRefs->cend; ++it ) {
|
||||||
|
//1. get inst type
|
||||||
|
//2. compare its type to types that may reference this inst
|
||||||
|
//3. if there is a match, load it and check whether this instance is reference by the correct attr
|
||||||
|
//4. if so, link the two
|
||||||
|
//5. repeat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
void loadInverseRefs( instanceID id ) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //LAZYREFS_H
|
||||||
68
src/cllazyfile/lazyRefs.txt
Normal file
68
src/cllazyfile/lazyRefs.txt
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
for inverse attrs, we have the attr name and the type of the instance
|
||||||
|
|
||||||
|
--load instance, find inverse attr(s)
|
||||||
|
--for each inverse attr:
|
||||||
|
--find all instance types that inherit from the inverted attr's owner (list A)
|
||||||
|
--look up instances that reference the one in question (list B) - use memoization
|
||||||
|
--find instances that match both lists, put in list C
|
||||||
|
--load instances in list C
|
||||||
|
--for list C, check that the relevant attr references the original instance - if not, unload (?)
|
||||||
|
--
|
||||||
|
|
||||||
|
--when done with this inverse attr, cache list A
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLE
|
||||||
|
*******
|
||||||
|
|
||||||
|
information model
|
||||||
|
-----------------
|
||||||
|
ENTITY Object;
|
||||||
|
ObjectType : OPTIONAL STRING;
|
||||||
|
INVERSE
|
||||||
|
IsDefinedBy : SET [0:?] OF RelDefinesByType FOR RelatedObjects;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY RelDefinesByType;
|
||||||
|
RelatedObjects : SET [1:?] OF Object;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY Window
|
||||||
|
SUBTYPE OF (Object);
|
||||||
|
Description : OPTIONAL string;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
data file
|
||||||
|
---------
|
||||||
|
#1=OBJECT('one');
|
||||||
|
#2=RELDEFINESBYTYPE((#1));
|
||||||
|
#3=RELDEFINESBYTYPE((#4));
|
||||||
|
#4=WINDOW('two','blah');
|
||||||
|
|
||||||
|
#1 and #4 have an inverse attr, but this is not visible in the data file
|
||||||
|
#2 and #3 have #1 and #4, respectively, in an aggregate (thus the parenthesis around the instance); in this case, a SET called RelatedObjects
|
||||||
|
RelatedObjects is the inverted attr that the inverse attr IsDefinedBy links to
|
||||||
|
|
||||||
|
looking at the entity descriptor for WINDOW, it is not apparent that there is an inverse attr; its parents must be examined
|
||||||
|
|
||||||
|
|
||||||
|
given inverted attr ia:
|
||||||
|
attr method value
|
||||||
|
----------- -----
|
||||||
|
ia->Name() isdefinedby
|
||||||
|
ia->inverted_attr_id_() relatedobjects
|
||||||
|
ia->inverted_entity_id_() reldefinesbytype
|
||||||
|
|
||||||
|
1. for the instance in question, find inverse attrs with recursion
|
||||||
|
2. for each ia,
|
||||||
|
a. entity name is returned by ia->inverted_entity_id_()
|
||||||
|
b. add this entity and its children to a list (list A)
|
||||||
|
c. look up references to the current instance (list B)
|
||||||
|
d. for each item in B, look up its type; if its type is present in A, remember the instance number (list C)
|
||||||
|
e. load each instance in C
|
||||||
|
f. (optional) check if the relevant inverted attr of instances loaded from list C reference the instance in step 1; if not, unload **IF** the instance hadn't been loaded
|
||||||
|
--> if it was loaded, this implies that it is used elsewhere
|
||||||
|
g. cache list A, since it may be useful in the future
|
||||||
|
-- best to store such that the most recently (frequently?) used lists are retained and others are discarded
|
||||||
47
src/exppp/test/1.exp
Normal file
47
src/exppp/test/1.exp
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
(* [ ... , ... ] and [ ... : ... ] in this schema are not changed by exppp *)
|
||||||
|
SCHEMA exppp_comma_colon_unchanged;
|
||||||
|
|
||||||
|
ENTITY A;
|
||||||
|
name : STRING; -- should remain colon
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY B
|
||||||
|
SUBTYPE OF (A);
|
||||||
|
WHERE
|
||||||
|
WR1: SELF.name IN ['prefix', 'suffix']; -- should remain comma
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY C;
|
||||||
|
arr_real : ARRAY[1:3] OF REAL; -- should remain colon
|
||||||
|
DERIVE
|
||||||
|
id : REAL := 1.2345678901234567890E20; -- check precision after pretty print
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
FUNCTION exppp_colon_and_comma(
|
||||||
|
lis: LIST [0:?] OF GENERIC:t -- should remain colon
|
||||||
|
): ARRAY [1:5] OF GENERIC:t; -- should remain colon
|
||||||
|
|
||||||
|
LOCAL
|
||||||
|
re : ARRAY [1:5] OF GENERIC:t; -- should remain colon
|
||||||
|
res : ARRAY [1:5] OF GENERIC:t; -- should remain colon
|
||||||
|
END_LOCAL;
|
||||||
|
re := [lis[1],5]; --should remain a comma
|
||||||
|
res := [lis[1]:5]; --should remain a colon
|
||||||
|
RETURN(res);
|
||||||
|
|
||||||
|
END_FUNCTION; -- exppp_colon_and_comma
|
||||||
|
|
||||||
|
ENTITY long_lines;
|
||||||
|
name : STRING;
|
||||||
|
WHERE
|
||||||
|
WR1: SIZEOF (USEDIN (SELF, 'AP210_ELECTRONIC_ASSEMBLY_INTERCONNECT_AND_PACKAGING_DESIGN_MIM_LF.' +
|
||||||
|
'ID_ATTRIBUTE.IDENTIFIED_ITEM'))
|
||||||
|
<= 1;
|
||||||
|
WR2: SIZEOF (USEDIN (SELF, 'AP210_ELECTRONIC_ASSEMBLY_INTERCONNECT_AND_PACKAGING_DESIGN_MIM_LF.DESCRIPTION_ATTRIBUTE.DESCRIBED_ITEM')) <= 1;
|
||||||
|
WR3: SIZEOF ([ USEDIN (SELF, 'AP210_ELECTRONIC_ASSEMBLY_INTERCONNECT_AND_PACKAGING_DESIGN_MIM_LF.MANIFOLD_SOLID_BREP'), USEDIN (SELF, 'AP210_ELECTRONIC_ASSEMBLY_INTERCONNECT_AND_PACKAGING_DESIGN_MIM_LF.MAPPED_ITEM') ] ) = 1;
|
||||||
|
WR4: SIZEOF (USEDIN (SELF, 'AP210_ELECTRONIC_ASSEMBLY_INTERCONNECT_AND_PACKAGING_DESIGN_MIM_LF.'
|
||||||
|
+ 'DESCRIPTION_ATTRIBUTE.DESCRIBED_ITEM')) <= 1;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
|
||||||
|
END_SCHEMA;
|
||||||
1898
src/exppp/test/assembly_structure_non_pretty_printed_mim_lf.exp
Normal file
1898
src/exppp/test/assembly_structure_non_pretty_printed_mim_lf.exp
Normal file
File diff suppressed because it is too large
Load diff
15
src/express/test/libexpress_prob_func.exp
Normal file
15
src/express/test/libexpress_prob_func.exp
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
SCHEMA libexpress_prob_func;
|
||||||
|
|
||||||
|
FUNCTION comma_accepted(
|
||||||
|
lis: LIST [0:?] OF GENERIC:t
|
||||||
|
): ARRAY [1:5] OF GENERIC:t;
|
||||||
|
|
||||||
|
LOCAL
|
||||||
|
res : ARRAY [1:5] OF GENERIC:t;
|
||||||
|
END_LOCAL;
|
||||||
|
res := [lis[1],5]; -- libexpress parser will accept this - I think it should fail
|
||||||
|
RETURN(res);
|
||||||
|
|
||||||
|
END_FUNCTION; -- comma_accepted
|
||||||
|
|
||||||
|
END_SCHEMA; -- libexpress_prob_func
|
||||||
42
src/test/list_attributes/list_attributes.cc
Normal file
42
src/test/list_attributes/list_attributes.cc
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
/** \file list_attributes.cc
|
||||||
|
*
|
||||||
|
* early-bound implementation of an attribute printer
|
||||||
|
* list_attributes -a entity
|
||||||
|
*/
|
||||||
|
#include <sc_cf.h>
|
||||||
|
extern void SchemaInit( class Registry & );
|
||||||
|
#include "sc_version.h"
|
||||||
|
// #include <STEPfile.h>
|
||||||
|
// #include <sdai.h>
|
||||||
|
#include <STEPattribute.h>
|
||||||
|
#include <ExpDict.h>
|
||||||
|
#include <Registry.h>
|
||||||
|
#include <errordesc.h>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <string>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
#include <sc_getopt.h>
|
||||||
|
#include "schema.h"
|
||||||
|
|
||||||
|
|
||||||
|
int main( int argc, char * argv[] ) {
|
||||||
|
const char * entity = "si_energy_unit"; //TODO
|
||||||
|
if( argc == 2 ) {
|
||||||
|
entity = argv[1];
|
||||||
|
} else if( ( argc == 3 ) && ( 0 == strncasecmp( argv[1], "-a", 2 ) ) ) {
|
||||||
|
entity = argv[2];
|
||||||
|
} /*else {
|
||||||
|
std::cerr << "Bad args. Use:" << std::endl << argv[0] << " [-aA] <entity>" << std::endl;
|
||||||
|
std::cerr << "Prints entity attributes as STEPcode thinks they should be" << std::endl;
|
||||||
|
exit( EXIT_FAILURE );
|
||||||
|
}*/ //TODO
|
||||||
|
|
||||||
|
Registry registry( SchemaInit );
|
||||||
|
EntityDescriptor * seu = registry.FindEntity( entity );
|
||||||
|
AttrDescriptorList adl = seu->ExplicitAttr();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -51,7 +51,8 @@ set_tests_properties( test_aggregate_bound_runtime_FAIL1 PROPERTIES
|
||||||
|
|
||||||
add_schema_dependent_test( "inverse_attr1" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
|
add_schema_dependent_test( "inverse_attr1" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
|
||||||
add_schema_dependent_test( "inverse_attr2" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
|
add_schema_dependent_test( "inverse_attr2" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
|
||||||
add_schema_dependent_test( "inverse_attr3" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
|
add_schema_dependent_test( "inverse_attr3" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21"
|
||||||
|
"-I${SC_SOURCE_DIR}/src/cllazyfile -I${SC_SOURCE_DIR}/src/base/judy/src" "steplazyfile" )
|
||||||
add_schema_dependent_test( "attribute" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
|
add_schema_dependent_test( "attribute" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
|
||||||
|
|
||||||
if(HAVE_STD_THREAD)
|
if(HAVE_STD_THREAD)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/** \file inverse_attr.cc
|
/** \file inverse_attr2.cc
|
||||||
** 1-Jul-2012
|
** 1-Jul-2012
|
||||||
** Test inverse attributes; uses a tiny schema similar to a subset of IFC2x3
|
** Test inverse attributes; uses a tiny schema similar to a subset of IFC2x3
|
||||||
**
|
**
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
/** \file inverse_attr.cc
|
/** \file inverse_attr3.cc
|
||||||
** 1-Jul-2012
|
* Oct 2013
|
||||||
** Test inverse attributes; uses a tiny schema similar to a subset of IFC2x3
|
* Test inverse attributes; uses a tiny schema similar to a subset of IFC2x3
|
||||||
**
|
*
|
||||||
*/
|
* This test originally used STEPfile, which didn't work. Fixing STEPfile would have been very difficult, it uses lazyInstMgr now.
|
||||||
|
*/
|
||||||
#include <sc_cf.h>
|
#include <sc_cf.h>
|
||||||
extern void SchemaInit( class Registry & );
|
extern void SchemaInit( class Registry & );
|
||||||
#include "sc_version_string.h"
|
#include <lazyInstMgr.h>
|
||||||
#include <STEPfile.h>
|
|
||||||
#include <sdai.h>
|
#include <sdai.h>
|
||||||
#include <STEPattribute.h>
|
#include <STEPattribute.h>
|
||||||
#include <ExpDict.h>
|
#include <ExpDict.h>
|
||||||
|
|
@ -21,22 +21,23 @@ extern void SchemaInit( class Registry & );
|
||||||
#include "schema.h"
|
#include "schema.h"
|
||||||
|
|
||||||
int main( int argc, char * argv[] ) {
|
int main( int argc, char * argv[] ) {
|
||||||
Registry registry( SchemaInit );
|
|
||||||
InstMgr instance_list;
|
|
||||||
STEPfile sfile( registry, instance_list, "", false );
|
|
||||||
if( argc != 2 ) {
|
if( argc != 2 ) {
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
sfile.ReadExchangeFile( argv[1] );
|
lazyInstMgr lim;
|
||||||
|
lim.initRegistry( SchemaInit );
|
||||||
|
|
||||||
if( sfile.Error().severity() <= SEVERITY_INCOMPLETE ) {
|
lim.openFile( argv[1] );
|
||||||
sfile.Error().PrintContents( cout );
|
|
||||||
|
//find attributes
|
||||||
|
instanceTypes_t::cvector * insts = lim.getInstances( "window" );
|
||||||
|
if( !insts || insts->empty() ) {
|
||||||
|
cout << "No window instances found!" << endl;
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
//find attributes
|
SdaiWindow * instance = dynamic_cast< SdaiWindow * >( lim.loadInstance( insts->at( 0 ) ) );
|
||||||
SdaiWindow * instance = ( SdaiWindow * ) instance_list.GetApplication_instance( "window" );
|
|
||||||
if( !instance ) {
|
if( !instance ) {
|
||||||
cout << "NULL" << endl;
|
cout << "Problem loading instance" << endl;
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
cout << "instance #" << instance->StepFileId() << endl;
|
cout << "instance #" << instance->StepFileId() << endl;
|
||||||
|
|
|
||||||
274
test/unitary_schemas/si_energy_unit_snippet.exp
Normal file
274
test/unitary_schemas/si_energy_unit_snippet.exp
Normal file
|
|
@ -0,0 +1,274 @@
|
||||||
|
SCHEMA si_energy_unit_snippet_209;
|
||||||
|
|
||||||
|
(* derived from Ap209_multidisciplinary_analysis_and_design_mim_LF, N2617 MIM LF *)
|
||||||
|
|
||||||
|
ENTITY si_energy_unit
|
||||||
|
SUBTYPE OF (energy_unit, si_unit);
|
||||||
|
WHERE
|
||||||
|
WR1 : SELF\si_unit.name = si_unit_name.joule;
|
||||||
|
WR2 : NOT EXISTS(SELF\derived_unit.name);
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY energy_unit
|
||||||
|
SUBTYPE OF (derived_unit);
|
||||||
|
WHERE
|
||||||
|
WR1 : derive_dimensional_exponents(SELF) = dimensions_for_si_unit (si_unit_name.joule);
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY derived_unit
|
||||||
|
SUPERTYPE OF (ONEOF ((*absorbed_dose_unit, acceleration_unit, radioactivity_unit, area_unit, capacitance_unit, dose_equivalent_unit, electric_charge_unit, conductance_unit, electric_potential_unit,*) energy_unit(*, magnetic_flux_density_unit, force_unit, frequency_unit, illuminance_unit, inductance_unit, magnetic_flux_unit, power_unit, pressure_unit, resistance_unit, velocity_unit, volume_unit*)));
|
||||||
|
elements : SET [1:?] OF derived_unit_element;
|
||||||
|
DERIVE
|
||||||
|
name : label := get_name_value(SELF);
|
||||||
|
WHERE
|
||||||
|
WR1 : (SIZEOF(elements) > 1) OR ((SIZEOF(elements) = 1) AND (elements[1].exponent <> 1.0));
|
||||||
|
WR2 : SIZEOF(USEDIN(SELF, 'AP209_MULTIDISCIPLINARY_ANALYSIS_AND_DESIGN_MIM_LF.' + 'NAME_ATTRIBUTE.NAMED_ITEM')) <= 1;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY si_unit
|
||||||
|
SUBTYPE OF (named_unit);
|
||||||
|
prefix : OPTIONAL si_prefix;
|
||||||
|
name : si_unit_name;
|
||||||
|
DERIVE
|
||||||
|
SELF\named_unit.dimensions : dimensional_exponents := dimensions_for_si_unit(name);
|
||||||
|
WHERE
|
||||||
|
WR1 : NOT(('AP209_MULTIDISCIPLINARY_ANALYSIS_AND_DESIGN_MIM_LF.MASS_UNIT' IN TYPEOF(SELF)) AND
|
||||||
|
(SIZEOF(USEDIN(SELF,'AP209_MULTIDISCIPLINARY_ANALYSIS_AND_DESIGN_MIM_LF.DERIVED_UNIT_ELEMENT.UNIT')) > 0)) OR
|
||||||
|
(prefix = si_prefix.kilo);
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY named_unit
|
||||||
|
SUPERTYPE OF ((ONEOF (si_unit(*, conversion_based_unit, context_dependent_unit *)) ANDOR ONEOF (length_unit, mass_unit, time_unit (*, electric_current_unit, thermodynamic_temperature_unit, amount_of_substance_unit, luminous_flux_unit, luminous_intensity_unit, plane_angle_unit, solid_angle_unit, ratio_unit*))));
|
||||||
|
dimensions : dimensional_exponents;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY dimensional_exponents;
|
||||||
|
length_exponent : REAL;
|
||||||
|
mass_exponent : REAL;
|
||||||
|
time_exponent : REAL;
|
||||||
|
electric_current_exponent : REAL;
|
||||||
|
thermodynamic_temperature_exponent : REAL;
|
||||||
|
amount_of_substance_exponent : REAL;
|
||||||
|
luminous_intensity_exponent : REAL;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
TYPE si_prefix = ENUMERATION OF (
|
||||||
|
exa,
|
||||||
|
peta,
|
||||||
|
tera,
|
||||||
|
giga,
|
||||||
|
mega,
|
||||||
|
kilo,
|
||||||
|
hecto,
|
||||||
|
deca,
|
||||||
|
deci,
|
||||||
|
centi,
|
||||||
|
milli,
|
||||||
|
micro,
|
||||||
|
nano,
|
||||||
|
pico,
|
||||||
|
femto,
|
||||||
|
atto );
|
||||||
|
END_TYPE;
|
||||||
|
|
||||||
|
TYPE si_unit_name = ENUMERATION OF (
|
||||||
|
metre,
|
||||||
|
gram,
|
||||||
|
second,
|
||||||
|
ampere,
|
||||||
|
kelvin,
|
||||||
|
mole,
|
||||||
|
candela,
|
||||||
|
radian,
|
||||||
|
steradian,
|
||||||
|
hertz,
|
||||||
|
newton,
|
||||||
|
pascal,
|
||||||
|
joule,
|
||||||
|
watt,
|
||||||
|
coulomb,
|
||||||
|
volt,
|
||||||
|
farad,
|
||||||
|
ohm,
|
||||||
|
siemens,
|
||||||
|
weber,
|
||||||
|
tesla,
|
||||||
|
henry,
|
||||||
|
degree_Celsius,
|
||||||
|
lumen,
|
||||||
|
lux,
|
||||||
|
becquerel,
|
||||||
|
gray,
|
||||||
|
sievert );
|
||||||
|
END_TYPE;
|
||||||
|
|
||||||
|
FUNCTION dimensions_for_si_unit
|
||||||
|
(n: si_unit_name) : dimensional_exponents;
|
||||||
|
CASE n OF
|
||||||
|
metre:
|
||||||
|
RETURN (dimensional_exponents(1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
gram:
|
||||||
|
RETURN (dimensional_exponents(0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
second:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
ampere:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0));
|
||||||
|
kelvin:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0));
|
||||||
|
mole:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0));
|
||||||
|
candela:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0));
|
||||||
|
radian:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
steradian:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
hertz:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
newton:
|
||||||
|
RETURN (dimensional_exponents(1.0, 1.0, -2.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
pascal:
|
||||||
|
RETURN (dimensional_exponents(-1.0, 1.0, -2.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
joule:
|
||||||
|
RETURN (dimensional_exponents(2.0, 1.0, -2.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
watt:
|
||||||
|
RETURN (dimensional_exponents(2.0, 1.0, -3.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
coulomb:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0));
|
||||||
|
volt:
|
||||||
|
RETURN (dimensional_exponents(2.0, 1.0, -3.0, -1.0, 0.0, 0.0, 0.0));
|
||||||
|
farad:
|
||||||
|
RETURN (dimensional_exponents(-2.0, -1.0, 4.0, 1.0, 0.0, 0.0, 0.0));
|
||||||
|
ohm:
|
||||||
|
RETURN (dimensional_exponents(2.0, 1.0, -3.0, -2.0, 0.0, 0.0, 0.0));
|
||||||
|
siemens:
|
||||||
|
RETURN (dimensional_exponents(-2.0, -1.0, 3.0, 2.0, 0.0, 0.0, 0.0));
|
||||||
|
weber:
|
||||||
|
RETURN (dimensional_exponents(2.0, 1.0, -2.0, -1.0, 0.0, 0.0, 0.0));
|
||||||
|
tesla:
|
||||||
|
RETURN (dimensional_exponents(0.0, 1.0, -2.0, -1.0, 0.0, 0.0, 0.0));
|
||||||
|
henry:
|
||||||
|
RETURN (dimensional_exponents(2.0, 1.0, -2.0, -2.0, 0.0, 0.0, 0.0));
|
||||||
|
degree_Celsius:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0));
|
||||||
|
lumen:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0));
|
||||||
|
lux:
|
||||||
|
RETURN (dimensional_exponents(-2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0));
|
||||||
|
becquerel:
|
||||||
|
RETURN (dimensional_exponents(0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
gray:
|
||||||
|
RETURN (dimensional_exponents(2.0, 0.0, -2.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
sievert:
|
||||||
|
RETURN (dimensional_exponents(2.0, 0.0, -2.0, 0.0, 0.0, 0.0, 0.0));
|
||||||
|
OTHERWISE:
|
||||||
|
RETURN (?);
|
||||||
|
END_CASE;
|
||||||
|
END_FUNCTION;
|
||||||
|
|
||||||
|
FUNCTION get_name_value
|
||||||
|
(obj: name_attribute_select) : label;
|
||||||
|
LOCAL
|
||||||
|
name_bag : BAG OF name_attribute := (USEDIN(obj, 'AP209_MULTIDISCIPLINARY_ANALYSIS_AND_DESIGN_MIM_LF.' + 'NAME_ATTRIBUTE.' + 'NAMED_ITEM'));
|
||||||
|
END_LOCAL;
|
||||||
|
|
||||||
|
IF SIZEOF(name_bag) = 1 THEN
|
||||||
|
RETURN (name_bag[1].attribute_value);
|
||||||
|
ELSE
|
||||||
|
RETURN (?);
|
||||||
|
END_IF;
|
||||||
|
END_FUNCTION;
|
||||||
|
|
||||||
|
TYPE name_attribute_select = SELECT (
|
||||||
|
-- action_request_solution,
|
||||||
|
-- address,
|
||||||
|
-- configuration_design,
|
||||||
|
-- context_dependent_shape_representation,
|
||||||
|
derived_unit(*,
|
||||||
|
effectivity,
|
||||||
|
person_and_organization,
|
||||||
|
product_definition,
|
||||||
|
product_definition_substitute,
|
||||||
|
property_definition_representation*));
|
||||||
|
END_TYPE;
|
||||||
|
|
||||||
|
ENTITY name_attribute;
|
||||||
|
attribute_value : label;
|
||||||
|
named_item : name_attribute_select;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY derived_unit_element;
|
||||||
|
unit : named_unit;
|
||||||
|
exponent : REAL;
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
FUNCTION derive_dimensional_exponents
|
||||||
|
(x: unit) : dimensional_exponents;
|
||||||
|
LOCAL
|
||||||
|
result : dimensional_exponents := dimensional_exponents(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||||
|
END_LOCAL;
|
||||||
|
|
||||||
|
IF 'AP209_MULTIDISCIPLINARY_ANALYSIS_AND_DESIGN_MIM_LF.DERIVED_UNIT' IN TYPEOF(x) THEN
|
||||||
|
REPEAT i := LOINDEX(x\derived_unit.elements) TO HIINDEX(x\derived_unit.elements);
|
||||||
|
result.length_exponent := result.length_exponent +
|
||||||
|
(x\derived_unit.elements[i]\derived_unit_element.exponent *
|
||||||
|
x\derived_unit.elements[i]\derived_unit_element.unit\named_unit.dimensions.length_exponent);
|
||||||
|
result.mass_exponent := result.mass_exponent +
|
||||||
|
(x\derived_unit.elements[i]\derived_unit_element.exponent *
|
||||||
|
x\derived_unit.elements[i]\derived_unit_element.unit\named_unit.dimensions.mass_exponent);
|
||||||
|
result.time_exponent := result.time_exponent +
|
||||||
|
(x\derived_unit.elements[i]\derived_unit_element.exponent *
|
||||||
|
x\derived_unit.elements[i]\derived_unit_element.unit\named_unit.dimensions.time_exponent);
|
||||||
|
result.electric_current_exponent := result.electric_current_exponent +
|
||||||
|
(x\derived_unit.elements[i]\derived_unit_element.exponent *
|
||||||
|
x\derived_unit.elements[i]\derived_unit_element.unit\named_unit.dimensions.electric_current_exponent);
|
||||||
|
result.thermodynamic_temperature_exponent := result.thermodynamic_temperature_exponent +
|
||||||
|
(x\derived_unit.elements[i]\derived_unit_element.exponent *
|
||||||
|
x\derived_unit.elements[i]\derived_unit_element.unit\named_unit.dimensions.thermodynamic_temperature_exponent);
|
||||||
|
result.amount_of_substance_exponent := result.amount_of_substance_exponent +
|
||||||
|
(x\derived_unit.elements[i]\derived_unit_element.exponent *
|
||||||
|
x\derived_unit.elements[i]\derived_unit_element.unit\named_unit.dimensions.amount_of_substance_exponent);
|
||||||
|
result.luminous_intensity_exponent := result.luminous_intensity_exponent +
|
||||||
|
(x\derived_unit.elements[i]\derived_unit_element.exponent *
|
||||||
|
x\derived_unit.elements[i]\derived_unit_element.unit\named_unit.dimensions.luminous_intensity_exponent);
|
||||||
|
END_REPEAT;
|
||||||
|
ELSE
|
||||||
|
result := x\named_unit.dimensions;
|
||||||
|
END_IF;
|
||||||
|
RETURN (result);
|
||||||
|
END_FUNCTION;
|
||||||
|
|
||||||
|
TYPE label = STRING;
|
||||||
|
END_TYPE;
|
||||||
|
|
||||||
|
TYPE unit = SELECT (
|
||||||
|
derived_unit,
|
||||||
|
named_unit);
|
||||||
|
END_TYPE;
|
||||||
|
|
||||||
|
ENTITY mass_unit
|
||||||
|
SUBTYPE OF (named_unit);
|
||||||
|
WHERE
|
||||||
|
WR1 : (SELF\named_unit.dimensions.length_exponent = 0.0) AND (SELF\named_unit.dimensions.mass_exponent = 1.0) AND (SELF\named_unit.dimensions.time_exponent = 0.0) AND (SELF\named_unit.dimensions.electric_current_exponent = 0.0) AND (SELF\named_unit.dimensions.thermodynamic_temperature_exponent = 0.0) AND (SELF\named_unit.dimensions.amount_of_substance_exponent = 0.0) AND (SELF\named_unit.dimensions.luminous_intensity_exponent = 0.0);
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY length_unit
|
||||||
|
SUBTYPE OF (named_unit);
|
||||||
|
WHERE
|
||||||
|
WR1 : (SELF\named_unit.dimensions.length_exponent = 1.0) AND
|
||||||
|
(SELF\named_unit.dimensions.mass_exponent = 0.0) AND
|
||||||
|
(SELF\named_unit.dimensions.time_exponent = 0.0) AND
|
||||||
|
(SELF\named_unit.dimensions.electric_current_exponent = 0.0) AND
|
||||||
|
(SELF\named_unit.dimensions.thermodynamic_temperature_exponent = 0.0) AND
|
||||||
|
(SELF\named_unit.dimensions.amount_of_substance_exponent = 0.0) AND
|
||||||
|
(SELF\named_unit.dimensions.luminous_intensity_exponent = 0.0);
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
ENTITY time_unit
|
||||||
|
SUBTYPE OF (named_unit);
|
||||||
|
WHERE
|
||||||
|
WR1 : (SELF\named_unit.dimensions.length_exponent = 0.0) AND (SELF\named_unit.dimensions.mass_exponent = 0.0) AND (SELF\named_unit.dimensions.time_exponent = 1.0) AND (SELF\named_unit.dimensions.electric_current_exponent = 0.0) AND (SELF\named_unit.dimensions.thermodynamic_temperature_exponent = 0.0) AND (SELF\named_unit.dimensions.amount_of_substance_exponent = 0.0) AND (SELF\named_unit.dimensions.luminous_intensity_exponent = 0.0);
|
||||||
|
END_ENTITY;
|
||||||
|
|
||||||
|
|
||||||
|
END_SCHEMA;
|
||||||
41
test/unitary_schemas/uninitialized_edge_list.exp
Normal file
41
test/unitary_schemas/uninitialized_edge_list.exp
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
(*
|
||||||
|
* Fragment of ap203.exp
|
||||||
|
* starseeker: _edge_list is initialized to null when an SdaiEdge_loop is created
|
||||||
|
*)
|
||||||
|
|
||||||
|
SCHEMA uninitialized_edge_list;
|
||||||
|
|
||||||
|
ENTITY edge_loop
|
||||||
|
SUBTYPE OF (loop, path);
|
||||||
|
DERIVE
|
||||||
|
ne : INTEGER := SIZEOF(SELF\path.edge_list);
|
||||||
|
-- WHERE
|
||||||
|
-- wr1: (SELF\path.edge_list[1].edge_start :=: SELF\path.edge_list[ne].
|
||||||
|
-- edge_end);
|
||||||
|
END_ENTITY; -- edge_loop
|
||||||
|
|
||||||
|
ENTITY loop
|
||||||
|
SUPERTYPE OF (edge_loop)
|
||||||
|
SUBTYPE OF (topological_representation_item);
|
||||||
|
END_ENTITY; -- loop
|
||||||
|
|
||||||
|
ENTITY path
|
||||||
|
SUPERTYPE OF (edge_loop)
|
||||||
|
SUBTYPE OF (topological_representation_item);
|
||||||
|
edge_list : LIST [1:?] OF UNIQUE INTEGER; -- was oriented_edge
|
||||||
|
-- WHERE
|
||||||
|
-- wr1: path_head_to_tail(SELF);
|
||||||
|
END_ENTITY; -- path
|
||||||
|
|
||||||
|
ENTITY topological_representation_item
|
||||||
|
SUPERTYPE OF (ONEOF (loop ANDOR path))
|
||||||
|
SUBTYPE OF (representation_item);
|
||||||
|
END_ENTITY; -- topological_representation_item
|
||||||
|
|
||||||
|
ENTITY representation_item;
|
||||||
|
name : STRING; -- was label
|
||||||
|
-- WHERE
|
||||||
|
-- wr1: (SIZEOF(using_representations(SELF)) > 0);
|
||||||
|
END_ENTITY; -- representation_item
|
||||||
|
|
||||||
|
END_SCHEMA;
|
||||||
Loading…
Reference in a new issue