#include <ExtendedInstruction.h>
Inheritance diagram for ExtendedInstructionDef:
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 ExtendedInstruction * | createInstruction (vector< RegisterReference * > const ®s)=0 |
Creates an instruction of this type which references a particular set of registers. | |
Protected Member Functions | |
ExtendedInstructionDef (string const &name, vector< StandardTypeDescriptorOrdinal > const ¶meterTypes) | |
Only an ExtendedInstructionTable can create an ExtendedInstructionDef. | |
Protected Attributes | |
string | _name |
vector< StandardTypeDescriptorOrdinal > | _parameterTypes |
string | _signature |
Private Member Functions | |
string | computeSignature () |
Friends | |
class | ExtendedInstructionTable |
Created by ExtendedInstructionTable.
Definition at line 44 of file ExtendedInstruction.h.
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] |
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 }
friend class ExtendedInstructionTable [friend] |
Reimplemented in FunctorExtendedInstructionDef< T >.
Definition at line 51 of file ExtendedInstruction.h.
string ExtendedInstructionDef::_name [protected] |
vector<StandardTypeDescriptorOrdinal> ExtendedInstructionDef::_parameterTypes [protected] |
string ExtendedInstructionDef::_signature [protected] |
Definition at line 49 of file ExtendedInstruction.h.