mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
ifcparse: widen all integer attribute types to int64_t for consistency
Follow-up to the scalar-only fix in #8754, per aothms's direct request on that PR ("Please do make all int types consistent") and his own original 2023 design intent on issue #3058 ("make all integers (incl. schema namespaces) an int64_t"). Widens the remaining inconsistent spots now that compatibility isn't a constraint on this v0.9 branch: - Integer aggregates (IfcTriangulatedFaceSet.CoordIndex and similar List<int> attributes), including the SWIG to_vec_int/to_vec_vec_int helpers, which previously silently truncated via static_cast<int> on the Python-set path - the same bug class as the original scalar issue. - The schema code generator (express/mapping.py's integer type mapping), and all 12 generated schema header/source pairs regenerated to match, so every schema-typed getter/setter (e.g. IfcOwnerHistory::CreationDate) is int64_t end to end, not just the dynamic attribute-value path. Instance/reference identifiers (STEP #123 ids) are deliberately left at 32-bit: they're a file-local index into internal maps, not an EXPRESS domain value an application chooses, and no realistic STEP file has billions of entities. The lexer's Token_IDENTIFIER parsing still funnels through a 32-bit int for this reason - flagged as a known, low-risk gap rather than fixed, since fixing it would mean touching indexing/hashing code for no realistic benefit. Verified: original PR's round-trip tests extended with aggregate cases (IfcTriangulatedFaceSet.CoordIndex, InnerCoordIndices) at 64-bit boundary values, in memory and through STEP text, IFC2X3 and IFC4. A standalone C++ program exercising the generated schema API directly (Ifc4::IfcOwnerHistory ::setCreationDate/CreationDate, IfcTriangulatedFaceSet::setCoordIndex/ CoordIndex) confirms int64_t end to end, bypassing SWIG. Full build (BUILD_IFCGEOM, WITH_OPENCASCADE, BUILD_IFCPYTHON, IFC2X3+IFC4) clean. test/util/test_attribute.py and test_file.py pass unchanged. This contribution was produced with the assistance of an AI coding tool.
This commit is contained in:
committed by
Thomas Krijnen
parent
d5076bded3
commit
f23db9440f
@@ -186,8 +186,9 @@ typedef parameter_pack <
|
||||
|
||||
// AGGREGATES:
|
||||
empty_aggregate_t,
|
||||
// An aggregate of integers, e.g. (1,2,3)
|
||||
std::vector<int>,
|
||||
// An aggregate of integers, e.g. (1,2,3). Stored as int64_t for the
|
||||
// same reason as the scalar int64_t above.
|
||||
std::vector<int64_t>,
|
||||
// An aggregate of floats, e.g. (12.3,4.)
|
||||
std::vector<double>,
|
||||
// An aggregate of strings, e.g. ('Ifc','Open','Shell')
|
||||
@@ -202,7 +203,7 @@ typedef parameter_pack <
|
||||
// AGGREGATES OF AGGREGATES:
|
||||
empty_aggregate_of_aggregate_t,
|
||||
// An aggregate of an aggregate of ints. E.g. ((1, 2), (3))
|
||||
std::vector<std::vector<int>>,
|
||||
std::vector<std::vector<int64_t>>,
|
||||
// An aggregate of an aggregate of floats. E.g. ((1., 2.3), (4.))
|
||||
std::vector<std::vector<double>>,
|
||||
// An aggregate of an aggregate of entities. E.g. ((#1, #2), (#3))
|
||||
@@ -401,7 +402,6 @@ public:
|
||||
, array_(storage)
|
||||
{}
|
||||
|
||||
operator int() const;
|
||||
operator int64_t() const;
|
||||
operator bool() const;
|
||||
operator boost::logic::tribool() const;
|
||||
@@ -410,13 +410,13 @@ public:
|
||||
operator boost::dynamic_bitset<>() const;
|
||||
operator express::Base() const;
|
||||
|
||||
operator std::vector<int>() const;
|
||||
operator std::vector<int64_t>() const;
|
||||
operator std::vector<double>() const;
|
||||
operator std::vector<std::string>() const;
|
||||
operator std::vector<boost::dynamic_bitset<>>() const;
|
||||
operator std::vector<express::Base>() const;
|
||||
|
||||
operator std::vector<std::vector<int>>() const;
|
||||
operator std::vector<std::vector<int64_t>>() const;
|
||||
operator std::vector<std::vector<double>>() const;
|
||||
operator std::vector<std::vector<express::Base>>() const;
|
||||
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
case ifcopenshell::Argument_ENTITY_INSTANCE:
|
||||
return visitor((express::Base) * this);
|
||||
case ifcopenshell::Argument_AGGREGATE_OF_INT:
|
||||
return visitor((std::vector<int>)*this);
|
||||
return visitor((std::vector<int64_t>)*this);
|
||||
case ifcopenshell::Argument_AGGREGATE_OF_DOUBLE:
|
||||
return visitor((std::vector<double>)*this);
|
||||
case ifcopenshell::Argument_AGGREGATE_OF_STRING:
|
||||
@@ -461,7 +461,7 @@ public:
|
||||
case ifcopenshell::Argument_AGGREGATE_OF_ENTITY_INSTANCE:
|
||||
return visitor((std::vector<express::Base>)*this);
|
||||
case ifcopenshell::Argument_AGGREGATE_OF_AGGREGATE_OF_INT:
|
||||
return visitor((std::vector<std::vector<int>>)*this);
|
||||
return visitor((std::vector<std::vector<int64_t>>)*this);
|
||||
case ifcopenshell::Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE:
|
||||
return visitor((std::vector<std::vector<double>>)*this);
|
||||
case ifcopenshell::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE:
|
||||
|
||||
Reference in New Issue
Block a user