Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Show ctQueue on ClarionLive Open Webinar 2017-Aug-16
PROGRAM
MAP
END
include('ctQueue.inc'),ONCE
!gtPoint GROUP,TYPE
!X REAL
!Y REAL
! END
!
!gtSegment GROUP,TYPE !,PRE(!)
!StartPt LIKE(gtPoint)
!EndPt LIKE(gtPoint)
! END
!
!ASegment LIKE(gtSegment)
! !code
! ASegment.StartPt.X = 10
! ASegment.EndPt.X = 11
!
! Seg:X = 42
gtRoom GROUP,TYPE
Description STRING(100)
Width REAL
Length REAL
END
qtRoom QUEUE(gtRoom),TYPE
END
ctRoom CLASS(ctQueue)
Q &qtRoom
Construct PROCEDURE
Add PROCEDURE(STRING Description, REAL Width, REAL Length)
END
gtBuilding GROUP,TYPE
Description STRING(100)
Rooms &ctRoom
END
qtBuilding QUEUE(gtBuilding),TYPE
END
ctBuilding CLASS(ctQueue),TYPE
Q &qtBuilding
Construct PROCEDURE()
Del PROCEDURE(),DERIVED
Add PROCEDURE(STRING Description)
Add PROCEDURE(),DERIVED
END
Buildings qtBuilding
RoomQ &qtRoom
oRoom ctRoom
oBuilding ctBuilding
include('errors.clw'),once
include('Debuger.inc'),once
dbg Debuger
CODE
dbg.mg_init('ShowQ')
oBuilding.Add('Home')
oBuilding.Q.Rooms.Add('BedRoom', 144, 120)
oBuilding.Q.Rooms.Add('Dinning', 288, 120)
oBuilding.Add('Office')
oBuilding.Q.Rooms.Add('Conference', 144, 120)
oBuilding.Q.Rooms.Add('Break' , 288, 120)
SORT(oBuilding.Q, oBuilding.Q.Description)
! oBuilding.Dump()
oBuilding.PrepForLoop()
LOOP WHILE oBuilding.GetNextRow() = NoError
dbg.Debugout('Building['& CLIP(oBuilding.Q.Description) &']')
oBuilding.Q.Rooms.PrepForLoop()
LOOP WHILE oBuilding.Q.Rooms.GetNextRow() = NoError
dbg.Debugout(' Room ['& CLIP(oBuidling.Q.Rooms.Q.Description) &']')
END
END
! Example of noisy
!QPtrBuilding LONG
! LOOP QPtrBuilding = 1 TO RECORDS( oBuilding.Q )
! GET(oBuilding.Q, QPtrBuilding )
! oBuilding.Q.Description = 'Home'
! oBuilding.Add()
! Building.Q.Rooms.Q.Description = 'Hello'
! Building.Q.Rooms.Description = 'Hello'
! RoomQ &= Building.Q.Rooms.Q
ctRoom.Construct PROCEDURE
CODE
SELF.Q &= new qtRoom
CLEAR(SELF.Q)
SELF.BaseQ &= SELF.Q !<--- something you have to know for ctQueue
ctRoom.Add PROCEDURE(STRING Description, REAL Width, REAL Length)
CODE
SELF.Q.Description = Description
SELF.Q.Width = Width
SELF.Q.Length = Length
ADD(SELF.Q, SELF.Q.Description)
!SELF.Add()
ctBuilding.Construct PROCEDURE
CODE
SELF.Q &= new qtBuilding
CLEAR(SELF.Q)
SELF.BaseQ &= SELF.Q !<--- something you have to know for ctQueue
ctBuilding.Del PROCEDURE
CODE
!FREE(SELF.Q.Rooms)
DISPOSE(SELF.Q.Rooms)
PARENT.Del()
ctBuilding.Add PROCEDURE() !,DERIVED
CODE
IF SELF.Q.Rooms &= NULL
SELF.Q.Rooms &= NEW ctRoom
END
!ADD(SELF.Q, SELF.Q.Description)
PARENT.ADD()
ctBuilding.Add PROCEDURE(STRING Description)
CODE
SELF.Q.Description = Description
SELF.Add()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.