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

Kernel.h

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile: Kernel.h,v $
00027  * Date modified: $Date: 2004/01/24 20:59:11 $
00028  * Version:       $Revision: 1.96 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
00032 
00033 #ifndef _VRJ_KERNEL_H_
00034 #define _VRJ_KERNEL_H_
00035 //#pragma once
00036 
00037 #include <vrj/vrjConfig.h>
00038 #include <vector>
00039 
00040 #include <vpr/Util/Singleton.h>
00041 #include <vpr/Sync/CondVar.h>
00042 #include <jccl/RTRC/ConfigElementHandler.h>
00043 #include <gadget/Type/DigitalInterface.h>
00044 
00045 namespace gadget
00046 {
00047    class InputManager;
00048 }
00049 
00050 namespace cluster
00051 {
00052    class ClusterManager;
00053 }
00054 
00055 namespace vpr
00056 {
00057    class BaseThread;
00058 }
00059 
00060 namespace vrj
00061 {
00062 
00063 class DisplayManager;
00064 class DrawManager;
00065 class SoundManager;
00066 class User;
00067 class App;
00068 
00069 
00077 class VJ_CLASS_API Kernel : public jccl::ConfigElementHandler
00078 {
00079 public:
00080 
00082    int start();
00083 
00089    void stop();
00090 
00092    bool isRunning() const
00093    {
00094       return mIsRunning;
00095    }
00096 
00098    void waitForKernelStop();
00099 
00105    void initConfig();
00106 
00108    void controlLoop(void* nullParam);
00109 
00117    void setApplication(vrj::App* newApp);
00118 
00123    void loadConfigFile(const char* filename)
00124    {
00125       std::string filename_str = std::string(filename);
00126       loadConfigFile(filename_str);
00127    }
00128 
00133    void loadConfigFile(std::string filename);
00134 
00145    void scanForConfigDefinitions(const std::string& path);
00146 
00147 
00148 protected:  // -- CONFIG ELEMENT HANDLER
00153    virtual bool configCanHandle(jccl::ConfigElementPtr element);
00154 
00160    virtual bool configAdd(jccl::ConfigElementPtr element);
00161 
00167    virtual bool configRemove(jccl::ConfigElementPtr element);
00168 
00169 protected:  // Local config functions
00171    bool addUser(jccl::ConfigElementPtr element);
00172 
00177    bool removeUser(jccl::ConfigElementPtr element);
00178 
00179 protected:
00184    void updateFrameData();
00185 
00191    void checkForReconfig();
00192 
00202    void changeApplication(vrj::App* newApp);
00203 
00205    void initSignalButtons();
00206 
00208    void checkSignalButtons();
00209 
00210 protected:      // --- DRAW MGR ROUTINES --- //
00221    void startDrawManager(bool newMgr);
00222 
00229    void stopDrawManager();
00230 
00231 public:      // Global "get" interface
00232 
00234    gadget::InputManager* getInputManager();
00235 
00240    vrj::User* getUser(const std::string& userName);
00241 
00243    std::vector<vrj::User*> getUsers()
00244    {
00245       return mUsers;
00246    }
00247 
00248    const vpr::BaseThread* getThread()
00249    {
00250       return mControlThread;
00251    }
00252 
00253 protected:
00254    vrj::App*      mApp;                         
00255    vrj::App*      mNewApp;                      
00256    bool           mNewAppSet;                   
00258    bool               mIsRunning;               
00259    bool               mExitFlag;                
00260    vpr::BaseThread*   mControlThread;           
00261    vpr::CondVar       mExitWaitCondVar;         
00265    gadget::InputManager*      mInputManager;          
00266    DrawManager*               mDrawManager;           
00267    SoundManager*              mSoundManager;          
00268    DisplayManager*            mDisplayManager;        
00269    cluster::ClusterManager*   mClusterManager;        
00271 
00274    std::vector<vrj::User*>   mUsers;    
00276 
00278    gadget::DigitalInterface   mStopKernelSignalButton;
00279 
00280    // ----------------------- //
00281    // --- SINGLETON STUFF --- //
00282    // ----------------------- //
00283 protected:
00285    Kernel();
00286 
00287    Kernel(const vrj::Kernel& k) : jccl::ConfigElementHandler() {;}
00288    void operator=(const vrj::Kernel& k) {;}
00289 
00290    virtual ~Kernel()
00291    {;}
00292 
00293    vprSingletonHeader( Kernel );
00294 };
00295 
00296 } // end namespace
00297 
00298 #endif

Generated on Sun May 2 15:10:17 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002