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

/ray/src/lib/module/symbol.h

Go to the documentation of this file.
00001 /*
00002  * lib/module/symbol.h
00003  * 
00004  * Represents a symbol in a shared object / module / DLL. 
00005  * 
00006  * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 
00007  * 
00008  * This file may be distributed and/or modified under the terms of the 
00009  * GNU General Public License version 2 as published by the Free Software 
00010  * Foundation. (See COPYING.GPL for details.)
00011  * 
00012  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014  * 
00015  */
00016 
00017 #ifndef _LIB_MODULE_SYMBOL_H_
00018 #define _LIB_MODULE_SYMBOL_H_
00019 
00020 #include <lib/sconfig.h>    /* MUST be first */
00021 #include <lib/module/sharedobject.h>
00022 
00023 
00034 class ModuleSymbol
00035 {
00036     friend class _ISharedObject;
00037     private:
00039         void *sptr;
00041         SharedObject so;
00042         
00044         ModuleSymbol(void *_ptr,const SharedObject &_so) : sptr(_ptr),so(_so) {}
00045     public:
00047         inline ModuleSymbol() : sptr(NULL),so() {}
00049         inline ModuleSymbol(const ModuleSymbol &s) : sptr(s.sptr),so(s.so) {}
00051         inline ~ModuleSymbol() {}
00052         
00054         inline ModuleSymbol &operator=(const ModuleSymbol &s)
00055             {  sptr=s.sptr;  so=s.so;  return(*this);  }
00056         
00058         inline void *ptr() const
00059             {  return(sptr);  }
00060         
00062         inline bool operator!() const  {  return(!sptr);  }
00063         inline operator bool() const  {  return(sptr);  }
00064         
00066         inline SharedObject object() const
00067             {  return(so);  }
00068 };
00069 
00070 
00103 template<typename FPTR>class ModuleFunction : public ModuleSymbol
00104 {
00105     public:
00107         inline ModuleFunction() : ModuleSymbol() {}
00109         inline ModuleFunction(const ModuleSymbol &s) : ModuleSymbol(s) {}
00111         inline ModuleFunction(const ModuleFunction &mf) : ModuleSymbol(mf) {}
00112         inline ~ModuleFunction() {}
00113         
00115         inline FPTR fptr() const
00116             {  return((FPTR)(ptr()));  }
00118         inline FPTR operator*() const
00119             {  return(fptr());  }
00120 };
00121 
00122 #endif  /* _LIB_MODULE_SYMBOL_H_ */

Generated on Sat Feb 19 22:33:45 2005 for Ray by doxygen 1.3.5