/usr/include/spatialindex/SpatialIndex.h is in libspatialindex-dev 1.8.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | /******************************************************************************
* Project: libspatialindex - A C++ library for spatial indexing
* Author: Marios Hadjieleftheriou, mhadji@gmail.com
******************************************************************************
* Copyright (c) 2003, Marios Hadjieleftheriou
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************/
#pragma once
#include "tools/Tools.h"
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661922
#endif
namespace SpatialIndex
{
class Point;
class LineSegment;
class Region;
typedef int64_t id_type;
SIDX_DLL enum CommandType
{
CT_NODEREAD = 0x0,
CT_NODEDELETE,
CT_NODEWRITE
};
class SIDX_DLL InvalidPageException : public Tools::Exception
{
public:
InvalidPageException(id_type id);
virtual ~InvalidPageException() {}
virtual std::string what();
private:
std::string m_error;
}; // InvalidPageException
//
// Interfaces
//
class SIDX_DLL IShape : public Tools::ISerializable
{
public:
virtual bool intersectsShape(const IShape& in) const = 0;
virtual bool containsShape(const IShape& in) const = 0;
virtual bool touchesShape(const IShape& in) const = 0;
virtual void getCenter(Point& out) const = 0;
virtual uint32_t getDimension() const = 0;
virtual void getMBR(Region& out) const = 0;
virtual double getArea() const = 0;
virtual double getMinimumDistance(const IShape& in) const = 0;
virtual ~IShape() {}
}; // IShape
class SIDX_DLL ITimeShape : public Tools::IInterval
{
public:
virtual bool intersectsShapeInTime(const ITimeShape& in) const = 0;
virtual bool intersectsShapeInTime(const Tools::IInterval& ivI, const ITimeShape& in) const = 0;
virtual bool containsShapeInTime(const ITimeShape& in) const = 0;
virtual bool containsShapeInTime(const Tools::IInterval& ivI, const ITimeShape& in) const = 0;
virtual bool touchesShapeInTime(const ITimeShape& in) const = 0;
virtual bool touchesShapeInTime(const Tools::IInterval& ivI, const ITimeShape& in) const = 0;
virtual double getAreaInTime() const = 0;
virtual double getAreaInTime(const Tools::IInterval& ivI) const = 0;
virtual double getIntersectingAreaInTime(const ITimeShape& r) const = 0;
virtual double getIntersectingAreaInTime(const Tools::IInterval& ivI, const ITimeShape& r) const = 0;
virtual ~ITimeShape() {}
}; // ITimeShape
class SIDX_DLL IEvolvingShape
{
public:
virtual void getVMBR(Region& out) const = 0;
virtual void getMBRAtTime(double t, Region& out) const = 0;
virtual ~IEvolvingShape() {}
}; // IEvolvingShape
class SIDX_DLL IEntry : public Tools::IObject
{
public:
virtual id_type getIdentifier() const = 0;
virtual void getShape(IShape** out) const = 0;
virtual ~IEntry() {}
}; // IEntry
class SIDX_DLL INode : public IEntry, public Tools::ISerializable
{
public:
virtual uint32_t getChildrenCount() const = 0;
virtual id_type getChildIdentifier(uint32_t index) const = 0;
virtual void getChildData(uint32_t index, uint32_t& len, byte** data) const = 0;
virtual void getChildShape(uint32_t index, IShape** out) const = 0;
virtual uint32_t getLevel() const = 0;
virtual bool isIndex() const = 0;
virtual bool isLeaf() const = 0;
virtual ~INode() {}
}; // INode
class SIDX_DLL IData : public IEntry
{
public:
virtual void getData(uint32_t& len, byte** data) const = 0;
virtual ~IData() {}
}; // IData
class SIDX_DLL IDataStream : public Tools::IObjectStream
{
public:
virtual IData* getNext() = 0;
virtual ~IDataStream() {}
}; // IDataStream
class SIDX_DLL ICommand
{
public:
virtual void execute(const INode& in) = 0;
virtual ~ICommand() {}
}; // ICommand
class SIDX_DLL INearestNeighborComparator
{
public:
virtual double getMinimumDistance(const IShape& query, const IShape& entry) = 0;
virtual double getMinimumDistance(const IShape& query, const IData& data) = 0;
virtual ~INearestNeighborComparator() {}
}; // INearestNeighborComparator
class SIDX_DLL IStorageManager
{
public:
virtual void loadByteArray(const id_type id, uint32_t& len, byte** data) = 0;
virtual void storeByteArray(id_type& id, const uint32_t len, const byte* const data) = 0;
virtual void deleteByteArray(const id_type id) = 0;
virtual ~IStorageManager() {}
}; // IStorageManager
class SIDX_DLL IVisitor
{
public:
virtual void visitNode(const INode& in) = 0;
virtual void visitData(const IData& in) = 0;
virtual void visitData(std::vector<const IData*>& v) = 0;
virtual ~IVisitor() {}
}; // IVisitor
class SIDX_DLL IQueryStrategy
{
public:
virtual void getNextEntry(const IEntry& previouslyFetched, id_type& nextEntryToFetch, bool& bFetchNextEntry) = 0;
virtual ~IQueryStrategy() {}
}; // IQueryStrategy
class SIDX_DLL IStatistics
{
public:
virtual uint64_t getReads() const = 0;
virtual uint64_t getWrites() const = 0;
virtual uint32_t getNumberOfNodes() const = 0;
virtual uint64_t getNumberOfData() const = 0;
virtual ~IStatistics() {}
}; // IStatistics
class SIDX_DLL ISpatialIndex
{
public:
virtual void insertData(uint32_t len, const byte* pData, const IShape& shape, id_type shapeIdentifier) = 0;
virtual bool deleteData(const IShape& shape, id_type shapeIdentifier) = 0;
virtual void containsWhatQuery(const IShape& query, IVisitor& v) = 0;
virtual void intersectsWithQuery(const IShape& query, IVisitor& v) = 0;
virtual void pointLocationQuery(const Point& query, IVisitor& v) = 0;
virtual void nearestNeighborQuery(uint32_t k, const IShape& query, IVisitor& v, INearestNeighborComparator& nnc) = 0;
virtual void nearestNeighborQuery(uint32_t k, const IShape& query, IVisitor& v) = 0;
virtual void selfJoinQuery(const IShape& s, IVisitor& v) = 0;
virtual void queryStrategy(IQueryStrategy& qs) = 0;
virtual void getIndexProperties(Tools::PropertySet& out) const = 0;
virtual void addCommand(ICommand* in, CommandType ct) = 0;
virtual bool isIndexValid() = 0;
virtual void getStatistics(IStatistics** out) const = 0;
virtual ~ISpatialIndex() {}
}; // ISpatialIndex
namespace StorageManager
{
SIDX_DLL enum StorageManagerConstants
{
EmptyPage = -0x1,
NewPage = -0x1
};
class SIDX_DLL IBuffer : public IStorageManager
{
public:
virtual uint64_t getHits() = 0;
virtual void clear() = 0;
virtual ~IBuffer() {}
}; // IBuffer
SIDX_DLL IStorageManager* returnMemoryStorageManager(Tools::PropertySet& in);
SIDX_DLL IStorageManager* createNewMemoryStorageManager();
SIDX_DLL IStorageManager* returnDiskStorageManager(Tools::PropertySet& in);
SIDX_DLL IStorageManager* createNewDiskStorageManager(std::string& baseName, uint32_t pageSize);
SIDX_DLL IStorageManager* loadDiskStorageManager(std::string& baseName);
SIDX_DLL IBuffer* returnRandomEvictionsBuffer(IStorageManager& ind, Tools::PropertySet& in);
SIDX_DLL IBuffer* createNewRandomEvictionsBuffer(IStorageManager& in, uint32_t capacity, bool bWriteThrough);
}
//
// Global functions
//
SIDX_DLL std::ostream& operator<<(std::ostream&, const ISpatialIndex&);
SIDX_DLL std::ostream& operator<<(std::ostream&, const IStatistics&);
}
#include "Point.h"
#include "Region.h"
#include "LineSegment.h"
#include "TimePoint.h"
#include "TimeRegion.h"
#include "MovingPoint.h"
#include "MovingRegion.h"
#include "RTree.h"
#include "MVRTree.h"
#include "TPRTree.h"
#include "Version.h"
// typedef SpatialIndex::Tools::PoolPointer<Region> RegionPtr;
// typedef SpatialIndex::Tools::PoolPointer<Point> PointPtr;
// typedef SpatialIndex::Tools::PoolPointer<TimeRegion> TimeRegionPtr;
// typedef SpatialIndex::Tools::PoolPointer<MovingRegion> MovingRegionPtr;
|