Skip to content

Commit

Permalink
eckit::geometry instance()-based factories (3/7)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmaciel committed Aug 18, 2023
1 parent b5a2f2c commit 053537f
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 637 deletions.
100 changes: 0 additions & 100 deletions src/eckit/geometry/Area.cc

This file was deleted.

47 changes: 11 additions & 36 deletions src/eckit/geometry/Area.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@

#pragma once

#include <iosfwd>
#include <string>

#include "eckit/memory/Builder.h"
#include "eckit/memory/Factory.h"


namespace eckit {
class Configuration;
namespace geometry::area {
class BoundingBox;
}
} // namespace eckit


namespace eckit::geometry {
Expand All @@ -31,15 +30,15 @@ class Area {
public:
// -- Types

using Type = std::string;
using builder_t = BuilderT1<Area>;
using ARG1 = const Configuration&;

// -- Exceptions
// None

// -- Constructors

Area() noexcept = default;

Area() noexcept = default;
Area(const Area&) = default;
Area(Area&&) = default;

Expand All @@ -56,7 +55,8 @@ class Area {
Area& operator=(Area&&) = default;

// -- Methods
// None

static std::string className() { return "area"; }

// -- Overridden methods
// None
Expand Down Expand Up @@ -104,35 +104,10 @@ class Area {
};


struct AreaFactory {
static Area* build(const Configuration&);
static Area* build(const Area::Type&, const Configuration&);
static std::ostream& list(std::ostream&);

AreaFactory(const AreaFactory&) = delete;
AreaFactory(AreaFactory&&) = delete;
AreaFactory& operator=(const AreaFactory&) = delete;
AreaFactory& operator=(AreaFactory&&) = delete;

virtual Area* make(const Configuration&) = 0;

protected:
explicit AreaFactory(const Area::Type&);
virtual ~AreaFactory();
using AreaFactory = Factory<Area>;

private:
const Area::Type key_;
};


template <class T>
class AreaBuilder final : public AreaFactory {
Area* make(const Configuration& config) override { return new T(config); }

public:
explicit AreaBuilder(const Area::Type& key) :
AreaFactory(key) {}
};
template <typename T>
using AreaBuilder = ConcreteBuilderT1<Area, T>;


} // namespace eckit::geometry
3 changes: 0 additions & 3 deletions src/eckit/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
list( APPEND eckit_geometry_srcs
Area.cc
Area.h
Cache.cc
Cache.h
Expand All @@ -10,7 +9,6 @@ list( APPEND eckit_geometry_srcs
Earth.h
EllipsoidOfRevolution.cc
EllipsoidOfRevolution.h
Figure.cc
Figure.h
GreatCircle.cc
GreatCircle.h
Expand All @@ -34,7 +32,6 @@ list( APPEND eckit_geometry_srcs
Point3.h
PointLonLat.cc
PointLonLat.h
Projection.cc
Projection.h
Range.cc
Range.h
Expand Down
112 changes: 0 additions & 112 deletions src/eckit/geometry/Figure.cc

This file was deleted.

Loading

0 comments on commit 053537f

Please sign in to comment.