Skip to content

File Registry.h

File List > detail > tools > Registry.h

Go to the documentation of this file

// Copyright (c) 2012-2013, IGN France.
// Copyright (c) 2012-2022, Oslandia.
// SPDX-License-Identifier: LGPL-2.0-or-later

#ifndef _SFCGAL_REGISTRY_H_
#define _SFCGAL_REGISTRY_H_

#include "SFCGAL/config.h"

#include <map>
#include <string>
#include <vector>

namespace SFCGAL {
class Geometry;
}

namespace SFCGAL {
namespace tools {

class SFCGAL_API Registry {
public:
  typedef std::vector<Geometry *>::iterator       prototype_iterator;
  typedef std::vector<Geometry *>::const_iterator const_prototype_iterator;

  ~Registry();

  void
  addPrototype(const Geometry &g);

  std::vector<std::string>
  getGeometryTypes() const;

  Geometry *
  newGeometryByTypeName(const std::string &geometryTypeName) const;

  Geometry *
  newGeometryByTypeId(int typeId) const;

  static Registry &
  instance();

private:
  static Registry *_instance;
  std::vector<Geometry *> _prototypes;

  Registry();
};

} // namespace tools
} // namespace SFCGAL

#endif