8282#include " ../ifcgeom/IfcRepresentationShapeItem.h"
8383#include " ../ifcgeom/IfcGeomFilter.h"
8484
85+ #include " ../iterator/IteratorImplementation.h"
86+
8587// The infamous min & max Win32 #defines can leak here from OCE depending on the build configuration
8688#ifdef min
8789#undef min
9092#undef max
9193#endif
9294
95+ #define MAKE_TYPE_NAME__ (a, b ) a ## b
96+ #define MAKE_TYPE_NAME_ (a, b ) MAKE_TYPE_NAME__(a, b)
97+ #define MAKE_TYPE_NAME (t ) MAKE_TYPE_NAME_(t, IfcSchema)
98+
9399namespace IfcGeom {
94100
95101 template <typename P>
96- class Iterator {
102+ class MAKE_TYPE_NAME (IteratorImplementation_) : public IteratorImplementation<P> {
97103 private:
98- Iterator (const Iterator&); // N/I
99- Iterator& operator =(const Iterator&); // N/I
104+
105+ MAKE_TYPE_NAME (IteratorImplementation_)(const MAKE_TYPE_NAME (IteratorImplementation_)&); // N/I
106+ MAKE_TYPE_NAME (IteratorImplementation_)& operator =(const MAKE_TYPE_NAME (IteratorImplementation_)&); // N/I
100107
101108 Kernel kernel;
102109 IteratorSettings settings;
@@ -136,7 +143,7 @@ namespace IfcGeom {
136143 };
137144
138145 void initUnits () {
139- IfcSchema::IfcProject::list::ptr projects = ifc_file->entitiesByType <IfcSchema::IfcProject>();
146+ IfcSchema::IfcProject::list::ptr projects = ifc_file->instances_by_type <IfcSchema::IfcProject>();
140147 if (projects->size () == 1 ) {
141148 IfcSchema::IfcProject* project = *projects->begin ();
142149 std::pair<std::string, double > length_unit = kernel.initializeUnits (project->UnitsInContext ());
@@ -147,7 +154,9 @@ namespace IfcGeom {
147154
148155 // / @todo public/private sections all over the place: move all public to the beginning of the class
149156 public:
150- Iterator (const IteratorSettings& settings, IfcParse::IfcFile* file, std::vector<IfcGeom::filter_t >& filters)
157+ typedef P Precision;
158+
159+ MAKE_TYPE_NAME (IteratorImplementation_)(const IteratorSettings& settings, IfcParse::IfcFile* file, std::vector<IfcGeom::filter_t >& filters)
151160 : settings (settings)
152161 , ifc_file (file)
153162 , owns_ifc_file (false )
@@ -191,7 +200,7 @@ namespace IfcGeom {
191200 IfcSchema::IfcGeometricRepresentationContext::list::it it;
192201 IfcSchema::IfcGeometricRepresentationSubContext::list::it jt;
193202 IfcSchema::IfcGeometricRepresentationContext::list::ptr contexts =
194- ifc_file->entitiesByType <IfcSchema::IfcGeometricRepresentationContext>();
203+ ifc_file->instances_by_type <IfcSchema::IfcGeometricRepresentationContext>();
195204
196205 IfcSchema::IfcGeometricRepresentationContext::list::ptr filtered_contexts (new IfcSchema::IfcGeometricRepresentationContext::list);
197206
@@ -286,7 +295,7 @@ namespace IfcGeom {
286295 bounds_max_.SetCoord (i, -std::numeric_limits<double >::infinity ());
287296 }
288297
289- IfcSchema::IfcProduct::list::ptr products = ifc_file->entitiesByType <IfcSchema::IfcProduct>();
298+ IfcSchema::IfcProduct::list::ptr products = ifc_file->instances_by_type <IfcSchema::IfcProduct>();
290299 for (IfcSchema::IfcProduct::list::it iter = products->begin (); iter != products->end (); ++iter) {
291300 IfcSchema::IfcProduct* product = *iter;
292301 if (product->hasObjectPlacement ()) {
@@ -493,7 +502,7 @@ namespace IfcGeom {
493502
494503 // / Moves to the next shape representation, create its geometry, and returns the associated product.
495504 // / Use get() to retrieve the created geometry.
496- IfcSchema::IfcProduct * next () {
505+ IfcUtil::IfcBaseClass * next () {
497506 // Increment the iterator over the list of products using the current
498507 // shape representation
499508 if (ifcproducts) {
@@ -575,8 +584,8 @@ namespace IfcGeom {
575584 IfcSchema::IfcProduct* ifc_product = 0 ;
576585
577586 try {
578- IfcUtil::IfcBaseClass* ifc_entity = ifc_file->entityById (id);
579- instance_type = IfcSchema::ToString::Class ()( ifc_entity->declaration ().type () );
587+ IfcUtil::IfcBaseClass* ifc_entity = ifc_file->instance_by_id (id);
588+ instance_type = ifc_entity->declaration ().name ( );
580589
581590 if (ifc_entity->declaration ().is (IfcSchema::IfcRoot::Class ())) {
582591 IfcSchema::IfcRoot* ifc_root = ifc_entity->as <IfcSchema::IfcRoot>();
@@ -624,7 +633,7 @@ namespace IfcGeom {
624633 return ifc_object;
625634 }
626635
627- IfcSchema::IfcProduct * create () {
636+ IfcUtil::IfcBaseClass * create () {
628637 IfcGeom::BRepElement<P>* next_shape_model = 0 ;
629638 IfcGeom::SerializedElement<P>* next_serialization = 0 ;
630639 IfcGeom::TriangulationElement<P>* next_triangulation = 0 ;
@@ -684,45 +693,42 @@ namespace IfcGeom {
684693 kernel.setValue (IfcGeom::Kernel::GV_DIMENSIONALITY, (settings.get (IteratorSettings::INCLUDE_CURVES)
685694 ? (settings.get (IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES) ? -1 . : 0 .) : +1 .));
686695 if (settings.get (IteratorSettings::SITE_LOCAL_PLACEMENT)) {
687- kernel.set_conversion_placement_rel_to (IfcSchema::IfcSite::Class ());
696+ kernel.set_conversion_placement_rel_to (& IfcSchema::IfcSite::Class ());
688697 }
689698 }
690699
691700 bool owns_ifc_file;
692701 public:
693- Iterator (const IteratorSettings& settings, IfcParse::IfcFile* file)
702+ MAKE_TYPE_NAME (IteratorImplementation_) (const IteratorSettings& settings, IfcParse::IfcFile* file)
694703 : settings (settings)
695704 , ifc_file (file)
696705 , owns_ifc_file (false )
697706 {
698707 _initialize ();
699708 }
700- Iterator (const IteratorSettings& settings, const std::string& filename)
709+ MAKE_TYPE_NAME (IteratorImplementation_) (const IteratorSettings& settings, const std::string& filename)
701710 : settings (settings)
702- , ifc_file(new IfcParse::IfcFile)
711+ , ifc_file (new IfcParse::IfcFile (filename) )
703712 , owns_ifc_file (true )
704713 {
705- ifc_file->Init (filename);
706714 _initialize ();
707715 }
708- Iterator (const IteratorSettings& settings, void * data, int length)
716+ MAKE_TYPE_NAME (IteratorImplementation_) (const IteratorSettings& settings, void * data, int length)
709717 : settings (settings)
710- , ifc_file(new IfcParse::IfcFile)
718+ , ifc_file (new IfcParse::IfcFile (data, length) )
711719 , owns_ifc_file (true )
712720 {
713- ifc_file->Init (data, length);
714721 _initialize ();
715722 }
716- Iterator (const IteratorSettings& settings, std::istream& filestream, int length)
723+ MAKE_TYPE_NAME (IteratorImplementation_) (const IteratorSettings& settings, std::istream& filestream, int length)
717724 : settings (settings)
718- , ifc_file(new IfcParse::IfcFile)
725+ , ifc_file (new IfcParse::IfcFile (filestream, length) )
719726 , owns_ifc_file (true )
720727 {
721- ifc_file->Init (filestream, length);
722728 _initialize ();
723729 }
724730
725- ~Iterator () {
731+ ~MAKE_TYPE_NAME (IteratorImplementation_) () {
726732 if (owns_ifc_file) {
727733 delete ifc_file;
728734 }
0 commit comments