2014-11-28 09:00:48 -05:00
|
|
|
#ifndef SCRIPTING_ENVIRONMENT_HPP
|
|
|
|
#define SCRIPTING_ENVIRONMENT_HPP
|
2012-11-19 13:04:59 -05:00
|
|
|
|
2016-07-11 11:44:58 -04:00
|
|
|
#include "extractor/guidance/turn_lane_types.hpp"
|
|
|
|
#include "extractor/internal_extractor_edge.hpp"
|
2016-03-21 17:42:47 -04:00
|
|
|
#include "extractor/profile_properties.hpp"
|
2016-07-11 11:44:58 -04:00
|
|
|
#include "extractor/restriction.hpp"
|
2016-03-21 17:42:47 -04:00
|
|
|
|
2016-07-11 11:44:58 -04:00
|
|
|
#include <osmium/memory/buffer.hpp>
|
|
|
|
|
|
|
|
#include <boost/optional/optional.hpp>
|
|
|
|
|
|
|
|
#include <tbb/concurrent_vector.h>
|
2016-03-22 16:23:25 -04:00
|
|
|
|
2016-05-27 15:05:04 -04:00
|
|
|
#include <string>
|
2016-07-11 11:44:58 -04:00
|
|
|
#include <vector>
|
2012-11-19 13:04:59 -05:00
|
|
|
|
2016-07-11 11:44:58 -04:00
|
|
|
namespace osmium
|
|
|
|
{
|
|
|
|
class Node;
|
|
|
|
class Way;
|
2017-08-31 07:23:00 -04:00
|
|
|
class Relation;
|
2016-07-11 11:44:58 -04:00
|
|
|
}
|
2013-12-23 11:55:29 -05:00
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
2016-07-11 11:44:58 -04:00
|
|
|
|
|
|
|
namespace util
|
|
|
|
{
|
|
|
|
struct Coordinate;
|
|
|
|
}
|
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
|
2016-07-11 11:44:58 -04:00
|
|
|
class RestrictionParser;
|
2017-08-30 12:35:38 -04:00
|
|
|
class ExtractionRelationContainer;
|
2016-07-11 11:44:58 -04:00
|
|
|
struct ExtractionNode;
|
|
|
|
struct ExtractionWay;
|
2017-08-31 07:23:00 -04:00
|
|
|
struct ExtractionRelation;
|
2016-05-12 12:50:10 -04:00
|
|
|
struct ExtractionTurn;
|
|
|
|
struct ExtractionSegment;
|
2016-07-11 11:44:58 -04:00
|
|
|
|
2015-04-10 09:46:49 -04:00
|
|
|
/**
|
2016-07-11 11:44:58 -04:00
|
|
|
* Abstract class that handles processing osmium ways, nodes and relation objects by applying
|
|
|
|
* user supplied profiles.
|
2015-04-10 09:46:49 -04:00
|
|
|
*/
|
2014-05-09 10:17:31 -04:00
|
|
|
class ScriptingEnvironment
|
|
|
|
{
|
|
|
|
public:
|
2016-07-11 11:44:58 -04:00
|
|
|
ScriptingEnvironment() = default;
|
Takes care of proper special member generation globally, fixes #1689
Phew, a lot of classes were affected by this. The rationale for the
changes are as follows:
- When a type X declares any constructor, the default constructor is
not declared, so there is no need for X() = delete there. In fact,
there is brutal difference between those two: deleted members
participate in overload resolution, but not-declared members do not!
- When a type X wants to be non-copyable (e.g. to be only movable, like
threads, unique_ptrs, and so on), you can either do it by inheriting
from boost::noncopyable (the old way), or better declare both (!) the
copy constructor _and_ the copy assignment operator as deleted:
X(X const&) = delete;
X& operator=(X const&) = delete;
We had tons of types with deleted copy constructors that were lacking
a corresponding deleted copy assignment operator, making them still
copyable and you wouldn't even notice (read: scary)!
References:
- http://accu.org/content/conf2014/Howard_Hinnant_Accu_2014.pdf
- http://www.boost.org/doc/libs/master/libs/core/doc/html/core/noncopyable.html
Note: I know, I'm quoting Hinnant's extraordinary slides a lot, but
getting the sematic right here is so incredibly important.
2016-01-27 05:20:55 -05:00
|
|
|
ScriptingEnvironment(const ScriptingEnvironment &) = delete;
|
|
|
|
ScriptingEnvironment &operator=(const ScriptingEnvironment &) = delete;
|
2016-07-11 11:44:58 -04:00
|
|
|
virtual ~ScriptingEnvironment() = default;
|
Takes care of proper special member generation globally, fixes #1689
Phew, a lot of classes were affected by this. The rationale for the
changes are as follows:
- When a type X declares any constructor, the default constructor is
not declared, so there is no need for X() = delete there. In fact,
there is brutal difference between those two: deleted members
participate in overload resolution, but not-declared members do not!
- When a type X wants to be non-copyable (e.g. to be only movable, like
threads, unique_ptrs, and so on), you can either do it by inheriting
from boost::noncopyable (the old way), or better declare both (!) the
copy constructor _and_ the copy assignment operator as deleted:
X(X const&) = delete;
X& operator=(X const&) = delete;
We had tons of types with deleted copy constructors that were lacking
a corresponding deleted copy assignment operator, making them still
copyable and you wouldn't even notice (read: scary)!
References:
- http://accu.org/content/conf2014/Howard_Hinnant_Accu_2014.pdf
- http://www.boost.org/doc/libs/master/libs/core/doc/html/core/noncopyable.html
Note: I know, I'm quoting Hinnant's extraordinary slides a lot, but
getting the sematic right here is so incredibly important.
2016-01-27 05:20:55 -05:00
|
|
|
|
2016-07-11 11:44:58 -04:00
|
|
|
virtual const ProfileProperties &GetProfileProperties() = 0;
|
2012-11-19 13:04:59 -05:00
|
|
|
|
2017-08-16 16:21:19 -04:00
|
|
|
virtual std::vector<std::vector<std::string>> GetExcludableClasses() = 0;
|
2017-08-14 18:18:57 -04:00
|
|
|
virtual std::vector<std::string> GetClassNames() = 0;
|
2016-07-11 11:44:58 -04:00
|
|
|
virtual std::vector<std::string> GetNameSuffixList() = 0;
|
2016-09-09 06:34:04 -04:00
|
|
|
virtual std::vector<std::string> GetRestrictions() = 0;
|
2016-05-12 12:50:10 -04:00
|
|
|
virtual void ProcessTurn(ExtractionTurn &turn) = 0;
|
|
|
|
virtual void ProcessSegment(ExtractionSegment &segment) = 0;
|
|
|
|
|
2017-09-01 09:55:00 -04:00
|
|
|
virtual void ProcessElements(
|
|
|
|
const osmium::memory::Buffer &buffer,
|
|
|
|
const RestrictionParser &restriction_parser,
|
|
|
|
const ExtractionRelationContainer &relations,
|
|
|
|
std::vector<std::pair<const osmium::Node &, ExtractionNode>> &resulting_nodes,
|
|
|
|
std::vector<std::pair<const osmium::Way &, ExtractionWay>> &resulting_ways,
|
|
|
|
std::vector<std::pair<const osmium::Relation &, ExtractionRelation>> &resulting_relations,
|
|
|
|
std::vector<InputConditionalTurnRestriction> &resulting_restrictions) = 0;
|
2017-09-22 11:33:06 -04:00
|
|
|
|
|
|
|
virtual bool HasLocationDependentData() const = 0;
|
2012-11-19 13:04:59 -05:00
|
|
|
};
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#endif /* SCRIPTING_ENVIRONMENT_HPP */
|