1717
1818#include < deque>
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>
@@ -1636,6 +1644,8 @@ SCL_CORE_EXPORT RealAggregate * create_RealAggregate();
16361644
16371645SCL_CORE_EXPORT IntAggregate * create_IntAggregate ();
16381646
1647+ typedef SDAI_Integer (*boundCallbackFn)(SDAI_Application_instance *);
1648+
16391649/* *
16401650 * \class AggrTypeDescriptor
16411651 * I think we decided on a simplistic representation of aggr. types for now?
@@ -1651,12 +1661,15 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
16511661
16521662 protected:
16531663
1654- SDAI_Integer _bound1 ;
1655- SDAI_Integer _bound2 ;
1664+ SDAI_Integer _bound1, _bound2;
16561665 SDAI_LOGICAL _uniqueElements ;
16571666 TypeDescriptor * _aggrDomainType ;
16581667 AggregateCreator CreateNewAggr;
16591668
1669+ AggrBoundTypeEnum _bound1_type, _bound2_type;
1670+ boundCallbackFn _bound1_callback, _bound2_callback;
1671+ std::string _bound1_str, _bound2_str;
1672+
16601673 public:
16611674
16621675 void AssignAggrCreator ( AggregateCreator f = 0 ) {
@@ -1672,22 +1685,72 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
16721685 AggrTypeDescriptor ( const char * nm, PrimitiveType ft,
16731686 Schema * origSchema, const char * d,
16741687 AggregateCreator f = 0 )
1675- : TypeDescriptor( nm, ft, origSchema, d ), CreateNewAggr( f ) { }
1688+ : TypeDescriptor( nm, ft, origSchema, d ), CreateNewAggr( f ) { }
16761689 virtual ~AggrTypeDescriptor ();
16771690
16781691
1679- SDAI_Integer & Bound1 () {
1692+ // / find bound type
1693+ AggrBoundTypeEnum Bound1Type () const { return _bound1_type; };
1694+ // / get a constant bound
1695+ SDAI_Integer Bound1 ( ) const {
1696+ assert ( _bound1_type == bound_constant );
16801697 return _bound1;
16811698 }
1682- void Bound1 ( SDAI_Integer b1 ) {
1699+ // / get a runtime bound using an object's 'this' pointer
1700+ SDAI_Integer Bound1Runtime ( SDAI_Application_instance* this_ptr) const {
1701+ assert ( this_ptr && ( _bound1_type == bound_runtime ) );
1702+ return _bound1_callback (this_ptr) ;
1703+ }
1704+ // / get a bound's EXPRESS function call string
1705+ std::string Bound1Funcall () const {
1706+ return _bound1_str;
1707+ }
1708+ // / set bound to a constant
1709+ void SetBound1 ( SDAI_Integer b1 ) {
16831710 _bound1 = b1;
1711+ _bound1_type = bound_constant;
1712+ }
1713+ // /set bound's callback fn. only for bounds dependent on an attribute
1714+ void SetBound1FromMemberAccessor ( boundCallbackFn callback ) {
1715+ _bound1_callback = callback;
1716+ _bound1_type = bound_runtime;
1717+ }
1718+ // /set bound from express function call. currently, this only stores the function call as a string.
1719+ void SetBound1FromExpressFuncall ( std::string s ) {
1720+ _bound1_str = s;
1721+ _bound1_type = bound_funcall;
16841722 }
16851723
1686- SDAI_Integer & Bound2 () {
1724+ // / find bound type
1725+ AggrBoundTypeEnum Bound2Type () const { return _bound2_type; };
1726+ // / get a constant bound
1727+ SDAI_Integer Bound2 ( ) const {
1728+ assert ( _bound2_type == bound_constant );
16871729 return _bound2;
16881730 }
1689- void Bound2 ( SDAI_Integer b2 ) {
1731+ // / get a runtime bound using an object's 'this' pointer
1732+ SDAI_Integer Bound2Runtime ( SDAI_Application_instance* this_ptr) const {
1733+ assert ( this_ptr && ( _bound2_type == bound_runtime ) );
1734+ return _bound2_callback (this_ptr) ;
1735+ }
1736+ // / get a bound's EXPRESS function call string
1737+ std::string Bound2Funcall () const {
1738+ return _bound2_str;
1739+ }
1740+ // / set bound to a constant
1741+ void SetBound2 ( SDAI_Integer b2 ) {
16901742 _bound2 = b2;
1743+ _bound2_type = bound_constant;
1744+ }
1745+ // /set bound's callback fn
1746+ void SetBound2FromMemberAccessor ( boundCallbackFn callback ){
1747+ _bound2_callback = callback;
1748+ _bound2_type = bound_runtime;
1749+ }
1750+ // /set bound from express function call. currently, this only stores the function call as a string.
1751+ void SetBound2FromExpressFuncall ( std::string s ) {
1752+ _bound2_str = s;
1753+ _bound2_type = bound_funcall;
16911754 }
16921755
16931756 SDAI_LOGICAL & UniqueElements () {
0 commit comments