Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
unique -> shared ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
incanus authored and jfirebaugh committed Mar 9, 2015
1 parent 0652174 commit 2d8bf82
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/mbgl/map/geometry_tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class GeometryTileLayer {
virtual const std::unordered_map<std::string, uint32_t>& getKeyIndex() const = 0;
virtual const std::vector<Value>& getValues() const = 0;
virtual const std::map<std::string, std::map<Value, Shaping>>& getShaping() const = 0;
virtual std::unique_ptr<GeometryFilteredTileLayer> createFilteredTileLayer(const FilterExpression&) const = 0;
virtual util::ptr<GeometryFilteredTileLayer> createFilteredTileLayer(const FilterExpression&) const = 0;
};

class GeometryTile {
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/map/tile_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ std::unique_ptr<Bucket> TileParser::createBucket(const StyleBucket &bucketDesc)
template <class Bucket>
void TileParser::addBucketGeometries(Bucket& bucket, const util::ptr<const GeometryTileLayer> layer, const FilterExpression &filter) {

std::unique_ptr<GeometryFilteredTileLayer> filtered_layer = layer->createFilteredTileLayer(filter);
util::ptr<GeometryFilteredTileLayer> filtered_layer = layer->createFilteredTileLayer(filter);

for (auto feature_it = filtered_layer->begin(); feature_it != filtered_layer->end(); ++feature_it) {

Expand Down
5 changes: 2 additions & 3 deletions src/mbgl/map/vector_tile.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <mbgl/map/vector_tile.hpp>
#include <mbgl/geometry/pbf_geometry.hpp>
#include <mbgl/style/filter_expression_private.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/pbf.hpp>

#include <type_traits>
Expand Down Expand Up @@ -145,8 +144,8 @@ VectorTileLayer::VectorTileLayer(pbf layer_pbf)
}
}

std::unique_ptr<GeometryFilteredTileLayer> VectorTileLayer::createFilteredTileLayer(const FilterExpression& filterExpression) const {
return util::make_unique<FilteredVectorTileLayer>(*this, filterExpression);
util::ptr<GeometryFilteredTileLayer> VectorTileLayer::createFilteredTileLayer(const FilterExpression& filterExpression) const {
return std::make_shared<FilteredVectorTileLayer>(*this, filterExpression);
}

FilteredVectorTileLayer::FilteredVectorTileLayer(const VectorTileLayer& layer_, const FilterExpression& filterExpression_)
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/map/vector_tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class VectorTileLayer : public GeometryTileLayer {
virtual inline const std::vector<Value>& getValues() const { return values; }
virtual inline const std::map<std::string, std::map<Value, Shaping>>& getShaping() const { return shaping; }

virtual std::unique_ptr<GeometryFilteredTileLayer> createFilteredTileLayer(const FilterExpression&) const;
virtual util::ptr<GeometryFilteredTileLayer> createFilteredTileLayer(const FilterExpression&) const;

private:
std::string name;
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/symbol_bucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::vector<SymbolFeature> SymbolBucket::processFeatures(const util::ptr<const G
// Determine and load glyph ranges
std::set<GlyphRange> ranges;

std::unique_ptr<GeometryFilteredTileLayer> filtered_layer = layer->createFilteredTileLayer(filter);
util::ptr<GeometryFilteredTileLayer> filtered_layer = layer->createFilteredTileLayer(filter);

for (auto feature_it = filtered_layer->begin(); feature_it != filtered_layer->end(); ++feature_it) {

Expand Down

2 comments on commit 2d8bf82

@kkaefer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are they shared pointers?

@incanus
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly certain this was because I didn't know what I was doing at the time. This doesn't exist now.

Please sign in to comment.