Fennel: /home/pub/open/dev/fennel/calculator/ExtendedInstructionTable.h Source File (original) (raw)

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 #ifndef Fennel_ExtendedInstructionTable_Included 00024 #define Fennel_ExtendedInstructionTable_Included 00025 00026 #include "fennel/calculator/ExtendedInstruction.h" 00027 #include 00028 00029 FENNEL_BEGIN_NAMESPACE 00030 00031 using std::string; 00032 00035 class FENNEL_CALCULATOR_EXPORT ExtendedInstructionTable 00036 { 00037 public: 00039 template 00040 void add( 00041 const string &name, 00042 const vector &parameterTypes, 00043 T *dummy, 00044 typename T::Functor functor) 00045 { 00046 FunctorExtendedInstructionDef pDef = 00047 new FunctorExtendedInstructionDef( 00048 name, 00049 parameterTypes, 00050 functor); 00051 _defsByName[pDef->getSignature()] = pDef; 00052 } 00053 00057 ExtendedInstructionDef operator[] (string const &signature) { 00058 return _defsByName[signature]; 00059 } 00060 00061 string signatures(); 00062 00063 private: 00064 map<string, ExtendedInstructionDef *> _defsByName; 00065 }; 00066 00067 00068 FENNEL_END_NAMESPACE 00069 00070 #endif 00071