mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
ifcparse: unify private member variables name to use trailing underscore
This commit is contained in:
committed by
Thomas Krijnen
parent
8b145248c6
commit
eea9a14722
@@ -72,7 +72,7 @@ using namespace IfcParse;
|
|||||||
using namespace IfcWrite;
|
using namespace IfcWrite;
|
||||||
|
|
||||||
IfcCharacterDecoder::IfcCharacterDecoder(IfcParse::IfcSpfStream* f) {
|
IfcCharacterDecoder::IfcCharacterDecoder(IfcParse::IfcSpfStream* f) {
|
||||||
file = f;
|
stream_ = f;
|
||||||
codepage_ = 0;
|
codepage_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,18 +241,18 @@ class pure_impure_helper {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
IfcCharacterDecoder::operator std::string() {
|
IfcCharacterDecoder::operator std::string() {
|
||||||
return pure_impure_helper(file).get(mode, substitution_character);
|
return pure_impure_helper(stream_).get(mode, substitution_character);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string IfcCharacterDecoder::get(unsigned int& ptr) {
|
std::string IfcCharacterDecoder::get(unsigned int& ptr) {
|
||||||
return pure_impure_helper(file, ptr).get(mode, substitution_character);
|
return pure_impure_helper(stream_, ptr).get(mode, substitution_character);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcCharacterDecoder::skip() {
|
void IfcCharacterDecoder::skip() {
|
||||||
unsigned int parse_state = 0;
|
unsigned int parse_state = 0;
|
||||||
char current_char;
|
char current_char;
|
||||||
unsigned int hex_count = 0;
|
unsigned int hex_count = 0;
|
||||||
while ((current_char = file->Peek()) != 0) {
|
while ((current_char = stream_->Peek()) != 0) {
|
||||||
if (EXPECTS_CHARACTER(parse_state)) {
|
if (EXPECTS_CHARACTER(parse_state)) {
|
||||||
parse_state = 0;
|
parse_state = 0;
|
||||||
} else if (current_char == '\'' && (parse_state == 0U)) {
|
} else if (current_char == '\'' && (parse_state == 0U)) {
|
||||||
@@ -307,11 +307,11 @@ void IfcCharacterDecoder::skip() {
|
|||||||
if (parse_state == APOSTROPHE && current_char != '\'') {
|
if (parse_state == APOSTROPHE && current_char != '\'') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw IfcInvalidTokenException(file->Tell(), current_char);
|
throw IfcInvalidTokenException(stream_->Tell(), current_char);
|
||||||
} else {
|
} else {
|
||||||
parse_state = hex_count = 0;
|
parse_state = hex_count = 0;
|
||||||
}
|
}
|
||||||
file->Inc();
|
stream_->Inc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +319,7 @@ IfcCharacterDecoder::ConversionMode IfcCharacterDecoder::mode = IfcCharacterDeco
|
|||||||
char IfcCharacterDecoder::substitution_character = '_';
|
char IfcCharacterDecoder::substitution_character = '_';
|
||||||
|
|
||||||
IfcCharacterEncoder::IfcCharacterEncoder(const std::string& input)
|
IfcCharacterEncoder::IfcCharacterEncoder(const std::string& input)
|
||||||
: str(IfcUtil::convert_utf8_to_utf32(input)) {}
|
: str_(IfcUtil::convert_utf8_to_utf32(input)) {}
|
||||||
|
|
||||||
IfcCharacterEncoder::operator std::string() {
|
IfcCharacterEncoder::operator std::string() {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@@ -328,12 +328,12 @@ IfcCharacterEncoder::operator std::string() {
|
|||||||
// Either 2 or 4 to uses \X2 or \X4 respectively.
|
// Either 2 or 4 to uses \X2 or \X4 respectively.
|
||||||
// Currently hardcoded to 4, but \X2 might be
|
// Currently hardcoded to 4, but \X2 might be
|
||||||
// sufficient for nearly all purposes.
|
// sufficient for nearly all purposes.
|
||||||
const int num_bytes = (str.empty() || (*std::max_element(str.begin(), str.end()) > 0xffff)) ? 4 : 2;
|
const int num_bytes = (str_.empty() || (*std::max_element(str_.begin(), str_.end()) > 0xffff)) ? 4 : 2;
|
||||||
const std::string num_bytes_str = std::string(1, num_bytes + 0x30);
|
const std::string num_bytes_str = std::string(1, num_bytes + 0x30);
|
||||||
|
|
||||||
bool in_extended = false;
|
bool in_extended = false;
|
||||||
|
|
||||||
for (auto it = str.begin(); it != str.end(); ++it) {
|
for (auto it = str_.begin(); it != str_.end(); ++it) {
|
||||||
auto ch = *it;
|
auto ch = *it;
|
||||||
const bool within_spf_range = ch >= 0x20 && ch <= 0x7e;
|
const bool within_spf_range = ch >= 0x20 && ch <= 0x7e;
|
||||||
if (in_extended && within_spf_range) {
|
if (in_extended && within_spf_range) {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace IfcParse {
|
|||||||
|
|
||||||
class IFC_PARSE_API IfcCharacterDecoder {
|
class IFC_PARSE_API IfcCharacterDecoder {
|
||||||
private:
|
private:
|
||||||
IfcParse::IfcSpfStream* file;
|
IfcParse::IfcSpfStream* stream_;
|
||||||
int codepage_;
|
int codepage_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -72,7 +72,7 @@ namespace IfcWrite {
|
|||||||
|
|
||||||
class IFC_PARSE_API IfcCharacterEncoder {
|
class IFC_PARSE_API IfcCharacterEncoder {
|
||||||
private:
|
private:
|
||||||
std::u32string str;
|
std::u32string str_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IfcCharacterEncoder(const std::string& input);
|
IfcCharacterEncoder(const std::string& input);
|
||||||
|
|||||||
@@ -36,14 +36,14 @@
|
|||||||
namespace IfcParse {
|
namespace IfcParse {
|
||||||
class IFC_PARSE_API IfcException : public std::exception {
|
class IFC_PARSE_API IfcException : public std::exception {
|
||||||
private:
|
private:
|
||||||
std::string message;
|
std::string message_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IfcException(const std::string& m)
|
IfcException(const std::string& m)
|
||||||
: message(m) {}
|
: message_(m) {}
|
||||||
virtual ~IfcException() throw() {}
|
virtual ~IfcException() throw() {}
|
||||||
virtual const char* what() const throw() {
|
virtual const char* what() const throw() {
|
||||||
return message.c_str();
|
return message_.c_str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -135,15 +135,15 @@ class IFC_PARSE_API IfcFile {
|
|||||||
|
|
||||||
std::vector<Argument*> internal_attribute_vector_, internal_attribute_vector_simple_type_;
|
std::vector<Argument*> internal_attribute_vector_, internal_attribute_vector_simple_type_;
|
||||||
|
|
||||||
entity_by_id_t byid;
|
entity_by_id_t byid_;
|
||||||
// this is for simple types
|
// this is for simple types
|
||||||
entity_by_iden_t byidentity;
|
entity_by_iden_t byidentity_;
|
||||||
entities_by_type_t bytype;
|
entities_by_type_t bytype_;
|
||||||
entities_by_type_t bytype_excl;
|
entities_by_type_t bytype_excl_;
|
||||||
entities_by_ref_t byref;
|
entities_by_ref_t byref_;
|
||||||
entities_by_ref_excl_t byref_excl;
|
entities_by_ref_excl_t byref_excl_;
|
||||||
entity_by_guid_t byguid;
|
entity_by_guid_t byguid_;
|
||||||
entity_entity_map_t entity_file_map;
|
entity_entity_map_t entity_file_map_;
|
||||||
|
|
||||||
unsigned int MaxId;
|
unsigned int MaxId;
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ class IFC_PARSE_API IfcFile {
|
|||||||
|
|
||||||
void build_inverses();
|
void build_inverses();
|
||||||
|
|
||||||
entity_by_guid_t& internal_guid_map() { return byguid; };
|
entity_by_guid_t& internal_guid_map() { return byguid_; };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef WITH_IFCXML
|
#ifdef WITH_IFCXML
|
||||||
|
|||||||
@@ -89,14 +89,14 @@ void expand(const std::string& s, std::vector<unsigned char>& v) {
|
|||||||
static boost::uuids::basic_random_generator<boost::mt19937> gen;
|
static boost::uuids::basic_random_generator<boost::mt19937> gen;
|
||||||
|
|
||||||
IfcParse::IfcGlobalId::IfcGlobalId() {
|
IfcParse::IfcGlobalId::IfcGlobalId() {
|
||||||
uuid_data = gen();
|
uuid_data_ = gen();
|
||||||
std::vector<unsigned char> v(uuid_data.size());
|
std::vector<unsigned char> v(uuid_data_.size());
|
||||||
std::copy(uuid_data.begin(), uuid_data.end(), v.begin());
|
std::copy(uuid_data_.begin(), uuid_data_.end(), v.begin());
|
||||||
string_data = compress(&v[0]);
|
string_data_ = compress(&v[0]);
|
||||||
#if BOOST_VERSION < 104400
|
#if BOOST_VERSION < 104400
|
||||||
formatted_string = boost::lexical_cast<std::string>(uuid_data);
|
formatted_string = boost::lexical_cast<std::string>(uuid_data);
|
||||||
#else
|
#else
|
||||||
formatted_string = boost::uuids::to_string(uuid_data);
|
formatted_string_ = boost::uuids::to_string(uuid_data_);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@@ -111,14 +111,14 @@ IfcParse::IfcGlobalId::IfcGlobalId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IfcParse::IfcGlobalId::IfcGlobalId(const std::string& s)
|
IfcParse::IfcGlobalId::IfcGlobalId(const std::string& s)
|
||||||
: string_data(s) {
|
: string_data_(s) {
|
||||||
std::vector<unsigned char> v;
|
std::vector<unsigned char> v;
|
||||||
expand(string_data, v);
|
expand(string_data_, v);
|
||||||
std::copy(v.begin(), v.end(), uuid_data.begin());
|
std::copy(v.begin(), v.end(), uuid_data_.begin());
|
||||||
#if BOOST_VERSION < 104400
|
#if BOOST_VERSION < 104400
|
||||||
formatted_string = boost::lexical_cast<std::string>(uuid_data);
|
formatted_string = boost::lexical_cast<std::string>(uuid_data);
|
||||||
#else
|
#else
|
||||||
formatted_string = boost::uuids::to_string(uuid_data);
|
formatted_string_ = boost::uuids::to_string(uuid_data_);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@@ -130,13 +130,13 @@ IfcParse::IfcGlobalId::IfcGlobalId(const std::string& s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
IfcParse::IfcGlobalId::operator const std::string&() const {
|
IfcParse::IfcGlobalId::operator const std::string&() const {
|
||||||
return string_data;
|
return string_data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcParse::IfcGlobalId::operator const boost::uuids::uuid&() const {
|
IfcParse::IfcGlobalId::operator const boost::uuids::uuid&() const {
|
||||||
return uuid_data;
|
return uuid_data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& IfcParse::IfcGlobalId::formatted() const {
|
const std::string& IfcParse::IfcGlobalId::formatted() const {
|
||||||
return formatted_string;
|
return formatted_string_;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ namespace IfcParse {
|
|||||||
/// A helper class for the creation of IFC GlobalIds.
|
/// A helper class for the creation of IFC GlobalIds.
|
||||||
class IFC_PARSE_API IfcGlobalId {
|
class IFC_PARSE_API IfcGlobalId {
|
||||||
private:
|
private:
|
||||||
std::string string_data, formatted_string;
|
std::string string_data_;
|
||||||
boost::uuids::uuid uuid_data;
|
std::string formatted_string_;
|
||||||
|
boost::uuids::uuid uuid_data_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const unsigned int length = 22;
|
static const unsigned int length = 22;
|
||||||
|
|||||||
@@ -995,8 +995,8 @@ void push_back_to_maybe_optional(boost::optional<boost::shared_ptr<T>>& t, U* u)
|
|||||||
|
|
||||||
template <typename Schema>
|
template <typename Schema>
|
||||||
typename Schema::IfcGeometricRepresentationContext* IfcHierarchyHelper<Schema>::getRepresentationContext(const std::string& s) {
|
typename Schema::IfcGeometricRepresentationContext* IfcHierarchyHelper<Schema>::getRepresentationContext(const std::string& s) {
|
||||||
typename std::map<std::string, typename Schema::IfcGeometricRepresentationContext*>::const_iterator it = contexts.find(s);
|
typename std::map<std::string, typename Schema::IfcGeometricRepresentationContext*>::const_iterator it = contexts_.find(s);
|
||||||
if (it != contexts.end()) {
|
if (it != contexts_.end()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
typename Schema::IfcProject* project = getSingle<typename Schema::IfcProject>();
|
typename Schema::IfcProject* project = getSingle<typename Schema::IfcProject>();
|
||||||
@@ -1010,7 +1010,7 @@ typename Schema::IfcGeometricRepresentationContext* IfcHierarchyHelper<Schema>::
|
|||||||
push_back_to_maybe_optional(project_contexts, context);
|
push_back_to_maybe_optional(project_contexts, context);
|
||||||
|
|
||||||
project->setRepresentationContexts(project_contexts);
|
project->setRepresentationContexts(project_contexts);
|
||||||
return contexts[s] = context;
|
return contexts_[s] = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_SCHEMA_2x3
|
#ifdef HAS_SCHEMA_2x3
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ class IFC_PARSE_API IfcHierarchyHelper : public IfcParse::IfcFile {
|
|||||||
typename Schema::IfcGeometricRepresentationContext* getRepresentationContext(const std::string&);
|
typename Schema::IfcGeometricRepresentationContext* getRepresentationContext(const std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, typename Schema::IfcGeometricRepresentationContext*> contexts;
|
std::map<std::string, typename Schema::IfcGeometricRepresentationContext*> contexts_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAS_SCHEMA_2x3
|
#ifdef HAS_SCHEMA_2x3
|
||||||
|
|||||||
+58
-58
@@ -61,7 +61,7 @@ template <>
|
|||||||
const std::array<std::basic_string<wchar_t>, 5> severity_strings<wchar_t>::value = {L"Performance", L"Debug", L"Notice", L"Warning", L"Error"};
|
const std::array<std::basic_string<wchar_t>, 5> severity_strings<wchar_t>::value = {L"Performance", L"Debug", L"Notice", L"Warning", L"Error"};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void plain_text_message(T& os, const boost::optional<const IfcUtil::IfcBaseClass*>& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
|
void plain_text_message(T& os, const boost::optional<IfcUtil::IfcBaseClass*>& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
|
||||||
os << "[" << severity_strings<typename T::char_type>::value[type] << "] ";
|
os << "[" << severity_strings<typename T::char_type>::value[type] << "] ";
|
||||||
os << "[" << get_time(type <= Logger::LOG_PERF).c_str() << "] ";
|
os << "[" << get_time(type <= Logger::LOG_PERF).c_str() << "] ";
|
||||||
if (current_product) {
|
if (current_product) {
|
||||||
@@ -86,7 +86,7 @@ std::basic_string<T> string_as(const std::string& s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void json_message(T& os, const boost::optional<const IfcUtil::IfcBaseClass*>& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
|
void json_message(T& os, const boost::optional<IfcUtil::IfcBaseClass*>& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
|
||||||
boost::property_tree::basic_ptree<std::basic_string<typename T::char_type>, std::basic_string<typename T::char_type>> pt;
|
boost::property_tree::basic_ptree<std::basic_string<typename T::char_type>, std::basic_string<typename T::char_type>> pt;
|
||||||
|
|
||||||
// @todo this is crazy
|
// @todo this is crazy
|
||||||
@@ -112,31 +112,31 @@ void json_message(T& os, const boost::optional<const IfcUtil::IfcBaseClass*>& cu
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void Logger::SetProduct(boost::optional<const IfcUtil::IfcBaseClass*> product) {
|
void Logger::SetProduct(boost::optional<const IfcUtil::IfcBaseClass*> product) {
|
||||||
if (verbosity <= LOG_DEBUG && product) {
|
if (verbosity_ <= LOG_DEBUG && product) {
|
||||||
Message(LOG_DEBUG, "Begin processing", *product);
|
Message(LOG_DEBUG, "Begin processing", *product);
|
||||||
}
|
}
|
||||||
if (!product && print_perf_stats_on_element) {
|
if (!product && print_perf_stats_on_element_) {
|
||||||
PrintPerformanceStats();
|
PrintPerformanceStats();
|
||||||
performance_statistics.clear();
|
performance_statistics_.clear();
|
||||||
}
|
}
|
||||||
current_product = product;
|
current_product_ = product;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::SetOutput(std::ostream* l1, std::ostream* l2) {
|
void Logger::SetOutput(std::ostream* l1, std::ostream* l2) {
|
||||||
wlog1 = wlog2 = 0;
|
wlog1_ = wlog2_ = 0;
|
||||||
log1 = l1;
|
log1_ = l1;
|
||||||
log2 = l2;
|
log2_ = l2;
|
||||||
if (log2 == nullptr) {
|
if (log2_ == nullptr) {
|
||||||
log2 = &log_stream;
|
log2_ = &log_stream_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::SetOutput(std::wostream* l1, std::wostream* l2) {
|
void Logger::SetOutput(std::wostream* l1, std::wostream* l2) {
|
||||||
log1 = log2 = 0;
|
log1_ = log2_ = 0;
|
||||||
wlog1 = l1;
|
wlog1_ = l1;
|
||||||
wlog2 = l2;
|
wlog2_ = l2;
|
||||||
if (wlog2 == nullptr) {
|
if (wlog2_ == nullptr) {
|
||||||
log2 = &log_stream;
|
log2_ = &log_stream_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,33 +145,33 @@ void Logger::Message(Logger::Severity type, const std::string& message, const If
|
|||||||
std::lock_guard<std::mutex> lk(m);
|
std::lock_guard<std::mutex> lk(m);
|
||||||
|
|
||||||
if (type == LOG_PERF) {
|
if (type == LOG_PERF) {
|
||||||
if (!first_timepoint) {
|
if (!first_timepoint_) {
|
||||||
first_timepoint = std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
|
first_timepoint_ = std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
|
||||||
}
|
}
|
||||||
double t0 = (std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count() - *first_timepoint) / 1.e9;
|
double t0 = (std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count() - *first_timepoint_) / 1.e9;
|
||||||
if (message.substr(0, 5) == "done ") {
|
if (message.substr(0, 5) == "done ") {
|
||||||
auto orig = message.substr(5);
|
auto orig = message.substr(5);
|
||||||
performance_statistics[orig] += t0 - performance_signal_start[orig];
|
performance_statistics_[orig] += t0 - performance_signal_start_[orig];
|
||||||
} else {
|
} else {
|
||||||
performance_signal_start[message] = t0;
|
performance_signal_start_[message] = t0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type > max_severity) {
|
if (type > max_severity_) {
|
||||||
max_severity = type;
|
max_severity_ = type;
|
||||||
}
|
}
|
||||||
if (((log2 != nullptr) || (wlog2 != nullptr)) && type >= verbosity) {
|
if (((log2_ != nullptr) || (wlog2_ != nullptr)) && type >= verbosity_) {
|
||||||
if (format == FMT_PLAIN) {
|
if (format_ == FMT_PLAIN) {
|
||||||
if (log2 != nullptr) {
|
if (log2_ != nullptr) {
|
||||||
plain_text_message(*log2, current_product, type, message, instance);
|
plain_text_message(*log2_, current_product_, type, message, instance);
|
||||||
} else if (wlog2 != nullptr) {
|
} else if (wlog2_ != nullptr) {
|
||||||
plain_text_message(*wlog2, current_product, type, message, instance);
|
plain_text_message(*wlog2_, current_product_, type, message, instance);
|
||||||
}
|
}
|
||||||
} else if (format == FMT_JSON) {
|
} else if (format_ == FMT_JSON) {
|
||||||
if (log2 != nullptr) {
|
if (log2_ != nullptr) {
|
||||||
json_message(*log2, current_product, type, message, instance);
|
json_message(*log2_, current_product_, type, message, instance);
|
||||||
} else if (wlog2 != nullptr) {
|
} else if (wlog2_ != nullptr) {
|
||||||
json_message(*wlog2, current_product, type, message, instance);
|
json_message(*wlog2_, current_product_, type, message, instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,10 +192,10 @@ void status(T& log1, const std::string& message, bool new_line) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Logger::Status(const std::string& message, bool new_line) {
|
void Logger::Status(const std::string& message, bool new_line) {
|
||||||
if (log1 != nullptr) {
|
if (log1_ != nullptr) {
|
||||||
status(*log1, message, new_line);
|
status(*log1_, message, new_line);
|
||||||
} else if (wlog1 != nullptr) {
|
} else if (wlog1_ != nullptr) {
|
||||||
status(*wlog1, message, new_line);
|
status(*wlog1_, message, new_line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,12 +204,12 @@ void Logger::ProgressBar(int progress) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string Logger::GetLog() {
|
std::string Logger::GetLog() {
|
||||||
return log_stream.str();
|
return log_stream_.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::PrintPerformanceStats() {
|
void Logger::PrintPerformanceStats() {
|
||||||
std::vector<std::pair<double, std::string>> items;
|
std::vector<std::pair<double, std::string>> items;
|
||||||
for (auto& p : performance_statistics) {
|
for (auto& p : performance_statistics_) {
|
||||||
items.push_back({p.second, p.first});
|
items.push_back({p.second, p.first});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,24 +229,24 @@ void Logger::PrintPerformanceStats() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::Verbosity(Logger::Severity v) { verbosity = v; }
|
void Logger::Verbosity(Logger::Severity v) { verbosity_ = v; }
|
||||||
Logger::Severity Logger::Verbosity() { return verbosity; }
|
Logger::Severity Logger::Verbosity() { return verbosity_; }
|
||||||
|
|
||||||
Logger::Severity Logger::MaxSeverity() { return max_severity; }
|
Logger::Severity Logger::MaxSeverity() { return max_severity_; }
|
||||||
|
|
||||||
void Logger::OutputFormat(Format f) { format = f; }
|
void Logger::OutputFormat(Format f) { format_ = f; }
|
||||||
Logger::Format Logger::OutputFormat() { return format; }
|
Logger::Format Logger::OutputFormat() { return format_; }
|
||||||
|
|
||||||
std::ostream* Logger::log1 = 0;
|
std::ostream* Logger::log1_ = 0;
|
||||||
std::ostream* Logger::log2 = 0;
|
std::ostream* Logger::log2_ = 0;
|
||||||
std::wostream* Logger::wlog1 = 0;
|
std::wostream* Logger::wlog1_ = 0;
|
||||||
std::wostream* Logger::wlog2 = 0;
|
std::wostream* Logger::wlog2_ = 0;
|
||||||
std::stringstream Logger::log_stream;
|
std::stringstream Logger::log_stream_;
|
||||||
Logger::Severity Logger::verbosity = Logger::LOG_NOTICE;
|
Logger::Severity Logger::verbosity_ = Logger::LOG_NOTICE;
|
||||||
Logger::Severity Logger::max_severity = Logger::LOG_NOTICE;
|
Logger::Severity Logger::max_severity_ = Logger::LOG_NOTICE;
|
||||||
Logger::Format Logger::format = Logger::FMT_PLAIN;
|
Logger::Format Logger::format_ = Logger::FMT_PLAIN;
|
||||||
boost::optional<const IfcUtil::IfcBaseClass*> Logger::current_product;
|
boost::optional<IfcUtil::IfcBaseClass*> Logger::current_product_;
|
||||||
boost::optional<long long> Logger::first_timepoint;
|
boost::optional<long long> Logger::first_timepoint_;
|
||||||
std::map<std::string, double> Logger::performance_statistics;
|
std::map<std::string, double> Logger::performance_statistics_;
|
||||||
std::map<std::string, double> Logger::performance_signal_start;
|
std::map<std::string, double> Logger::performance_signal_start_;
|
||||||
bool Logger::print_perf_stats_on_element = false;
|
bool Logger::print_perf_stats_on_element_ = false;
|
||||||
|
|||||||
+14
-14
@@ -47,24 +47,24 @@ class IFC_PARSE_API Logger {
|
|||||||
private:
|
private:
|
||||||
// To both stream variants need to exist at runtime or should this be a
|
// To both stream variants need to exist at runtime or should this be a
|
||||||
// template argument of Logger or controlled using preprocessor directives?
|
// template argument of Logger or controlled using preprocessor directives?
|
||||||
static std::ostream* log1;
|
static std::ostream* log1_;
|
||||||
static std::ostream* log2;
|
static std::ostream* log2_;
|
||||||
|
|
||||||
static std::wostream* wlog1;
|
static std::wostream* wlog1_;
|
||||||
static std::wostream* wlog2;
|
static std::wostream* wlog2_;
|
||||||
|
|
||||||
static std::stringstream log_stream;
|
static std::stringstream log_stream_;
|
||||||
|
|
||||||
static Severity verbosity;
|
static Severity verbosity_;
|
||||||
static Format format;
|
static Format format_;
|
||||||
static boost::optional<const IfcUtil::IfcBaseClass*> current_product;
|
static boost::optional<IfcUtil::IfcBaseClass*> current_product_;
|
||||||
static Severity max_severity;
|
static Severity max_severity_;
|
||||||
|
|
||||||
static boost::optional<long long> first_timepoint;
|
static boost::optional<long long> first_timepoint_;
|
||||||
static std::map<std::string, double> performance_statistics;
|
static std::map<std::string, double> performance_statistics_;
|
||||||
static std::map<std::string, double> performance_signal_start;
|
static std::map<std::string, double> performance_signal_start_;
|
||||||
|
|
||||||
static bool print_perf_stats_on_element;
|
static bool print_perf_stats_on_element_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void SetProduct(boost::optional<const IfcUtil::IfcBaseClass*> product);
|
static void SetProduct(boost::optional<const IfcUtil::IfcBaseClass*> product);
|
||||||
@@ -101,7 +101,7 @@ class IFC_PARSE_API Logger {
|
|||||||
static void ProgressBar(int progress);
|
static void ProgressBar(int progress);
|
||||||
static std::string GetLog();
|
static std::string GetLog();
|
||||||
static void PrintPerformanceStats();
|
static void PrintPerformanceStats();
|
||||||
static void PrintPerformanceStatsOnElement(bool b) { print_perf_stats_on_element = b; }
|
static void PrintPerformanceStatsOnElement(bool b) { print_perf_stats_on_element_ = b; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PERF(x) \
|
#define PERF(x) \
|
||||||
|
|||||||
+126
-127
@@ -110,8 +110,8 @@ IfcSpfStream::IfcSpfStream(const std::string& fn, bool mmap)
|
|||||||
#else
|
#else
|
||||||
IfcSpfStream::IfcSpfStream(const std::string& fn)
|
IfcSpfStream::IfcSpfStream(const std::string& fn)
|
||||||
#endif
|
#endif
|
||||||
: stream(0),
|
: stream_(0),
|
||||||
buffer(0),
|
buffer_(0),
|
||||||
valid(false),
|
valid(false),
|
||||||
eof(false) {
|
eof(false) {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -123,7 +123,7 @@ IfcSpfStream::IfcSpfStream(const std::string& fn)
|
|||||||
mfs = boost::iostreams::mapped_file_source(boost::filesystem::wpath(fn_wide));
|
mfs = boost::iostreams::mapped_file_source(boost::filesystem::wpath(fn_wide));
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
stream = _wfopen(fn_wide, L"rb");
|
stream_ = _wfopen(fn_wide, L"rb");
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -135,7 +135,7 @@ IfcSpfStream::IfcSpfStream(const std::string& fn)
|
|||||||
mfs = boost::iostreams::mapped_file_source(fn);
|
mfs = boost::iostreams::mapped_file_source(fn);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
stream = fopen(fn.c_str(), "rb");
|
stream_ = fopen(fn.c_str(), "rb");
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -149,53 +149,53 @@ IfcSpfStream::IfcSpfStream(const std::string& fn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
valid = true;
|
valid = true;
|
||||||
buffer = mfs.data();
|
buffer_ = mfs.data();
|
||||||
ptr = 0;
|
ptr_ = 0;
|
||||||
len = mfs.size();
|
len_ = mfs.size();
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
if (stream == NULL) {
|
if (stream_ == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
valid = true;
|
valid = true;
|
||||||
fseek(stream, 0, SEEK_END);
|
fseek(stream_, 0, SEEK_END);
|
||||||
size = (unsigned int)ftell(stream);
|
size = (unsigned int)ftell(stream_);
|
||||||
rewind(stream);
|
rewind(stream_);
|
||||||
char* buffer_rw = new char[size];
|
char* buffer_rw = new char[size];
|
||||||
len = (unsigned int)fread(buffer_rw, 1, size, stream);
|
len_ = (unsigned int)fread(buffer_rw, 1, size, stream_);
|
||||||
buffer = buffer_rw;
|
buffer_ = buffer_rw;
|
||||||
eof = len == 0;
|
eof = len_ == 0;
|
||||||
ptr = 0;
|
ptr_ = 0;
|
||||||
fclose(stream);
|
fclose(stream_);
|
||||||
stream = nullptr;
|
stream_ = nullptr;
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcSpfStream::IfcSpfStream(std::istream& f, int l)
|
IfcSpfStream::IfcSpfStream(std::istream& f, int l)
|
||||||
: stream(0),
|
: stream_(0),
|
||||||
buffer(0) {
|
buffer_(0) {
|
||||||
eof = false;
|
eof = false;
|
||||||
size = l;
|
size = l;
|
||||||
char* buffer_rw = new char[size];
|
char* buffer_rw = new char[size];
|
||||||
f.read(buffer_rw, size);
|
f.read(buffer_rw, size);
|
||||||
buffer = buffer_rw;
|
buffer_ = buffer_rw;
|
||||||
valid = f.gcount() == size;
|
valid = f.gcount() == size;
|
||||||
ptr = 0;
|
ptr_ = 0;
|
||||||
len = l;
|
len_ = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcSpfStream::IfcSpfStream(void* data, int l)
|
IfcSpfStream::IfcSpfStream(void* data, int l)
|
||||||
: stream(0),
|
: stream_(0),
|
||||||
buffer(0) {
|
buffer_(0) {
|
||||||
eof = false;
|
eof = false;
|
||||||
size = l;
|
size = l;
|
||||||
buffer = (char*)data;
|
buffer_ = (char*)data;
|
||||||
valid = true;
|
valid = true;
|
||||||
ptr = 0;
|
ptr_ = 0;
|
||||||
len = l;
|
len_ = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcSpfStream::~IfcSpfStream() {
|
IfcSpfStream::~IfcSpfStream() {
|
||||||
@@ -209,9 +209,9 @@ void IfcSpfStream::Close() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
delete[] buffer;
|
delete[] buffer_;
|
||||||
if (stream != nullptr) {
|
if (stream_ != nullptr) {
|
||||||
fclose(stream);
|
fclose(stream_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,8 +219,8 @@ void IfcSpfStream::Close() {
|
|||||||
// Seeks an arbitrary position in the file
|
// Seeks an arbitrary position in the file
|
||||||
//
|
//
|
||||||
void IfcSpfStream::Seek(unsigned int o) {
|
void IfcSpfStream::Seek(unsigned int o) {
|
||||||
ptr = o;
|
ptr_ = o;
|
||||||
if (ptr >= len) {
|
if (ptr_ >= len_) {
|
||||||
throw IfcException("Reading outside of file limits");
|
throw IfcException("Reading outside of file limits");
|
||||||
}
|
}
|
||||||
eof = false;
|
eof = false;
|
||||||
@@ -230,28 +230,28 @@ void IfcSpfStream::Seek(unsigned int o) {
|
|||||||
// Returns the character at the cursor
|
// Returns the character at the cursor
|
||||||
//
|
//
|
||||||
char IfcSpfStream::Peek() {
|
char IfcSpfStream::Peek() {
|
||||||
return buffer[ptr];
|
return buffer_[ptr_];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Returns the character at specified offset
|
// Returns the character at specified offset
|
||||||
//
|
//
|
||||||
char IfcSpfStream::Read(unsigned int o) {
|
char IfcSpfStream::Read(unsigned int o) {
|
||||||
return buffer[o];
|
return buffer_[o];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Returns the cursor position
|
// Returns the cursor position
|
||||||
//
|
//
|
||||||
unsigned int IfcSpfStream::Tell() {
|
unsigned int IfcSpfStream::Tell() {
|
||||||
return ptr;
|
return ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Increments cursor and reads new chunk if necessary
|
// Increments cursor and reads new chunk if necessary
|
||||||
//
|
//
|
||||||
void IfcSpfStream::Inc() {
|
void IfcSpfStream::Inc() {
|
||||||
if (++ptr == len) {
|
if (++ptr_ == len_) {
|
||||||
eof = true;
|
eof = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -265,11 +265,11 @@ void IfcSpfStream::Inc() {
|
|||||||
IfcSpfLexer::IfcSpfLexer(IfcParse::IfcSpfStream* s, IfcParse::IfcFile* f) {
|
IfcSpfLexer::IfcSpfLexer(IfcParse::IfcSpfStream* s, IfcParse::IfcFile* f) {
|
||||||
file = f;
|
file = f;
|
||||||
stream = s;
|
stream = s;
|
||||||
decoder = new IfcCharacterDecoder(s);
|
decoder_ = new IfcCharacterDecoder(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcSpfLexer::~IfcSpfLexer() {
|
IfcSpfLexer::~IfcSpfLexer() {
|
||||||
delete decoder;
|
delete decoder_;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int IfcSpfLexer::skipWhitespace() {
|
unsigned int IfcSpfLexer::skipWhitespace() {
|
||||||
@@ -350,7 +350,7 @@ Token IfcSpfLexer::Next() {
|
|||||||
|
|
||||||
// If a string is encountered defer processing to the IfcCharacterDecoder
|
// If a string is encountered defer processing to the IfcCharacterDecoder
|
||||||
if (c == '\'') {
|
if (c == '\'') {
|
||||||
decoder->skip();
|
decoder_->skip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
@@ -360,11 +360,11 @@ Token IfcSpfLexer::Next() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IfcSpfStream::is_eof_at(unsigned int local_ptr) {
|
bool IfcSpfStream::is_eof_at(unsigned int local_ptr) {
|
||||||
return local_ptr >= len;
|
return local_ptr >= len_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcSpfStream::increment_at(unsigned int& local_ptr) {
|
void IfcSpfStream::increment_at(unsigned int& local_ptr) {
|
||||||
if (++local_ptr == len) {
|
if (++local_ptr == len_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char current = IfcSpfStream::peek_at(local_ptr);
|
const char current = IfcSpfStream::peek_at(local_ptr);
|
||||||
@@ -374,7 +374,7 @@ void IfcSpfStream::increment_at(unsigned int& local_ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char IfcSpfStream::peek_at(unsigned int local_ptr) {
|
char IfcSpfStream::peek_at(unsigned int local_ptr) {
|
||||||
return buffer[local_ptr];
|
return buffer_[local_ptr];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -394,7 +394,7 @@ void IfcSpfLexer::TokenString(unsigned int offset, std::string& buffer) {
|
|||||||
}
|
}
|
||||||
if (c == '\'') {
|
if (c == '\'') {
|
||||||
// todo, make decoder use local offset ptr
|
// todo, make decoder use local offset ptr
|
||||||
buffer = decoder->get(offset);
|
buffer = decoder_->get(offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
buffer.push_back(c);
|
buffer.push_back(c);
|
||||||
@@ -664,7 +664,7 @@ EntityArgument::EntityArgument(const Token& t) {
|
|||||||
// Data needs to be loaded, for the tokens
|
// Data needs to be loaded, for the tokens
|
||||||
// to be consumed and parsing to continue.
|
// to be consumed and parsing to continue.
|
||||||
data->load();
|
data->load();
|
||||||
entity = file->schema()->instantiate(data);
|
entity_ = file->schema()->instantiate(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -989,7 +989,7 @@ IfcUtil::ArgumentType EntityArgument::type() const {
|
|||||||
// Functions for casting the EntityArgument to other types
|
// Functions for casting the EntityArgument to other types
|
||||||
//
|
//
|
||||||
EntityArgument::operator IfcUtil::IfcBaseClass*() const {
|
EntityArgument::operator IfcUtil::IfcBaseClass*() const {
|
||||||
return entity;
|
return entity_;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int EntityArgument::size() const {
|
unsigned int EntityArgument::size() const {
|
||||||
@@ -1001,7 +1001,7 @@ Argument* EntityArgument::operator[](unsigned int /*i*/) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string EntityArgument::toString(bool upper) const {
|
std::string EntityArgument::toString(bool upper) const {
|
||||||
return entity->data().toString(upper);
|
return entity_->data().toString(upper);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityArgument::isNull() const { return false; }
|
bool EntityArgument::isNull() const { return false; }
|
||||||
@@ -1052,18 +1052,18 @@ void IfcParse::IfcFile::try_read_semicolon() {
|
|||||||
void IfcParse::IfcFile::register_inverse(unsigned id_from, const IfcParse::entity* from_entity, Token t, int attribute_index) {
|
void IfcParse::IfcFile::register_inverse(unsigned id_from, const IfcParse::entity* from_entity, Token t, int attribute_index) {
|
||||||
// Assume a check on token type has already been performed
|
// Assume a check on token type has already been performed
|
||||||
const auto* e = from_entity;
|
const auto* e = from_entity;
|
||||||
byref_excl[t.value_int].push_back(id_from);
|
byref_excl_[t.value_int].push_back(id_from);
|
||||||
while (e != nullptr) {
|
while (e != nullptr) {
|
||||||
byref[{t.value_int, e->index_in_schema(), attribute_index}].push_back(id_from);
|
byref_[{t.value_int, e->index_in_schema(), attribute_index}].push_back(id_from);
|
||||||
e = e->supertype();
|
e = e->supertype();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcParse::IfcFile::register_inverse(unsigned id_from, const IfcParse::entity* from_entity, IfcUtil::IfcBaseClass* inst, int attribute_index) {
|
void IfcParse::IfcFile::register_inverse(unsigned id_from, const IfcParse::entity* from_entity, IfcUtil::IfcBaseClass* inst, int attribute_index) {
|
||||||
const auto* e = from_entity;
|
const auto* e = from_entity;
|
||||||
byref_excl[inst->data().id()].push_back(id_from);
|
byref_excl_[inst->data().id()].push_back(id_from);
|
||||||
while (e != nullptr) {
|
while (e != nullptr) {
|
||||||
byref[{inst->data().id(), e->index_in_schema(), attribute_index}].push_back(id_from);
|
byref_[{inst->data().id(), e->index_in_schema(), attribute_index}].push_back(id_from);
|
||||||
e = e->supertype();
|
e = e->supertype();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1071,7 +1071,7 @@ void IfcParse::IfcFile::register_inverse(unsigned id_from, const IfcParse::entit
|
|||||||
void IfcParse::IfcFile::unregister_inverse(unsigned id_from, const IfcParse::entity* from_entity, IfcUtil::IfcBaseClass* inst, int attribute_index) {
|
void IfcParse::IfcFile::unregister_inverse(unsigned id_from, const IfcParse::entity* from_entity, IfcUtil::IfcBaseClass* inst, int attribute_index) {
|
||||||
const auto* e = from_entity;
|
const auto* e = from_entity;
|
||||||
while (e != nullptr) {
|
while (e != nullptr) {
|
||||||
std::vector<int>& ids = byref[{inst->data().id(), e->index_in_schema(), attribute_index}];
|
std::vector<int>& ids = byref_[{inst->data().id(), e->index_in_schema(), attribute_index}];
|
||||||
std::vector<int>::iterator it = std::find(ids.begin(), ids.end(), id_from);
|
std::vector<int>::iterator it = std::find(ids.begin(), ids.end(), id_from);
|
||||||
if (it == ids.end()) {
|
if (it == ids.end()) {
|
||||||
// @todo inverses also need to be populated when multiple instances are added to a new file.
|
// @todo inverses also need to be populated when multiple instances are added to a new file.
|
||||||
@@ -1082,7 +1082,7 @@ void IfcParse::IfcFile::unregister_inverse(unsigned id_from, const IfcParse::ent
|
|||||||
e = e->supertype();
|
e = e->supertype();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int>& ids = byref_excl[inst->data().id()];
|
std::vector<int>& ids = byref_excl_[inst->data().id()];
|
||||||
std::vector<int>::iterator it = std::find(ids.begin(), ids.end(), id_from);
|
std::vector<int>::iterator it = std::find(ids.begin(), ids.end(), id_from);
|
||||||
if (it == ids.end()) {
|
if (it == ids.end()) {
|
||||||
// @todo inverses also need to be populated when multiple instances are added to a new file.
|
// @todo inverses also need to be populated when multiple instances are added to a new file.
|
||||||
@@ -1675,12 +1675,12 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
|
|||||||
if (instance->declaration().is(*ifcroot_type_)) {
|
if (instance->declaration().is(*ifcroot_type_)) {
|
||||||
try {
|
try {
|
||||||
const std::string guid = *instance->data().getArgument(0);
|
const std::string guid = *instance->data().getArgument(0);
|
||||||
if (byguid.find(guid) != byguid.end()) {
|
if (byguid_.find(guid) != byguid_.end()) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Instance encountered with non-unique GlobalId " << guid;
|
ss << "Instance encountered with non-unique GlobalId " << guid;
|
||||||
Logger::Message(Logger::LOG_WARNING, ss.str());
|
Logger::Message(Logger::LOG_WARNING, ss.str());
|
||||||
}
|
}
|
||||||
byguid[guid] = instance;
|
byguid_[guid] = instance;
|
||||||
} catch (const IfcException& ex) {
|
} catch (const IfcException& ex) {
|
||||||
Logger::Message(Logger::LOG_ERROR, ex.what());
|
Logger::Message(Logger::LOG_ERROR, ex.what());
|
||||||
}
|
}
|
||||||
@@ -1695,7 +1695,7 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
|
|||||||
aggregate_of_instance::ptr insts = instances_by_type_excl_subtypes(ty);
|
aggregate_of_instance::ptr insts = instances_by_type_excl_subtypes(ty);
|
||||||
if (!insts) {
|
if (!insts) {
|
||||||
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
|
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
|
||||||
bytype_excl[ty] = insts;
|
bytype_excl_[ty] = insts;
|
||||||
}
|
}
|
||||||
insts->push(instance);
|
insts->push(instance);
|
||||||
}
|
}
|
||||||
@@ -1704,7 +1704,7 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
|
|||||||
aggregate_of_instance::ptr insts = instances_by_type(ty);
|
aggregate_of_instance::ptr insts = instances_by_type(ty);
|
||||||
if (!insts) {
|
if (!insts) {
|
||||||
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
|
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
|
||||||
bytype[ty] = insts;
|
bytype_[ty] = insts;
|
||||||
}
|
}
|
||||||
insts->push(instance);
|
insts->push(instance);
|
||||||
const IfcParse::declaration* pt = ty->as_entity()->supertype();
|
const IfcParse::declaration* pt = ty->as_entity()->supertype();
|
||||||
@@ -1715,12 +1715,12 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (byid.find(current_id) != byid.end()) {
|
if (byid_.find(current_id) != byid_.end()) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Overwriting instance with name #" << current_id;
|
ss << "Overwriting instance with name #" << current_id;
|
||||||
Logger::Message(Logger::LOG_WARNING, ss.str());
|
Logger::Message(Logger::LOG_WARNING, ss.str());
|
||||||
}
|
}
|
||||||
byid[current_id] = instance;
|
byid_[current_id] = instance;
|
||||||
|
|
||||||
MaxId = (std::max)(MaxId, current_id);
|
MaxId = (std::max)(MaxId, current_id);
|
||||||
} else if (token_stream[0].type == IfcParse::Token_IDENTIFIER && (instance != nullptr)) {
|
} else if (token_stream[0].type == IfcParse::Token_IDENTIFIER && (instance != nullptr)) {
|
||||||
@@ -1762,7 +1762,7 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
|
|||||||
|
|
||||||
void IfcFile::recalculate_id_counter() {
|
void IfcFile::recalculate_id_counter() {
|
||||||
entity_by_id_t::key_type k = 0;
|
entity_by_id_t::key_type k = 0;
|
||||||
for (auto& p : byid) {
|
for (auto& p : byid_) {
|
||||||
if (p.first > k) {
|
if (p.first > k) {
|
||||||
k = p.first;
|
k = p.first;
|
||||||
}
|
}
|
||||||
@@ -1875,7 +1875,7 @@ void IfcFile::addEntities(aggregate_of_instance::ptr es) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id) {
|
IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id) {
|
||||||
if (id != -1 && byid.find((unsigned)id) != byid.end()) {
|
if (id != -1 && byid_.find((unsigned)id) != byid_.end()) {
|
||||||
throw IfcParse::IfcException("An instance with id " + boost::lexical_cast<std::string>(id) + " is already part of this file");
|
throw IfcParse::IfcException("An instance with id " + boost::lexical_cast<std::string>(id) + " is already part of this file");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1885,8 +1885,8 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
|
|
||||||
// If this instance has been inserted before, return
|
// If this instance has been inserted before, return
|
||||||
// a reference to the copy that was created from it.
|
// a reference to the copy that was created from it.
|
||||||
entity_entity_map_t::iterator mit = entity_file_map.find(entity->identity());
|
entity_entity_map_t::iterator mit = entity_file_map_.find(entity->identity());
|
||||||
if (mit != entity_file_map.end()) {
|
if (mit != entity_file_map_.end()) {
|
||||||
return mit->second;
|
return mit->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1899,9 +1899,9 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
aggregate_of_instance::ptr entity_attributes = traverse(entity, 1);
|
aggregate_of_instance::ptr entity_attributes = traverse(entity, 1);
|
||||||
for (aggregate_of_instance::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) {
|
for (aggregate_of_instance::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) {
|
||||||
if (*it != entity) {
|
if (*it != entity) {
|
||||||
entity_entity_map_t::iterator mit2 = entity_file_map.find((*it)->identity());
|
entity_entity_map_t::iterator mit2 = entity_file_map_.find((*it)->identity());
|
||||||
if (mit2 == entity_file_map.end()) {
|
if (mit2 == entity_file_map_.end()) {
|
||||||
entity_file_map.insert(entity_entity_map_t::value_type((*it)->identity(), addEntity(*it)));
|
entity_file_map_.insert(entity_entity_map_t::value_type((*it)->identity(), addEntity(*it)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1915,7 +1915,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
if (entity->data().file == this) {
|
if (entity->data().file == this) {
|
||||||
if (entity->declaration().as_entity() == nullptr) {
|
if (entity->declaration().as_entity() == nullptr) {
|
||||||
// While not a mapping that can be queried, we do need to free the instance later on
|
// While not a mapping that can be queried, we do need to free the instance later on
|
||||||
byidentity[new_entity->identity()] = new_entity;
|
byidentity_[new_entity->identity()] = new_entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it is part of this file
|
// If it is part of this file
|
||||||
@@ -1951,8 +1951,8 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attr_type == IfcUtil::Argument_ENTITY_INSTANCE) {
|
if (attr_type == IfcUtil::Argument_ENTITY_INSTANCE) {
|
||||||
entity_entity_map_t::const_iterator eit = entity_file_map.find(((IfcUtil::IfcBaseClass*)(*attr))->identity());
|
entity_entity_map_t::const_iterator eit = entity_file_map_.find(((IfcUtil::IfcBaseClass*)(*attr))->identity());
|
||||||
if (eit == entity_file_map.end()) {
|
if (eit == entity_file_map_.end()) {
|
||||||
throw IfcParse::IfcException("Unable to map instance to file");
|
throw IfcParse::IfcException("Unable to map instance to file");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1963,8 +1963,8 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
aggregate_of_instance::ptr instances = *attr;
|
aggregate_of_instance::ptr instances = *attr;
|
||||||
aggregate_of_instance::ptr new_instances(new aggregate_of_instance);
|
aggregate_of_instance::ptr new_instances(new aggregate_of_instance);
|
||||||
for (aggregate_of_instance::it it = instances->begin(); it != instances->end(); ++it) {
|
for (aggregate_of_instance::it it = instances->begin(); it != instances->end(); ++it) {
|
||||||
entity_entity_map_t::const_iterator eit = entity_file_map.find((*it)->identity());
|
entity_entity_map_t::const_iterator eit = entity_file_map_.find((*it)->identity());
|
||||||
if (eit == entity_file_map.end()) {
|
if (eit == entity_file_map_.end()) {
|
||||||
throw IfcParse::IfcException("Unable to map instance to file");
|
throw IfcParse::IfcException("Unable to map instance to file");
|
||||||
}
|
}
|
||||||
new_instances->push(eit->second);
|
new_instances->push(eit->second);
|
||||||
@@ -1979,8 +1979,8 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
for (aggregate_of_aggregate_of_instance::outer_it it = instances->begin(); it != instances->end(); ++it) {
|
for (aggregate_of_aggregate_of_instance::outer_it it = instances->begin(); it != instances->end(); ++it) {
|
||||||
std::vector<IfcUtil::IfcBaseClass*> list;
|
std::vector<IfcUtil::IfcBaseClass*> list;
|
||||||
for (aggregate_of_aggregate_of_instance::inner_it jt = it->begin(); jt != it->end(); ++jt) {
|
for (aggregate_of_aggregate_of_instance::inner_it jt = it->begin(); jt != it->end(); ++jt) {
|
||||||
entity_entity_map_t::const_iterator eit = entity_file_map.find((*jt)->identity());
|
entity_entity_map_t::const_iterator eit = entity_file_map_.find((*jt)->identity());
|
||||||
if (eit == entity_file_map.end()) {
|
if (eit == entity_file_map_.end()) {
|
||||||
throw IfcParse::IfcException("Unable to map instance to file");
|
throw IfcParse::IfcException("Unable to map instance to file");
|
||||||
}
|
}
|
||||||
list.push_back(eit->second);
|
list.push_back(eit->second);
|
||||||
@@ -2052,19 +2052,19 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity_file_map.insert(entity_entity_map_t::value_type(entity->identity(), new_entity));
|
entity_file_map_.insert(entity_entity_map_t::value_type(entity->identity(), new_entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
// For subtypes of IfcRoot, the GUID mapping needs to be updated.
|
// For subtypes of IfcRoot, the GUID mapping needs to be updated.
|
||||||
if (new_entity->declaration().is(*ifcroot_type_)) {
|
if (new_entity->declaration().is(*ifcroot_type_)) {
|
||||||
try {
|
try {
|
||||||
const std::string guid = *new_entity->data().getArgument(0);
|
const std::string guid = *new_entity->data().getArgument(0);
|
||||||
if (byguid.find(guid) != byguid.end()) {
|
if (byguid_.find(guid) != byguid_.end()) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Overwriting entity with guid " << guid;
|
ss << "Overwriting entity with guid " << guid;
|
||||||
Logger::Message(Logger::LOG_WARNING, ss.str());
|
Logger::Message(Logger::LOG_WARNING, ss.str());
|
||||||
}
|
}
|
||||||
byguid[guid] = new_entity;
|
byguid_[guid] = new_entity;
|
||||||
} catch (const IfcException& ex) {
|
} catch (const IfcException& ex) {
|
||||||
Logger::Message(Logger::LOG_ERROR, ex.what());
|
Logger::Message(Logger::LOG_ERROR, ex.what());
|
||||||
}
|
}
|
||||||
@@ -2077,7 +2077,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
aggregate_of_instance::ptr insts = instances_by_type_excl_subtypes(ty);
|
aggregate_of_instance::ptr insts = instances_by_type_excl_subtypes(ty);
|
||||||
if (!insts) {
|
if (!insts) {
|
||||||
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
|
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
|
||||||
bytype_excl[ty] = insts;
|
bytype_excl_[ty] = insts;
|
||||||
}
|
}
|
||||||
insts->push(new_entity);
|
insts->push(new_entity);
|
||||||
}
|
}
|
||||||
@@ -2086,7 +2086,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
aggregate_of_instance::ptr insts = instances_by_type(ty);
|
aggregate_of_instance::ptr insts = instances_by_type(ty);
|
||||||
if (!insts) {
|
if (!insts) {
|
||||||
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
|
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
|
||||||
bytype[ty] = insts;
|
bytype_[ty] = insts;
|
||||||
}
|
}
|
||||||
insts->push(new_entity);
|
insts->push(new_entity);
|
||||||
|
|
||||||
@@ -2115,15 +2115,14 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
new_id = new_entity->data().id();
|
new_id = new_entity->data().id();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (byid.find(new_id) != byid.end()) {
|
if (byid_.find(new_id) != byid_.end()) {
|
||||||
// This should not happen
|
// This should not happen
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Overwriting entity with id " << new_id;
|
ss << "Overwriting entity with id " << new_id;
|
||||||
Logger::Message(Logger::LOG_WARNING, ss.str());
|
Logger::Message(Logger::LOG_WARNING, ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// The mapping by entity instance name is updated.
|
// The mapping by entity instance name is updated.
|
||||||
byid[new_id] = new_entity;
|
byid_[new_id] = new_entity;
|
||||||
} else if (new_entity->data().file == nullptr) {
|
} else if (new_entity->data().file == nullptr) {
|
||||||
// For non-entity instances, no mappings are updated, but the file
|
// For non-entity instances, no mappings are updated, but the file
|
||||||
// pointer has to be set, so that actual copies are created in subsequent
|
// pointer has to be set, so that actual copies are created in subsequent
|
||||||
@@ -2131,7 +2130,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
|
|||||||
new_entity->data().file = this;
|
new_entity->data().file = this;
|
||||||
|
|
||||||
// While not a mapping that can be queried, we do need to free the instance
|
// While not a mapping that can be queried, we do need to free the instance
|
||||||
byidentity[new_entity->identity()] = new_entity;
|
byidentity_[new_entity->identity()] = new_entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parsing_complete_ && (ty->as_entity() != nullptr)) {
|
if (parsing_complete_ && (ty->as_entity() != nullptr)) {
|
||||||
@@ -2248,11 +2247,11 @@ void IfcFile::process_deletion_() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!batch_mode_) {
|
if (!batch_mode_) {
|
||||||
byref.erase(
|
byref_.erase(
|
||||||
byref.lower_bound({id, -1, -1}),
|
byref_.lower_bound({id, -1, -1}),
|
||||||
byref.upper_bound({id, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()}));
|
byref_.upper_bound({id, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()}));
|
||||||
|
|
||||||
byref_excl.erase(id);
|
byref_excl_.erase(id);
|
||||||
|
|
||||||
// This is based on traversal which needs instances to still be contained in the map.
|
// This is based on traversal which needs instances to still be contained in the map.
|
||||||
// another option would be to keep byid intact for the remainder of this loop
|
// another option would be to keep byid intact for the remainder of this loop
|
||||||
@@ -2266,8 +2265,8 @@ void IfcFile::process_deletion_() {
|
|||||||
// Do not update inverses for simple types (which have id()==0 in IfcOpenShell).
|
// Do not update inverses for simple types (which have id()==0 in IfcOpenShell).
|
||||||
if (name != 0) {
|
if (name != 0) {
|
||||||
{
|
{
|
||||||
auto lower = byref.lower_bound({name, -1, -1});
|
auto lower = byref_.lower_bound({name, -1, -1});
|
||||||
auto upper = byref.upper_bound({name, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()});
|
auto upper = byref_.upper_bound({name, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()});
|
||||||
|
|
||||||
for (auto byref_it = lower; byref_it != upper; ++byref_it) {
|
for (auto byref_it = lower; byref_it != upper; ++byref_it) {
|
||||||
auto& ids = byref_it->second;
|
auto& ids = byref_it->second;
|
||||||
@@ -2275,8 +2274,8 @@ void IfcFile::process_deletion_() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto byref_it = byref_excl.find(name);
|
auto byref_it = byref_excl_.find(name);
|
||||||
if (byref_it != byref_excl.end()) {
|
if (byref_it != byref_excl_.end()) {
|
||||||
auto& ids = byref_it->second;
|
auto& ids = byref_it->second;
|
||||||
ids.erase(std::remove(ids.begin(), ids.end(), id), ids.end());
|
ids.erase(std::remove(ids.begin(), ids.end(), id), ids.end());
|
||||||
}
|
}
|
||||||
@@ -2287,15 +2286,15 @@ void IfcFile::process_deletion_() {
|
|||||||
|
|
||||||
if (entity->declaration().is(*ifcroot_type_)) {
|
if (entity->declaration().is(*ifcroot_type_)) {
|
||||||
const std::string global_id = *entity->data().getArgument(0);
|
const std::string global_id = *entity->data().getArgument(0);
|
||||||
auto it = byguid.find(global_id);
|
auto it = byguid_.find(global_id);
|
||||||
if (it != byguid.end()) {
|
if (it != byguid_.end()) {
|
||||||
byguid.erase(it);
|
byguid_.erase(it);
|
||||||
} else {
|
} else {
|
||||||
Logger::Warning("GlobalId on rooted instance not encountered in map");
|
Logger::Warning("GlobalId on rooted instance not encountered in map");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byid.erase(byid.find(id));
|
byid_.erase(byid_.find(id));
|
||||||
|
|
||||||
const IfcParse::declaration* ty = &entity->declaration();
|
const IfcParse::declaration* ty = &entity->declaration();
|
||||||
|
|
||||||
@@ -2303,7 +2302,7 @@ void IfcFile::process_deletion_() {
|
|||||||
aggregate_of_instance::ptr instances_of_same_type = instances_by_type_excl_subtypes(ty);
|
aggregate_of_instance::ptr instances_of_same_type = instances_by_type_excl_subtypes(ty);
|
||||||
instances_of_same_type->remove(entity);
|
instances_of_same_type->remove(entity);
|
||||||
if (instances_of_same_type->size() == 0) {
|
if (instances_of_same_type->size() == 0) {
|
||||||
bytype_excl.erase(ty);
|
bytype_excl_.erase(ty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2313,7 +2312,7 @@ void IfcFile::process_deletion_() {
|
|||||||
instances_of_same_type->remove(entity);
|
instances_of_same_type->remove(entity);
|
||||||
}
|
}
|
||||||
if (instances_of_same_type->size() == 0) {
|
if (instances_of_same_type->size() == 0) {
|
||||||
bytype.erase(ty);
|
bytype_.erase(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
const IfcParse::declaration* pt = ty->as_entity()->supertype();
|
const IfcParse::declaration* pt = ty->as_entity()->supertype();
|
||||||
@@ -2326,9 +2325,9 @@ void IfcFile::process_deletion_() {
|
|||||||
|
|
||||||
// entity_file_map is in place to prevent duplicate definitions with usage of add().
|
// entity_file_map is in place to prevent duplicate definitions with usage of add().
|
||||||
// Upon deletion the pairs need to be erased.
|
// Upon deletion the pairs need to be erased.
|
||||||
for (auto it = entity_file_map.begin(); it != entity_file_map.end();) {
|
for (auto it = entity_file_map_.begin(); it != entity_file_map_.end();) {
|
||||||
if (it->second == entity) {
|
if (it->second == entity) {
|
||||||
it = entity_file_map.erase(it);
|
it = entity_file_map_.erase(it);
|
||||||
} else {
|
} else {
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
@@ -2338,7 +2337,7 @@ void IfcFile::process_deletion_() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (batch_mode_) {
|
if (batch_mode_) {
|
||||||
for (auto it = byref.begin(); it != byref.end();) {
|
for (auto it = byref_.begin(); it != byref_.end();) {
|
||||||
bool do_delete = batch_deletion_ids_.get<1>().find(std::get<INSTANCE_ID>(it->first)) != batch_deletion_ids_.get<1>().end();
|
bool do_delete = batch_deletion_ids_.get<1>().find(std::get<INSTANCE_ID>(it->first)) != batch_deletion_ids_.get<1>().end();
|
||||||
if (!do_delete) {
|
if (!do_delete) {
|
||||||
it->second.erase(std::remove_if(it->second.begin(), it->second.end(), [this](int x) {
|
it->second.erase(std::remove_if(it->second.begin(), it->second.end(), [this](int x) {
|
||||||
@@ -2348,13 +2347,13 @@ void IfcFile::process_deletion_() {
|
|||||||
do_delete = it->second.empty();
|
do_delete = it->second.empty();
|
||||||
}
|
}
|
||||||
if (do_delete) {
|
if (do_delete) {
|
||||||
it = byref.erase(it);
|
it = byref_.erase(it);
|
||||||
} else {
|
} else {
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto it = byref_excl.begin(); it != byref_excl.end();) {
|
for (auto it = byref_excl_.begin(); it != byref_excl_.end();) {
|
||||||
bool do_delete = batch_deletion_ids_.get<1>().find(it->first) != batch_deletion_ids_.get<1>().end();
|
bool do_delete = batch_deletion_ids_.get<1>().find(it->first) != batch_deletion_ids_.get<1>().end();
|
||||||
if (!do_delete) {
|
if (!do_delete) {
|
||||||
it->second.erase(std::remove_if(it->second.begin(), it->second.end(), [this](int x) {
|
it->second.erase(std::remove_if(it->second.begin(), it->second.end(), [this](int x) {
|
||||||
@@ -2364,7 +2363,7 @@ void IfcFile::process_deletion_() {
|
|||||||
do_delete = it->second.empty();
|
do_delete = it->second.empty();
|
||||||
}
|
}
|
||||||
if (do_delete) {
|
if (do_delete) {
|
||||||
it = byref_excl.erase(it);
|
it = byref_excl_.erase(it);
|
||||||
} else {
|
} else {
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
@@ -2375,13 +2374,13 @@ void IfcFile::process_deletion_() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aggregate_of_instance::ptr IfcFile::instances_by_type(const IfcParse::declaration* t) {
|
aggregate_of_instance::ptr IfcFile::instances_by_type(const IfcParse::declaration* t) {
|
||||||
entities_by_type_t::const_iterator it = bytype.find(t);
|
entities_by_type_t::const_iterator it = bytype_.find(t);
|
||||||
return (it == bytype.end()) ? aggregate_of_instance::ptr() : it->second;
|
return (it == bytype_.end()) ? aggregate_of_instance::ptr() : it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
aggregate_of_instance::ptr IfcFile::instances_by_type_excl_subtypes(const IfcParse::declaration* t) {
|
aggregate_of_instance::ptr IfcFile::instances_by_type_excl_subtypes(const IfcParse::declaration* t) {
|
||||||
entities_by_type_t::const_iterator it = bytype_excl.find(t);
|
entities_by_type_t::const_iterator it = bytype_excl_.find(t);
|
||||||
return (it == bytype_excl.end()) ? aggregate_of_instance::ptr() : it->second;
|
return (it == bytype_excl_.end()) ? aggregate_of_instance::ptr() : it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
aggregate_of_instance::ptr IfcFile::instances_by_type(const std::string& t) {
|
aggregate_of_instance::ptr IfcFile::instances_by_type(const std::string& t) {
|
||||||
@@ -2394,23 +2393,23 @@ aggregate_of_instance::ptr IfcFile::instances_by_type_excl_subtypes(const std::s
|
|||||||
|
|
||||||
aggregate_of_instance::ptr IfcFile::instances_by_reference(int t) {
|
aggregate_of_instance::ptr IfcFile::instances_by_reference(int t) {
|
||||||
aggregate_of_instance::ptr ret(new aggregate_of_instance);
|
aggregate_of_instance::ptr ret(new aggregate_of_instance);
|
||||||
for (auto& i : byref_excl[t]) {
|
for (auto& i : byref_excl_[t]) {
|
||||||
ret->push(instance_by_id(i));
|
ret->push(instance_by_id(i));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcUtil::IfcBaseClass* IfcFile::instance_by_id(int id) {
|
IfcUtil::IfcBaseClass* IfcFile::instance_by_id(int id) {
|
||||||
entity_by_id_t::const_iterator it = byid.find(id);
|
entity_by_id_t::const_iterator it = byid_.find(id);
|
||||||
if (it == byid.end()) {
|
if (it == byid_.end()) {
|
||||||
throw IfcException("Instance #" + boost::lexical_cast<std::string>(id) + " not found");
|
throw IfcException("Instance #" + boost::lexical_cast<std::string>(id) + " not found");
|
||||||
}
|
}
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcUtil::IfcBaseClass* IfcFile::instance_by_guid(const std::string& guid) {
|
IfcUtil::IfcBaseClass* IfcFile::instance_by_guid(const std::string& guid) {
|
||||||
entity_by_guid_t::const_iterator it = byguid.find(guid);
|
entity_by_guid_t::const_iterator it = byguid_.find(guid);
|
||||||
if (it == byguid.end()) {
|
if (it == byguid_.end()) {
|
||||||
throw IfcException("Instance with GlobalId '" + guid + "' not found");
|
throw IfcException("Instance with GlobalId '" + guid + "' not found");
|
||||||
}
|
}
|
||||||
return it->second;
|
return it->second;
|
||||||
@@ -2419,10 +2418,10 @@ IfcUtil::IfcBaseClass* IfcFile::instance_by_guid(const std::string& guid) {
|
|||||||
// FIXME: Test destructor to delete entity and arg allocations
|
// FIXME: Test destructor to delete entity and arg allocations
|
||||||
IfcFile::~IfcFile() {
|
IfcFile::~IfcFile() {
|
||||||
std::set<IfcUtil::IfcBaseClass*> entities_to_delete;
|
std::set<IfcUtil::IfcBaseClass*> entities_to_delete;
|
||||||
for (const auto& pair : byid) {
|
for (const auto& pair : byid_) {
|
||||||
entities_to_delete.insert(pair.second);
|
entities_to_delete.insert(pair.second);
|
||||||
}
|
}
|
||||||
for (const auto& pair : byidentity) {
|
for (const auto& pair : byidentity_) {
|
||||||
entities_to_delete.insert(pair.second);
|
entities_to_delete.insert(pair.second);
|
||||||
}
|
}
|
||||||
for (auto* entity : entities_to_delete) {
|
for (auto* entity : entities_to_delete) {
|
||||||
@@ -2433,27 +2432,27 @@ IfcFile::~IfcFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::entity_by_id_t::const_iterator IfcFile::begin() const {
|
IfcFile::entity_by_id_t::const_iterator IfcFile::begin() const {
|
||||||
return byid.begin();
|
return byid_.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::entity_by_id_t::const_iterator IfcFile::end() const {
|
IfcFile::entity_by_id_t::const_iterator IfcFile::end() const {
|
||||||
return byid.end();
|
return byid_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::type_iterator IfcFile::types_begin() const {
|
IfcFile::type_iterator IfcFile::types_begin() const {
|
||||||
return bytype_excl.begin();
|
return bytype_excl_.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::type_iterator IfcFile::types_end() const {
|
IfcFile::type_iterator IfcFile::types_end() const {
|
||||||
return bytype_excl.end();
|
return bytype_excl_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::type_iterator IfcFile::types_incl_super_begin() const {
|
IfcFile::type_iterator IfcFile::types_incl_super_begin() const {
|
||||||
return bytype.begin();
|
return bytype_.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFile::type_iterator IfcFile::types_incl_super_end() const {
|
IfcFile::type_iterator IfcFile::types_incl_super_end() const {
|
||||||
return bytype.end();
|
return bytype_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -2503,8 +2502,8 @@ std::string IfcFile::createTimestamp() const {
|
|||||||
std::vector<int> IfcFile::get_inverse_indices(int instance_id) {
|
std::vector<int> IfcFile::get_inverse_indices(int instance_id) {
|
||||||
std::vector<int> return_value;
|
std::vector<int> return_value;
|
||||||
|
|
||||||
auto lower = byref.lower_bound({instance_id, -1, -1});
|
auto lower = byref_.lower_bound({instance_id, -1, -1});
|
||||||
auto upper = byref.upper_bound({instance_id, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()});
|
auto upper = byref_.upper_bound({instance_id, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()});
|
||||||
|
|
||||||
// Mapping of instance id to attribute offset.
|
// Mapping of instance id to attribute offset.
|
||||||
std::map<int, std::vector<int>> mapping;
|
std::map<int, std::vector<int>> mapping;
|
||||||
@@ -2549,8 +2548,8 @@ aggregate_of_instance::ptr IfcFile::getInverse(int instance_id, const IfcParse::
|
|||||||
aggregate_of_instance::ptr return_value(new aggregate_of_instance);
|
aggregate_of_instance::ptr return_value(new aggregate_of_instance);
|
||||||
|
|
||||||
if (attribute_index == -1) {
|
if (attribute_index == -1) {
|
||||||
auto lower = byref.lower_bound({instance_id, type->index_in_schema(), -1});
|
auto lower = byref_.lower_bound({instance_id, type->index_in_schema(), -1});
|
||||||
auto upper = byref.upper_bound({instance_id, type->index_in_schema(), std::numeric_limits<int>::max()});
|
auto upper = byref_.upper_bound({instance_id, type->index_in_schema(), std::numeric_limits<int>::max()});
|
||||||
|
|
||||||
for (auto it = lower; it != upper; ++it) {
|
for (auto it = lower; it != upper; ++it) {
|
||||||
for (auto& i : it->second) {
|
for (auto& i : it->second) {
|
||||||
@@ -2558,8 +2557,8 @@ aggregate_of_instance::ptr IfcFile::getInverse(int instance_id, const IfcParse::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto it = byref.find({instance_id, type->index_in_schema(), attribute_index});
|
auto it = byref_.find({instance_id, type->index_in_schema(), attribute_index});
|
||||||
if (it != byref.end()) {
|
if (it != byref_.end()) {
|
||||||
for (auto& i : it->second) {
|
for (auto& i : it->second) {
|
||||||
return_value->push(instance_by_id(i));
|
return_value->push(instance_by_id(i));
|
||||||
}
|
}
|
||||||
@@ -2570,7 +2569,7 @@ aggregate_of_instance::ptr IfcFile::getInverse(int instance_id, const IfcParse::
|
|||||||
}
|
}
|
||||||
|
|
||||||
int IfcFile::getTotalInverses(int instance_id) {
|
int IfcFile::getTotalInverses(int instance_id) {
|
||||||
return byref_excl[instance_id].size();
|
return byref_excl_[instance_id].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcFile::setDefaultHeaderValues() {
|
void IfcFile::setDefaultHeaderValues() {
|
||||||
@@ -2668,9 +2667,9 @@ void IfcParse::IfcFile::build_inverses_(IfcUtil::IfcBaseClass* inst) {
|
|||||||
if (attr->declaration().as_entity() != nullptr) {
|
if (attr->declaration().as_entity() != nullptr) {
|
||||||
unsigned entity_attribute_id = attr->data().id();
|
unsigned entity_attribute_id = attr->data().id();
|
||||||
const auto* decl = inst->declaration().as_entity();
|
const auto* decl = inst->declaration().as_entity();
|
||||||
byref_excl[entity_attribute_id].push_back(inst->data().id());
|
byref_excl_[entity_attribute_id].push_back(inst->data().id());
|
||||||
while (decl != nullptr) {
|
while (decl != nullptr) {
|
||||||
byref[{entity_attribute_id, decl->index_in_schema(), idx}].push_back(inst->data().id());
|
byref_[{entity_attribute_id, decl->index_in_schema(), idx}].push_back(inst->data().id());
|
||||||
decl = decl->supertype();
|
decl = decl->supertype();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ Token NoneTokenPtr();
|
|||||||
/// A stream of tokens to be read from a IfcSpfStream.
|
/// A stream of tokens to be read from a IfcSpfStream.
|
||||||
class IFC_PARSE_API IfcSpfLexer {
|
class IFC_PARSE_API IfcSpfLexer {
|
||||||
private:
|
private:
|
||||||
IfcCharacterDecoder* decoder;
|
IfcCharacterDecoder* decoder_;
|
||||||
unsigned int skipWhitespace();
|
unsigned int skipWhitespace();
|
||||||
unsigned int skipComment();
|
unsigned int skipComment();
|
||||||
|
|
||||||
@@ -219,7 +219,6 @@ class IFC_PARSE_API NullArgument : public Argument {
|
|||||||
/// #1=IfcVector(#2,1.0);
|
/// #1=IfcVector(#2,1.0);
|
||||||
/// == ===
|
/// == ===
|
||||||
class IFC_PARSE_API TokenArgument : public Argument {
|
class IFC_PARSE_API TokenArgument : public Argument {
|
||||||
private:
|
|
||||||
public:
|
public:
|
||||||
Token token;
|
Token token;
|
||||||
TokenArgument(const Token& t);
|
TokenArgument(const Token& t);
|
||||||
@@ -246,7 +245,7 @@ class IFC_PARSE_API TokenArgument : public Argument {
|
|||||||
/// ===================== =====================
|
/// ===================== =====================
|
||||||
class IFC_PARSE_API EntityArgument : public Argument {
|
class IFC_PARSE_API EntityArgument : public Argument {
|
||||||
private:
|
private:
|
||||||
IfcUtil::IfcBaseClass* entity;
|
IfcUtil::IfcBaseClass* entity_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EntityArgument(const Token& t);
|
EntityArgument(const Token& t);
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ class IFC_PARSE_API aggregation_type : public parameter_type {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
aggregate_type type_of_aggregation_;
|
aggregate_type type_of_aggregation_;
|
||||||
int bound1_, bound2_;
|
int bound1_;
|
||||||
|
int bound2_;
|
||||||
parameter_type* type_of_element_;
|
parameter_type* type_of_element_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -268,7 +269,8 @@ class IFC_PARSE_API inverse_attribute {
|
|||||||
protected:
|
protected:
|
||||||
std::string name_;
|
std::string name_;
|
||||||
aggregate_type type_of_aggregation_;
|
aggregate_type type_of_aggregation_;
|
||||||
int bound1_, bound2_;
|
int bound1_;
|
||||||
|
int bound2_;
|
||||||
const entity* entity_reference_;
|
const entity* entity_reference_;
|
||||||
const attribute* attribute_reference_;
|
const attribute* attribute_reference_;
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ using namespace IfcParse;
|
|||||||
|
|
||||||
HeaderEntity::HeaderEntity(const char* const datatype, size_t size, IfcFile* file)
|
HeaderEntity::HeaderEntity(const char* const datatype, size_t size, IfcFile* file)
|
||||||
: IfcEntityInstanceData(file, size),
|
: IfcEntityInstanceData(file, size),
|
||||||
_datatype(datatype),
|
datatype_(datatype),
|
||||||
size_(size) {
|
size_(size) {
|
||||||
if (file != nullptr) {
|
if (file != nullptr) {
|
||||||
offset_in_file_ = file->stream->Tell();
|
offset_in_file_ = file->stream->Tell();
|
||||||
@@ -88,18 +88,18 @@ void IfcSpfHeader::read() {
|
|||||||
// ISO 10303-21 Second edition 2002-01-15 p. 16
|
// ISO 10303-21 Second edition 2002-01-15 p. 16
|
||||||
|
|
||||||
readTerminal(FILE_DESCRIPTION, NONE);
|
readTerminal(FILE_DESCRIPTION, NONE);
|
||||||
delete _file_description;
|
delete file_description_;
|
||||||
_file_description = new FileDescription(file_);
|
file_description_ = new FileDescription(file_);
|
||||||
// readSemicolon();
|
// readSemicolon();
|
||||||
|
|
||||||
readTerminal(FILE_NAME, NONE);
|
readTerminal(FILE_NAME, NONE);
|
||||||
delete _file_name;
|
delete file_name_;
|
||||||
_file_name = new FileName(file_);
|
file_name_ = new FileName(file_);
|
||||||
// readSemicolon();
|
// readSemicolon();
|
||||||
|
|
||||||
readTerminal(FILE_SCHEMA, NONE);
|
readTerminal(FILE_SCHEMA, NONE);
|
||||||
delete _file_schema;
|
delete file_schema_;
|
||||||
_file_schema = new FileSchema(file_);
|
file_schema_ = new FileSchema(file_);
|
||||||
// readSemicolon();
|
// readSemicolon();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,45 +131,45 @@ void IfcSpfHeader::write(std::ostream& os) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FileDescription& IfcSpfHeader::file_description() const {
|
const FileDescription& IfcSpfHeader::file_description() const {
|
||||||
if (_file_description == nullptr) {
|
if (file_description_ == nullptr) {
|
||||||
throw IfcException("File description not set");
|
throw IfcException("File description not set");
|
||||||
}
|
}
|
||||||
return *_file_description;
|
return *file_description_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileName& IfcSpfHeader::file_name() const {
|
const FileName& IfcSpfHeader::file_name() const {
|
||||||
if (_file_name == nullptr) {
|
if (file_name_ == nullptr) {
|
||||||
throw IfcException("File name not set");
|
throw IfcException("File name not set");
|
||||||
}
|
}
|
||||||
return *_file_name;
|
return *file_name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileSchema& IfcSpfHeader::file_schema() const {
|
const FileSchema& IfcSpfHeader::file_schema() const {
|
||||||
if (_file_schema == nullptr) {
|
if (file_schema_ == nullptr) {
|
||||||
throw IfcException("File schema not set");
|
throw IfcException("File schema not set");
|
||||||
}
|
}
|
||||||
return *_file_schema;
|
return *file_schema_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDescription& IfcSpfHeader::file_description() {
|
FileDescription& IfcSpfHeader::file_description() {
|
||||||
if (_file_description == nullptr) {
|
if (file_description_ == nullptr) {
|
||||||
throw IfcException("File description not set");
|
throw IfcException("File description not set");
|
||||||
}
|
}
|
||||||
return *_file_description;
|
return *file_description_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName& IfcSpfHeader::file_name() {
|
FileName& IfcSpfHeader::file_name() {
|
||||||
if (_file_name == nullptr) {
|
if (file_name_ == nullptr) {
|
||||||
throw IfcException("File name not set");
|
throw IfcException("File name not set");
|
||||||
}
|
}
|
||||||
return *_file_name;
|
return *file_name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSchema& IfcSpfHeader::file_schema() {
|
FileSchema& IfcSpfHeader::file_schema() {
|
||||||
if (_file_schema == nullptr) {
|
if (file_schema_ == nullptr) {
|
||||||
throw IfcException("File schema not set");
|
throw IfcException("File schema not set");
|
||||||
}
|
}
|
||||||
return *_file_schema;
|
return *file_schema_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDescription::FileDescription(IfcFile* file) : HeaderEntity(FILE_DESCRIPTION, 2, file) {}
|
FileDescription::FileDescription(IfcFile* file) : HeaderEntity(FILE_DESCRIPTION, 2, file) {}
|
||||||
|
|||||||
+14
-14
@@ -27,7 +27,7 @@ namespace IfcParse {
|
|||||||
|
|
||||||
class IFC_PARSE_API HeaderEntity : public IfcEntityInstanceData {
|
class IFC_PARSE_API HeaderEntity : public IfcEntityInstanceData {
|
||||||
private:
|
private:
|
||||||
const char* const _datatype;
|
const char* const datatype_;
|
||||||
size_t size_;
|
size_t size_;
|
||||||
|
|
||||||
HeaderEntity(const HeaderEntity&); //N/A
|
HeaderEntity(const HeaderEntity&); //N/A
|
||||||
@@ -55,7 +55,7 @@ class IFC_PARSE_API HeaderEntity : public IfcEntityInstanceData {
|
|||||||
|
|
||||||
std::string toString(bool upper = false) const {
|
std::string toString(bool upper = false) const {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << _datatype << IfcEntityInstanceData::toString(upper);
|
ss << datatype_ << IfcEntityInstanceData::toString(upper);
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -104,9 +104,9 @@ class IFC_PARSE_API FileSchema : public HeaderEntity {
|
|||||||
class IFC_PARSE_API IfcSpfHeader {
|
class IFC_PARSE_API IfcSpfHeader {
|
||||||
private:
|
private:
|
||||||
IfcFile* file_;
|
IfcFile* file_;
|
||||||
FileDescription* _file_description;
|
FileDescription* file_description_;
|
||||||
FileName* _file_name;
|
FileName* file_name_;
|
||||||
FileSchema* _file_schema;
|
FileSchema* file_schema_;
|
||||||
void readParen();
|
void readParen();
|
||||||
void readSemicolon();
|
void readSemicolon();
|
||||||
enum Trail {
|
enum Trail {
|
||||||
@@ -119,18 +119,18 @@ class IFC_PARSE_API IfcSpfHeader {
|
|||||||
public:
|
public:
|
||||||
explicit IfcSpfHeader(IfcParse::IfcFile* file = 0)
|
explicit IfcSpfHeader(IfcParse::IfcFile* file = 0)
|
||||||
: file_(file),
|
: file_(file),
|
||||||
_file_description(0),
|
file_description_(0),
|
||||||
_file_name(0),
|
file_name_(0),
|
||||||
_file_schema(0) {
|
file_schema_(0) {
|
||||||
_file_description = new FileDescription(file_);
|
file_description_ = new FileDescription(file_);
|
||||||
_file_name = new FileName(file_);
|
file_name_ = new FileName(file_);
|
||||||
_file_schema = new FileSchema(file_);
|
file_schema_ = new FileSchema(file_);
|
||||||
}
|
}
|
||||||
|
|
||||||
~IfcSpfHeader() {
|
~IfcSpfHeader() {
|
||||||
delete _file_schema;
|
delete file_schema_;
|
||||||
delete _file_name;
|
delete file_name_;
|
||||||
delete _file_description;
|
delete file_description_;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcParse::IfcFile* file() { return file_; }
|
IfcParse::IfcFile* file() { return file_; }
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ class IFC_PARSE_API IfcSpfStream {
|
|||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
boost::iostreams::mapped_file_source mfs;
|
boost::iostreams::mapped_file_source mfs;
|
||||||
#endif
|
#endif
|
||||||
FILE* stream;
|
FILE* stream_;
|
||||||
const char* buffer;
|
const char* buffer_;
|
||||||
unsigned int ptr;
|
unsigned int ptr_;
|
||||||
unsigned int len;
|
unsigned int len_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool valid;
|
bool valid;
|
||||||
|
|||||||
+10
-10
@@ -63,32 +63,32 @@
|
|||||||
|
|
||||||
void aggregate_of_instance::push(IfcUtil::IfcBaseClass* l) {
|
void aggregate_of_instance::push(IfcUtil::IfcBaseClass* l) {
|
||||||
if (l != nullptr) {
|
if (l != nullptr) {
|
||||||
ls.push_back(l);
|
list_.push_back(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void aggregate_of_instance::push(const aggregate_of_instance::ptr& l) {
|
void aggregate_of_instance::push(const aggregate_of_instance::ptr& l) {
|
||||||
if (l) {
|
if (l) {
|
||||||
for (it i = l->begin(); i != l->end(); ++i) {
|
for (it i = l->begin(); i != l->end(); ++i) {
|
||||||
if (*i != nullptr) {
|
if (*i != nullptr) {
|
||||||
ls.push_back(*i);
|
list_.push_back(*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsigned int aggregate_of_instance::size() const { return (unsigned int)ls.size(); }
|
unsigned int aggregate_of_instance::size() const { return (unsigned int)list_.size(); }
|
||||||
void aggregate_of_instance::reserve(unsigned capacity) { ls.reserve((size_t)capacity); }
|
void aggregate_of_instance::reserve(unsigned capacity) { list_.reserve((size_t)capacity); }
|
||||||
aggregate_of_instance::it aggregate_of_instance::begin() { return ls.begin(); }
|
aggregate_of_instance::it aggregate_of_instance::begin() { return list_.begin(); }
|
||||||
aggregate_of_instance::it aggregate_of_instance::end() { return ls.end(); }
|
aggregate_of_instance::it aggregate_of_instance::end() { return list_.end(); }
|
||||||
IfcUtil::IfcBaseClass* aggregate_of_instance::operator[](int i) {
|
IfcUtil::IfcBaseClass* aggregate_of_instance::operator[](int i) {
|
||||||
return ls[i];
|
return list_[i];
|
||||||
}
|
}
|
||||||
bool aggregate_of_instance::contains(IfcUtil::IfcBaseClass* instance) const {
|
bool aggregate_of_instance::contains(IfcUtil::IfcBaseClass* instance) const {
|
||||||
return std::find(ls.begin(), ls.end(), instance) != ls.end();
|
return std::find(list_.begin(), list_.end(), instance) != list_.end();
|
||||||
}
|
}
|
||||||
void aggregate_of_instance::remove(IfcUtil::IfcBaseClass* instance) {
|
void aggregate_of_instance::remove(IfcUtil::IfcBaseClass* instance) {
|
||||||
std::vector<IfcUtil::IfcBaseClass*>::iterator it;
|
std::vector<IfcUtil::IfcBaseClass*>::iterator it;
|
||||||
while ((it = std::find(ls.begin(), ls.end(), instance)) != ls.end()) {
|
while ((it = std::find(list_.begin(), list_.end(), instance)) != list_.end()) {
|
||||||
ls.erase(it);
|
list_.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -273,12 +273,12 @@ std::string IfcWriteArgument::toString(bool upper) const {
|
|||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
str.imbue(std::locale::classic());
|
str.imbue(std::locale::classic());
|
||||||
StringBuilderVisitor v(str, upper);
|
StringBuilderVisitor v(str, upper);
|
||||||
container.apply_visitor(v);
|
container_.apply_visitor(v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
unsigned int IfcWriteArgument::size() const {
|
unsigned int IfcWriteArgument::size() const {
|
||||||
SizeVisitor v;
|
SizeVisitor v;
|
||||||
const int size = container.apply_visitor(v);
|
const int size = container_.apply_visitor(v);
|
||||||
if (size == -1) {
|
if (size == -1) {
|
||||||
throw IfcParse::IfcException("Invalid cast");
|
throw IfcParse::IfcException("Invalid cast");
|
||||||
}
|
}
|
||||||
@@ -286,32 +286,32 @@ unsigned int IfcWriteArgument::size() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IfcUtil::ArgumentType IfcWriteArgument::type() const {
|
IfcUtil::ArgumentType IfcWriteArgument::type() const {
|
||||||
return static_cast<IfcUtil::ArgumentType>(container.which());
|
return static_cast<IfcUtil::ArgumentType>(container_.which());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overload to detect null values
|
// Overload to detect null values
|
||||||
void IfcWriteArgument::set(const aggregate_of_instance::ptr& v) {
|
void IfcWriteArgument::set(const aggregate_of_instance::ptr& v) {
|
||||||
if (v) {
|
if (v) {
|
||||||
container = v;
|
container_ = v;
|
||||||
} else {
|
} else {
|
||||||
container = boost::blank();
|
container_ = boost::blank();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overload to detect null values
|
// Overload to detect null values
|
||||||
void IfcWriteArgument::set(const aggregate_of_aggregate_of_instance::ptr& v) {
|
void IfcWriteArgument::set(const aggregate_of_aggregate_of_instance::ptr& v) {
|
||||||
if (v) {
|
if (v) {
|
||||||
container = v;
|
container_ = v;
|
||||||
} else {
|
} else {
|
||||||
container = boost::blank();
|
container_ = boost::blank();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overload to detect null values
|
// Overload to detect null values
|
||||||
void IfcWriteArgument::set(IfcUtil::IfcBaseInterface* const& v) {
|
void IfcWriteArgument::set(IfcUtil::IfcBaseInterface* const& v) {
|
||||||
if (v != nullptr) {
|
if (v != nullptr) {
|
||||||
container = v->as<IfcUtil::IfcBaseClass>();
|
container_ = v->as<IfcUtil::IfcBaseClass>();
|
||||||
} else {
|
} else {
|
||||||
container = boost::blank();
|
container_ = boost::blank();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,12 +115,12 @@ class IFC_PARSE_API IfcWriteArgument : public Argument {
|
|||||||
std::vector<std::vector<double>>,
|
std::vector<std::vector<double>>,
|
||||||
// An aggregate of an aggregate of entities. E.g. ((#1, #2), (#3))
|
// An aggregate of an aggregate of entities. E.g. ((#1, #2), (#3))
|
||||||
aggregate_of_aggregate_of_instance::ptr>
|
aggregate_of_aggregate_of_instance::ptr>
|
||||||
container;
|
container_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T& as() const {
|
const T& as() const {
|
||||||
if (const T* val = boost::get<T>(&container)) {
|
if (const T* val = boost::get<T>(&container_)) {
|
||||||
return *val;
|
return *val;
|
||||||
}
|
}
|
||||||
throw IfcParse::IfcException("Invalid cast");
|
throw IfcParse::IfcException("Invalid cast");
|
||||||
@@ -129,7 +129,7 @@ class IFC_PARSE_API IfcWriteArgument : public Argument {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
typename boost::disable_if<boost::is_base_of<IfcUtil::IfcBaseInterface, typename boost::remove_pointer<T>::type>, void>::type
|
typename boost::disable_if<boost::is_base_of<IfcUtil::IfcBaseInterface, typename boost::remove_pointer<T>::type>, void>::type
|
||||||
set(const T& t) {
|
set(const T& t) {
|
||||||
container = t;
|
container_ = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overload to detect null values
|
// Overload to detect null values
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ template <class T>
|
|||||||
class aggregate_of;
|
class aggregate_of;
|
||||||
|
|
||||||
class IFC_PARSE_API aggregate_of_instance {
|
class IFC_PARSE_API aggregate_of_instance {
|
||||||
std::vector<IfcUtil::IfcBaseClass*> ls;
|
std::vector<IfcUtil::IfcBaseClass*> list_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef boost::shared_ptr<aggregate_of_instance> ptr;
|
typedef boost::shared_ptr<aggregate_of_instance> ptr;
|
||||||
@@ -59,14 +59,14 @@ class IFC_PARSE_API aggregate_of_instance {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class aggregate_of {
|
class aggregate_of {
|
||||||
std::vector<T*> ls;
|
std::vector<T*> list_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef boost::shared_ptr<aggregate_of<T>> ptr;
|
typedef boost::shared_ptr<aggregate_of<T>> ptr;
|
||||||
typedef typename std::vector<T*>::const_iterator it;
|
typedef typename std::vector<T*>::const_iterator it;
|
||||||
void push(T* t) {
|
void push(T* t) {
|
||||||
if (t) {
|
if (t) {
|
||||||
ls.push_back(t);
|
list_.push_back(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void push(ptr t) {
|
void push(ptr t) {
|
||||||
@@ -76,9 +76,9 @@ class aggregate_of {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it begin() { return ls.begin(); }
|
it begin() { return list_.begin(); }
|
||||||
it end() { return ls.end(); }
|
it end() { return list_.end(); }
|
||||||
unsigned int size() const { return (unsigned int)ls.size(); }
|
unsigned int size() const { return (unsigned int)list_.size(); }
|
||||||
aggregate_of_instance::ptr generalize() {
|
aggregate_of_instance::ptr generalize() {
|
||||||
aggregate_of_instance::ptr r(new aggregate_of_instance());
|
aggregate_of_instance::ptr r(new aggregate_of_instance());
|
||||||
for (it i = begin(); i != end(); ++i) {
|
for (it i = begin(); i != end(); ++i) {
|
||||||
@@ -86,7 +86,7 @@ class aggregate_of {
|
|||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
bool contains(T* t) const { return std::find(ls.begin(), ls.end(), t) != ls.end(); }
|
bool contains(T* t) const { return std::find(list_.begin(), list_.end(), t) != list_.end(); }
|
||||||
template <class U>
|
template <class U>
|
||||||
typename U::list::ptr as() {
|
typename U::list::ptr as() {
|
||||||
typename U::list::ptr r(new typename U::list);
|
typename U::list::ptr r(new typename U::list);
|
||||||
@@ -100,8 +100,8 @@ class aggregate_of {
|
|||||||
}
|
}
|
||||||
void remove(T* t) {
|
void remove(T* t) {
|
||||||
typename std::vector<T*>::iterator it;
|
typename std::vector<T*>::iterator it;
|
||||||
while ((it = std::find(ls.begin(), ls.end(), t)) != ls.end()) {
|
while ((it = std::find(list_.begin(), list_.end(), t)) != list_.end()) {
|
||||||
ls.erase(it);
|
list_.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -110,14 +110,14 @@ template <class T>
|
|||||||
class aggregate_of_aggregate_of;
|
class aggregate_of_aggregate_of;
|
||||||
|
|
||||||
class IFC_PARSE_API aggregate_of_aggregate_of_instance {
|
class IFC_PARSE_API aggregate_of_aggregate_of_instance {
|
||||||
std::vector<std::vector<IfcUtil::IfcBaseClass*>> ls;
|
std::vector<std::vector<IfcUtil::IfcBaseClass*>> list_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef boost::shared_ptr<aggregate_of_aggregate_of_instance> ptr;
|
typedef boost::shared_ptr<aggregate_of_aggregate_of_instance> ptr;
|
||||||
typedef std::vector<std::vector<IfcUtil::IfcBaseClass*>>::const_iterator outer_it;
|
typedef std::vector<std::vector<IfcUtil::IfcBaseClass*>>::const_iterator outer_it;
|
||||||
typedef std::vector<IfcUtil::IfcBaseClass*>::const_iterator inner_it;
|
typedef std::vector<IfcUtil::IfcBaseClass*>::const_iterator inner_it;
|
||||||
void push(const std::vector<IfcUtil::IfcBaseClass*>& l) {
|
void push(const std::vector<IfcUtil::IfcBaseClass*>& l) {
|
||||||
ls.push_back(l);
|
list_.push_back(l);
|
||||||
}
|
}
|
||||||
void push(const aggregate_of_instance::ptr& l) {
|
void push(const aggregate_of_instance::ptr& l) {
|
||||||
if (l) {
|
if (l) {
|
||||||
@@ -128,9 +128,9 @@ class IFC_PARSE_API aggregate_of_aggregate_of_instance {
|
|||||||
push(li);
|
push(li);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer_it begin() const { return ls.begin(); }
|
outer_it begin() const { return list_.begin(); }
|
||||||
outer_it end() const { return ls.end(); }
|
outer_it end() const { return list_.end(); }
|
||||||
int size() const { return (int)ls.size(); }
|
int size() const { return (int)list_.size(); }
|
||||||
int totalSize() const {
|
int totalSize() const {
|
||||||
int accum = 0;
|
int accum = 0;
|
||||||
for (outer_it it = begin(); it != end(); ++it) {
|
for (outer_it it = begin(); it != end(); ++it) {
|
||||||
@@ -167,16 +167,16 @@ class IFC_PARSE_API aggregate_of_aggregate_of_instance {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class aggregate_of_aggregate_of {
|
class aggregate_of_aggregate_of {
|
||||||
std::vector<std::vector<T*>> ls;
|
std::vector<std::vector<T*>> list_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename boost::shared_ptr<aggregate_of_aggregate_of<T>> ptr;
|
typedef typename boost::shared_ptr<aggregate_of_aggregate_of<T>> ptr;
|
||||||
typedef typename std::vector<std::vector<T*>>::const_iterator outer_it;
|
typedef typename std::vector<std::vector<T*>>::const_iterator outer_it;
|
||||||
typedef typename std::vector<T*>::const_iterator inner_it;
|
typedef typename std::vector<T*>::const_iterator inner_it;
|
||||||
void push(const std::vector<T*>& t) { ls.push_back(t); }
|
void push(const std::vector<T*>& t) { list_.push_back(t); }
|
||||||
outer_it begin() { return ls.begin(); }
|
outer_it begin() { return list_.begin(); }
|
||||||
outer_it end() { return ls.end(); }
|
outer_it end() { return list_.end(); }
|
||||||
int size() const { return (int)ls.size(); }
|
int size() const { return (int)list_.size(); }
|
||||||
int totalSize() const {
|
int totalSize() const {
|
||||||
int accum = 0;
|
int accum = 0;
|
||||||
for (outer_it it = begin(); it != end(); ++it) {
|
for (outer_it it = begin(); it != end(); ++it) {
|
||||||
|
|||||||
Reference in New Issue
Block a user