1717
1818#include < vector>
1919#include < string>
20+ #include < assert.h>
2021
2122typedef SDAI_Application_instance * ( * Creator )();
2223
@@ -27,6 +28,13 @@ enum AttrType_Enum {
2728 AttrType_Redefining
2829};
2930
31+ enum AggrBoundTypeEnum {
32+ bound_unset = 0 ,
33+ bound_constant,
34+ bound_runtime,
35+ bound_funcall
36+ };
37+
3038#include < SingleLinkList.h>
3139
3240#include < baseType.h>
@@ -1644,28 +1652,32 @@ SCL_CORE_EXPORT RealAggregate * create_RealAggregate();
16441652
16451653SCL_CORE_EXPORT IntAggregate * create_IntAggregate ();
16461654
1647- // /////////////////////////////////////////////////////////////////////////////
1648- // AggrTypeDescriptor
1649- // I think we decided on a simplistic representation of aggr. types for now?
1650- // i.e. just have one AggrTypeDesc for Array of [list of] [set of] someType
1651- // the inherited variable _referentType will point to the TypeDesc for someType
1652- // So I don't believe this class was necessary. If we were to retain
1653- // info for each of the [aggr of]'s in the example above then there would be
1654- // one of these for each [aggr of] above and they would be strung
1655- // together by the _aggrDomainType variables. If you can make this
1656- // work then go for it.
1657- // /////////////////////////////////////////////////////////////////////////////
1658-
1655+ typedef SDAI_Integer (*boundCallbackFn)(SDAI_Application_instance *);
1656+
1657+ /* *
1658+ * \class AggrTypeDescriptor
1659+ * I think we decided on a simplistic representation of aggr. types for now?
1660+ * i.e. just have one AggrTypeDesc for Array of [list of] [set of] someType
1661+ * the inherited variable _referentType will point to the TypeDesc for someType
1662+ * So I don't believe this class was necessary. If we were to retain
1663+ * info for each of the [aggr of]'s in the example above then there would be
1664+ * one of these for each [aggr of] above and they would be strung
1665+ * together by the _aggrDomainType variables. If you can make this
1666+ * work then go for it.
1667+ */
16591668class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
16601669
16611670 protected:
16621671
1663- SDAI_Integer _bound1;
1664- SDAI_Integer _bound2;
1672+ SDAI_Integer _bound1, _bound2;
16651673 SDAI_LOGICAL _uniqueElements;
16661674 TypeDescriptor * _aggrDomainType;
16671675 AggregateCreator CreateNewAggr;
16681676
1677+ AggrBoundTypeEnum _bound1_type, _bound2_type;
1678+ boundCallbackFn _bound1_callback, _bound2_callback;
1679+ std::string _bound1_str, _bound2_str;
1680+
16691681 public:
16701682
16711683 void AssignAggrCreator ( AggregateCreator f = 0 ) {
@@ -1685,18 +1697,68 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
16851697 virtual ~AggrTypeDescriptor ();
16861698
16871699
1688- SDAI_Integer & Bound1 () {
1700+ // / find bound type
1701+ AggrBoundTypeEnum Bound1Type () const { return _bound1_type; };
1702+ // / get a constant bound
1703+ SDAI_Integer Bound1 ( ) const {
1704+ assert ( _bound1_type == bound_constant );
16891705 return _bound1;
16901706 }
1691- void Bound1 ( SDAI_Integer b1 ) {
1707+ // / get a runtime bound using an object's 'this' pointer
1708+ SDAI_Integer Bound1Runtime ( SDAI_Application_instance* this_ptr) const {
1709+ assert ( this_ptr && ( _bound1_type == bound_runtime ) );
1710+ return _bound1_callback (this_ptr) ;
1711+ }
1712+ // / get a bound's EXPRESS function call string
1713+ std::string Bound1Funcall () const {
1714+ return _bound1_str;
1715+ }
1716+ // / set bound to a constant
1717+ void SetBound1 ( SDAI_Integer b1 ) {
16921718 _bound1 = b1;
1719+ _bound1_type = bound_constant;
1720+ }
1721+ // /set bound's callback fn. only for bounds dependent on an attribute
1722+ void SetBound1FromMemberAccessor ( boundCallbackFn callback ) {
1723+ _bound1_callback = callback;
1724+ _bound1_type = bound_runtime;
1725+ }
1726+ // /set bound from express function call. currently, this only stores the function call as a string.
1727+ void SetBound1FromExpressFuncall ( std::string s ) {
1728+ _bound1_str = s;
1729+ _bound1_type = bound_funcall;
16931730 }
16941731
1695- SDAI_Integer & Bound2 () {
1732+ // / find bound type
1733+ AggrBoundTypeEnum Bound2Type () const { return _bound2_type; };
1734+ // / get a constant bound
1735+ SDAI_Integer Bound2 ( ) const {
1736+ assert ( _bound2_type == bound_constant );
16961737 return _bound2;
16971738 }
1698- void Bound2 ( SDAI_Integer b2 ) {
1739+ // / get a runtime bound using an object's 'this' pointer
1740+ SDAI_Integer Bound2Runtime ( SDAI_Application_instance* this_ptr) const {
1741+ assert ( this_ptr && ( _bound2_type == bound_runtime ) );
1742+ return _bound2_callback (this_ptr) ;
1743+ }
1744+ // / get a bound's EXPRESS function call string
1745+ std::string Bound2Funcall () const {
1746+ return _bound2_str;
1747+ }
1748+ // / set bound to a constant
1749+ void SetBound2 ( SDAI_Integer b2 ) {
16991750 _bound2 = b2;
1751+ _bound2_type = bound_constant;
1752+ }
1753+ // /set bound's callback fn
1754+ void SetBound2FromMemberAccessor ( boundCallbackFn callback ){
1755+ _bound2_callback = callback;
1756+ _bound2_type = bound_runtime;
1757+ }
1758+ // /set bound from express function call. currently, this only stores the function call as a string.
1759+ void SetBound2FromExpressFuncall ( std::string s ) {
1760+ _bound2_str = s;
1761+ _bound2_type = bound_funcall;
17001762 }
17011763
17021764 SDAI_LOGICAL & UniqueElements () {
0 commit comments