#include <filters.h>
Public Member Functions | |
SnapShotList () | |
Constructs a snap shot list. | |
~SnapShotList () | |
Destroys a snapshot list. At this stage the snap shot list should be empty (if Create and Destroy have been matched correctly). | |
BOOL | CreateSnapShot (AttributeEntry *CurrAttrs) |
Take a snap shot of the attribute list described by CurrAttrs. | |
void | DestroySnapShot () |
Destroy the last snap shot taken by CreateSnapShot(). | |
SnapShotItem * | GetCurrentSnapShot () |
This function is an abstracted way of finding the current snap shot created by the last CreateSnapShot() to be called (as snap shots can be stacked). | |
BOOL | ApplyChangedAttrs (Node *pNode, AttributeEntry *CurrAttrs) |
This function uses the snapshot facility to work out which of the current attributes have changed. Obviously it expects a snap shot to have been taken some time earlier. Only those attributes that have changes will be applied to the node described on entry. Note, any changed attributes which now match defaults will not be applied as the function calls ApplyBasedOnDefaults() with the changes list. | |
void | PushAttrsBasedOnSnapShot (AttributeEntry *CurrAttrs) |
This function uses the snap shot facility. It checks the snap shot list against the current attribute list to find attributes which differ. Those that do are obviously new attributes. ie attributes which have been parsed by the filter after the snap shot was taken. This function takes the current attrubute list and removes all those attributes which have changed in this way. It resets them to their default none temp attribute types. | |
void | PopAttrsBasedOnSnapShot (AttributeEntry *CurrAttrs) |
This function uses the snap shot facility. It checks the snap shot list against the current attribute list to find attributes which differ. Those that do are obviously new attributes. ie attributes which have been parsed by the filter after the snap shot was taken. This function takes the current attrubute list and removes all those attributes which have changed in this way. It resets them to their default none temp attribute types. | |
Private Member Functions | |
CC_DECLARE_MEMDUMP (SnapShotList) | |
Private Attributes | |
List | SnapShot |
Definition at line 354 of file filters.h.
|
Constructs a snap shot list.
Definition at line 5581 of file filters.cpp.
|
|
Destroys a snapshot list. At this stage the snap shot list should be empty (if Create and Destroy have been matched correctly).
Definition at line 5599 of file filters.cpp. 05600 { 05601 BOOL notempty=FALSE; 05602 SnapShotItem* pItem=NULL; 05603 while ( (pItem=(SnapShotItem*)SnapShot.RemoveTail()) !=NULL ) 05604 { 05605 notempty=TRUE; 05606 delete pItem; 05607 } 05608 if (notempty) 05609 { 05610 ERROR3("Destroyed a none empty snapshot list!\n"); 05611 } 05612 }
|
|
This function uses the snapshot facility to work out which of the current attributes have changed. Obviously it expects a snap shot to have been taken some time earlier. Only those attributes that have changes will be applied to the node described on entry. Note, any changed attributes which now match defaults will not be applied as the function calls ApplyBasedOnDefaults() with the changes list.
Definition at line 5709 of file filters.cpp. 05710 { 05711 // check that we have a snap shot attr mask 05712 SnapShotItem* pCurrItem = GetCurrentSnapShot(); 05713 if (pCurrItem==NULL) 05714 { 05715 ERROR3("No snap shot taken of the current attributes in SnapShotList::ApplyChangedAttrs()"); 05716 return FALSE; 05717 } 05718 05719 // Now get a set of default attributes so we can use them to reset the 05720 // current values 05721 INT32 i, NumAttrs = AttributeManager::GetNumAttributes(); 05722 AttributeEntry *pDefAtts = AttributeManager::GetDefaultAttributes(); 05723 if (pDefAtts==NULL) 05724 return FALSE; 05725 05726 // Alter the list of default attrs we've just created to include the differences 05727 // between our snap shot set and the current attributes described. 05728 for (i=0; i<NumAttrs; i++) 05729 { 05730 pDefAtts[i].Ignore = TRUE; 05731 NodeAttribute* pNodeAtt = pCurrItem->SnapShotAttrs[i]; 05732 if (pNodeAtt) 05733 { 05734 AttributeValue* pSavedAttr = pNodeAtt->GetAttributeValue(); 05735 05736 if ((pSavedAttr!=NULL) && (CurrAttrs[i].pAttr->IsDifferent(pSavedAttr))) 05737 { 05738 pDefAtts[i].pAttr = CurrAttrs[i].pAttr; 05739 pDefAtts[i].Temp = FALSE; 05740 pDefAtts[i].Ignore = FALSE; 05741 } 05742 } 05743 } 05744 05745 // Now apply the attribute list we have built 05746 BOOL Success = AttributeManager::ApplyBasedOnDefaults(pNode, pDefAtts); 05747 05748 // finally free up the array we have created and return 05749 CCFree(pDefAtts); 05750 return Success; 05751 }
|
|
|
|
Take a snap shot of the attribute list described by CurrAttrs.
Definition at line 5649 of file filters.cpp. 05650 { 05651 SnapShotItem* pItem = new SnapShotItem; 05652 if (pItem==NULL) 05653 return FALSE; 05654 05655 if (!pItem->Initialise(CurrAttrs)) 05656 { 05657 delete pItem; 05658 return FALSE; 05659 } 05660 05661 SnapShot.AddTail(pItem); 05662 return TRUE; 05663 }
|
|
Destroy the last snap shot taken by CreateSnapShot().
Definition at line 5678 of file filters.cpp. 05679 { 05680 SnapShotItem* pItem = (SnapShotItem*)SnapShot.RemoveTail(); 05681 if (pItem==NULL) 05682 { 05683 ERROR3("underflow in SnapShotList::DestroySnapShot()"); 05684 return; 05685 } 05686 05687 delete pItem; 05688 }
|
|
This function is an abstracted way of finding the current snap shot created by the last CreateSnapShot() to be called (as snap shots can be stacked).
Definition at line 5629 of file filters.cpp. 05630 { 05631 return (SnapShotItem*)SnapShot.GetTail(); 05632 }
|
|
This function uses the snap shot facility. It checks the snap shot list against the current attribute list to find attributes which differ. Those that do are obviously new attributes. ie attributes which have been parsed by the filter after the snap shot was taken. This function takes the current attrubute list and removes all those attributes which have changed in this way. It resets them to their default none temp attribute types.
Definition at line 5838 of file filters.cpp. 05839 { 05840 // check that we have a snap shot attr mask 05841 SnapShotItem* pCurrItem = GetCurrentSnapShot(); 05842 if (pCurrItem==NULL) 05843 { 05844 ERROR3("No snap shot taken of the current attributes in SnapShotList::PopAttrsBasedOnSnapShot()"); 05845 return; 05846 } 05847 05848 INT32 i, NumAttrs = AttributeManager::GetNumAttributes(); 05849 AttributeEntry *pDefAtts = AttributeManager::GetDefaultAttributes(); 05850 if (pDefAtts==NULL) 05851 return; 05852 05853 for (i=0; i<NumAttrs; i++) 05854 { 05855 if (pCurrItem->SnapShotAttrsStack[i].pAttr != NULL) 05856 { 05857 if ( !(CurrAttrs[i].pAttr->IsDifferent(pDefAtts[i].pAttr)) ) 05858 { 05859 CurrAttrs[i].pAttr = pCurrItem->SnapShotAttrsStack[i].pAttr; 05860 CurrAttrs[i].Temp = pCurrItem->SnapShotAttrsStack[i].Temp; 05861 CurrAttrs[i].Ignore = pCurrItem->SnapShotAttrsStack[i].Ignore; 05862 } 05863 } 05864 } 05865 05866 CCFree(pDefAtts); 05867 }
|
|
This function uses the snap shot facility. It checks the snap shot list against the current attribute list to find attributes which differ. Those that do are obviously new attributes. ie attributes which have been parsed by the filter after the snap shot was taken. This function takes the current attrubute list and removes all those attributes which have changed in this way. It resets them to their default none temp attribute types.
Definition at line 5773 of file filters.cpp. 05774 { 05775 // check that we have a snap shot attr mask 05776 SnapShotItem* pCurrItem = GetCurrentSnapShot(); 05777 if (pCurrItem==NULL) 05778 { 05779 ERROR3("No snap shot taken of the current attributes in SnapShotList::PushAttrsBasedOnSnapShot()"); 05780 return; 05781 } 05782 05783 // Now get a set of default attributes so we can use them to reset the 05784 // current values 05785 INT32 i, NumAttrs = AttributeManager::GetNumAttributes(); 05786 AttributeEntry *pDefAtts = AttributeManager::GetDefaultAttributes(); 05787 if (pDefAtts==NULL) 05788 return; 05789 05790 for (i=0; i<NumAttrs; i++) 05791 { 05792 pCurrItem->SnapShotAttrsStack[i].pAttr = NULL; 05793 pCurrItem->SnapShotAttrsStack[i].Temp = FALSE; 05794 pCurrItem->SnapShotAttrsStack[i].Ignore = TRUE; 05795 05796 NodeAttribute* pNodeAtt = pCurrItem->SnapShotAttrs[i]; 05797 05798 if (pNodeAtt) 05799 { 05800 AttributeValue* pSavedAttr = pNodeAtt->GetAttributeValue(); 05801 05802 if ((pSavedAttr!=NULL) && (CurrAttrs[i].pAttr->IsDifferent(pSavedAttr))) 05803 { 05804 // we don't want to apply this attr! 05805 pCurrItem->SnapShotAttrsStack[i].pAttr = CurrAttrs[i].pAttr; 05806 pCurrItem->SnapShotAttrsStack[i].Temp = CurrAttrs[i].Temp; 05807 pCurrItem->SnapShotAttrsStack[i].Ignore = CurrAttrs[i].Ignore; 05808 05809 CurrAttrs[i].pAttr = pDefAtts[i].pAttr; 05810 CurrAttrs[i].Temp = pDefAtts[i].Temp; 05811 CurrAttrs[i].Ignore = pDefAtts[i].Ignore; 05812 } 05813 } 05814 } 05815 05816 CCFree(pDefAtts); 05817 }
|
|
|