BfxErrorRegionList Class Reference

#include <bfxalu.h>

Inheritance diagram for BfxErrorRegionList:

CCObject SimpleCCObject List of all members.

Public Member Functions

 BfxErrorRegionList ()
 Default constructor for ALU.
 ~BfxErrorRegionList ()
 Default constructor for ALU.
BOOL Next ()
BOOL Init (UINT32 Length)
 Default constructor for ALU.
BOOL ResetRead ()
 Resets the read pointer.
BOOL Empty ()
 Empties the list.
BOOL Insert (INT32 XCoord, INT32 YCoord, INT32 Area)
 Inserts an item into the list.
BOOL Sort ()
 Sorts the list.
BOOL IsSpace ()
BOOL GetCurrent (INT32 *XCoord, INT32 *YCoord, INT32 *Area)
BOOL MarkUsed ()
INT32 GetSize ()

Protected Member Functions

void Swap (BfxErrorRegionListItem *A, BfxErrorRegionListItem *B)

Protected Attributes

BfxErrorRegionListItempList
INT32 ListLength
INT32 Used
INT32 CurrentRead
INT32 CurrentWrite
BOOL Sorted

Private Member Functions

 CC_DECLARE_DYNCREATE (BfxErrorRegionList)

Detailed Description

Definition at line 180 of file bfxalu.h.


Constructor & Destructor Documentation

BfxErrorRegionList::BfxErrorRegionList  ) 
 

Default constructor for ALU.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/02/95
Parameters:
None [INPUTS]
Constructs object [OUTPUTS]
Returns:
Nothing

Errors: None yet

See also:
-
This constructs the error region list - most of the work is done in the Init function

Definition at line 2723 of file bfxalu.cpp.

02724 {
02725     pList = NULL;
02726     ListLength = 0;
02727     Used = 0;
02728     CurrentRead = 0;
02729     CurrentWrite = 0;
02730     Sorted = FALSE;
02731 }

BfxErrorRegionList::~BfxErrorRegionList  ) 
 

Default constructor for ALU.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/02/95
Parameters:
None [INPUTS]
Constructs object [OUTPUTS]
Returns:
Nothing

Errors: Error3 if DeInit hasn't been called.

See also:
-
This destructs the region list freeing memory if appropriate

Definition at line 2750 of file bfxalu.cpp.

02751 {
02752     if (pList) CCFree(pList);
02753 }


Member Function Documentation

BfxErrorRegionList::CC_DECLARE_DYNCREATE BfxErrorRegionList   )  [private]
 

BOOL BfxErrorRegionList::Empty  ) 
 

Empties the list.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/02/95
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
TRUE if succeeds else FALSE & error set

Errors: Memory

See also:
-
This empties the list

Definition at line 2809 of file bfxalu.cpp.

02810 {
02811     ERROR2IF (!pList, FALSE, "No BfxErrorRegionList");
02812     CurrentRead = 0;
02813     CurrentWrite = 0;
02814     Sorted = FALSE;
02815 
02816     pList[CurrentWrite].X=pList[CurrentWrite].Y=pList[CurrentWrite].Area = 0;
02817 
02818     return TRUE;
02819 }

BOOL BfxErrorRegionList::GetCurrent INT32 *  XCoord,
INT32 *  YCoord,
INT32 *  Area
[inline]
 

Definition at line 212 of file bfxalu.h.

00213         {return ((pList) && (*XCoord=pList[CurrentRead].X,*YCoord=pList[CurrentRead].Y,*Area = pList[CurrentRead].Area));};

INT32 BfxErrorRegionList::GetSize  )  [inline]
 

Definition at line 215 of file bfxalu.h.

00215 { return ListLength; };

BOOL BfxErrorRegionList::Init UINT32  Length  ) 
 

Default constructor for ALU.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/02/95
Parameters:
Length = no. of items that should go into list [INPUTS]
None [OUTPUTS]
Returns:
TRUE if succeeds else FALSE & error set

Errors: Memory

See also:
-
This claims the memory for the region list. You cna init it to 0 to remove the memory.

Definition at line 2772 of file bfxalu.cpp.

02773 {
02774     if (pList) CCFree(pList);
02775     pList = NULL;
02776     ListLength = 0;
02777     Used = 0;
02778     CurrentRead = 0;
02779     CurrentWrite = 0;
02780     Sorted = FALSE;
02781 
02782     if (!Length) return TRUE;
02783 
02784     if ((pList = /*assign*/ (BfxErrorRegionListItem *)CCMalloc(sizeof(BfxErrorRegionListItem) * (Length+1))) == NULL)
02785         return FALSE;
02786 
02787     ListLength = Length;
02788     
02789     return (Empty() && ResetRead());
02790 }

BOOL BfxErrorRegionList::Insert INT32  XCoord,
INT32  YCoord,
INT32  Area
 

Inserts an item into the list.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/02/95
Parameters:
XCoord,YCoord & Area = the number of the [INPUTS]
None [OUTPUTS]
Returns:
TRUE if succeeds else FALSE & error set

Errors: Memory

See also:
-
This empties the list

Definition at line 2859 of file bfxalu.cpp.

02860 {
02861     ERROR2IF (!pList, FALSE, "No BfxErrorRegionList");
02862     ERROR2IF (!IsSpace(), FALSE, "It's full! Why not use IsSpace() first like a good programmer?");
02863     ERROR2IF (!Area, FALSE, "BfxErrorRegionLists cannot hold zero area regions coz they aren't really regions, are they?");
02864 
02865     pList[CurrentWrite].X=XCoord;
02866     pList[CurrentWrite].Y=YCoord;
02867     pList[CurrentWrite++].Area=Area;
02868     pList[CurrentWrite].Area=0;
02869     pList[CurrentWrite].X=0;
02870     pList[CurrentWrite].Y=0;
02871 
02872     return TRUE;
02873 }

BOOL BfxErrorRegionList::IsSpace  )  [inline]
 

Definition at line 211 of file bfxalu.h.

00211 { return (CurrentWrite<ListLength); };

BOOL BfxErrorRegionList::MarkUsed  )  [inline]
 

Definition at line 214 of file bfxalu.h.

00214 { return (pList && ((!pList[CurrentRead].Area) || (pList[CurrentRead].Area=/*assign*/1))); };

BOOL BfxErrorRegionList::Next  )  [inline]
 

Definition at line 205 of file bfxalu.h.

00205 {if (pList && pList[CurrentRead].Area) CurrentRead++;return TRUE;};

BOOL BfxErrorRegionList::ResetRead  ) 
 

Resets the read pointer.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/02/95
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
TRUE if succeeds else FALSE & error set

Errors: Memory

See also:
-

Definition at line 2836 of file bfxalu.cpp.

02837 {
02838     CurrentRead = 0;
02839     return TRUE;
02840 }

BOOL BfxErrorRegionList::Sort  ) 
 

Sorts the list.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/02/95
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
TRUE if succeeds else FALSE & error set

Errors: Memory

See also:
-
SSSSLLLLOOOOOWWWW sort. But never mind.

Definition at line 2893 of file bfxalu.cpp.

02894 {
02895     ERROR2IF (!pList, FALSE, "No BfxErrorRegionList");
02896     Sorted = FALSE;
02897 
02898     // Handle special cases
02899     if ((pList[0].Area == 0) || (pList[1].Area ==0))
02900     {
02901         Sorted = TRUE;
02902         return TRUE;
02903     }
02904     
02905     while (!Sorted)
02906     {
02907         INT32 Current = 0;
02908         Sorted = TRUE;
02909         while (pList[++Current].Area !=0) if (pList[Current].Area > pList[Current-1].Area)
02910         {   
02911             Sorted=FALSE;
02912             Swap(&pList[Current], &pList[Current-1]);
02913         }
02914     }
02915     return TRUE;
02916 }

void BfxErrorRegionList::Swap BfxErrorRegionListItem A,
BfxErrorRegionListItem B
[inline, protected]
 

Definition at line 199 of file bfxalu.h.

00199                                                                        { BfxErrorRegionListItem T;
00200         T.X=A->X;T.Y=A->Y;T.Area=A->Area;A->X=B->X;A->Y=B->Y;A->Area=B->Area;B->X=T.X;B->Y=T.Y;B->Area=T.Area;};


Member Data Documentation

INT32 BfxErrorRegionList::CurrentRead [protected]
 

Definition at line 195 of file bfxalu.h.

INT32 BfxErrorRegionList::CurrentWrite [protected]
 

Definition at line 196 of file bfxalu.h.

INT32 BfxErrorRegionList::ListLength [protected]
 

Definition at line 192 of file bfxalu.h.

BfxErrorRegionListItem* BfxErrorRegionList::pList [protected]
 

Definition at line 191 of file bfxalu.h.

BOOL BfxErrorRegionList::Sorted [protected]
 

Definition at line 197 of file bfxalu.h.

INT32 BfxErrorRegionList::Used [protected]
 

Definition at line 193 of file bfxalu.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:09 2007 for Camelot by  doxygen 1.4.4