Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9743 in orxonox.OLD for branches/new_class_id/src/lib


Ignore:
Timestamp:
Sep 16, 2006, 2:29:28 PM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: lua_State executor definition

Location:
branches/new_class_id/src/lib/util
Files:
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/util/Makefile.am

    r9742 r9743  
    99                executor/executor.cc \
    1010                executor/executor_lua.cc \
     11                executor/executor_lua_state.cc \
    1112                executor/executor_substring.cc
    1213
     
    4950                executor/executor_xml.h \
    5051                executor/executor_lua.h \
     52                executor/executor_lua_state.h \
    5153                executor/executor_substring.h \
    5254                executor/executor_generic.h \
  • branches/new_class_id/src/lib/util/executor/executor_generic.h

    r9742 r9743  
    5555#endif /* __EXECUTOR_GENERIC_H_ */
    5656
     57
    5758#ifdef __EXECUTOR_FUNCTIONAL_NAME
    58 
    5959///////////
    6060//// 0 ////
     
    101101
    102102
    103 
    104 
    105103///////////
    106104//// 1 ////
     
    148146
    149147
    150 
    151 
    152148///////////
    153149//// 2 ////
     
    196192
    197193
    198 
    199 
    200194///////////
    201195//// 3 ////
     
    242236  };
    243237};
    244 
    245 
    246238
    247239
     
    292284  };
    293285};
    294 
    295 
    296 
    297286
    298287
  • branches/new_class_id/src/lib/util/executor/executor_lua_state.cc

    r9735 r9743  
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
    1717
    18 #include "executor_lua.h"
     18#include "executor_lua_state.h"
    1919
    2020#include "lunar.h"
  • branches/new_class_id/src/lib/util/executor/executor_lua_state.h

    r9742 r9743  
    2121
    2222
    23 #ifndef __EXECUTOR_SUBSTRING_H_
    24 #define __EXECUTOR_SUBSTRING_H_
     23#ifndef __EXECUTOR_LUA_STATE_H_
     24#define __EXECUTOR_LUA_STATE_H_
    2525
    2626
    2727#include "executor_generic.h"
    28 #include "substring.h"
     28#include "luaincl.h"
    2929
     30template<typename type> type fromLua(lua_State* state, int index);
     31template<> bool fromLua<bool>(lua_State* state, int index);
     32template<> int fromLua<int>(lua_State* state, int index);
     33template<> unsigned int fromLua<unsigned int>(lua_State* state, int index);
     34template<> float fromLua<float>(lua_State* state, int index);
     35template<> char fromLua<char>(lua_State* state, int index);
     36template<> const std::string& fromLua<const std::string&>(lua_State* state, int index);
    3037
    31 template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
    32 template<> bool fromString<bool>(const std::string& input, bool defaultValue);
    33 template<> int fromString<int>(const std::string& input, int defaultValue);
    34 template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue);
    35 template<> float fromString<float>(const std::string& input, float defaultValue);
    36 template<> char fromString<char>(const std::string& input, char defaultValue);
    37 template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue);
    38 
    39 template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ };
    40 template<> bool fromMulti<bool>(const MultiType& multi);
    41 template<> int fromMulti<int>(const MultiType& multi);
    42 template<> unsigned int fromMulti<unsigned int>(const MultiType& multi);
    43 template<> float fromMulti<float>(const MultiType& multi);
    44 template<> char fromMulti<char>(const MultiType& multi);
    45 template<> const std::string& fromMulti<const std::string&>(const MultiType& multi);
    46 
    47 
    48 template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; };
    49 template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i);
    50 template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i);
    51 template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i);
    52 template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i);
    53 template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i);
    54 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i);
    55 
     38template<typename type> void toLua(lua_State* state, type value);
     39template<> void toLua<bool>(lua_State* state, bool value);
     40template<> void toLua<int>(lua_State* state, int value);
     41template<> void toLua<unsigned int>(lua_State* state, unsigned int value);
     42template<> void toLua<float>(lua_State* state, float value);
     43template<> void toLua<char>(lua_State* state, char value);
     44template<> void toLua<const std::string&>(lua_State* state, const std::string& value);
    5645
    5746/**
     
    6049 * @param default The default Values.
    6150 */
    62 template<> class ExecutorEvaluater <const SubString>
     51template<> class ExecutorEvaluater <lua_State*>
    6352{
    6453public:
     
    6857   */
    6958  template <typename ToType, int index>
    70   ToType operator()(const SubString& CallValue, const MultiType* const defaults)
     59  ToType operator()(lua_State*& CallValue, const MultiType* const defaults)
    7160  {
    72     return (CallValue.size() > index) ?
    73            fromString<ToType>(CallValue[index], getDefault<ToType>(defaults, index)) :
    74            fromMulti<ToType>(defaults[index]);
     61    return (fromLua<ToType>(CallValue, index));
    7562  }
    76   static const SubString& defaultValue() { return SubString::NullSubString; };
     63  static lua_State*& defaultValue() { static lua_State* nullState; return nullState; };
    7764};
    7865
    79 #endif /* __EXECUTOR_SUBSTRING_H_ */
     66#endif /* __EXECUTOR_LUA_STATE_H_ */
Note: See TracChangeset for help on using the changeset viewer.