First stab at a new express parser to have some more luck with Ifc4

This commit is contained in:
Thomas Krijnen
2014-02-17 22:13:55 +00:00
parent 87259c0cab
commit 17f873b486
44 changed files with 82103 additions and 9785 deletions
+18 -12
View File
@@ -20,7 +20,7 @@
/********************************************************************************
* *
* This file provides functions for loading an IFC file into memory and access *
* its entities either by ID, by an Ifc2x3::Type or by reference *
* its entities either by ID, by an IfcSchema::Type or by reference *
* *
********************************************************************************/
@@ -40,7 +40,13 @@
#include "../ifcparse/SharedPointer.h"
#include "../ifcparse/IfcCharacterDecoder.h"
#include "../ifcparse/IfcUtil.h"
#ifdef USE_IFC4
#include "../ifcparse/Ifc4.h"
#else
#include "../ifcparse/Ifc2x3.h"
#endif
#include "../ifcparse/IfcFile.h"
namespace IfcParse {
@@ -163,7 +169,7 @@ namespace IfcParse {
private:
IfcUtil::IfcArgumentSelect* entity;
public:
EntityArgument(Ifc2x3::Type::Enum ty, const Token& t);
EntityArgument(IfcSchema::Type::Enum ty, const Token& t);
~EntityArgument();
operator int() const;
operator bool() const;
@@ -188,7 +194,7 @@ namespace IfcParse {
private:
//IfcFile* file;
ArgumentPtr args;
Ifc2x3::Type::Enum _type;
IfcSchema::Type::Enum _type;
public:
/// The EXPRESS ENTITY_INSTANCE_NAME
unsigned int _id;
@@ -197,24 +203,24 @@ namespace IfcParse {
Entity(unsigned int i, IfcFile* t);
Entity(unsigned int i, IfcFile* t, unsigned int o);
~Entity();
IfcEntities getInverse(Ifc2x3::Type::Enum c = Ifc2x3::Type::ALL);
IfcEntities getInverse(Ifc2x3::Type::Enum c, int i, const std::string& a);
IfcEntities getInverse(IfcSchema::Type::Enum c = IfcSchema::Type::ALL);
IfcEntities getInverse(IfcSchema::Type::Enum c, int i, const std::string& a);
void Load(std::vector<unsigned int>& ids, bool seek=false);
ArgumentPtr getArgument (unsigned int i);
unsigned int getArgumentCount();
std::string toString(bool upper=false);
std::string datatype();
Ifc2x3::Type::Enum type() const;
bool is(Ifc2x3::Type::Enum v) const;
IfcSchema::Type::Enum type() const;
bool is(IfcSchema::Type::Enum v) const;
unsigned int id();
bool isWritable();
};
typedef IfcUtil::IfcSchemaEntity IfcEntity;
//typedef IfcEntities IfcEntities;
typedef std::map<Ifc2x3::Type::Enum,IfcEntities> MapEntitiesByType;
typedef std::map<IfcSchema::Type::Enum,IfcEntities> MapEntitiesByType;
typedef std::map<unsigned int,IfcEntity> MapEntityById;
typedef std::map<std::string,Ifc2x3::IfcRoot::ptr> MapEntityByGuid;
typedef std::map<std::string,IfcSchema::IfcRoot::ptr> MapEntityByGuid;
typedef std::map<unsigned int,IfcEntities> MapEntitiesByRef;
typedef std::map<unsigned int,unsigned int> MapOffsetById;
@@ -261,7 +267,7 @@ public:
/// Returns all entities in the file that match the positional argument.
/// NOTE: This also returns subtypes of the requested type, for example:
/// IfcWall will also return IfcWallStandardCase entities
IfcEntities EntitiesByType(Ifc2x3::Type::Enum t);
IfcEntities EntitiesByType(IfcSchema::Type::Enum t);
/// Returns all entities in the file that match the positional argument.
/// NOTE: This also returns subtypes of the requested type, for example:
/// IfcWall will also return IfcWallStandardCase entities
@@ -271,7 +277,7 @@ public:
/// Returns the entity with the specified id
IfcEntity EntityById(int id);
/// Returns the entity with the specified GlobalId
Ifc2x3::IfcRoot::ptr EntityByGuid(const std::string& guid);
IfcSchema::IfcRoot::ptr EntityByGuid(const std::string& guid);
bool Init(const std::string& fn);
bool Init(std::istream& fn, int len);
bool Init(void* data, int len);
@@ -290,7 +296,7 @@ public:
std::string authorOrganisation() const;
};
double UnitPrefixToValue( Ifc2x3::IfcSIPrefix::IfcSIPrefix v );
double UnitPrefixToValue( IfcSchema::IfcSIPrefix::IfcSIPrefix v );
}