InstructionArgs.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/calculator/InstructionArgs.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 // InstructionArgs.h
00023 // Include this file if you intend to manipulate instructions directly,
00024 // otherwise include Calculator.h
00025 //
00026 */
00027 #ifndef Fennel_InstructionArgs_Included
00028 #define Fennel_InstructionArgs_Included
00029 
00030 #include <string>
00031 #include "fennel/calculator/Calculator.h"
00032 #include "fennel/calculator/RegisterReference.h"
00033 #include "fennel/tuple/StandardTypeDescriptor.h"
00034 
00035 FENNEL_BEGIN_NAMESPACE
00036 
00037 // InstructionArgs
00038 // A class that can represent all possible arguments to
00039 // an Instruction constructor.
00040 class FENNEL_CALCULATOR_EXPORT InstructionArgs
00041 {
00042 public:
00043     explicit
00044     InstructionArgs(const vector<RegisterReference*> o)
00045         : operands(o),
00046           pcSet(false)
00047     {
00048     }
00049 
00050     explicit
00051     InstructionArgs(
00052         const vector<RegisterReference*> o,
00053         TProgramCounter p)
00054         : operands(o),
00055           pc(p),
00056           pcSet(true)
00057     {
00058     }
00059 
00060     const TProgramCounter
00061     getPC()
00062     {
00063         assert(pcSet);
00064         return pc;
00065     }
00066 
00067     const vector<RegisterReference*>&
00068     getOperands()
00069     {
00070         return operands;
00071     }
00072 
00073     const RegisterReference*
00074     operator[] (int i)
00075     {
00076         return operands[i];
00077     }
00078 
00079 private:
00080     vector<RegisterReference*> operands;
00081     TProgramCounter pc;
00082     bool pcSet;
00083 };
00084 
00085 
00086 
00087 
00088 FENNEL_END_NAMESPACE
00089 
00090 #endif
00091 
00092 // End InstructionArgs.h
00093 

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