2010-07-09 05:05:40 -04:00
|
|
|
/*
|
2013-10-14 07:42:28 -04:00
|
|
|
|
|
|
|
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
Redistributions of source code must retain the above copyright notice, this list
|
|
|
|
of conditions and the following disclaimer.
|
|
|
|
Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
|
list of conditions and the following disclaimer in the documentation and/or
|
|
|
|
other materials provided with the distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
2010-07-09 05:05:40 -04:00
|
|
|
|
2011-01-09 16:42:27 -05:00
|
|
|
#ifndef BASEPLUGIN_H_
|
|
|
|
#define BASEPLUGIN_H_
|
2010-07-09 05:05:40 -04:00
|
|
|
|
2014-04-16 10:59:40 -04:00
|
|
|
#include "../Util/StringUtil.h"
|
|
|
|
|
2013-12-20 07:12:56 -05:00
|
|
|
#include <osrm/Coordinate.h>
|
|
|
|
#include <osrm/Reply.h>
|
|
|
|
#include <osrm/RouteParameters.h>
|
2011-01-09 16:42:27 -05:00
|
|
|
|
2014-04-16 10:59:40 -04:00
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
|
2013-06-26 19:48:02 -04:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2011-01-09 16:42:27 -05:00
|
|
|
class BasePlugin {
|
|
|
|
public:
|
|
|
|
BasePlugin() { }
|
|
|
|
//Maybe someone can explain the pure virtual destructor thing to me (dennis)
|
|
|
|
virtual ~BasePlugin() { }
|
2013-08-13 12:09:20 -04:00
|
|
|
virtual const std::string & GetDescriptor() const = 0;
|
2011-12-28 08:14:09 -05:00
|
|
|
virtual void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) = 0;
|
2013-08-07 08:02:10 -04:00
|
|
|
|
2013-08-14 07:12:28 -04:00
|
|
|
inline bool checkCoord(const FixedPointCoordinate & c) {
|
2013-08-07 08:02:10 -04:00
|
|
|
if(
|
|
|
|
c.lat > 90*COORDINATE_PRECISION ||
|
|
|
|
c.lat < -90*COORDINATE_PRECISION ||
|
|
|
|
c.lon > 180*COORDINATE_PRECISION ||
|
|
|
|
c.lon < -180*COORDINATE_PRECISION
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2010-07-09 05:05:40 -04:00
|
|
|
};
|
|
|
|
|
2011-01-09 16:42:27 -05:00
|
|
|
#endif /* BASEPLUGIN_H_ */
|