/*
* ReadMe.txt (Version 2)
* ===============================================================================================
* Project : Glue Library
* ===============================================================================================
*
* [A] Compiler Settings
* -----------------------------------------------------------------------------------------------
*
* 1. The library and application uses the following features,
* 1) Build environment - MS Visual Studio 2008, .Net 3.5
* 2) Features - Uses MFC with MFC threads
* 3) Project is built with admin rights to the user
*
* 2. Project generation settings,
* 1) MFC Application (.exe)
* 2) Single Document
* 3) No Document/View support, No database support, No toolbar
*
* 3. Project Properties / Settings,
* Configuration Properties -> General
* - Use MFC in a shared DLL
* - Not using ATL
* - Use unicode char set
* - No Common Language Runtime Support
*
* ===============================================================================================
*
* [B] Commands Information
* -----------------------------------------------------------------------------------------------
*
* 1. show memory : Show current objects",
* 2. show registry : Show registered objects",
* 3. show threads : Show threads status",
* 4. save log : Save log in Log.txt file",
* 5. clear log : Delete log strings",
* 6. clear leaks : Delete noticed memory leaks",
* 7. help / commands : Show commands (show help)"
*
* ===============================================================================================
*
* [C] List of Object Oriented Design Patterns used and other standard design practices used.
* -----------------------------------------------------------------------------------------------
*
* 1. Singleton
* 2. Factory
* 3. Builder
* 4. Bridge
* 5. Composite
* 6. Command
* 7. Iterator
* 8. Observer
* 9. Visitor
* 10. Asynchronous messaging
* 11. Reference counting mechanism
* 12. Multi-threading and synchronization
* 13. Parallel tasks management, synchronization and
* tasks scheduling on multiple processors.
* 14. Multiple processors management.
*
* ===============================================================================================
*
* [D] Glue system - Information about usage
* -----------------------------------------------------------------------------------------------
*
* a) All datatypes are defined in [datatypes.h], datatypes end with underscore.
* b) Most of the constants such as messages, flags, error numbers etc are defined in [constants.h].
* c) All class names begin with G and are derived from the generic base class (Glue) or Glue's
* derivatives. Glue class and other interfaces are defined in [gsystem.h].
* d) Asynchronous communication and notifications happens through call-back messages.
* An object must be attached to the object from which it expects to receive asynchronous messages.
* Any object can send message to any other object or receive message from any other object.
* All messages should be handled in the GRecvMessage() function. Also see GSubject class.
* Synchronous messaging is also supported, see SyncNotify() function.
* e) Multiple strings in a buffer should be separated by the delimiter. Currently (*) is used
* as delimiter. see GBufferStr class. e.g. File name open mode string = file.txt*RW*
* In case single string has many sub strings then (.) is used for separation. e.g.
* IP addr port string = "10.10.10.10*80*" OR Window info = "Caption*left.top.right.bottom*CV*"
* f) Reference counting is suppoted and should be used for dynamic objects.
* Call the function Release() for releasing an object, do not call delete.
* g) Windows OS specific classes and code are put in files whose names starts with "win".
* h) Startup code - GBase::InitGSystem(), Shutdown code - GBase::StopGSystem() and
* Message processing code - GBase::ProcessMessages() should be done at proper places.
* This is done in overloaded functions of CWinApp - InitInstance(), ExitInstance() and Run().
* i) Singleton manager classes are implemented thread safe. Other classes are not thread safe.
* j) Messages from push-button and text-edit are sent directly to their parent objects.
* k) Most of the functions, including search functions, returns 0 for failure and 1 for success.
* l) GRecvMessage() is for asynchronous as well as synchronous communication/messaging.
* m) Concrete definition, implementation of gsystem features is in [congsystem.h], [congsystem.cpp].
* n) Control messages, like resize etc, can be send to IO objects and also control information can be
* get from objects using Write() and Read() respectively. Use classes derived from GIOData for this.
* o) Nested Getting and Releasing locks is allowed and should be supported by platform specific code.
* p) More usage information can be found in individual .h files. Also see example in QuickStart file.
*
* ===============================================================================================
*
* [E] Class Hierarchy (basic top-level information)
*
*
* ------------------------------------------------------> Glue
* | |
* | ---------------------------------------------------------------------------------------------------------------------
* | | | | | | | |
* ManagerClasses <-- GThreadSafe GSubject GData GRenderer GIterator GCommand
* GMessageManager | | | | |
* GRegistry ------------------------------- ----------------------------------- ----- ----- -----
* GErrorManager | | | | | | | | | | | |
* GLogManager GIODevice GOSObject GProcessor | | GGlyph GListInt GBuffer GIOData GGraphicsRender | GRunCommand
* GMemoryManager | | | | | | | | | GGlyphRenderer | GShowHelpCommand
* GObjectFactory ----- ----- ----- GTimer | ----- ----- ----- ----- GTextRenderer | GShowMemCommand
* GThreadManager | | | | | | | | GImageRenderer | GShowRegCommand
* GScheduler GFile GMutex GVirtualPro | GCircle GList GString GWinData GAudioRenderer | GShowThreadsCommand
* GProcessorManager GNetSocket GSema GRemotePro | GEllipse GStack GMediaBuf GKeyData GVideoRenderer | GSaveLogCommand
* GMouse GRWLock | GLine GQueue GMouseData | GClearLogCommand
* GKey GCompLock | GPoint GArray GScrollData | GClearLeaksCommand
* (GRenderer)--> GWindow | GText GDoubleList GColorData |
* | | GRectanle GListIterator
* ----------------------------- GTask GQueueIterator
* | | | | GTaskContext GStackIterator
* GMainWnd GChildWnd GButtonWnd GTextWnd GProsData GDListIterator
*
*
* ===============================================================================================
*
* [F] Classes and Usage Information
* -----------------------------------------------------------------------------------------------
*
* 1. Glue Glue is base class for all other classes, it provides the following,
* a) Init functions, Exit function, message processing function.
* b) Reference count of the object, with reference counting mechanism.
* c) Reference counting methods, AddRef() Release() for dynamic objects.
* d) Virtual function for accepting synchronous & asynchronous messages.
* e) Pointers to manager objects : Message manager, Error manager,
* Log manager, Memory manager, Registry manager, Thread manager,
* Object factory, Scheduler and Processor manager.
*
* 2. GMemoryManager Class for tracking all the objects in the application.
* (Singleton) a) Allocate and Release memory
* b) Tracks dynamic objects, static objects and memory leaks.
* c) Checks if object is dynamic or static.
*
* 3. GErrorHandler Informs the uset about error that has occured in the application
* (Singleton) Error is logged. No corrective action is taken as of now.
*
* 4. GMessageManager Handles sending async and sync messages. Processes message queue.
* (Singleton) Application defined messages from any object to any other object.
* Supports sending high priority messages.
*
* 5. GLogManager Handles logging of information as well as logging of errors.
* (Singleton) Any string / number / float can be logged for the user information.
*
* 6. GRegistry Any object can be registered along with its type and data. Searching in
* (Singleton) the registry is supported. Registry is available to all objects.
*
* 7. GThreadManager Handles creating, deleting, suspending and resuming threads.
* (Singleton) Different priority levels are supported. There is limit on max threads.
*
* 8. GWinObjectFactory Handles creation of common objects as well as plotform specific objects.
* (Singleton) Currently implemented for Windows platform.
*
* 9. GScheduler Supports creating and managing parallel tasks with task synchronization.
* (Singleton) Multi-processor priority scheduling is supported.
*
* 10. GProcessorManager Manages virtual processors and remote processors.
* (Singleton) (Not all functions are available as of now)
*
* 11. GData Base class to manage data. Data can be passed along with messages.
* Enforces data cloaning and serialization.
*
* 12. GBuffer Supports buffer management. Allocating, deleting, comparing and
* concating buffers is supported.
*
* 13. GString Supports strings management. Searching, concating, comparing operations
* are supported. Strings ends with '\0' and multiple strings can be
* separated by delimiter. Default delimiter is "*".
*
* 14. GMediaBuffer Manages media buffers such as audio and video samples.
*
* 15. GIOData Base class to manage IO messages. It is derived from GData class.
* 15.1) GWinData Class to manage window related messages.
* 15.2) GKeyData Class to manage key-board messages.
* 15.3) GMouseData Class to manage mouse messages.
* 15.4) GScrollData Class to manage scroll-bar messages.
* 15.5) GColorData Class to manage color related messages.
*
* 16. GSubject Base class for asynchronous communication (Observer pattern).
* It provides Notify() and SyncNotify() functions.
*
* 17. GTimer Timer. Getting call-backs for each defined time interval.
*
* 18. GWinReadWriteLock Application level read/write lock for resource sharing among threads.
*
* 19. GThreadSafe Class that creates Read/Write lock and provides interface for
* resource sharing and thread safty.
*
* 20. GCommand Base class for all command commands.
* 20.1) GRunCommand Parse user input, create command object and run command.
* 20.2) GShowHelpCommand Handles (help) command. Shows commands help.
* 20.3) GShowMemCommand Handles (show memory) command. Shows objects in the system.
* 20.4) GShowRegCommand Handles (show registry) commands. Shows registred object.
* 20.5) GShowThreadsCommand Handles (show threads) command. Shows threads in the system.
* 20.6) GSaveLogCommand Handles (save log) command. Saves log information in Lox.txt file.
* 20.7) GClearLogCommand Handles (clear log) command. Deletes log strings.
* 20.8) GClearLeaksCommand Handles (clear leaks) commands. Deletes any detected memory leaks.
*
* 21. GGlyph Base class for graphics objects. Supports recursive composition.
* 21.1) GCircle Circle could be filled ot opaque.
* 21.2) GEllipse Ellipse could be filled or opaque.
* 21.3) GRectangle Rectangle could be filled or opaque.
* 21.4) GLine Line connecting two points.
* 21.5) GText Alpha-numeric text to be displayed.
* 21.6) GPoint Single pixel.
*
* 22. GListInt Base class for lists. It is derived from GData.
* 22.1) GArray Continous elements array.
* 22.2) GStack Stack supports Push and Pop - LIFO order list.
* 22.3) GQueue Queue supports Push and Pop - FIFO order list.
* 22.4) GList Singly linked list - Supports Search, Get, Append, Prepend, Insert.
* 22.5) GDoubleList Doubly linked list - Supports Search, Get, Append, Prepend, Insert.
*
* 23. GIterator For traversing Lists.
* 23.1) GNullIterator No iterator available.
* 23.2) GArrayIterator Array iterator.
* 23.3) GListIterator Single list iterator.
* 23.4) GDListIterator Doubly list iterator.
* 23.5) GStackIterator Stack iterator.
* 23.6) GQueueIterator Queue iterator.
*
* 24. GSort Base class for sorting algo. Sorts GList and its derived objects.
* 24.1) GRapidSort Sorts list with at most N swappings.
*
* 25. GIODevice Base class for all IO related objects.
* 25.1) GNetSocket Network socket (TCP/IP) based.
* 25.2) GFile IO to disk file.
* 25.3) GKey Key board input (not used, Windows are used instead).
* 25.4) GMouse Mouse input (not used, Windows are used instead).
* 25.5) GWindow Screen input / output.
* 25.6) GMainWnd Main application window (Singleton).
* 25.7) GChildWnd Sub windows in the application.
* 25.8) GTextWnd Text box for inputting text.
* 25.9) GButtonWnd Push Button press.
*
* 26. GRenderer Base class for managing rendering contents in a window on the screen.
* 26.1) GTextRenderer Text rendering along with scrolling.
* 26.2) GImageRenderer Image rendering.
* 26.3) GGraphicsRenderer Drawing graphical objects.
* 26.4) GGlyphRenderer Drawing graphics composit structure.
* 26.5) GVideoRenderer Show video (Not implemented).
* 26.6) GAudioRenderer Play audio (Not implemented).
*
* Some of the platform specific classes are not shown here as they are wrapped inside application
* specific classes listed above. They are put in files starting with "win" for Windows OS specific.
*
* ===============================================================================================
*
* [G] Window control message information
* -----------------------------------------------------------------------------------------------
*
* a) Below is a typical way of sending control message and getting control information
*
* GIOData* pMsg = new GWinData(MSG_DO_RESIZE, 0, 10, 20, 100, 100);
* if (pMsg)
* {
* WinObj.Write(pMsg); // do control operation
* }
* if (pMsg)
* {
* pMsg->Set(MSG_GET_WIN_SIZE_POS);
* WinObj.Read(pMsg); // get current control state
* }
*
* b) Parameter information for control messages. See classes derived from GIOData
*
* 1) MSG_DO_WIN_MOVE : GWinData X, Y, CX, CY - Left, Top, Right, Bottom (Move window)
* 2) MSG_DO_WIN_SIZE : GWinData X, Y, CX, CY - Left, Top, Right, Bottom (resize window)
* 3) MSG_DO_WIN_POS : GWinData X, Y, CX, CY - Left, Top, Right, Bottom (change window pos)
* 4) MSG_DO_WIN_MINIMIZE : GWinData X, Y - Left, Top position of minimized window
* 5) MSG_DO_WIN_MAXIMIZE : GWinData X, Y - Left, Top position of maximized window
* 6) MSG_DO_WIN_RESTORE : GWinData X, Y, CX, CY - Left, Top, Right, Botton (restore window)
* 7) MSG_DO_WIN_HIDE : GWinData - None (hide window)
* 8) MSG_DO_WIN_SHOW : GWinData X, Y, CX, CY - Left, Top, Right, Bottom (show window)
* 9) MSG_DO_WIN_STYLE_ADD : GKeyData Char - Char flag specifying style (change style)
* 10) MSG_DO_WIN_STYLE_REMOVE : GKeyData Char - Char flag specifying style (Change style)
* 11) MSG_DO_WIN_ACTIVE : GWinData - None (Activate window)
* 12) MSG_DO_WIN_ON_TOP : GWinData - None (move window on top)
* 13) MSG_DO_WIN_RECT : GWinData X, Y, CX, CY - Left, Top, Right, Bottom (change window rect)
* 14) MSG_DO_WIN_ELLIPTIC : GWinData X, Y, CX, CY - Left, Top, Right, Bottom (change window rect)
* 15) MSG_DO_WIN_PEN : GColorData Color, Flag - Color with style, Pen width in flags (change pen)
* 16) MSG_DO_WIN_BRUSH : GColorData Color - Color with style (change brush)
* 17) MSG_DO_WIN_FONT : GWinData CX - Font size (font is Courier New)
* 18) MSG_DO_TEXT_COLOR : GColorData Color - Color RGB. Style is ignored.
* 19) MSG_DO_TEXT_BK_COLOR : GColorData Color - Background Color RGB. Style is ignored.
* 20) MSG_DO_WIN_DATA_APPEND : GIOData - None (From next Write, Append data to current data)
* 21) MSG_DO_WIN_DATA_REPLACE : GIOData - None (From next Write, Replace currently shown data)
* 22) MSG_GET_WIN_SIZE_POS : GWinData X, Y, CX, CY - Left, Top, Right, Bottom
* 23) MSG_GET_WIN_STATE : GWinData Flags - Flag containing window state
* 24) MSG_GET_WIN_PEN : GColorData Color, Flag - Color with style, Pen width in flags
* 25) MSG_GET_WIN_BRUSH : GColorData Color - Color with style
* 26) MSG_GET_WIN_FONT : GWinData CX - Font size (font is Courier New)
* 27) MSG_GET_TEXT_COLOR : GColorData Color - Color RGB. Style is ignored.
* 28) MSG_GET_TEXT_BK_COLOR : GColorData Color - Background Color RGB. Style is ignored.
* 29) MSG_GET_WIN_DATA_STATE : GIODAta Flags - Data state: Replace/Append
*
* ===============================================================================================
*
*
* [H] Messages information - See constants.h
* -----------------------------------------------------------------------------------------------
*
* 1) MSG_OK : - Positive response from object
* 2) MSG_FAIL : - Operation or request failed
* 3) MSG_CANCEL : - Operation or request canceled
* 4) MSG_DONE : - Operation or request done
* 5) MSG_TIME_TICK : - Timer event
* 6) MSG_IO_OPEN : - Open IO device
* 7) MSG_IO_READ : - Read IO device / get control information
* 8) MSG_IO_WRITE : - Write to IO device / do control operation
* 9) MSG_IO_CLOSE : - Close IO device
* 10) MSG_DONE_IO_OPEN : - IO Open done
* 11) MSG_DONE_IO_READ : - IO Read done
* 12) MSG_DONE_IO_WRITE : - IO Write done
* 13) MSG_DONE_IO_CLOSE : - IO Close done
* 14) MSG_LBUTTON_DOWN : GMouseData X, Y, Flags - Mouse left button down at X, Y position
* 15) MSG_LBUTTON_UP : GMouseData X, Y, Flags - Mouse left button up at X, Y position
* 16) MSG_RBUTTON_DOWN : GMouseData X, Y, Flags - Mouse right button down at X, Y position
* 17) MSG_RBUTTON_UP : GMouseData X, Y, Flags - Mouse right button up at X, Y position
* 18) MSG_MOUSE_MOVE : GMouseData X, Y, Flags - Mouse moved to X, Y location
* 19) MSG_VSCROLL : GScrollData SBCode, Position - Vertical scroll (new position)
* 20) MSG_HSCROLL : GScrollData SBCode, Position - Horizontal scroll (new position)
* 21) MSG_KEY_DOWN : GKeyData Char, ReptCnt, Flag - Key down (ASCII value, count)
* 22) MSG_KEY_UP : GKeyData Char, ReptCnt, Flag - Key up (ASCII value, count)
* 23) MSG_CHAR : GKeyData Char, ReptCnt, Flag - Key pressed and released (ASCII char, cnt)
* 24) MSG_PAINT : - Window paint
* 25) MSG_MOVE : GWinData X, Y, CX, CY - Window moved
* 26) MSG_SIZE : GWinData X, Y, CX. CY - Window resized (X & Y holds new size)
* 27) MSG_DESTROY : GWinData - Window destroyed
* 28) MSG_CLOSE : GWinData - Window closed
* 29) MSG_CREATE : GWinData - Window created
* 30) MSG_WINDOW_POS : GWinData - (Not used)
* 31) MSG_SERVER_CONNECTION : - Server connection
* 32) MSG_BUTTON_CLICKED : - Push button clicked (button ID in source info)
* 33) MSG_START_ASYNC_READ : - Start async reading IO device (if applicable)
* 34) MSG_NET_INPUT : - Async set net input
* 35) MSG_CREATE_FILE : - Create file message
* 36) MSG_CREATE_NET_SOCKET : - Create network socket message
* 37) MSG_CREATE_WINDOW : - Create window message
* 38) MSG_CREATE_TEXT_EDIT : - Create text edit window message
* 39) MSG_CREATE_PUSH_BUTTON : - Create button window message
* 40) MSG_DONE_IO_CREATE : - IO object creation done message
* 41) MSG_DELETE_IO_OBJ : - Delete OS object message
* 42) MSG_OS_OBJ_RELEASE : - Release is done on OS object message
* 43) MSG_SCHEDULE_INTERRUPT : - Schedule interrupt occured message
*
* ===============================================================================================
* ====================================== End of File ============================================
*/