2011-01-12 13:08:10 -05:00
|
|
|
/*
|
|
|
|
open source routing machine
|
|
|
|
Copyright (C) Dennis Luxen, others 2010
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU AFFERO General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
or see http://www.gnu.org/licenses/agpl.txt.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BASEPARSER_H_
|
|
|
|
#define BASEPARSER_H_
|
|
|
|
|
2013-06-26 19:48:02 -04:00
|
|
|
#include "ExtractorCallbacks.h"
|
|
|
|
#include "ScriptingEnvironment.h"
|
2013-08-05 11:28:57 -04:00
|
|
|
#include "../Util/OSRMException.h"
|
2013-06-26 19:48:02 -04:00
|
|
|
|
2012-11-19 13:04:59 -05:00
|
|
|
extern "C" {
|
2013-06-26 19:48:02 -04:00
|
|
|
#include <lua.h>
|
|
|
|
#include <lauxlib.h>
|
|
|
|
#include <lualib.h>
|
2012-11-19 13:04:59 -05:00
|
|
|
}
|
|
|
|
|
2013-01-01 18:32:34 -05:00
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
|
|
|
class BaseParser : boost::noncopyable {
|
2011-01-12 13:08:10 -05:00
|
|
|
public:
|
2013-02-10 12:28:04 -05:00
|
|
|
BaseParser(ExtractorCallbacks* ec, ScriptingEnvironment& se);
|
2011-01-12 13:08:10 -05:00
|
|
|
virtual ~BaseParser() {}
|
2013-02-10 04:59:54 -05:00
|
|
|
virtual bool ReadHeader() = 0;
|
2011-01-12 13:08:10 -05:00
|
|
|
virtual bool Parse() = 0;
|
2012-08-30 10:59:41 -04:00
|
|
|
|
2013-02-22 08:31:49 -05:00
|
|
|
virtual void ParseNodeInLua(ImportNode& n, lua_State* luaStateForThread);
|
|
|
|
virtual void ParseWayInLua(ExtractionWay& n, lua_State* luaStateForThread);
|
2013-02-10 12:28:04 -05:00
|
|
|
virtual void report_errors(lua_State *L, const int status) const;
|
2013-02-10 04:59:54 -05:00
|
|
|
|
2013-06-26 19:48:02 -04:00
|
|
|
protected:
|
2013-02-10 04:59:54 -05:00
|
|
|
virtual void ReadUseRestrictionsSetting();
|
|
|
|
virtual void ReadRestrictionExceptions();
|
2013-02-22 08:31:49 -05:00
|
|
|
virtual bool ShouldIgnoreRestriction(const std::string& except_tag_string) const;
|
2013-06-26 19:48:02 -04:00
|
|
|
|
2013-02-27 11:36:44 -05:00
|
|
|
ExtractorCallbacks* extractor_callbacks;
|
2013-02-10 04:59:54 -05:00
|
|
|
ScriptingEnvironment& scriptingEnvironment;
|
|
|
|
lua_State* luaState;
|
|
|
|
std::vector<std::string> restriction_exceptions;
|
|
|
|
bool use_turn_restrictions;
|
2012-08-30 10:59:41 -04:00
|
|
|
|
2011-01-12 13:08:10 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* BASEPARSER_H_ */
|