Mass Balance Summary Slot: Slot Refs Updated with SimObj, Acct, and Slot Name Changes [6024] Bug Number: 6024 Release notes (y/n): Yes For Release Nums: 7.2 Mass Balance Summary Slots refer to Flow or Volume Series Slots in these two contexts: (1) Terms in Water Balance / Slot Sums (2) Dependent Expression Slots In RiverWare 7.1 and prior versions, changes to the names of any referenced Slots (including changes to the names of containing SimObjs and Accounts) did not result in updating references to those slots from Mass Balance Summary Slots. This commit provides updates to both uses of slot references (mentioned above), for name changes of Slots or their containing SimObjs or Accounts. This is, of course, done at the data model level -- the Mass Balance Summary Slot dialog does not have to be shown for such reference updates to be effected. But of course, also, that dialog is updated with the changed slots' full names. Here is a screenshot of a trivial Mass Balance Summary Slot (slot dialog) with basic test cases for slot name changes: http://cadswes2.colorado.edu/~philw/2017/bugs/6024/MassBalSumDlg1.png Note about Gnats 6024: The issue that is being addressed with this change for RiverWare 7.2 isn't eactly the one which was originally identified by Gnats 6024. Probably what was reported there was the result of the problem which was addressed, but we haven't produced the exact problem described in that bug. TECHNICAL: Slot references (for both uses cited above) are represented internally with the MassBalSumConfig::SymSlotColRef class. This class does not retain live slot pointers. Rather, it represents slot references using their "complete" name (including containing SimObj and Account names). This is different from most other entities in RiverWare which retain slot references in the form of LIVE SLOT POINTERS. Using the "live pointer" approach, updates to the names of slots is "implicit" -- nothing needs to be done to update references to those slots. (However, any _DIALOG_ showing those slot references does need to be refreshed). With the "symbolic" slot reference approach used in the MassBalSumConfig classes, slot name changes need to be explicitly applied to the data model (in addition to any dialog showing those reference needing to be updated). The changes in this commit take the approach of TEMPORARILY computing and retaining (caching) live slot pointers DURING slot, account, and SimObj name changes. During that name change process, any slot references matching the slot whose full name is changed (identified via live slot pointers) are explicitly updated within MassBalSumConfig::SymSlotColRef records. The processing of all such MassBalSumConfig::SymSlotColRef records is done using a static list of ALL EXISTING instances of that class. (This is instead of navigating to all known instances at the application level). The following static list is maintained, containing pointers to all SymSlotColRef records: static QList MassBalSumConfig::SymSlotColRef::_instanceList; Before and after slot, account, and SimObj changes, the following MassBalSumConfig::SymSlotColRef fields are, respectively, computed and cleared. (Notice that the 'bool' is a static field): // Slot name change processing static bool MassBalSumConfig::SymSlotColRef::_slotPointersCached; Slot* MassBalSumConfig::SymSlotColRef::_cachedSlotPointer; The computation of those cached slot pointers, the updating of slot reference name data, and the clearing of those pointers is done through these new MassBalSumConfig::SymSlotColRef methods. // Slot name change processing void cacheSlotPointer(); void clearCachedSlotPointer(); bool updateSlotNameFromPointer (const Slot*); static void allRefs_cacheSlotPointers(); static void allRefs_clearCachedSlotPointers(); static void allRefs_updateSlotNamesFromPointer (const Slot*); For the purpose of updating the Mass Balance Summary Slot dialog, an new "WS_ACCOUNT_RENAMED" callback was introduced (issued from the SimWS). This makes use of this new SimWS method: void sendWsAccountRenamedCallback (Account*); Some provisions were implemented to skip the new name-change processing during RiverWare program initialization (e.g. of Prototype SimObjs) and Model and Object File loading. This code was developed on top of the Release_71 branch (see temporary branch: bug6024_71), but will be applied only to RiverWare 7.2 development. ---