root/juggler/tags/1.0.5/Kernel/vjConfigChunkHandler.h
| Revision 2828, 3.4 kB (checked in by patrickh, 8 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /*************** <auto-copyright.pl BEGIN do not edit this line> ************** |
| 2 | * |
| 3 | * VR Juggler is (C) Copyright 1998, 1999, 2000 by Iowa State University |
| 4 | * |
| 5 | * Original Authors: |
| 6 | * Allen Bierbaum, Christopher Just, |
| 7 | * Patrick Hartling, Kevin Meinert, |
| 8 | * Carolina Cruz-Neira, Albert Baker |
| 9 | * |
| 10 | * This library is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Library General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This library is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * Library General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Library General Public |
| 21 | * License along with this library; if not, write to the |
| 22 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 02111-1307, USA. |
| 24 | * |
| 25 | * ----------------------------------------------------------------- |
| 26 | * File: $RCSfile$ |
| 27 | * Date modified: $Date$ |
| 28 | * Version: $Revision$ |
| 29 | * ----------------------------------------------------------------- |
| 30 | * |
| 31 | *************** <auto-copyright.pl END do not edit this line> ***************/ |
| 32 | |
| 33 | |
| 34 | #ifndef _VJ_CONFIG_CHUNK_HANDLER_H_ |
| 35 | #define _VJ_CONFIG_CHUNK_HANDLER_H_ |
| 36 | |
| 37 | #include <vjConfig.h> |
| 38 | class vjConfigChunk; |
| 39 | |
| 40 | //----------------------------------------- |
| 41 | //: Abstract base class for all classes that can handle config chunks |
| 42 | // |
| 43 | // This means that they can be "configured" |
| 44 | // and queried using the specified interface. |
| 45 | // |
| 46 | // |
| 47 | // The idea is that you override canHandle() |
| 48 | // to recognize chunks the derived class cares about. |
| 49 | // Then you over ride configAdd and configRemove |
| 50 | // to actually process those chunks. |
| 51 | // It is also possible to override configProcessPending although the |
| 52 | // default one will work in most cases. |
| 53 | //--------------------------------------------- |
| 54 | //! PUBLIC_API: |
| 55 | class vjConfigChunkHandler |
| 56 | { |
| 57 | public: |
| 58 | //: Can the handler handle the given chunk? |
| 59 | //! RETURNS: true - Can handle it |
| 60 | //+ false - Can't handle it |
| 61 | virtual bool configCanHandle(vjConfigChunk* chunk) = 0; |
| 62 | |
| 63 | //: Process any pending reconfiguration that we can deal with |
| 64 | // This function processes each pending reconfiguration in configuration manager |
| 65 | // The default implementation does the following. <br> |
| 66 | // if(this->configCanHandle && passesDepCheck) |
| 67 | // configAdd/configRemove(chunk) |
| 68 | // if(success) |
| 69 | // add/remove from pending |
| 70 | // remove/add from current |
| 71 | // |
| 72 | //! ARGS: lockIt - Should we lock the cfg_mgr pending list |
| 73 | //+ defaults to true. The only time this should be false is |
| 74 | //+ if you override this function and still want to make use of it's abilities |
| 75 | //+ (ex. The kernel needs to do this because if has to call configProcessPending on other managers in addition to itself) |
| 76 | //! RETURNS: Number of chunks it actually processes |
| 77 | virtual int configProcessPending(bool lockIt = true); |
| 78 | |
| 79 | protected: |
| 80 | //: Add the chunk to the configuration |
| 81 | //! PRE: configCanHandle(chunk) == true |
| 82 | //! RETURNS: success |
| 83 | virtual bool configAdd(vjConfigChunk* chunk) = 0; |
| 84 | |
| 85 | //: Remove the chunk from the current configuration |
| 86 | //! PRE: configCanHandle(chunk) == true |
| 87 | //!RETURNS: success |
| 88 | virtual bool configRemove(vjConfigChunk* chunk) = 0; |
| 89 | }; |
| 90 | |
| 91 | |
| 92 | #endif |
Note: See TracBrowser for help on using the browser.
