Module.h

Go to the documentation of this file.
00001 /* ========================================================================
00002  * Copyright (c) 2006,
00003  * Institute for Computer Graphics and Vision
00004  * Graz University of Technology
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions are
00009  * met:
00010  *
00011  * Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the following disclaimer.
00013  *
00014  * Redistributions in binary form must reproduce the above copyright
00015  * notice, this list of conditions and the following disclaimer in the
00016  * documentation and/or other materials provided with the distribution.
00017  *
00018  * Neither the name of the Graz University of Technology nor the names of
00019  * its contributors may be used to endorse or promote products derived from
00020  * this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00023  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00024  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00025  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00026  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00028  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00029  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00030  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00031  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  * ========================================================================
00034  * PROJECT: OpenTracker
00035  * ======================================================================== */
00042 /* ======================================================================= */
00043 
00044 #ifndef _MODULE_H
00045 #define _MODULE_H
00046 
00047 #include "../dllinclude.h"
00048 
00049 #include "ConfigNode.h"
00050 #include "StringTable.h"
00051 
00066 namespace ot {
00067 
00068     class OPENTRACKER_API Module
00069     {
00070         //members
00071     protected:
00073         int initialized;
00077         Context * context;
00078         
00079     public:
00080         static Context * contextx;
00081 
00082         //methods
00083     public:
00085         Module(): initialized(0), context(NULL) {};
00086 
00088         virtual ~Module() {};
00089 
00094         virtual void close() {};
00095 
00106         virtual void init(StringTable& attributes,  ConfigNode * localTree)
00107         {
00108             initialized = 1;
00109         };
00110 
00116         virtual void pullEvent() {};
00117 
00123         virtual void pushEvent() {};
00124 
00129         virtual void start() {};
00130 
00134         virtual int stop()
00135         {
00136             return 0;
00137         };
00138 
00143                 virtual void addNode(const Node * ){};
00148                 virtual void removeNode(Node *){};
00149 
00153         int isInitialized()
00154         {
00155             return initialized;
00156         };
00157 
00158         friend class Context;
00159     };
00160 
00161 
00162 
00163 /*
00164 #define OT_MODULE(MODNAME) static void registerModule (Context * context, void * data)
00165 
00166 #define OT_MODULE_REGISTER_FUNC(MODNAME) \
00167         void MODNAME::registerModule( Context * context , void * data) 
00168 
00169 #define OT_MODULE_REGISTRATION_DEFAULT(MODNAME, REGISTRATIONSTRING) \
00170                 MODNAME * mod = new MODNAME();\
00171                 context->addFactory (*mod);\
00172                 context->addModule (REGISTRATIONSTRING, *mod)
00173 
00174 #define OT_REGISTER_MODULE (MODNAME, VOIDPARAMETER) \
00175         Configurator::addModuleInit(#MODNAME, MODNAME::registerModule, VOIDPARAMETER)
00176 
00177 */
00178 
00179 
00180 class Context;
00181 
00182 
00183 #define OT_MODULE(MODNAME) void registerModule##MODNAME (Context * context, void * data)
00184 
00185 #define OT_MODULE_REGISTER_FUNC(MODNAME) \
00186         void registerModule##MODNAME( Context * context , void * data) 
00187 
00188 #define OT_MODULE_REGISTRATION_DEFAULT(MODNAME, REGISTRATIONSTRING) \
00189                 MODNAME * mod = new MODNAME();\
00190                 context->addFactory (*mod);\
00191                 context->addModule (REGISTRATIONSTRING, *mod)
00192 
00193 #define OT_REGISTER_MODULE(MODNAME, VOIDPARAMETER) \
00194         Configurator::addModuleInit(#MODNAME, registerModule##MODNAME, VOIDPARAMETER)
00195 
00196 
00197 
00198 } // namespace ot
00199 
00200 #endif
00201 
00202 /* 
00203  * ------------------------------------------------------------
00204  *   End of Module.h
00205  * ------------------------------------------------------------
00206  *   Automatic Emacs configuration follows.
00207  *   Local Variables:
00208  *   mode:c++
00209  *   c-basic-offset: 4
00210  *   eval: (c-set-offset 'substatement-open 0)
00211  *   eval: (c-set-offset 'case-label '+)
00212  *   eval: (c-set-offset 'statement 'c-lineup-runin-statements)
00213  *   eval: (setq indent-tabs-mode nil)
00214  *   End:
00215  * ------------------------------------------------------------ 
00216  */

Generated on Wed Feb 28 15:18:48 2007 for NaviTrack by  doxygen 1.4.6