PointerInstruction.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/calculator/PointerInstruction.h#5 $
00003 // Fennel is a library of data storage and processing components.
00004 // Copyright (C) 2005-2009 The Eigenbase Project
00005 // Copyright (C) 2004-2009 SQLstream, Inc.
00006 // Copyright (C) 2009-2009 LucidEra, Inc.
00007 //
00008 // This program is free software; you can redistribute it and/or modify it
00009 // under the terms of the GNU General Public License as published by the Free
00010 // Software Foundation; either version 2 of the License, or (at your option)
00011 // any later version approved by The Eigenbase Project.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 //
00022 // PointerInstruction
00023 //
00024 // Instruction->Pointer
00025 //
00026 // Template for all native types
00027 */
00028 #ifndef Fennel_PointerInstruction_Included
00029 #define Fennel_PointerInstruction_Included
00030 
00031 #include "fennel/calculator/Instruction.h"
00032 
00033 FENNEL_BEGIN_NAMESPACE
00034 
00035 
00042 typedef uint32_t PointerSizeT;
00043 #define POINTERSIZET_STANDARD_TYPE STANDARD_TYPE_UINT_32
00044 
00057 typedef uint32_t PointerOperandT;
00058 #define POINTEROPERANDT_STANDARD_TYPE STANDARD_TYPE_UINT_32
00059 
00060 class FENNEL_CALCULATOR_EXPORT PointerInstruction
00061     : public Instruction
00062 {
00063 public:
00064     explicit
00065     PointerInstruction() {}
00066     ~PointerInstruction() {}
00067 
00068 protected:
00069     static vector<StandardTypeDescriptorOrdinal>
00070     regDesc(
00071         uint sizetArgs1,
00072         uint ptrArgs,
00073         StandardTypeDescriptorOrdinal type,
00074         uint operandArgs2)
00075     {
00076         vector<StandardTypeDescriptorOrdinal> v(
00077             sizetArgs1,
00078             POINTERSIZET_STANDARD_TYPE);
00079         uint i;
00080         for (i = 0; i < ptrArgs; i++) {
00081             v.push_back(type);
00082         }
00083         for (i = 0; i < operandArgs2; i++) {
00084             v.push_back(POINTEROPERANDT_STANDARD_TYPE);
00085         }
00086         return v;
00087     }
00088 };
00089 
00090 
00091 //
00092 // PointerInstruction_NotAPointerType
00093 //
00094 // Force the use of a (non-pointer) native type.
00095 // Note: You cannot use typedefs like int32_t here or the
00096 // built-in names thereof won't work. By using the built-in
00097 // type name, you can support the built-in and typedefs
00098 // built on top. Also, signed char is somehow different
00099 // than char. This is not true for short, int, long or
00100 // long long.
00101 //
00102 template <class T> class PointerInstruction_NotAPointerType;
00103 template <> class PointerInstruction_NotAPointerType<char *> {};
00104 template <> class PointerInstruction_NotAPointerType<short *> {};
00105 template <> class PointerInstruction_NotAPointerType<int *> {};
00106 template <> class PointerInstruction_NotAPointerType<long *> {};
00107 template <> class PointerInstruction_NotAPointerType<long long *> {};
00108 template <> class PointerInstruction_NotAPointerType<unsigned char *> {};
00109 template <> class PointerInstruction_NotAPointerType<unsigned short *> {};
00110 template <> class PointerInstruction_NotAPointerType<unsigned int *> {};
00111 template <> class PointerInstruction_NotAPointerType<unsigned long *> {};
00112 template <> class PointerInstruction_NotAPointerType<unsigned long long *> {};
00113 template <> class PointerInstruction_NotAPointerType<signed char *> {};
00114 template <> class PointerInstruction_NotAPointerType<float *> {};
00115 template <> class PointerInstruction_NotAPointerType<double *> {};
00116 
00117 FENNEL_END_NAMESPACE
00118 
00119 #endif
00120 
00121 // End PointerInstruction.h
00122 

Generated on Mon Jun 22 04:00:17 2009 for Fennel by  doxygen 1.5.1