ExtendedInstructionDef Class Reference

Describes an extended instruction. More...

#include <ExtendedInstruction.h>

Inheritance diagram for ExtendedInstructionDef:

FunctorExtendedInstructionDef< T > List of all members.

Public Member Functions

virtual ~ExtendedInstructionDef ()
string getName ()
 Returns the name of this instruction.
const vector< StandardTypeDescriptorOrdinal > & getParameterTypes ()
 Returns the parameter types of this instruction.
string getSignature () const
 Returns the signature of this instruction.
virtual ExtendedInstructioncreateInstruction (vector< RegisterReference * > const &regs)=0
 Creates an instruction of this type which references a particular set of registers.

Protected Member Functions

 ExtendedInstructionDef (string const &name, vector< StandardTypeDescriptorOrdinal > const &parameterTypes)
 Only an ExtendedInstructionTable can create an ExtendedInstructionDef.

Protected Attributes

string _name
vector< StandardTypeDescriptorOrdinal_parameterTypes
string _signature

Private Member Functions

string computeSignature ()

Friends

class ExtendedInstructionTable

Detailed Description

Describes an extended instruction.

Created by ExtendedInstructionTable.

Definition at line 44 of file ExtendedInstruction.h.


Constructor & Destructor Documentation

ExtendedInstructionDef::ExtendedInstructionDef ( string const &  name,
vector< StandardTypeDescriptorOrdinal > const &  parameterTypes 
) [inline, explicit, protected]

Only an ExtendedInstructionTable can create an ExtendedInstructionDef.

Definition at line 57 of file ExtendedInstruction.h.

00060         : _name(name),
00061           _parameterTypes(parameterTypes),
00062           _signature(computeSignature())
00063     {
00064     }

virtual ExtendedInstructionDef::~ExtendedInstructionDef (  )  [inline, virtual]

Definition at line 67 of file ExtendedInstruction.h.

00067 {}


Member Function Documentation

string ExtendedInstructionDef::getName (  )  [inline]

Returns the name of this instruction.

Definition at line 72 of file ExtendedInstruction.h.

Referenced by CalcExtContextTest::setupExtendedTestInstructions(), testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), and testConvertStringToExactNumber().

00073     {
00074         return _name;
00075     }

const vector<StandardTypeDescriptorOrdinal>& ExtendedInstructionDef::getParameterTypes (  )  [inline]

Returns the parameter types of this instruction.

Definition at line 80 of file ExtendedInstruction.h.

Referenced by TestCalculator::setUp(), CalcExtContextTest::setupExtendedTestInstructions(), testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), and testConvertStringToExactNumber().

00081     {
00082         return _parameterTypes;
00083     }

string ExtendedInstructionDef::getSignature (  )  const [inline]

Returns the signature of this instruction.

The signature is always of the form "<name>(<type0>,<type1>,...)", for example "substr(ptr,ptr,int,intr)". The signature is used to identify instructions in an ExtendedInstructionTable, and in assembly language instructions such as "CALL 'substr(ptr,ptr,int,ptr) &0, &1, &2, &3".

Definition at line 91 of file ExtendedInstruction.h.

Referenced by ExtendedInstructionTable::add(), ExtendedInstruction5Context< T0, T1, T2, T3, T4 >::describe(), ExtendedInstruction5< T0, T1, T2, T3, T4 >::describe(), ExtendedInstruction4Context< T0, T1, T2, T3 >::describe(), ExtendedInstruction4< T0, T1, T2, T3 >::describe(), ExtendedInstruction3Context< T0, T1, T2 >::describe(), ExtendedInstruction3< T0, T1, T2 >::describe(), ExtendedInstruction2Context< T0, T1 >::describe(), ExtendedInstruction2< T0, T1 >::describe(), ExtendedInstruction1Context< T0 >::describe(), and ExtendedInstruction1< T0 >::describe().

00092     {
00093         return _signature;
00094     }

virtual ExtendedInstruction* ExtendedInstructionDef::createInstruction ( vector< RegisterReference * > const &  regs  )  [pure virtual]

Creates an instruction of this type which references a particular set of registers.

The registers supplied must be the same number and type as the registers supported by the function.

Implemented in FunctorExtendedInstructionDef< T >.

Referenced by InstructionFactory::createInstruction(), testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), and testConvertStringToExactNumber().

string ExtendedInstructionDef::computeSignature (  )  [private]

Definition at line 32 of file ExtendedInstruction.cpp.

References _name, _parameterTypes, and StandardTypeDescriptor::toString().

00033 {
00034     string sig = _name;
00035     sig += "(";
00036     for (uint i = 0; i < _parameterTypes.size(); i++) {
00037         if (i > 0) {
00038             sig += ",";
00039         }
00040 
00041         char const *pParamString =
00042             StandardTypeDescriptor::toString(_parameterTypes[i]);
00043         sig += pParamString;
00044     }
00045     sig += ")";
00046     return sig;
00047 }


Friends And Related Function Documentation

friend class ExtendedInstructionTable [friend]

Reimplemented in FunctorExtendedInstructionDef< T >.

Definition at line 51 of file ExtendedInstruction.h.


Member Data Documentation

string ExtendedInstructionDef::_name [protected]

Definition at line 47 of file ExtendedInstruction.h.

Referenced by computeSignature().

vector<StandardTypeDescriptorOrdinal> ExtendedInstructionDef::_parameterTypes [protected]

Definition at line 48 of file ExtendedInstruction.h.

Referenced by computeSignature().

string ExtendedInstructionDef::_signature [protected]

Definition at line 49 of file ExtendedInstruction.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:31 2009 for Fennel by  doxygen 1.5.1