Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CommandQueue.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: CommandQueue.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.42 $       $Date: 2019/01/17 21:20:58 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  * 
00019  * This stores all the Commands to be run in a queue.  The idea is that
00020  * the various events add Commands to the command queue then they
00021  * are read off the queue and the UIs are notified.
00022  *
00023  * There is one global instance of this class in VMDApp, called commandQueue.
00024  * It is used by all the user interface objects (UIObject classes).
00025  * Each time a new action is requested by the user or some other part of
00026  * VMD, a new Command instance is created and added to the
00027  * CommandQueue.  Within the main event loop of VMD, after each
00028  * UIObject is checked for new events, the commands in the queue are
00029  * all executed until the queue is empty (since the execution of one command
00030  * may result in the queuing of a new command, this process continues until
00031  * the queue is empty).
00032  *
00033  * NOTES:
00034  *  1) To add new commands to queue, use routine 'append(Command *)',
00035  *     inherited since this is a ResizeArray<> object.
00036  *  2) To do something, use 'execute' routine. 
00037  *     This will execute the top command and inform all the UIs 
00038  *  3) 'execute_all' will do all the commands until the queue is empty.
00039  *
00040  ***************************************************************************/
00041 #ifndef COMMANDQUEUE_H
00042 #define COMMANDQUEUE_H
00043 
00044 #include <stdio.h>
00045 #include <string.h>
00046 #include "ResizeArray.h"
00047 #include "Command.h"
00048 class UIObject;
00049 
00051 class CommandQueue {
00052   private:
00053     ResizeArray<Command *> cmdlist; 
00054     ResizeArray<UIObject *> uilist; 
00055 
00056   public:
00057     CommandQueue(void);             
00058     ~CommandQueue(void);            
00059     void register_UI(UIObject *);   
00060     void unregister_UI(UIObject *); 
00061     void append(Command *);         
00062     void runcommand(Command *);     
00063     void execute_all(void);         
00064     void check_events();            
00065 };
00066 
00067 #endif
00068 

Generated on Sat Oct 12 02:43:55 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002