mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +00:00
75 lines
2.3 KiB
C++
75 lines
2.3 KiB
C++
#ifndef ITERATOR_IMPLEMENTATION_H
|
|
#define ITERATOR_IMPLEMENTATION_H
|
|
|
|
#include "../ifcparse/IfcFile.h"
|
|
#include "../ifcgeom/IfcGeomIteratorSettings.h"
|
|
|
|
#include <boost/function.hpp>
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
namespace IfcGeom {
|
|
template <typename P, typename PP>
|
|
class IteratorImplementation;
|
|
|
|
template <typename P, typename PP>
|
|
class Element;
|
|
|
|
template <typename P, typename PP>
|
|
class BRepElement;
|
|
}
|
|
|
|
typedef boost::function2<IfcGeom::IteratorImplementation<float, float>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*> iterator_float_float_fn;
|
|
typedef boost::function2<IfcGeom::IteratorImplementation<float, double>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*> iterator_float_double_fn;
|
|
typedef boost::function2<IfcGeom::IteratorImplementation<double, double>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*> iterator_double_double_fn;
|
|
|
|
template <typename P, typename PP>
|
|
struct get_factory_type {};
|
|
|
|
template <>
|
|
struct get_factory_type<float, float> {
|
|
typedef iterator_float_float_fn type;
|
|
};
|
|
|
|
template <>
|
|
struct get_factory_type<float, double> {
|
|
typedef iterator_float_double_fn type;
|
|
};
|
|
|
|
template <>
|
|
struct get_factory_type<double, double> {
|
|
typedef iterator_double_double_fn type;
|
|
};
|
|
|
|
template <typename P, typename PP>
|
|
class IteratorFactoryImplementation : public std::map<std::string, typename get_factory_type<P, PP>::type> {
|
|
public:
|
|
IteratorFactoryImplementation();
|
|
void bind(const std::string& schema_name, typename get_factory_type<P, PP>::type fn);
|
|
IfcGeom::IteratorImplementation<P, PP>* construct(const std::string& schema_name, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*);
|
|
};
|
|
|
|
template <typename P, typename PP>
|
|
IteratorFactoryImplementation<P, PP>& iterator_implementations();
|
|
|
|
namespace IfcGeom {
|
|
|
|
template <typename P, typename PP>
|
|
class IteratorImplementation {
|
|
public:
|
|
virtual bool initialize() = 0;
|
|
virtual int progress() const = 0;
|
|
virtual const std::string& getUnitName() const = 0;
|
|
virtual double getUnitMagnitude() const = 0;
|
|
virtual IfcParse::IfcFile* file() const = 0;
|
|
virtual IfcUtil::IfcBaseClass* next() = 0;
|
|
virtual Element<P, PP>* get() = 0;
|
|
virtual BRepElement<P, PP>* get_native() = 0;
|
|
virtual const Element<P, PP>* get_object(int id) = 0;
|
|
virtual IfcUtil::IfcBaseClass* create() = 0;
|
|
};
|
|
|
|
}
|
|
|
|
#endif |