_SharedPtr<OTScript> OTScriptFactory(const std::string & script_type)
{
    // -------------------------------------------
#ifdef OT_USE_SCRIPT_CHAI
    // default or explicit chai script interpreter
    if (script_type == "" || script_type =="chai") // todo no hardcoding.
    {
        _SharedPtr<OTScript> pChaiScript(new OTScriptChai);
        return pChaiScript;
    }
    // -------------------------------------------
//#elif OT_USE_SCRIPT_LUA
//  if (script_type =="lua") // todo no hardcoding.
//  {
//      _SharedPtr<OTScript> pLuaScript(new OTScriptLua);
//      return pLuaScript;
//  }
    // -------------------------------------------
#else
    // default no script interpreter
    if (script_type == "")
    {
        OTLog::Error("\n\n WARNING 1: script_type == noscript. \n\n");
        
        _SharedPtr<OTScript> pNoScript(new OTScript);
        return pNoScript;
    }
#endif
    // -------------------------------------------
    OTLog::vError("%s: Script language (%s) not found.\n",
                  __FUNCTION__, script_type.c_str());
    
    _SharedPtr<OTScript> retVal;
    return retVal;
}
Exemple #2
0
std::shared_ptr<OTScript> OTScriptFactory(const std::string& script_type)
{

#ifdef OT_USE_SCRIPT_CHAI
    // default or explicit chai script interpreter
    if (script_type == "" || script_type == "chai") // todo no hardcoding.
    {
        std::shared_ptr<OTScript> pChaiScript(new OTScriptChai);
        return pChaiScript;
    }

//#elif OT_USE_SCRIPT_LUA
//  if (script_type =="lua") // todo no hardcoding.
//  {
//      std::shared_ptr<OTScript> pLuaScript(new OTScriptLua);
//      return pLuaScript;
//  }

#else
    // default no script interpreter
    if (script_type == "") {
        otErr << "\n\n WARNING 1: script_type == noscript. \n\n";

        std::shared_ptr<OTScript> pNoScript(new OTScript);
        return pNoScript;
    }
#endif

    otErr << __FUNCTION__ << ": Script language (" << script_type
          << ") not found.\n";

    std::shared_ptr<OTScript> retVal;
    return retVal;
}