From f006f143ab9ca9ba35872b1a6724678f6d3d32cb Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 23 Dec 2022 16:56:21 -0800 Subject: [PATCH 01/50] Refactored source files to mtconnect subdirectory --- src/{ => mtconnect}/agent.cpp | 0 src/{ => mtconnect}/agent.hpp | 0 src/{ => mtconnect}/asset/asset.cpp | 0 src/{ => mtconnect}/asset/asset.hpp | 0 src/{ => mtconnect}/asset/asset_buffer.hpp | 0 src/{ => mtconnect}/asset/asset_storage.hpp | 0 src/{ => mtconnect}/asset/cutting_tool.cpp | 0 src/{ => mtconnect}/asset/cutting_tool.hpp | 0 src/{ => mtconnect}/asset/file_asset.cpp | 0 src/{ => mtconnect}/asset/file_asset.hpp | 0 src/{ => mtconnect}/asset/qif_document.cpp | 0 src/{ => mtconnect}/asset/qif_document.hpp | 0 src/{ => mtconnect}/asset/raw_material.cpp | 0 src/{ => mtconnect}/asset/raw_material.hpp | 0 src/{ => mtconnect}/buffer/checkpoint.cpp | 0 src/{ => mtconnect}/buffer/checkpoint.hpp | 0 src/{ => mtconnect}/buffer/circular_buffer.hpp | 0 src/{ => mtconnect}/configuration/agent_config.cpp | 0 src/{ => mtconnect}/configuration/agent_config.hpp | 0 src/{ => mtconnect}/configuration/async_context.hpp | 0 src/{ => mtconnect}/configuration/config_options.hpp | 0 src/{ => mtconnect}/configuration/parser.cpp | 0 src/{ => mtconnect}/configuration/parser.hpp | 0 src/{ => mtconnect}/configuration/service.cpp | 0 src/{ => mtconnect}/configuration/service.hpp | 0 src/{ => mtconnect}/device_model/agent_device.cpp | 0 src/{ => mtconnect}/device_model/agent_device.hpp | 0 src/{ => mtconnect}/device_model/component.cpp | 0 src/{ => mtconnect}/device_model/component.hpp | 0 src/{ => mtconnect}/device_model/composition.cpp | 0 src/{ => mtconnect}/device_model/composition.hpp | 0 src/{ => mtconnect}/device_model/configuration/configuration.cpp | 0 src/{ => mtconnect}/device_model/configuration/configuration.hpp | 0 .../device_model/configuration/coordinate_systems.cpp | 0 .../device_model/configuration/coordinate_systems.hpp | 0 src/{ => mtconnect}/device_model/configuration/motion.cpp | 0 src/{ => mtconnect}/device_model/configuration/motion.hpp | 0 src/{ => mtconnect}/device_model/configuration/relationships.cpp | 0 src/{ => mtconnect}/device_model/configuration/relationships.hpp | 0 .../device_model/configuration/sensor_configuration.cpp | 0 .../device_model/configuration/sensor_configuration.hpp | 0 src/{ => mtconnect}/device_model/configuration/solid_model.cpp | 0 src/{ => mtconnect}/device_model/configuration/solid_model.hpp | 0 src/{ => mtconnect}/device_model/configuration/specifications.cpp | 0 src/{ => mtconnect}/device_model/configuration/specifications.hpp | 0 src/{ => mtconnect}/device_model/data_item/constraints.hpp | 0 src/{ => mtconnect}/device_model/data_item/data_item.cpp | 0 src/{ => mtconnect}/device_model/data_item/data_item.hpp | 0 src/{ => mtconnect}/device_model/data_item/definition.hpp | 0 src/{ => mtconnect}/device_model/data_item/filter.hpp | 0 src/{ => mtconnect}/device_model/data_item/relationships.hpp | 0 src/{ => mtconnect}/device_model/data_item/source.hpp | 0 src/{ => mtconnect}/device_model/data_item/unit_conversion.cpp | 0 src/{ => mtconnect}/device_model/data_item/unit_conversion.hpp | 0 src/{ => mtconnect}/device_model/description.cpp | 0 src/{ => mtconnect}/device_model/description.hpp | 0 src/{ => mtconnect}/device_model/device.cpp | 0 src/{ => mtconnect}/device_model/device.hpp | 0 src/{ => mtconnect}/device_model/reference.cpp | 0 src/{ => mtconnect}/device_model/reference.hpp | 0 src/{ => mtconnect}/entity/data_set.cpp | 0 src/{ => mtconnect}/entity/data_set.hpp | 0 src/{ => mtconnect}/entity/entity.cpp | 0 src/{ => mtconnect}/entity/entity.hpp | 0 src/{ => mtconnect}/entity/factory.cpp | 0 src/{ => mtconnect}/entity/factory.hpp | 0 src/{ => mtconnect}/entity/json_parser.cpp | 0 src/{ => mtconnect}/entity/json_parser.hpp | 0 src/{ => mtconnect}/entity/json_printer.cpp | 0 src/{ => mtconnect}/entity/json_printer.hpp | 0 src/{ => mtconnect}/entity/qname.hpp | 0 src/{ => mtconnect}/entity/requirement.cpp | 0 src/{ => mtconnect}/entity/requirement.hpp | 0 src/{ => mtconnect}/entity/xml_parser.cpp | 0 src/{ => mtconnect}/entity/xml_parser.hpp | 0 src/{ => mtconnect}/entity/xml_printer.cpp | 0 src/{ => mtconnect}/entity/xml_printer.hpp | 0 src/{ => mtconnect}/logging.hpp | 0 src/{ => mtconnect}/mqtt/mqtt_client.hpp | 0 src/{ => mtconnect}/mqtt/mqtt_client_impl.hpp | 0 src/{ => mtconnect}/mqtt/mqtt_server.hpp | 0 src/{ => mtconnect}/mqtt/mqtt_server_impl.hpp | 0 src/{ => mtconnect}/observation/change_observer.cpp | 0 src/{ => mtconnect}/observation/change_observer.hpp | 0 src/{ => mtconnect}/observation/observation.cpp | 0 src/{ => mtconnect}/observation/observation.hpp | 0 src/{ => mtconnect}/parser/xml_parser.cpp | 0 src/{ => mtconnect}/parser/xml_parser.hpp | 0 src/{ => mtconnect}/pipeline/convert_sample.hpp | 0 src/{ => mtconnect}/pipeline/deliver.cpp | 0 src/{ => mtconnect}/pipeline/deliver.hpp | 0 src/{ => mtconnect}/pipeline/delta_filter.hpp | 0 src/{ => mtconnect}/pipeline/duplicate_filter.hpp | 0 src/{ => mtconnect}/pipeline/guard.hpp | 0 src/{ => mtconnect}/pipeline/message_mapper.hpp | 0 src/{ => mtconnect}/pipeline/mtconnect_xml_transform.hpp | 0 src/{ => mtconnect}/pipeline/period_filter.hpp | 0 src/{ => mtconnect}/pipeline/pipeline.hpp | 0 src/{ => mtconnect}/pipeline/pipeline_context.hpp | 0 src/{ => mtconnect}/pipeline/pipeline_contract.hpp | 0 src/{ => mtconnect}/pipeline/response_document.cpp | 0 src/{ => mtconnect}/pipeline/response_document.hpp | 0 src/{ => mtconnect}/pipeline/shdr_token_mapper.cpp | 0 src/{ => mtconnect}/pipeline/shdr_token_mapper.hpp | 0 src/{ => mtconnect}/pipeline/shdr_tokenizer.hpp | 0 src/{ => mtconnect}/pipeline/timestamp_extractor.cpp | 0 src/{ => mtconnect}/pipeline/timestamp_extractor.hpp | 0 src/{ => mtconnect}/pipeline/topic_mapper.hpp | 0 src/{ => mtconnect}/pipeline/transform.hpp | 0 src/{ => mtconnect}/pipeline/upcase_value.hpp | 0 src/{ => mtconnect}/printer/json_printer.cpp | 0 src/{ => mtconnect}/printer/json_printer.hpp | 0 src/{ => mtconnect}/printer/printer.hpp | 0 src/{ => mtconnect}/printer/xml_helper.hpp | 0 src/{ => mtconnect}/printer/xml_printer.cpp | 0 src/{ => mtconnect}/printer/xml_printer.hpp | 0 src/{ => mtconnect}/printer/xml_printer_helper.hpp | 0 src/{ => mtconnect}/python/embedded.cpp | 0 src/{ => mtconnect}/python/embedded.hpp | 0 src/{ => mtconnect}/ruby/embedded.cpp | 0 src/{ => mtconnect}/ruby/embedded.hpp | 0 src/{ => mtconnect}/ruby/ruby_agent.hpp | 0 src/{ => mtconnect}/ruby/ruby_entity.hpp | 0 src/{ => mtconnect}/ruby/ruby_observation.hpp | 0 src/{ => mtconnect}/ruby/ruby_pipeline.hpp | 0 src/{ => mtconnect}/ruby/ruby_smart_ptr.hpp | 0 src/{ => mtconnect}/ruby/ruby_transform.hpp | 0 src/{ => mtconnect}/ruby/ruby_type.hpp | 0 src/{ => mtconnect}/ruby/ruby_vm.hpp | 0 src/{ => mtconnect}/sink/mqtt_sink/mqtt_service.cpp | 0 src/{ => mtconnect}/sink/mqtt_sink/mqtt_service.hpp | 0 src/{ => mtconnect}/sink/rest_sink/cached_file.hpp | 0 src/{ => mtconnect}/sink/rest_sink/file_cache.cpp | 0 src/{ => mtconnect}/sink/rest_sink/file_cache.hpp | 0 src/{ => mtconnect}/sink/rest_sink/parameter.hpp | 0 src/{ => mtconnect}/sink/rest_sink/request.hpp | 0 src/{ => mtconnect}/sink/rest_sink/response.hpp | 0 src/{ => mtconnect}/sink/rest_sink/rest_service.cpp | 0 src/{ => mtconnect}/sink/rest_sink/rest_service.hpp | 0 src/{ => mtconnect}/sink/rest_sink/routing.hpp | 0 src/{ => mtconnect}/sink/rest_sink/server.cpp | 0 src/{ => mtconnect}/sink/rest_sink/server.hpp | 0 src/{ => mtconnect}/sink/rest_sink/session.hpp | 0 src/{ => mtconnect}/sink/rest_sink/session_impl.cpp | 0 src/{ => mtconnect}/sink/rest_sink/session_impl.hpp | 0 src/{ => mtconnect}/sink/rest_sink/tls_dector.hpp | 0 src/{ => mtconnect}/sink/sink.cpp | 0 src/{ => mtconnect}/sink/sink.hpp | 0 src/{ => mtconnect}/source/adapter/adapter.hpp | 0 src/{ => mtconnect}/source/adapter/adapter_pipeline.cpp | 0 src/{ => mtconnect}/source/adapter/adapter_pipeline.hpp | 0 .../source/adapter/agent_adapter/agent_adapter.cpp | 0 .../source/adapter/agent_adapter/agent_adapter.hpp | 0 src/{ => mtconnect}/source/adapter/agent_adapter/http_session.hpp | 0 .../source/adapter/agent_adapter/https_session.hpp | 0 src/{ => mtconnect}/source/adapter/agent_adapter/session.hpp | 0 src/{ => mtconnect}/source/adapter/agent_adapter/session_impl.hpp | 0 src/{ => mtconnect}/source/adapter/agent_adapter/url_parser.cpp | 0 src/{ => mtconnect}/source/adapter/agent_adapter/url_parser.hpp | 0 src/{ => mtconnect}/source/adapter/mqtt/mqtt_adapter.cpp | 0 src/{ => mtconnect}/source/adapter/mqtt/mqtt_adapter.hpp | 0 src/{ => mtconnect}/source/adapter/shdr/connector.cpp | 0 src/{ => mtconnect}/source/adapter/shdr/connector.hpp | 0 src/{ => mtconnect}/source/adapter/shdr/shdr_adapter.cpp | 0 src/{ => mtconnect}/source/adapter/shdr/shdr_adapter.hpp | 0 src/{ => mtconnect}/source/adapter/shdr/shdr_pipeline.cpp | 0 src/{ => mtconnect}/source/adapter/shdr/shdr_pipeline.hpp | 0 src/{ => mtconnect}/source/error_code.hpp | 0 src/{ => mtconnect}/source/loopback_source.cpp | 0 src/{ => mtconnect}/source/loopback_source.hpp | 0 src/{ => mtconnect}/source/source.cpp | 0 src/{ => mtconnect}/source/source.hpp | 0 src/{ => mtconnect}/utilities.cpp | 0 src/{ => mtconnect}/utilities.hpp | 0 src/{ => mtconnect}/version.cpp | 0 src/{ => mtconnect}/version.h.in | 0 src/{ => mtconnect}/version.rc.in | 0 177 files changed, 0 insertions(+), 0 deletions(-) rename src/{ => mtconnect}/agent.cpp (100%) rename src/{ => mtconnect}/agent.hpp (100%) rename src/{ => mtconnect}/asset/asset.cpp (100%) rename src/{ => mtconnect}/asset/asset.hpp (100%) rename src/{ => mtconnect}/asset/asset_buffer.hpp (100%) rename src/{ => mtconnect}/asset/asset_storage.hpp (100%) rename src/{ => mtconnect}/asset/cutting_tool.cpp (100%) rename src/{ => mtconnect}/asset/cutting_tool.hpp (100%) rename src/{ => mtconnect}/asset/file_asset.cpp (100%) rename src/{ => mtconnect}/asset/file_asset.hpp (100%) rename src/{ => mtconnect}/asset/qif_document.cpp (100%) rename src/{ => mtconnect}/asset/qif_document.hpp (100%) rename src/{ => mtconnect}/asset/raw_material.cpp (100%) rename src/{ => mtconnect}/asset/raw_material.hpp (100%) rename src/{ => mtconnect}/buffer/checkpoint.cpp (100%) rename src/{ => mtconnect}/buffer/checkpoint.hpp (100%) rename src/{ => mtconnect}/buffer/circular_buffer.hpp (100%) rename src/{ => mtconnect}/configuration/agent_config.cpp (100%) rename src/{ => mtconnect}/configuration/agent_config.hpp (100%) rename src/{ => mtconnect}/configuration/async_context.hpp (100%) rename src/{ => mtconnect}/configuration/config_options.hpp (100%) rename src/{ => mtconnect}/configuration/parser.cpp (100%) rename src/{ => mtconnect}/configuration/parser.hpp (100%) rename src/{ => mtconnect}/configuration/service.cpp (100%) rename src/{ => mtconnect}/configuration/service.hpp (100%) rename src/{ => mtconnect}/device_model/agent_device.cpp (100%) rename src/{ => mtconnect}/device_model/agent_device.hpp (100%) rename src/{ => mtconnect}/device_model/component.cpp (100%) rename src/{ => mtconnect}/device_model/component.hpp (100%) rename src/{ => mtconnect}/device_model/composition.cpp (100%) rename src/{ => mtconnect}/device_model/composition.hpp (100%) rename src/{ => mtconnect}/device_model/configuration/configuration.cpp (100%) rename src/{ => mtconnect}/device_model/configuration/configuration.hpp (100%) rename src/{ => mtconnect}/device_model/configuration/coordinate_systems.cpp (100%) rename src/{ => mtconnect}/device_model/configuration/coordinate_systems.hpp (100%) rename src/{ => mtconnect}/device_model/configuration/motion.cpp (100%) rename src/{ => mtconnect}/device_model/configuration/motion.hpp (100%) rename src/{ => mtconnect}/device_model/configuration/relationships.cpp (100%) rename src/{ => mtconnect}/device_model/configuration/relationships.hpp (100%) rename src/{ => mtconnect}/device_model/configuration/sensor_configuration.cpp (100%) rename src/{ => mtconnect}/device_model/configuration/sensor_configuration.hpp (100%) rename src/{ => mtconnect}/device_model/configuration/solid_model.cpp (100%) rename src/{ => mtconnect}/device_model/configuration/solid_model.hpp (100%) rename src/{ => mtconnect}/device_model/configuration/specifications.cpp (100%) rename src/{ => mtconnect}/device_model/configuration/specifications.hpp (100%) rename src/{ => mtconnect}/device_model/data_item/constraints.hpp (100%) rename src/{ => mtconnect}/device_model/data_item/data_item.cpp (100%) rename src/{ => mtconnect}/device_model/data_item/data_item.hpp (100%) rename src/{ => mtconnect}/device_model/data_item/definition.hpp (100%) rename src/{ => mtconnect}/device_model/data_item/filter.hpp (100%) rename src/{ => mtconnect}/device_model/data_item/relationships.hpp (100%) rename src/{ => mtconnect}/device_model/data_item/source.hpp (100%) rename src/{ => mtconnect}/device_model/data_item/unit_conversion.cpp (100%) rename src/{ => mtconnect}/device_model/data_item/unit_conversion.hpp (100%) rename src/{ => mtconnect}/device_model/description.cpp (100%) rename src/{ => mtconnect}/device_model/description.hpp (100%) rename src/{ => mtconnect}/device_model/device.cpp (100%) rename src/{ => mtconnect}/device_model/device.hpp (100%) rename src/{ => mtconnect}/device_model/reference.cpp (100%) rename src/{ => mtconnect}/device_model/reference.hpp (100%) rename src/{ => mtconnect}/entity/data_set.cpp (100%) rename src/{ => mtconnect}/entity/data_set.hpp (100%) rename src/{ => mtconnect}/entity/entity.cpp (100%) rename src/{ => mtconnect}/entity/entity.hpp (100%) rename src/{ => mtconnect}/entity/factory.cpp (100%) rename src/{ => mtconnect}/entity/factory.hpp (100%) rename src/{ => mtconnect}/entity/json_parser.cpp (100%) rename src/{ => mtconnect}/entity/json_parser.hpp (100%) rename src/{ => mtconnect}/entity/json_printer.cpp (100%) rename src/{ => mtconnect}/entity/json_printer.hpp (100%) rename src/{ => mtconnect}/entity/qname.hpp (100%) rename src/{ => mtconnect}/entity/requirement.cpp (100%) rename src/{ => mtconnect}/entity/requirement.hpp (100%) rename src/{ => mtconnect}/entity/xml_parser.cpp (100%) rename src/{ => mtconnect}/entity/xml_parser.hpp (100%) rename src/{ => mtconnect}/entity/xml_printer.cpp (100%) rename src/{ => mtconnect}/entity/xml_printer.hpp (100%) rename src/{ => mtconnect}/logging.hpp (100%) rename src/{ => mtconnect}/mqtt/mqtt_client.hpp (100%) rename src/{ => mtconnect}/mqtt/mqtt_client_impl.hpp (100%) rename src/{ => mtconnect}/mqtt/mqtt_server.hpp (100%) rename src/{ => mtconnect}/mqtt/mqtt_server_impl.hpp (100%) rename src/{ => mtconnect}/observation/change_observer.cpp (100%) rename src/{ => mtconnect}/observation/change_observer.hpp (100%) rename src/{ => mtconnect}/observation/observation.cpp (100%) rename src/{ => mtconnect}/observation/observation.hpp (100%) rename src/{ => mtconnect}/parser/xml_parser.cpp (100%) rename src/{ => mtconnect}/parser/xml_parser.hpp (100%) rename src/{ => mtconnect}/pipeline/convert_sample.hpp (100%) rename src/{ => mtconnect}/pipeline/deliver.cpp (100%) rename src/{ => mtconnect}/pipeline/deliver.hpp (100%) rename src/{ => mtconnect}/pipeline/delta_filter.hpp (100%) rename src/{ => mtconnect}/pipeline/duplicate_filter.hpp (100%) rename src/{ => mtconnect}/pipeline/guard.hpp (100%) rename src/{ => mtconnect}/pipeline/message_mapper.hpp (100%) rename src/{ => mtconnect}/pipeline/mtconnect_xml_transform.hpp (100%) rename src/{ => mtconnect}/pipeline/period_filter.hpp (100%) rename src/{ => mtconnect}/pipeline/pipeline.hpp (100%) rename src/{ => mtconnect}/pipeline/pipeline_context.hpp (100%) rename src/{ => mtconnect}/pipeline/pipeline_contract.hpp (100%) rename src/{ => mtconnect}/pipeline/response_document.cpp (100%) rename src/{ => mtconnect}/pipeline/response_document.hpp (100%) rename src/{ => mtconnect}/pipeline/shdr_token_mapper.cpp (100%) rename src/{ => mtconnect}/pipeline/shdr_token_mapper.hpp (100%) rename src/{ => mtconnect}/pipeline/shdr_tokenizer.hpp (100%) rename src/{ => mtconnect}/pipeline/timestamp_extractor.cpp (100%) rename src/{ => mtconnect}/pipeline/timestamp_extractor.hpp (100%) rename src/{ => mtconnect}/pipeline/topic_mapper.hpp (100%) rename src/{ => mtconnect}/pipeline/transform.hpp (100%) rename src/{ => mtconnect}/pipeline/upcase_value.hpp (100%) rename src/{ => mtconnect}/printer/json_printer.cpp (100%) rename src/{ => mtconnect}/printer/json_printer.hpp (100%) rename src/{ => mtconnect}/printer/printer.hpp (100%) rename src/{ => mtconnect}/printer/xml_helper.hpp (100%) rename src/{ => mtconnect}/printer/xml_printer.cpp (100%) rename src/{ => mtconnect}/printer/xml_printer.hpp (100%) rename src/{ => mtconnect}/printer/xml_printer_helper.hpp (100%) rename src/{ => mtconnect}/python/embedded.cpp (100%) rename src/{ => mtconnect}/python/embedded.hpp (100%) rename src/{ => mtconnect}/ruby/embedded.cpp (100%) rename src/{ => mtconnect}/ruby/embedded.hpp (100%) rename src/{ => mtconnect}/ruby/ruby_agent.hpp (100%) rename src/{ => mtconnect}/ruby/ruby_entity.hpp (100%) rename src/{ => mtconnect}/ruby/ruby_observation.hpp (100%) rename src/{ => mtconnect}/ruby/ruby_pipeline.hpp (100%) rename src/{ => mtconnect}/ruby/ruby_smart_ptr.hpp (100%) rename src/{ => mtconnect}/ruby/ruby_transform.hpp (100%) rename src/{ => mtconnect}/ruby/ruby_type.hpp (100%) rename src/{ => mtconnect}/ruby/ruby_vm.hpp (100%) rename src/{ => mtconnect}/sink/mqtt_sink/mqtt_service.cpp (100%) rename src/{ => mtconnect}/sink/mqtt_sink/mqtt_service.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/cached_file.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/file_cache.cpp (100%) rename src/{ => mtconnect}/sink/rest_sink/file_cache.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/parameter.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/request.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/response.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/rest_service.cpp (100%) rename src/{ => mtconnect}/sink/rest_sink/rest_service.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/routing.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/server.cpp (100%) rename src/{ => mtconnect}/sink/rest_sink/server.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/session.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/session_impl.cpp (100%) rename src/{ => mtconnect}/sink/rest_sink/session_impl.hpp (100%) rename src/{ => mtconnect}/sink/rest_sink/tls_dector.hpp (100%) rename src/{ => mtconnect}/sink/sink.cpp (100%) rename src/{ => mtconnect}/sink/sink.hpp (100%) rename src/{ => mtconnect}/source/adapter/adapter.hpp (100%) rename src/{ => mtconnect}/source/adapter/adapter_pipeline.cpp (100%) rename src/{ => mtconnect}/source/adapter/adapter_pipeline.hpp (100%) rename src/{ => mtconnect}/source/adapter/agent_adapter/agent_adapter.cpp (100%) rename src/{ => mtconnect}/source/adapter/agent_adapter/agent_adapter.hpp (100%) rename src/{ => mtconnect}/source/adapter/agent_adapter/http_session.hpp (100%) rename src/{ => mtconnect}/source/adapter/agent_adapter/https_session.hpp (100%) rename src/{ => mtconnect}/source/adapter/agent_adapter/session.hpp (100%) rename src/{ => mtconnect}/source/adapter/agent_adapter/session_impl.hpp (100%) rename src/{ => mtconnect}/source/adapter/agent_adapter/url_parser.cpp (100%) rename src/{ => mtconnect}/source/adapter/agent_adapter/url_parser.hpp (100%) rename src/{ => mtconnect}/source/adapter/mqtt/mqtt_adapter.cpp (100%) rename src/{ => mtconnect}/source/adapter/mqtt/mqtt_adapter.hpp (100%) rename src/{ => mtconnect}/source/adapter/shdr/connector.cpp (100%) rename src/{ => mtconnect}/source/adapter/shdr/connector.hpp (100%) rename src/{ => mtconnect}/source/adapter/shdr/shdr_adapter.cpp (100%) rename src/{ => mtconnect}/source/adapter/shdr/shdr_adapter.hpp (100%) rename src/{ => mtconnect}/source/adapter/shdr/shdr_pipeline.cpp (100%) rename src/{ => mtconnect}/source/adapter/shdr/shdr_pipeline.hpp (100%) rename src/{ => mtconnect}/source/error_code.hpp (100%) rename src/{ => mtconnect}/source/loopback_source.cpp (100%) rename src/{ => mtconnect}/source/loopback_source.hpp (100%) rename src/{ => mtconnect}/source/source.cpp (100%) rename src/{ => mtconnect}/source/source.hpp (100%) rename src/{ => mtconnect}/utilities.cpp (100%) rename src/{ => mtconnect}/utilities.hpp (100%) rename src/{ => mtconnect}/version.cpp (100%) rename src/{ => mtconnect}/version.h.in (100%) rename src/{ => mtconnect}/version.rc.in (100%) diff --git a/src/agent.cpp b/src/mtconnect/agent.cpp similarity index 100% rename from src/agent.cpp rename to src/mtconnect/agent.cpp diff --git a/src/agent.hpp b/src/mtconnect/agent.hpp similarity index 100% rename from src/agent.hpp rename to src/mtconnect/agent.hpp diff --git a/src/asset/asset.cpp b/src/mtconnect/asset/asset.cpp similarity index 100% rename from src/asset/asset.cpp rename to src/mtconnect/asset/asset.cpp diff --git a/src/asset/asset.hpp b/src/mtconnect/asset/asset.hpp similarity index 100% rename from src/asset/asset.hpp rename to src/mtconnect/asset/asset.hpp diff --git a/src/asset/asset_buffer.hpp b/src/mtconnect/asset/asset_buffer.hpp similarity index 100% rename from src/asset/asset_buffer.hpp rename to src/mtconnect/asset/asset_buffer.hpp diff --git a/src/asset/asset_storage.hpp b/src/mtconnect/asset/asset_storage.hpp similarity index 100% rename from src/asset/asset_storage.hpp rename to src/mtconnect/asset/asset_storage.hpp diff --git a/src/asset/cutting_tool.cpp b/src/mtconnect/asset/cutting_tool.cpp similarity index 100% rename from src/asset/cutting_tool.cpp rename to src/mtconnect/asset/cutting_tool.cpp diff --git a/src/asset/cutting_tool.hpp b/src/mtconnect/asset/cutting_tool.hpp similarity index 100% rename from src/asset/cutting_tool.hpp rename to src/mtconnect/asset/cutting_tool.hpp diff --git a/src/asset/file_asset.cpp b/src/mtconnect/asset/file_asset.cpp similarity index 100% rename from src/asset/file_asset.cpp rename to src/mtconnect/asset/file_asset.cpp diff --git a/src/asset/file_asset.hpp b/src/mtconnect/asset/file_asset.hpp similarity index 100% rename from src/asset/file_asset.hpp rename to src/mtconnect/asset/file_asset.hpp diff --git a/src/asset/qif_document.cpp b/src/mtconnect/asset/qif_document.cpp similarity index 100% rename from src/asset/qif_document.cpp rename to src/mtconnect/asset/qif_document.cpp diff --git a/src/asset/qif_document.hpp b/src/mtconnect/asset/qif_document.hpp similarity index 100% rename from src/asset/qif_document.hpp rename to src/mtconnect/asset/qif_document.hpp diff --git a/src/asset/raw_material.cpp b/src/mtconnect/asset/raw_material.cpp similarity index 100% rename from src/asset/raw_material.cpp rename to src/mtconnect/asset/raw_material.cpp diff --git a/src/asset/raw_material.hpp b/src/mtconnect/asset/raw_material.hpp similarity index 100% rename from src/asset/raw_material.hpp rename to src/mtconnect/asset/raw_material.hpp diff --git a/src/buffer/checkpoint.cpp b/src/mtconnect/buffer/checkpoint.cpp similarity index 100% rename from src/buffer/checkpoint.cpp rename to src/mtconnect/buffer/checkpoint.cpp diff --git a/src/buffer/checkpoint.hpp b/src/mtconnect/buffer/checkpoint.hpp similarity index 100% rename from src/buffer/checkpoint.hpp rename to src/mtconnect/buffer/checkpoint.hpp diff --git a/src/buffer/circular_buffer.hpp b/src/mtconnect/buffer/circular_buffer.hpp similarity index 100% rename from src/buffer/circular_buffer.hpp rename to src/mtconnect/buffer/circular_buffer.hpp diff --git a/src/configuration/agent_config.cpp b/src/mtconnect/configuration/agent_config.cpp similarity index 100% rename from src/configuration/agent_config.cpp rename to src/mtconnect/configuration/agent_config.cpp diff --git a/src/configuration/agent_config.hpp b/src/mtconnect/configuration/agent_config.hpp similarity index 100% rename from src/configuration/agent_config.hpp rename to src/mtconnect/configuration/agent_config.hpp diff --git a/src/configuration/async_context.hpp b/src/mtconnect/configuration/async_context.hpp similarity index 100% rename from src/configuration/async_context.hpp rename to src/mtconnect/configuration/async_context.hpp diff --git a/src/configuration/config_options.hpp b/src/mtconnect/configuration/config_options.hpp similarity index 100% rename from src/configuration/config_options.hpp rename to src/mtconnect/configuration/config_options.hpp diff --git a/src/configuration/parser.cpp b/src/mtconnect/configuration/parser.cpp similarity index 100% rename from src/configuration/parser.cpp rename to src/mtconnect/configuration/parser.cpp diff --git a/src/configuration/parser.hpp b/src/mtconnect/configuration/parser.hpp similarity index 100% rename from src/configuration/parser.hpp rename to src/mtconnect/configuration/parser.hpp diff --git a/src/configuration/service.cpp b/src/mtconnect/configuration/service.cpp similarity index 100% rename from src/configuration/service.cpp rename to src/mtconnect/configuration/service.cpp diff --git a/src/configuration/service.hpp b/src/mtconnect/configuration/service.hpp similarity index 100% rename from src/configuration/service.hpp rename to src/mtconnect/configuration/service.hpp diff --git a/src/device_model/agent_device.cpp b/src/mtconnect/device_model/agent_device.cpp similarity index 100% rename from src/device_model/agent_device.cpp rename to src/mtconnect/device_model/agent_device.cpp diff --git a/src/device_model/agent_device.hpp b/src/mtconnect/device_model/agent_device.hpp similarity index 100% rename from src/device_model/agent_device.hpp rename to src/mtconnect/device_model/agent_device.hpp diff --git a/src/device_model/component.cpp b/src/mtconnect/device_model/component.cpp similarity index 100% rename from src/device_model/component.cpp rename to src/mtconnect/device_model/component.cpp diff --git a/src/device_model/component.hpp b/src/mtconnect/device_model/component.hpp similarity index 100% rename from src/device_model/component.hpp rename to src/mtconnect/device_model/component.hpp diff --git a/src/device_model/composition.cpp b/src/mtconnect/device_model/composition.cpp similarity index 100% rename from src/device_model/composition.cpp rename to src/mtconnect/device_model/composition.cpp diff --git a/src/device_model/composition.hpp b/src/mtconnect/device_model/composition.hpp similarity index 100% rename from src/device_model/composition.hpp rename to src/mtconnect/device_model/composition.hpp diff --git a/src/device_model/configuration/configuration.cpp b/src/mtconnect/device_model/configuration/configuration.cpp similarity index 100% rename from src/device_model/configuration/configuration.cpp rename to src/mtconnect/device_model/configuration/configuration.cpp diff --git a/src/device_model/configuration/configuration.hpp b/src/mtconnect/device_model/configuration/configuration.hpp similarity index 100% rename from src/device_model/configuration/configuration.hpp rename to src/mtconnect/device_model/configuration/configuration.hpp diff --git a/src/device_model/configuration/coordinate_systems.cpp b/src/mtconnect/device_model/configuration/coordinate_systems.cpp similarity index 100% rename from src/device_model/configuration/coordinate_systems.cpp rename to src/mtconnect/device_model/configuration/coordinate_systems.cpp diff --git a/src/device_model/configuration/coordinate_systems.hpp b/src/mtconnect/device_model/configuration/coordinate_systems.hpp similarity index 100% rename from src/device_model/configuration/coordinate_systems.hpp rename to src/mtconnect/device_model/configuration/coordinate_systems.hpp diff --git a/src/device_model/configuration/motion.cpp b/src/mtconnect/device_model/configuration/motion.cpp similarity index 100% rename from src/device_model/configuration/motion.cpp rename to src/mtconnect/device_model/configuration/motion.cpp diff --git a/src/device_model/configuration/motion.hpp b/src/mtconnect/device_model/configuration/motion.hpp similarity index 100% rename from src/device_model/configuration/motion.hpp rename to src/mtconnect/device_model/configuration/motion.hpp diff --git a/src/device_model/configuration/relationships.cpp b/src/mtconnect/device_model/configuration/relationships.cpp similarity index 100% rename from src/device_model/configuration/relationships.cpp rename to src/mtconnect/device_model/configuration/relationships.cpp diff --git a/src/device_model/configuration/relationships.hpp b/src/mtconnect/device_model/configuration/relationships.hpp similarity index 100% rename from src/device_model/configuration/relationships.hpp rename to src/mtconnect/device_model/configuration/relationships.hpp diff --git a/src/device_model/configuration/sensor_configuration.cpp b/src/mtconnect/device_model/configuration/sensor_configuration.cpp similarity index 100% rename from src/device_model/configuration/sensor_configuration.cpp rename to src/mtconnect/device_model/configuration/sensor_configuration.cpp diff --git a/src/device_model/configuration/sensor_configuration.hpp b/src/mtconnect/device_model/configuration/sensor_configuration.hpp similarity index 100% rename from src/device_model/configuration/sensor_configuration.hpp rename to src/mtconnect/device_model/configuration/sensor_configuration.hpp diff --git a/src/device_model/configuration/solid_model.cpp b/src/mtconnect/device_model/configuration/solid_model.cpp similarity index 100% rename from src/device_model/configuration/solid_model.cpp rename to src/mtconnect/device_model/configuration/solid_model.cpp diff --git a/src/device_model/configuration/solid_model.hpp b/src/mtconnect/device_model/configuration/solid_model.hpp similarity index 100% rename from src/device_model/configuration/solid_model.hpp rename to src/mtconnect/device_model/configuration/solid_model.hpp diff --git a/src/device_model/configuration/specifications.cpp b/src/mtconnect/device_model/configuration/specifications.cpp similarity index 100% rename from src/device_model/configuration/specifications.cpp rename to src/mtconnect/device_model/configuration/specifications.cpp diff --git a/src/device_model/configuration/specifications.hpp b/src/mtconnect/device_model/configuration/specifications.hpp similarity index 100% rename from src/device_model/configuration/specifications.hpp rename to src/mtconnect/device_model/configuration/specifications.hpp diff --git a/src/device_model/data_item/constraints.hpp b/src/mtconnect/device_model/data_item/constraints.hpp similarity index 100% rename from src/device_model/data_item/constraints.hpp rename to src/mtconnect/device_model/data_item/constraints.hpp diff --git a/src/device_model/data_item/data_item.cpp b/src/mtconnect/device_model/data_item/data_item.cpp similarity index 100% rename from src/device_model/data_item/data_item.cpp rename to src/mtconnect/device_model/data_item/data_item.cpp diff --git a/src/device_model/data_item/data_item.hpp b/src/mtconnect/device_model/data_item/data_item.hpp similarity index 100% rename from src/device_model/data_item/data_item.hpp rename to src/mtconnect/device_model/data_item/data_item.hpp diff --git a/src/device_model/data_item/definition.hpp b/src/mtconnect/device_model/data_item/definition.hpp similarity index 100% rename from src/device_model/data_item/definition.hpp rename to src/mtconnect/device_model/data_item/definition.hpp diff --git a/src/device_model/data_item/filter.hpp b/src/mtconnect/device_model/data_item/filter.hpp similarity index 100% rename from src/device_model/data_item/filter.hpp rename to src/mtconnect/device_model/data_item/filter.hpp diff --git a/src/device_model/data_item/relationships.hpp b/src/mtconnect/device_model/data_item/relationships.hpp similarity index 100% rename from src/device_model/data_item/relationships.hpp rename to src/mtconnect/device_model/data_item/relationships.hpp diff --git a/src/device_model/data_item/source.hpp b/src/mtconnect/device_model/data_item/source.hpp similarity index 100% rename from src/device_model/data_item/source.hpp rename to src/mtconnect/device_model/data_item/source.hpp diff --git a/src/device_model/data_item/unit_conversion.cpp b/src/mtconnect/device_model/data_item/unit_conversion.cpp similarity index 100% rename from src/device_model/data_item/unit_conversion.cpp rename to src/mtconnect/device_model/data_item/unit_conversion.cpp diff --git a/src/device_model/data_item/unit_conversion.hpp b/src/mtconnect/device_model/data_item/unit_conversion.hpp similarity index 100% rename from src/device_model/data_item/unit_conversion.hpp rename to src/mtconnect/device_model/data_item/unit_conversion.hpp diff --git a/src/device_model/description.cpp b/src/mtconnect/device_model/description.cpp similarity index 100% rename from src/device_model/description.cpp rename to src/mtconnect/device_model/description.cpp diff --git a/src/device_model/description.hpp b/src/mtconnect/device_model/description.hpp similarity index 100% rename from src/device_model/description.hpp rename to src/mtconnect/device_model/description.hpp diff --git a/src/device_model/device.cpp b/src/mtconnect/device_model/device.cpp similarity index 100% rename from src/device_model/device.cpp rename to src/mtconnect/device_model/device.cpp diff --git a/src/device_model/device.hpp b/src/mtconnect/device_model/device.hpp similarity index 100% rename from src/device_model/device.hpp rename to src/mtconnect/device_model/device.hpp diff --git a/src/device_model/reference.cpp b/src/mtconnect/device_model/reference.cpp similarity index 100% rename from src/device_model/reference.cpp rename to src/mtconnect/device_model/reference.cpp diff --git a/src/device_model/reference.hpp b/src/mtconnect/device_model/reference.hpp similarity index 100% rename from src/device_model/reference.hpp rename to src/mtconnect/device_model/reference.hpp diff --git a/src/entity/data_set.cpp b/src/mtconnect/entity/data_set.cpp similarity index 100% rename from src/entity/data_set.cpp rename to src/mtconnect/entity/data_set.cpp diff --git a/src/entity/data_set.hpp b/src/mtconnect/entity/data_set.hpp similarity index 100% rename from src/entity/data_set.hpp rename to src/mtconnect/entity/data_set.hpp diff --git a/src/entity/entity.cpp b/src/mtconnect/entity/entity.cpp similarity index 100% rename from src/entity/entity.cpp rename to src/mtconnect/entity/entity.cpp diff --git a/src/entity/entity.hpp b/src/mtconnect/entity/entity.hpp similarity index 100% rename from src/entity/entity.hpp rename to src/mtconnect/entity/entity.hpp diff --git a/src/entity/factory.cpp b/src/mtconnect/entity/factory.cpp similarity index 100% rename from src/entity/factory.cpp rename to src/mtconnect/entity/factory.cpp diff --git a/src/entity/factory.hpp b/src/mtconnect/entity/factory.hpp similarity index 100% rename from src/entity/factory.hpp rename to src/mtconnect/entity/factory.hpp diff --git a/src/entity/json_parser.cpp b/src/mtconnect/entity/json_parser.cpp similarity index 100% rename from src/entity/json_parser.cpp rename to src/mtconnect/entity/json_parser.cpp diff --git a/src/entity/json_parser.hpp b/src/mtconnect/entity/json_parser.hpp similarity index 100% rename from src/entity/json_parser.hpp rename to src/mtconnect/entity/json_parser.hpp diff --git a/src/entity/json_printer.cpp b/src/mtconnect/entity/json_printer.cpp similarity index 100% rename from src/entity/json_printer.cpp rename to src/mtconnect/entity/json_printer.cpp diff --git a/src/entity/json_printer.hpp b/src/mtconnect/entity/json_printer.hpp similarity index 100% rename from src/entity/json_printer.hpp rename to src/mtconnect/entity/json_printer.hpp diff --git a/src/entity/qname.hpp b/src/mtconnect/entity/qname.hpp similarity index 100% rename from src/entity/qname.hpp rename to src/mtconnect/entity/qname.hpp diff --git a/src/entity/requirement.cpp b/src/mtconnect/entity/requirement.cpp similarity index 100% rename from src/entity/requirement.cpp rename to src/mtconnect/entity/requirement.cpp diff --git a/src/entity/requirement.hpp b/src/mtconnect/entity/requirement.hpp similarity index 100% rename from src/entity/requirement.hpp rename to src/mtconnect/entity/requirement.hpp diff --git a/src/entity/xml_parser.cpp b/src/mtconnect/entity/xml_parser.cpp similarity index 100% rename from src/entity/xml_parser.cpp rename to src/mtconnect/entity/xml_parser.cpp diff --git a/src/entity/xml_parser.hpp b/src/mtconnect/entity/xml_parser.hpp similarity index 100% rename from src/entity/xml_parser.hpp rename to src/mtconnect/entity/xml_parser.hpp diff --git a/src/entity/xml_printer.cpp b/src/mtconnect/entity/xml_printer.cpp similarity index 100% rename from src/entity/xml_printer.cpp rename to src/mtconnect/entity/xml_printer.cpp diff --git a/src/entity/xml_printer.hpp b/src/mtconnect/entity/xml_printer.hpp similarity index 100% rename from src/entity/xml_printer.hpp rename to src/mtconnect/entity/xml_printer.hpp diff --git a/src/logging.hpp b/src/mtconnect/logging.hpp similarity index 100% rename from src/logging.hpp rename to src/mtconnect/logging.hpp diff --git a/src/mqtt/mqtt_client.hpp b/src/mtconnect/mqtt/mqtt_client.hpp similarity index 100% rename from src/mqtt/mqtt_client.hpp rename to src/mtconnect/mqtt/mqtt_client.hpp diff --git a/src/mqtt/mqtt_client_impl.hpp b/src/mtconnect/mqtt/mqtt_client_impl.hpp similarity index 100% rename from src/mqtt/mqtt_client_impl.hpp rename to src/mtconnect/mqtt/mqtt_client_impl.hpp diff --git a/src/mqtt/mqtt_server.hpp b/src/mtconnect/mqtt/mqtt_server.hpp similarity index 100% rename from src/mqtt/mqtt_server.hpp rename to src/mtconnect/mqtt/mqtt_server.hpp diff --git a/src/mqtt/mqtt_server_impl.hpp b/src/mtconnect/mqtt/mqtt_server_impl.hpp similarity index 100% rename from src/mqtt/mqtt_server_impl.hpp rename to src/mtconnect/mqtt/mqtt_server_impl.hpp diff --git a/src/observation/change_observer.cpp b/src/mtconnect/observation/change_observer.cpp similarity index 100% rename from src/observation/change_observer.cpp rename to src/mtconnect/observation/change_observer.cpp diff --git a/src/observation/change_observer.hpp b/src/mtconnect/observation/change_observer.hpp similarity index 100% rename from src/observation/change_observer.hpp rename to src/mtconnect/observation/change_observer.hpp diff --git a/src/observation/observation.cpp b/src/mtconnect/observation/observation.cpp similarity index 100% rename from src/observation/observation.cpp rename to src/mtconnect/observation/observation.cpp diff --git a/src/observation/observation.hpp b/src/mtconnect/observation/observation.hpp similarity index 100% rename from src/observation/observation.hpp rename to src/mtconnect/observation/observation.hpp diff --git a/src/parser/xml_parser.cpp b/src/mtconnect/parser/xml_parser.cpp similarity index 100% rename from src/parser/xml_parser.cpp rename to src/mtconnect/parser/xml_parser.cpp diff --git a/src/parser/xml_parser.hpp b/src/mtconnect/parser/xml_parser.hpp similarity index 100% rename from src/parser/xml_parser.hpp rename to src/mtconnect/parser/xml_parser.hpp diff --git a/src/pipeline/convert_sample.hpp b/src/mtconnect/pipeline/convert_sample.hpp similarity index 100% rename from src/pipeline/convert_sample.hpp rename to src/mtconnect/pipeline/convert_sample.hpp diff --git a/src/pipeline/deliver.cpp b/src/mtconnect/pipeline/deliver.cpp similarity index 100% rename from src/pipeline/deliver.cpp rename to src/mtconnect/pipeline/deliver.cpp diff --git a/src/pipeline/deliver.hpp b/src/mtconnect/pipeline/deliver.hpp similarity index 100% rename from src/pipeline/deliver.hpp rename to src/mtconnect/pipeline/deliver.hpp diff --git a/src/pipeline/delta_filter.hpp b/src/mtconnect/pipeline/delta_filter.hpp similarity index 100% rename from src/pipeline/delta_filter.hpp rename to src/mtconnect/pipeline/delta_filter.hpp diff --git a/src/pipeline/duplicate_filter.hpp b/src/mtconnect/pipeline/duplicate_filter.hpp similarity index 100% rename from src/pipeline/duplicate_filter.hpp rename to src/mtconnect/pipeline/duplicate_filter.hpp diff --git a/src/pipeline/guard.hpp b/src/mtconnect/pipeline/guard.hpp similarity index 100% rename from src/pipeline/guard.hpp rename to src/mtconnect/pipeline/guard.hpp diff --git a/src/pipeline/message_mapper.hpp b/src/mtconnect/pipeline/message_mapper.hpp similarity index 100% rename from src/pipeline/message_mapper.hpp rename to src/mtconnect/pipeline/message_mapper.hpp diff --git a/src/pipeline/mtconnect_xml_transform.hpp b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp similarity index 100% rename from src/pipeline/mtconnect_xml_transform.hpp rename to src/mtconnect/pipeline/mtconnect_xml_transform.hpp diff --git a/src/pipeline/period_filter.hpp b/src/mtconnect/pipeline/period_filter.hpp similarity index 100% rename from src/pipeline/period_filter.hpp rename to src/mtconnect/pipeline/period_filter.hpp diff --git a/src/pipeline/pipeline.hpp b/src/mtconnect/pipeline/pipeline.hpp similarity index 100% rename from src/pipeline/pipeline.hpp rename to src/mtconnect/pipeline/pipeline.hpp diff --git a/src/pipeline/pipeline_context.hpp b/src/mtconnect/pipeline/pipeline_context.hpp similarity index 100% rename from src/pipeline/pipeline_context.hpp rename to src/mtconnect/pipeline/pipeline_context.hpp diff --git a/src/pipeline/pipeline_contract.hpp b/src/mtconnect/pipeline/pipeline_contract.hpp similarity index 100% rename from src/pipeline/pipeline_contract.hpp rename to src/mtconnect/pipeline/pipeline_contract.hpp diff --git a/src/pipeline/response_document.cpp b/src/mtconnect/pipeline/response_document.cpp similarity index 100% rename from src/pipeline/response_document.cpp rename to src/mtconnect/pipeline/response_document.cpp diff --git a/src/pipeline/response_document.hpp b/src/mtconnect/pipeline/response_document.hpp similarity index 100% rename from src/pipeline/response_document.hpp rename to src/mtconnect/pipeline/response_document.hpp diff --git a/src/pipeline/shdr_token_mapper.cpp b/src/mtconnect/pipeline/shdr_token_mapper.cpp similarity index 100% rename from src/pipeline/shdr_token_mapper.cpp rename to src/mtconnect/pipeline/shdr_token_mapper.cpp diff --git a/src/pipeline/shdr_token_mapper.hpp b/src/mtconnect/pipeline/shdr_token_mapper.hpp similarity index 100% rename from src/pipeline/shdr_token_mapper.hpp rename to src/mtconnect/pipeline/shdr_token_mapper.hpp diff --git a/src/pipeline/shdr_tokenizer.hpp b/src/mtconnect/pipeline/shdr_tokenizer.hpp similarity index 100% rename from src/pipeline/shdr_tokenizer.hpp rename to src/mtconnect/pipeline/shdr_tokenizer.hpp diff --git a/src/pipeline/timestamp_extractor.cpp b/src/mtconnect/pipeline/timestamp_extractor.cpp similarity index 100% rename from src/pipeline/timestamp_extractor.cpp rename to src/mtconnect/pipeline/timestamp_extractor.cpp diff --git a/src/pipeline/timestamp_extractor.hpp b/src/mtconnect/pipeline/timestamp_extractor.hpp similarity index 100% rename from src/pipeline/timestamp_extractor.hpp rename to src/mtconnect/pipeline/timestamp_extractor.hpp diff --git a/src/pipeline/topic_mapper.hpp b/src/mtconnect/pipeline/topic_mapper.hpp similarity index 100% rename from src/pipeline/topic_mapper.hpp rename to src/mtconnect/pipeline/topic_mapper.hpp diff --git a/src/pipeline/transform.hpp b/src/mtconnect/pipeline/transform.hpp similarity index 100% rename from src/pipeline/transform.hpp rename to src/mtconnect/pipeline/transform.hpp diff --git a/src/pipeline/upcase_value.hpp b/src/mtconnect/pipeline/upcase_value.hpp similarity index 100% rename from src/pipeline/upcase_value.hpp rename to src/mtconnect/pipeline/upcase_value.hpp diff --git a/src/printer/json_printer.cpp b/src/mtconnect/printer/json_printer.cpp similarity index 100% rename from src/printer/json_printer.cpp rename to src/mtconnect/printer/json_printer.cpp diff --git a/src/printer/json_printer.hpp b/src/mtconnect/printer/json_printer.hpp similarity index 100% rename from src/printer/json_printer.hpp rename to src/mtconnect/printer/json_printer.hpp diff --git a/src/printer/printer.hpp b/src/mtconnect/printer/printer.hpp similarity index 100% rename from src/printer/printer.hpp rename to src/mtconnect/printer/printer.hpp diff --git a/src/printer/xml_helper.hpp b/src/mtconnect/printer/xml_helper.hpp similarity index 100% rename from src/printer/xml_helper.hpp rename to src/mtconnect/printer/xml_helper.hpp diff --git a/src/printer/xml_printer.cpp b/src/mtconnect/printer/xml_printer.cpp similarity index 100% rename from src/printer/xml_printer.cpp rename to src/mtconnect/printer/xml_printer.cpp diff --git a/src/printer/xml_printer.hpp b/src/mtconnect/printer/xml_printer.hpp similarity index 100% rename from src/printer/xml_printer.hpp rename to src/mtconnect/printer/xml_printer.hpp diff --git a/src/printer/xml_printer_helper.hpp b/src/mtconnect/printer/xml_printer_helper.hpp similarity index 100% rename from src/printer/xml_printer_helper.hpp rename to src/mtconnect/printer/xml_printer_helper.hpp diff --git a/src/python/embedded.cpp b/src/mtconnect/python/embedded.cpp similarity index 100% rename from src/python/embedded.cpp rename to src/mtconnect/python/embedded.cpp diff --git a/src/python/embedded.hpp b/src/mtconnect/python/embedded.hpp similarity index 100% rename from src/python/embedded.hpp rename to src/mtconnect/python/embedded.hpp diff --git a/src/ruby/embedded.cpp b/src/mtconnect/ruby/embedded.cpp similarity index 100% rename from src/ruby/embedded.cpp rename to src/mtconnect/ruby/embedded.cpp diff --git a/src/ruby/embedded.hpp b/src/mtconnect/ruby/embedded.hpp similarity index 100% rename from src/ruby/embedded.hpp rename to src/mtconnect/ruby/embedded.hpp diff --git a/src/ruby/ruby_agent.hpp b/src/mtconnect/ruby/ruby_agent.hpp similarity index 100% rename from src/ruby/ruby_agent.hpp rename to src/mtconnect/ruby/ruby_agent.hpp diff --git a/src/ruby/ruby_entity.hpp b/src/mtconnect/ruby/ruby_entity.hpp similarity index 100% rename from src/ruby/ruby_entity.hpp rename to src/mtconnect/ruby/ruby_entity.hpp diff --git a/src/ruby/ruby_observation.hpp b/src/mtconnect/ruby/ruby_observation.hpp similarity index 100% rename from src/ruby/ruby_observation.hpp rename to src/mtconnect/ruby/ruby_observation.hpp diff --git a/src/ruby/ruby_pipeline.hpp b/src/mtconnect/ruby/ruby_pipeline.hpp similarity index 100% rename from src/ruby/ruby_pipeline.hpp rename to src/mtconnect/ruby/ruby_pipeline.hpp diff --git a/src/ruby/ruby_smart_ptr.hpp b/src/mtconnect/ruby/ruby_smart_ptr.hpp similarity index 100% rename from src/ruby/ruby_smart_ptr.hpp rename to src/mtconnect/ruby/ruby_smart_ptr.hpp diff --git a/src/ruby/ruby_transform.hpp b/src/mtconnect/ruby/ruby_transform.hpp similarity index 100% rename from src/ruby/ruby_transform.hpp rename to src/mtconnect/ruby/ruby_transform.hpp diff --git a/src/ruby/ruby_type.hpp b/src/mtconnect/ruby/ruby_type.hpp similarity index 100% rename from src/ruby/ruby_type.hpp rename to src/mtconnect/ruby/ruby_type.hpp diff --git a/src/ruby/ruby_vm.hpp b/src/mtconnect/ruby/ruby_vm.hpp similarity index 100% rename from src/ruby/ruby_vm.hpp rename to src/mtconnect/ruby/ruby_vm.hpp diff --git a/src/sink/mqtt_sink/mqtt_service.cpp b/src/mtconnect/sink/mqtt_sink/mqtt_service.cpp similarity index 100% rename from src/sink/mqtt_sink/mqtt_service.cpp rename to src/mtconnect/sink/mqtt_sink/mqtt_service.cpp diff --git a/src/sink/mqtt_sink/mqtt_service.hpp b/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp similarity index 100% rename from src/sink/mqtt_sink/mqtt_service.hpp rename to src/mtconnect/sink/mqtt_sink/mqtt_service.hpp diff --git a/src/sink/rest_sink/cached_file.hpp b/src/mtconnect/sink/rest_sink/cached_file.hpp similarity index 100% rename from src/sink/rest_sink/cached_file.hpp rename to src/mtconnect/sink/rest_sink/cached_file.hpp diff --git a/src/sink/rest_sink/file_cache.cpp b/src/mtconnect/sink/rest_sink/file_cache.cpp similarity index 100% rename from src/sink/rest_sink/file_cache.cpp rename to src/mtconnect/sink/rest_sink/file_cache.cpp diff --git a/src/sink/rest_sink/file_cache.hpp b/src/mtconnect/sink/rest_sink/file_cache.hpp similarity index 100% rename from src/sink/rest_sink/file_cache.hpp rename to src/mtconnect/sink/rest_sink/file_cache.hpp diff --git a/src/sink/rest_sink/parameter.hpp b/src/mtconnect/sink/rest_sink/parameter.hpp similarity index 100% rename from src/sink/rest_sink/parameter.hpp rename to src/mtconnect/sink/rest_sink/parameter.hpp diff --git a/src/sink/rest_sink/request.hpp b/src/mtconnect/sink/rest_sink/request.hpp similarity index 100% rename from src/sink/rest_sink/request.hpp rename to src/mtconnect/sink/rest_sink/request.hpp diff --git a/src/sink/rest_sink/response.hpp b/src/mtconnect/sink/rest_sink/response.hpp similarity index 100% rename from src/sink/rest_sink/response.hpp rename to src/mtconnect/sink/rest_sink/response.hpp diff --git a/src/sink/rest_sink/rest_service.cpp b/src/mtconnect/sink/rest_sink/rest_service.cpp similarity index 100% rename from src/sink/rest_sink/rest_service.cpp rename to src/mtconnect/sink/rest_sink/rest_service.cpp diff --git a/src/sink/rest_sink/rest_service.hpp b/src/mtconnect/sink/rest_sink/rest_service.hpp similarity index 100% rename from src/sink/rest_sink/rest_service.hpp rename to src/mtconnect/sink/rest_sink/rest_service.hpp diff --git a/src/sink/rest_sink/routing.hpp b/src/mtconnect/sink/rest_sink/routing.hpp similarity index 100% rename from src/sink/rest_sink/routing.hpp rename to src/mtconnect/sink/rest_sink/routing.hpp diff --git a/src/sink/rest_sink/server.cpp b/src/mtconnect/sink/rest_sink/server.cpp similarity index 100% rename from src/sink/rest_sink/server.cpp rename to src/mtconnect/sink/rest_sink/server.cpp diff --git a/src/sink/rest_sink/server.hpp b/src/mtconnect/sink/rest_sink/server.hpp similarity index 100% rename from src/sink/rest_sink/server.hpp rename to src/mtconnect/sink/rest_sink/server.hpp diff --git a/src/sink/rest_sink/session.hpp b/src/mtconnect/sink/rest_sink/session.hpp similarity index 100% rename from src/sink/rest_sink/session.hpp rename to src/mtconnect/sink/rest_sink/session.hpp diff --git a/src/sink/rest_sink/session_impl.cpp b/src/mtconnect/sink/rest_sink/session_impl.cpp similarity index 100% rename from src/sink/rest_sink/session_impl.cpp rename to src/mtconnect/sink/rest_sink/session_impl.cpp diff --git a/src/sink/rest_sink/session_impl.hpp b/src/mtconnect/sink/rest_sink/session_impl.hpp similarity index 100% rename from src/sink/rest_sink/session_impl.hpp rename to src/mtconnect/sink/rest_sink/session_impl.hpp diff --git a/src/sink/rest_sink/tls_dector.hpp b/src/mtconnect/sink/rest_sink/tls_dector.hpp similarity index 100% rename from src/sink/rest_sink/tls_dector.hpp rename to src/mtconnect/sink/rest_sink/tls_dector.hpp diff --git a/src/sink/sink.cpp b/src/mtconnect/sink/sink.cpp similarity index 100% rename from src/sink/sink.cpp rename to src/mtconnect/sink/sink.cpp diff --git a/src/sink/sink.hpp b/src/mtconnect/sink/sink.hpp similarity index 100% rename from src/sink/sink.hpp rename to src/mtconnect/sink/sink.hpp diff --git a/src/source/adapter/adapter.hpp b/src/mtconnect/source/adapter/adapter.hpp similarity index 100% rename from src/source/adapter/adapter.hpp rename to src/mtconnect/source/adapter/adapter.hpp diff --git a/src/source/adapter/adapter_pipeline.cpp b/src/mtconnect/source/adapter/adapter_pipeline.cpp similarity index 100% rename from src/source/adapter/adapter_pipeline.cpp rename to src/mtconnect/source/adapter/adapter_pipeline.cpp diff --git a/src/source/adapter/adapter_pipeline.hpp b/src/mtconnect/source/adapter/adapter_pipeline.hpp similarity index 100% rename from src/source/adapter/adapter_pipeline.hpp rename to src/mtconnect/source/adapter/adapter_pipeline.hpp diff --git a/src/source/adapter/agent_adapter/agent_adapter.cpp b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp similarity index 100% rename from src/source/adapter/agent_adapter/agent_adapter.cpp rename to src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp diff --git a/src/source/adapter/agent_adapter/agent_adapter.hpp b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp similarity index 100% rename from src/source/adapter/agent_adapter/agent_adapter.hpp rename to src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp diff --git a/src/source/adapter/agent_adapter/http_session.hpp b/src/mtconnect/source/adapter/agent_adapter/http_session.hpp similarity index 100% rename from src/source/adapter/agent_adapter/http_session.hpp rename to src/mtconnect/source/adapter/agent_adapter/http_session.hpp diff --git a/src/source/adapter/agent_adapter/https_session.hpp b/src/mtconnect/source/adapter/agent_adapter/https_session.hpp similarity index 100% rename from src/source/adapter/agent_adapter/https_session.hpp rename to src/mtconnect/source/adapter/agent_adapter/https_session.hpp diff --git a/src/source/adapter/agent_adapter/session.hpp b/src/mtconnect/source/adapter/agent_adapter/session.hpp similarity index 100% rename from src/source/adapter/agent_adapter/session.hpp rename to src/mtconnect/source/adapter/agent_adapter/session.hpp diff --git a/src/source/adapter/agent_adapter/session_impl.hpp b/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp similarity index 100% rename from src/source/adapter/agent_adapter/session_impl.hpp rename to src/mtconnect/source/adapter/agent_adapter/session_impl.hpp diff --git a/src/source/adapter/agent_adapter/url_parser.cpp b/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp similarity index 100% rename from src/source/adapter/agent_adapter/url_parser.cpp rename to src/mtconnect/source/adapter/agent_adapter/url_parser.cpp diff --git a/src/source/adapter/agent_adapter/url_parser.hpp b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp similarity index 100% rename from src/source/adapter/agent_adapter/url_parser.hpp rename to src/mtconnect/source/adapter/agent_adapter/url_parser.hpp diff --git a/src/source/adapter/mqtt/mqtt_adapter.cpp b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.cpp similarity index 100% rename from src/source/adapter/mqtt/mqtt_adapter.cpp rename to src/mtconnect/source/adapter/mqtt/mqtt_adapter.cpp diff --git a/src/source/adapter/mqtt/mqtt_adapter.hpp b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp similarity index 100% rename from src/source/adapter/mqtt/mqtt_adapter.hpp rename to src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp diff --git a/src/source/adapter/shdr/connector.cpp b/src/mtconnect/source/adapter/shdr/connector.cpp similarity index 100% rename from src/source/adapter/shdr/connector.cpp rename to src/mtconnect/source/adapter/shdr/connector.cpp diff --git a/src/source/adapter/shdr/connector.hpp b/src/mtconnect/source/adapter/shdr/connector.hpp similarity index 100% rename from src/source/adapter/shdr/connector.hpp rename to src/mtconnect/source/adapter/shdr/connector.hpp diff --git a/src/source/adapter/shdr/shdr_adapter.cpp b/src/mtconnect/source/adapter/shdr/shdr_adapter.cpp similarity index 100% rename from src/source/adapter/shdr/shdr_adapter.cpp rename to src/mtconnect/source/adapter/shdr/shdr_adapter.cpp diff --git a/src/source/adapter/shdr/shdr_adapter.hpp b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp similarity index 100% rename from src/source/adapter/shdr/shdr_adapter.hpp rename to src/mtconnect/source/adapter/shdr/shdr_adapter.hpp diff --git a/src/source/adapter/shdr/shdr_pipeline.cpp b/src/mtconnect/source/adapter/shdr/shdr_pipeline.cpp similarity index 100% rename from src/source/adapter/shdr/shdr_pipeline.cpp rename to src/mtconnect/source/adapter/shdr/shdr_pipeline.cpp diff --git a/src/source/adapter/shdr/shdr_pipeline.hpp b/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp similarity index 100% rename from src/source/adapter/shdr/shdr_pipeline.hpp rename to src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp diff --git a/src/source/error_code.hpp b/src/mtconnect/source/error_code.hpp similarity index 100% rename from src/source/error_code.hpp rename to src/mtconnect/source/error_code.hpp diff --git a/src/source/loopback_source.cpp b/src/mtconnect/source/loopback_source.cpp similarity index 100% rename from src/source/loopback_source.cpp rename to src/mtconnect/source/loopback_source.cpp diff --git a/src/source/loopback_source.hpp b/src/mtconnect/source/loopback_source.hpp similarity index 100% rename from src/source/loopback_source.hpp rename to src/mtconnect/source/loopback_source.hpp diff --git a/src/source/source.cpp b/src/mtconnect/source/source.cpp similarity index 100% rename from src/source/source.cpp rename to src/mtconnect/source/source.cpp diff --git a/src/source/source.hpp b/src/mtconnect/source/source.hpp similarity index 100% rename from src/source/source.hpp rename to src/mtconnect/source/source.hpp diff --git a/src/utilities.cpp b/src/mtconnect/utilities.cpp similarity index 100% rename from src/utilities.cpp rename to src/mtconnect/utilities.cpp diff --git a/src/utilities.hpp b/src/mtconnect/utilities.hpp similarity index 100% rename from src/utilities.hpp rename to src/mtconnect/utilities.hpp diff --git a/src/version.cpp b/src/mtconnect/version.cpp similarity index 100% rename from src/version.cpp rename to src/mtconnect/version.cpp diff --git a/src/version.h.in b/src/mtconnect/version.h.in similarity index 100% rename from src/version.h.in rename to src/mtconnect/version.h.in diff --git a/src/version.rc.in b/src/mtconnect/version.rc.in similarity index 100% rename from src/version.rc.in rename to src/mtconnect/version.rc.in From a301cdf77455b586038cb7fd56356e144792947f Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 23 Dec 2022 17:13:15 -0800 Subject: [PATCH 02/50] Packing changes to support conan and plugin development --- agent/CMakeLists.txt | 2 +- agent/cppagent.cpp | 8 +- agent_lib/CMakeLists.txt | 368 +++++++++--------- conanfile.py | 41 +- src/mtconnect/agent.cpp | 32 +- src/mtconnect/agent.hpp | 32 +- src/mtconnect/asset/asset.cpp | 2 +- src/mtconnect/asset/asset.hpp | 6 +- src/mtconnect/asset/asset_buffer.hpp | 2 +- src/mtconnect/asset/asset_storage.hpp | 6 +- src/mtconnect/asset/cutting_tool.cpp | 5 +- src/mtconnect/asset/cutting_tool.hpp | 2 +- src/mtconnect/asset/file_asset.cpp | 2 +- src/mtconnect/asset/file_asset.hpp | 6 +- src/mtconnect/asset/qif_document.cpp | 2 +- src/mtconnect/asset/qif_document.hpp | 6 +- src/mtconnect/asset/raw_material.cpp | 2 +- src/mtconnect/asset/raw_material.hpp | 6 +- src/mtconnect/buffer/checkpoint.cpp | 2 +- src/mtconnect/buffer/checkpoint.hpp | 4 +- src/mtconnect/buffer/circular_buffer.hpp | 4 +- src/mtconnect/configuration/agent_config.cpp | 24 +- src/mtconnect/configuration/agent_config.hpp | 15 +- src/mtconnect/configuration/async_context.hpp | 2 +- src/mtconnect/configuration/parser.cpp | 2 +- src/mtconnect/configuration/service.cpp | 4 +- src/mtconnect/configuration/service.hpp | 2 +- src/mtconnect/device_model/agent_device.cpp | 6 +- src/mtconnect/device_model/agent_device.hpp | 4 +- src/mtconnect/device_model/component.cpp | 6 +- src/mtconnect/device_model/component.hpp | 4 +- src/mtconnect/device_model/composition.cpp | 1 - src/mtconnect/device_model/composition.hpp | 2 +- .../configuration/configuration.cpp | 2 +- .../configuration/configuration.hpp | 4 +- .../device_model/data_item/constraints.hpp | 4 +- .../device_model/data_item/data_item.cpp | 6 +- .../device_model/data_item/data_item.hpp | 9 +- .../device_model/data_item/definition.hpp | 2 +- .../device_model/data_item/filter.hpp | 4 +- .../device_model/data_item/relationships.hpp | 2 +- .../device_model/data_item/source.hpp | 2 +- .../data_item/unit_conversion.hpp | 2 +- src/mtconnect/device_model/description.hpp | 6 +- src/mtconnect/device_model/device.cpp | 6 +- src/mtconnect/device_model/device.hpp | 2 +- src/mtconnect/device_model/reference.cpp | 6 +- src/mtconnect/device_model/reference.hpp | 4 +- src/mtconnect/entity/data_set.cpp | 2 +- src/mtconnect/entity/data_set.hpp | 4 +- src/mtconnect/entity/factory.cpp | 2 +- src/mtconnect/entity/factory.hpp | 2 +- src/mtconnect/entity/json_parser.cpp | 4 +- src/mtconnect/entity/json_parser.hpp | 4 +- src/mtconnect/entity/json_printer.cpp | 2 +- src/mtconnect/entity/json_printer.hpp | 2 +- src/mtconnect/entity/requirement.cpp | 4 +- src/mtconnect/entity/requirement.hpp | 2 +- src/mtconnect/entity/xml_parser.cpp | 6 +- src/mtconnect/entity/xml_parser.hpp | 4 +- src/mtconnect/entity/xml_printer.cpp | 4 +- src/mtconnect/entity/xml_printer.hpp | 2 +- src/mtconnect/mqtt/mqtt_client.hpp | 4 +- src/mtconnect/mqtt/mqtt_client_impl.hpp | 6 +- src/mtconnect/mqtt/mqtt_server.hpp | 4 +- src/mtconnect/mqtt/mqtt_server_impl.hpp | 6 +- src/mtconnect/observation/change_observer.hpp | 2 +- src/mtconnect/observation/observation.cpp | 6 +- src/mtconnect/observation/observation.hpp | 8 +- src/mtconnect/parser/xml_parser.cpp | 10 +- src/mtconnect/parser/xml_parser.hpp | 12 +- src/mtconnect/pipeline/convert_sample.hpp | 4 +- src/mtconnect/pipeline/deliver.cpp | 8 +- src/mtconnect/pipeline/deliver.hpp | 4 +- src/mtconnect/pipeline/delta_filter.hpp | 2 +- src/mtconnect/pipeline/guard.hpp | 2 +- src/mtconnect/pipeline/message_mapper.hpp | 6 +- .../pipeline/mtconnect_xml_transform.hpp | 8 +- src/mtconnect/pipeline/period_filter.hpp | 2 +- src/mtconnect/pipeline/response_document.cpp | 12 +- src/mtconnect/pipeline/response_document.hpp | 8 +- src/mtconnect/pipeline/shdr_token_mapper.cpp | 12 +- src/mtconnect/pipeline/shdr_token_mapper.hpp | 4 +- src/mtconnect/pipeline/shdr_tokenizer.hpp | 2 +- .../pipeline/timestamp_extractor.cpp | 2 +- .../pipeline/timestamp_extractor.hpp | 2 +- src/mtconnect/pipeline/topic_mapper.hpp | 6 +- src/mtconnect/pipeline/transform.hpp | 2 +- src/mtconnect/pipeline/upcase_value.hpp | 4 +- src/mtconnect/printer/json_printer.cpp | 14 +- src/mtconnect/printer/json_printer.hpp | 6 +- src/mtconnect/printer/printer.hpp | 8 +- src/mtconnect/printer/xml_printer.cpp | 16 +- src/mtconnect/printer/xml_printer.hpp | 6 +- src/mtconnect/printer/xml_printer_helper.hpp | 2 +- src/mtconnect/ruby/embedded.cpp | 12 +- src/mtconnect/ruby/embedded.hpp | 2 +- src/mtconnect/ruby/ruby_agent.hpp | 6 +- src/mtconnect/ruby/ruby_entity.hpp | 12 +- src/mtconnect/ruby/ruby_observation.hpp | 2 +- src/mtconnect/ruby/ruby_pipeline.hpp | 6 +- src/mtconnect/ruby/ruby_transform.hpp | 6 +- src/mtconnect/ruby/ruby_type.hpp | 2 +- src/mtconnect/sink/mqtt_sink/mqtt_service.cpp | 12 +- src/mtconnect/sink/mqtt_sink/mqtt_service.hpp | 18 +- src/mtconnect/sink/rest_sink/cached_file.hpp | 2 +- src/mtconnect/sink/rest_sink/file_cache.cpp | 2 +- src/mtconnect/sink/rest_sink/response.hpp | 2 +- src/mtconnect/sink/rest_sink/rest_service.cpp | 12 +- src/mtconnect/sink/rest_sink/rest_service.hpp | 10 +- src/mtconnect/sink/rest_sink/routing.hpp | 2 +- src/mtconnect/sink/rest_sink/server.cpp | 2 +- src/mtconnect/sink/rest_sink/server.hpp | 4 +- src/mtconnect/sink/rest_sink/session_impl.cpp | 2 +- src/mtconnect/sink/rest_sink/session_impl.hpp | 4 +- src/mtconnect/sink/rest_sink/tls_dector.hpp | 4 +- src/mtconnect/sink/sink.cpp | 2 +- src/mtconnect/sink/sink.hpp | 10 +- src/mtconnect/source/adapter/adapter.hpp | 4 +- .../source/adapter/adapter_pipeline.cpp | 28 +- .../source/adapter/adapter_pipeline.hpp | 4 +- .../adapter/agent_adapter/agent_adapter.cpp | 6 +- .../adapter/agent_adapter/agent_adapter.hpp | 7 +- .../source/adapter/agent_adapter/session.hpp | 2 +- .../adapter/agent_adapter/session_impl.hpp | 4 +- .../adapter/agent_adapter/url_parser.hpp | 2 +- .../source/adapter/mqtt/mqtt_adapter.cpp | 28 +- .../source/adapter/mqtt/mqtt_adapter.hpp | 6 +- .../source/adapter/shdr/connector.cpp | 2 +- .../source/adapter/shdr/connector.hpp | 2 +- .../source/adapter/shdr/shdr_adapter.cpp | 6 +- .../source/adapter/shdr/shdr_adapter.hpp | 8 +- .../source/adapter/shdr/shdr_pipeline.cpp | 24 +- .../source/adapter/shdr/shdr_pipeline.hpp | 2 +- src/mtconnect/source/loopback_source.cpp | 24 +- src/mtconnect/source/loopback_source.hpp | 12 +- src/mtconnect/source/source.cpp | 4 +- src/mtconnect/source/source.hpp | 2 +- src/mtconnect/utilities.cpp | 2 +- src/mtconnect/utilities.hpp | 2 +- src/mtconnect/version.cpp | 2 +- test/adapter_test.cpp | 6 +- test/agent_adapter_test.cpp | 16 +- test/agent_device_test.cpp | 8 +- test/agent_test.cpp | 10 +- test/agent_test_helper.cpp | 4 +- test/agent_test_helper.hpp | 24 +- test/asset_buffer_test.cpp | 6 +- test/asset_test.cpp | 14 +- test/change_observer_test.cpp | 2 +- test/checkpoint_test.cpp | 2 +- test/circular_buffer_test.cpp | 4 +- test/component_test.cpp | 4 +- test/composition_test.cpp | 6 +- test/config_parser_test.cpp | 2 +- test/config_test.cpp | 12 +- test/connector_test.cpp | 2 +- test/coordinate_system_test.cpp | 4 +- test/cutting_tool_test.cpp | 18 +- test/data_item_mapping_test.cpp | 8 +- test/data_item_test.cpp | 4 +- test/data_set_test.cpp | 4 +- test/device_test.cpp | 2 +- test/duplicate_filter_test.cpp | 12 +- test/embedded_ruby_test.cpp | 20 +- test/entity_parser_test.cpp | 8 +- test/entity_printer_test.cpp | 12 +- test/entity_test.cpp | 4 +- test/file_asset_test.cpp | 14 +- test/file_cache_test.cpp | 2 +- test/globals_test.cpp | 2 +- test/http_server_test.cpp | 4 +- test/json_parser_test.cpp | 6 +- test/json_printer_asset_test.cpp | 22 +- test/json_printer_error_test.cpp | 12 +- test/json_printer_probe_test.cpp | 18 +- test/json_printer_stream_test.cpp | 16 +- test/json_printer_test.cpp | 16 +- test/kinematics_test.cpp | 4 +- test/mqtt_adapter_test.cpp | 4 +- test/mqtt_isolated_test.cpp | 14 +- test/mqtt_sink_test.cpp | 16 +- test/mtconnect_xml_transform_test.cpp | 8 +- test/observation_test.cpp | 14 +- test/period_filter_test.cpp | 14 +- test/pipeline_deliver_test.cpp | 14 +- test/pipeline_edit_test.cpp | 14 +- test/qif_document_test.cpp | 20 +- test/qname_test.cpp | 2 +- test/raw_material_test.cpp | 20 +- test/references_test.cpp | 4 +- test/relationship_test.cpp | 6 +- test/response_document_test.cpp | 8 +- test/routing_test.cpp | 4 +- test/sensor_configuration_test.cpp | 4 +- test/shdr_tokenizer_test.cpp | 6 +- test/solid_model_test.cpp | 4 +- test/specification_test.cpp | 4 +- test/table_test.cpp | 4 +- test/testadapter_service.hpp | 10 +- test/testsink_service.hpp | 2 +- test/timestamp_extractor_test.cpp | 4 +- test/tls_http_server_test.cpp | 4 +- test/topic_mapping_test.cpp | 8 +- test/unit_conversion_test.cpp | 2 +- test/url_parser_test.cpp | 2 +- test/xml_parser_test.cpp | 6 +- test/xml_printer_test.cpp | 16 +- 208 files changed, 922 insertions(+), 886 deletions(-) diff --git a/agent/CMakeLists.txt b/agent/CMakeLists.txt index 8a37ac68a..d7d9efb92 100644 --- a/agent/CMakeLists.txt +++ b/agent/CMakeLists.txt @@ -4,7 +4,7 @@ if(WIN32) # Version info string(TIMESTAMP AGENT_VERSION_TIME "%Y-%m-%dT%H:%M:%SZ" UTC) set(RESOURCE_FILE "${PROJECT_BINARY_DIR}/agent/version.rc") - configure_file("${CMAKE_CURRENT_LIST_DIR}/../src/version.rc.in" "${RESOURCE_FILE}") + configure_file("${CMAKE_CURRENT_LIST_DIR}/../src/mtconnect/version.rc.in" "${RESOURCE_FILE}") list(APPEND AGENT_SOURCES "${RESOURCE_FILE}") endif() diff --git a/agent/cppagent.cpp b/agent/cppagent.cpp index d8e279e22..ae86382a3 100644 --- a/agent/cppagent.cpp +++ b/agent/cppagent.cpp @@ -16,11 +16,11 @@ // #include -#include "agent.hpp" -#include "configuration/agent_config.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/configuration/agent_config.hpp" -#include "fcntl.h" -#include "sys/stat.h" +#include +#include #include diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index 87840a559..25eb183ba 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -1,296 +1,298 @@ +set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../src/mtconnect") + set(AGENT_SOURCES # src HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/agent.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/logging.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/utilities.hpp" + "${SOURCE_DIR}/agent.hpp" + "${SOURCE_DIR}/logging.hpp" + "${SOURCE_DIR}/utilities.hpp" # src SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/agent.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/utilities.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/version.cpp" + "${SOURCE_DIR}/agent.cpp" + "${SOURCE_DIR}/utilities.cpp" + "${SOURCE_DIR}/version.cpp" # src/asset HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/asset.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/asset_buffer.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/asset_storage.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/cutting_tool.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/file_asset.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/raw_material.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/qif_document.hpp" + "${SOURCE_DIR}/asset/asset.hpp" + "${SOURCE_DIR}/asset/asset_buffer.hpp" + "${SOURCE_DIR}/asset/asset_storage.hpp" + "${SOURCE_DIR}/asset/cutting_tool.hpp" + "${SOURCE_DIR}/asset/file_asset.hpp" + "${SOURCE_DIR}/asset/raw_material.hpp" + "${SOURCE_DIR}/asset/qif_document.hpp" # src/asset SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/asset.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/cutting_tool.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/file_asset.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/raw_material.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/asset/qif_document.cpp" + "${SOURCE_DIR}/asset/asset.cpp" + "${SOURCE_DIR}/asset/cutting_tool.cpp" + "${SOURCE_DIR}/asset/file_asset.cpp" + "${SOURCE_DIR}/asset/raw_material.cpp" + "${SOURCE_DIR}/asset/qif_document.cpp" # src/buffer HEADER_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/buffer/checkpoint.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/buffer/circular_buffer.hpp" + "${SOURCE_DIR}/buffer/checkpoint.hpp" + "${SOURCE_DIR}/buffer/circular_buffer.hpp" # src/buffer SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/buffer/checkpoint.cpp" + "${SOURCE_DIR}/buffer/checkpoint.cpp" # src/configuration HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/configuration/agent_config.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/configuration/async_context.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/configuration/config_options.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/configuration/parser.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/configuration/service.hpp" + "${SOURCE_DIR}/configuration/agent_config.hpp" + "${SOURCE_DIR}/configuration/async_context.hpp" + "${SOURCE_DIR}/configuration/config_options.hpp" + "${SOURCE_DIR}/configuration/parser.hpp" + "${SOURCE_DIR}/configuration/service.hpp" # src/configuration SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/configuration/agent_config.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/configuration/parser.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/configuration/service.cpp" + "${SOURCE_DIR}/configuration/agent_config.cpp" + "${SOURCE_DIR}/configuration/parser.cpp" + "${SOURCE_DIR}/configuration/service.cpp" # src/device_model HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/agent_device.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/component.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/composition.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/description.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/device.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/reference.hpp" + "${SOURCE_DIR}/device_model/agent_device.hpp" + "${SOURCE_DIR}/device_model/component.hpp" + "${SOURCE_DIR}/device_model/composition.hpp" + "${SOURCE_DIR}/device_model/description.hpp" + "${SOURCE_DIR}/device_model/device.hpp" + "${SOURCE_DIR}/device_model/reference.hpp" # src/device_model SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/agent_device.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/component.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/composition.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/description.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/device.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/reference.cpp" + "${SOURCE_DIR}/device_model/agent_device.cpp" + "${SOURCE_DIR}/device_model/component.cpp" + "${SOURCE_DIR}/device_model/composition.cpp" + "${SOURCE_DIR}/device_model/description.cpp" + "${SOURCE_DIR}/device_model/device.cpp" + "${SOURCE_DIR}/device_model/reference.cpp" # src/device_model/configuration HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/configuration.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/coordinate_systems.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/motion.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/relationships.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/sensor_configuration.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/solid_model.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/specifications.hpp" + "${SOURCE_DIR}/device_model/configuration/configuration.hpp" + "${SOURCE_DIR}/device_model/configuration/coordinate_systems.hpp" + "${SOURCE_DIR}/device_model/configuration/motion.hpp" + "${SOURCE_DIR}/device_model/configuration/relationships.hpp" + "${SOURCE_DIR}/device_model/configuration/sensor_configuration.hpp" + "${SOURCE_DIR}/device_model/configuration/solid_model.hpp" + "${SOURCE_DIR}/device_model/configuration/specifications.hpp" # src/device_model/configuration SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/configuration.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/coordinate_systems.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/motion.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/relationships.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/sensor_configuration.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/solid_model.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/configuration/specifications.cpp" + "${SOURCE_DIR}/device_model/configuration/configuration.cpp" + "${SOURCE_DIR}/device_model/configuration/coordinate_systems.cpp" + "${SOURCE_DIR}/device_model/configuration/motion.cpp" + "${SOURCE_DIR}/device_model/configuration/relationships.cpp" + "${SOURCE_DIR}/device_model/configuration/sensor_configuration.cpp" + "${SOURCE_DIR}/device_model/configuration/solid_model.cpp" + "${SOURCE_DIR}/device_model/configuration/specifications.cpp" # src/device_model/data_item HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/constraints.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/data_item.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/definition.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/filter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/relationships.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/source.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/unit_conversion.hpp" + "${SOURCE_DIR}/device_model/data_item/constraints.hpp" + "${SOURCE_DIR}/device_model/data_item/data_item.hpp" + "${SOURCE_DIR}/device_model/data_item/definition.hpp" + "${SOURCE_DIR}/device_model/data_item/filter.hpp" + "${SOURCE_DIR}/device_model/data_item/relationships.hpp" + "${SOURCE_DIR}/device_model/data_item/source.hpp" + "${SOURCE_DIR}/device_model/data_item/unit_conversion.hpp" # src/device_model/data_item SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/data_item.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/device_model/data_item/unit_conversion.cpp" + "${SOURCE_DIR}/device_model/data_item/data_item.cpp" + "${SOURCE_DIR}/device_model/data_item/unit_conversion.cpp" # src/entity HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/data_set.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/entity.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/factory.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/json_parser.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/json_printer.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/qname.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/requirement.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/xml_parser.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/xml_printer.hpp" + "${SOURCE_DIR}/entity/data_set.hpp" + "${SOURCE_DIR}/entity/entity.hpp" + "${SOURCE_DIR}/entity/factory.hpp" + "${SOURCE_DIR}/entity/json_parser.hpp" + "${SOURCE_DIR}/entity/json_printer.hpp" + "${SOURCE_DIR}/entity/qname.hpp" + "${SOURCE_DIR}/entity/requirement.hpp" + "${SOURCE_DIR}/entity/xml_parser.hpp" + "${SOURCE_DIR}/entity/xml_printer.hpp" # src/entity SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/data_set.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/entity.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/factory.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/json_parser.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/json_printer.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/requirement.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/xml_parser.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/entity/xml_printer.cpp" + "${SOURCE_DIR}/entity/data_set.cpp" + "${SOURCE_DIR}/entity/entity.cpp" + "${SOURCE_DIR}/entity/factory.cpp" + "${SOURCE_DIR}/entity/json_parser.cpp" + "${SOURCE_DIR}/entity/json_printer.cpp" + "${SOURCE_DIR}/entity/requirement.cpp" + "${SOURCE_DIR}/entity/xml_parser.cpp" + "${SOURCE_DIR}/entity/xml_printer.cpp" # src/mqtt HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/mqtt/mqtt_client.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/mqtt/mqtt_server.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/mqtt/mqtt_client_impl.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/mqtt/mqtt_server_impl.hpp" + "${SOURCE_DIR}/mqtt/mqtt_client.hpp" + "${SOURCE_DIR}/mqtt/mqtt_server.hpp" + "${SOURCE_DIR}/mqtt/mqtt_client_impl.hpp" + "${SOURCE_DIR}/mqtt/mqtt_server_impl.hpp" # src/observation HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/observation/change_observer.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/observation/observation.hpp" + "${SOURCE_DIR}/observation/change_observer.hpp" + "${SOURCE_DIR}/observation/observation.hpp" #src/observation SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/observation/change_observer.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/observation/observation.cpp" + "${SOURCE_DIR}/observation/change_observer.cpp" + "${SOURCE_DIR}/observation/observation.cpp" # src/parser HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/parser/xml_parser.hpp" + "${SOURCE_DIR}/parser/xml_parser.hpp" # src/parser SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/parser/xml_parser.cpp" + "${SOURCE_DIR}/parser/xml_parser.cpp" # src/pipeline HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/convert_sample.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/deliver.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/delta_filter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/duplicate_filter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/guard.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/message_mapper.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/mtconnect_xml_transform.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/period_filter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/pipeline.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/pipeline_context.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/pipeline_contract.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/response_document.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/shdr_token_mapper.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/shdr_tokenizer.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/timestamp_extractor.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/topic_mapper.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/transform.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/upcase_value.hpp" + "${SOURCE_DIR}/pipeline/convert_sample.hpp" + "${SOURCE_DIR}/pipeline/deliver.hpp" + "${SOURCE_DIR}/pipeline/delta_filter.hpp" + "${SOURCE_DIR}/pipeline/duplicate_filter.hpp" + "${SOURCE_DIR}/pipeline/guard.hpp" + "${SOURCE_DIR}/pipeline/message_mapper.hpp" + "${SOURCE_DIR}/pipeline/mtconnect_xml_transform.hpp" + "${SOURCE_DIR}/pipeline/period_filter.hpp" + "${SOURCE_DIR}/pipeline/pipeline.hpp" + "${SOURCE_DIR}/pipeline/pipeline_context.hpp" + "${SOURCE_DIR}/pipeline/pipeline_contract.hpp" + "${SOURCE_DIR}/pipeline/response_document.hpp" + "${SOURCE_DIR}/pipeline/shdr_token_mapper.hpp" + "${SOURCE_DIR}/pipeline/shdr_tokenizer.hpp" + "${SOURCE_DIR}/pipeline/timestamp_extractor.hpp" + "${SOURCE_DIR}/pipeline/topic_mapper.hpp" + "${SOURCE_DIR}/pipeline/transform.hpp" + "${SOURCE_DIR}/pipeline/upcase_value.hpp" # src/pipeline SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/deliver.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/shdr_token_mapper.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/timestamp_extractor.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/pipeline/response_document.cpp" + "${SOURCE_DIR}/pipeline/deliver.cpp" + "${SOURCE_DIR}/pipeline/shdr_token_mapper.cpp" + "${SOURCE_DIR}/pipeline/timestamp_extractor.cpp" + "${SOURCE_DIR}/pipeline/response_document.cpp" # src/printer HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/printer/json_printer.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/printer/printer.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/printer/xml_helper.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/printer/xml_printer.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/printer/xml_printer_helper.hpp" + "${SOURCE_DIR}/printer/json_printer.hpp" + "${SOURCE_DIR}/printer/printer.hpp" + "${SOURCE_DIR}/printer/xml_helper.hpp" + "${SOURCE_DIR}/printer/xml_printer.hpp" + "${SOURCE_DIR}/printer/xml_printer_helper.hpp" # src/printer SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/printer/json_printer.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/printer/xml_printer.cpp" + "${SOURCE_DIR}/printer/json_printer.cpp" + "${SOURCE_DIR}/printer/xml_printer.cpp" # src/source HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/adapter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/adapter_pipeline.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/agent_adapter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/http_session.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/https_session.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/session.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/session_impl.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/url_parser.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/mqtt/mqtt_adapter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/shdr/connector.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/shdr/shdr_adapter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/shdr/shdr_pipeline.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/error_code.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/loopback_source.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/source.hpp" + "${SOURCE_DIR}/source/adapter/adapter.hpp" + "${SOURCE_DIR}/source/adapter/adapter_pipeline.hpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/agent_adapter.hpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/http_session.hpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/https_session.hpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/session.hpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/session_impl.hpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/url_parser.hpp" + "${SOURCE_DIR}/source/adapter/mqtt/mqtt_adapter.hpp" + "${SOURCE_DIR}/source/adapter/shdr/connector.hpp" + "${SOURCE_DIR}/source/adapter/shdr/shdr_adapter.hpp" + "${SOURCE_DIR}/source/adapter/shdr/shdr_pipeline.hpp" + "${SOURCE_DIR}/source/error_code.hpp" + "${SOURCE_DIR}/source/loopback_source.hpp" + "${SOURCE_DIR}/source/source.hpp" # src/source SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/adapter_pipeline.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/mqtt/mqtt_adapter.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/shdr/connector.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/shdr/shdr_adapter.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/shdr/shdr_pipeline.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/loopback_source.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/source.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/agent_adapter.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/url_parser.cpp" + "${SOURCE_DIR}/source/adapter/adapter_pipeline.cpp" + "${SOURCE_DIR}/source/adapter/mqtt/mqtt_adapter.cpp" + "${SOURCE_DIR}/source/adapter/shdr/connector.cpp" + "${SOURCE_DIR}/source/adapter/shdr/shdr_adapter.cpp" + "${SOURCE_DIR}/source/adapter/shdr/shdr_pipeline.cpp" + "${SOURCE_DIR}/source/loopback_source.cpp" + "${SOURCE_DIR}/source/source.cpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/agent_adapter.cpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/url_parser.cpp" # src/sink HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/sink.hpp" + "${SOURCE_DIR}/sink/sink.hpp" # src/sink SOURCE_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/sink.cpp" + "${SOURCE_DIR}/sink/sink.cpp" # src/sink/mqtt_sink HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/mqtt_sink/mqtt_service.hpp" + "${SOURCE_DIR}/sink/mqtt_sink/mqtt_service.hpp" #src/sink/mqtt_sink SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/mqtt_sink/mqtt_service.cpp" + "${SOURCE_DIR}/sink/mqtt_sink/mqtt_service.cpp" # src/sink/rest_sink HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/cached_file.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/file_cache.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/parameter.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/request.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/response.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/rest_service.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/routing.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/server.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/session.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/session_impl.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/tls_dector.hpp" + "${SOURCE_DIR}/sink/rest_sink/cached_file.hpp" + "${SOURCE_DIR}/sink/rest_sink/file_cache.hpp" + "${SOURCE_DIR}/sink/rest_sink/parameter.hpp" + "${SOURCE_DIR}/sink/rest_sink/request.hpp" + "${SOURCE_DIR}/sink/rest_sink/response.hpp" + "${SOURCE_DIR}/sink/rest_sink/rest_service.hpp" + "${SOURCE_DIR}/sink/rest_sink/routing.hpp" + "${SOURCE_DIR}/sink/rest_sink/server.hpp" + "${SOURCE_DIR}/sink/rest_sink/session.hpp" + "${SOURCE_DIR}/sink/rest_sink/session_impl.hpp" + "${SOURCE_DIR}/sink/rest_sink/tls_dector.hpp" # src/sink/rest_sink SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/file_cache.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/rest_service.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/server.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/session_impl.cpp" + "${SOURCE_DIR}/sink/rest_sink/file_cache.cpp" + "${SOURCE_DIR}/sink/rest_sink/rest_service.cpp" + "${SOURCE_DIR}/sink/rest_sink/server.cpp" + "${SOURCE_DIR}/sink/rest_sink/session_impl.cpp" ) if(WITH_PYTHON) set(AGENT_SOURCES ${AGENT_SOURCES} - "${CMAKE_CURRENT_SOURCE_DIR}/../src/python/embedded.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/python/embedded.cpp" + "${SOURCE_DIR}/python/embedded.hpp" + "${SOURCE_DIR}/python/embedded.cpp" ) endif() if(WITH_RUBY) set(AGENT_SOURCES ${AGENT_SOURCES} # HEADER_FILE_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/embedded.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/ruby_agent.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/ruby_entity.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/ruby_observation.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/ruby_pipeline.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/ruby_smart_ptr.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/ruby_transform.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/ruby_type.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/ruby_vm.hpp" + "${SOURCE_DIR}/ruby/embedded.hpp" + "${SOURCE_DIR}/ruby/ruby_agent.hpp" + "${SOURCE_DIR}/ruby/ruby_entity.hpp" + "${SOURCE_DIR}/ruby/ruby_observation.hpp" + "${SOURCE_DIR}/ruby/ruby_pipeline.hpp" + "${SOURCE_DIR}/ruby/ruby_smart_ptr.hpp" + "${SOURCE_DIR}/ruby/ruby_transform.hpp" + "${SOURCE_DIR}/ruby/ruby_type.hpp" + "${SOURCE_DIR}/ruby/ruby_vm.hpp" #SOURCE_FILES_ONLY - "${CMAKE_CURRENT_SOURCE_DIR}/../src/ruby/embedded.cpp" + "${SOURCE_DIR}/ruby/embedded.cpp" ) endif() ## configure a header file to pass some of the CMake settings to the source code -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../src/version.h.in" "${PROJECT_BINARY_DIR}/agent_lib/version.h") +configure_file("${SOURCE_DIR}/version.h.in" "${PROJECT_BINARY_DIR}/agent_lib/mtconnect/version.h") set(AGENT_LIB_HEADERS ${AGENT_SOURCES}) list(FILTER AGENT_LIB_HEADERS INCLUDE REGEX "\\.(h|hpp|ipp)$") @@ -300,24 +302,24 @@ list(FILTER AGENT_LIB_SOURCES INCLUDE REGEX "\\.(c|cpp)$") # For IDE Grouping source_group("Header Files") source_group("Source Files") -source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/../src" PREFIX "Header Files" FILES ${AGENT_LIB_HEADERS}) -source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/../src" PREFIX "Source Files" FILES ${AGENT_LIB_SOURCES}) +source_group(TREE "${SOURCE_DIR}" PREFIX "Header Files" FILES ${AGENT_LIB_HEADERS}) +source_group(TREE "${SOURCE_DIR}" PREFIX "Source Files" FILES ${AGENT_LIB_SOURCES}) if(MSVC) if(CMAKE_GENERATOR_TOOLSET) if(${CMAKE_GENERATOR_TOOLSET} MATCHES "v14[01]_xp") message(info ": Setting /Ob1 for rest_sink/session_impl.cpp") - set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/session_impl.cpp" + set_property(SOURCE "${SOURCE_DIR}/sink/rest_sink/session_impl.cpp" PROPERTY COMPILE_FLAGS "/Ob1") endif() endif() # The modules including Beast required the /bigobj option in Windows set_property(SOURCE - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/mqtt_sink/mqtt_service.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/sink/rest_sink/session_impl.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/mqtt/mqtt_adapter.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../src/source/adapter/agent_adapter/agent_adapter.cpp" + "${SOURCE_DIR}/sink/mqtt_sink/mqtt_service.cpp" + "${SOURCE_DIR}/sink/rest_sink/session_impl.cpp" + "${SOURCE_DIR}/source/adapter/mqtt/mqtt_adapter.cpp" + "${SOURCE_DIR}/source/adapter/agent_adapter/agent_adapter.cpp" PROPERTY COMPILE_FLAGS "/bigobj") endif() diff --git a/conanfile.py b/conanfile.py index c4441fad8..7d98b550c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,15 +1,21 @@ from conans import ConanFile, CMake, tools +import os +import io +import re +import itertools as it +import glob -class CppAgentConan(ConanFile): - name = "mtconnect_cppagent" - version = "2.0" + +class MTConnectAgentConan(ConanFile): + name = "mtconnect_agent" + version = "2.1" generators = "cmake" url = "https://github.com/mtconnect/cppagent.git" license = "Apache License 2.0" settings = "os", "compiler", "arch", "build_type", "arch_build" options = { "run_tests": [True, False], "build_tests": [True, False], "without_python": [True, False], "without_ruby": [True, False], "without_ipv6": [True, False], "with_ruby": [True, False], - "with_python": [True, False] } + "with_python": [True, False], "development" : [True, False] } description = "MTConnect reference C++ agent copyright Association for Manufacturing Technology" requires = ["boost/1.79.0@#3249d9bd2b863a9489767bf9c8a05b4b", @@ -28,6 +34,7 @@ class CppAgentConan(ConanFile): "without_ipv6": False, "with_python": False, "with_ruby": False, + "development": False, "boost:shared": False, "boost:without_python": True, @@ -45,6 +52,15 @@ class CppAgentConan(ConanFile): "date:use_system_tz_db": True } + exports_sources = "*" + +# def source(self): +# git = tools.Git(self.source_folder) +# if self.options.development: +# git.clone("git@github.com:/mtconnect/cppagent_dev") +# else: +# git.clone("https://github.com/mtconnect/cppagent") + def configure(self): if not self.options.without_python: self.options["boost"].without_python = False @@ -118,4 +134,21 @@ def imports(self): self.copy("*.so*", "bin", "lib") self.copy("*.dylib", "bin", "lib") + def package_info(self): + self.cpp_info.includedirs = ['include'] + self.cpp_info.libs = ['agent_lib'] + + self.cpp_info.defines = [] + if self.options.with_ruby: + self.cpp_info.defines.append("WITH_RUBY=1") + if self.options.without_ipv6: + self.cpp_info.defines.append("AGENT_WITHOUT_IPV6=1") + + def package(self): + self.copy("*", src=os.path.join(self.build_folder, "bin"), dst="bin", keep_path=False) + self.copy("*.a", src=os.path.join(self.build_folder, "lib"), dst="lib", keep_path=False) + self.copy("*.h", src=os.path.join(self.build_folder, "agent_lib"), dst="include") + self.copy("*.h", src="src", dst="include") + self.copy("*.hpp", src="src", dst="include") + diff --git a/src/mtconnect/agent.cpp b/src/mtconnect/agent.cpp index 8a0700e19..a45c799ae 100644 --- a/src/mtconnect/agent.cpp +++ b/src/mtconnect/agent.cpp @@ -15,7 +15,7 @@ // limitations under the License. // -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include #include @@ -40,21 +40,21 @@ #include #include -#include "asset/asset.hpp" -#include "asset/cutting_tool.hpp" -#include "asset/file_asset.hpp" -#include "asset/qif_document.hpp" -#include "asset/raw_material.hpp" -#include "configuration/config_options.hpp" -#include "device_model/agent_device.hpp" -#include "entity/xml_parser.hpp" -#include "logging.hpp" -#include "observation/observation.hpp" -#include "printer/json_printer.hpp" -#include "printer/xml_printer.hpp" -#include "sink/rest_sink/file_cache.hpp" -#include "sink/rest_sink/session.hpp" -#include "version.h" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/asset/file_asset.hpp" +#include "mtconnect/asset/qif_document.hpp" +#include "mtconnect/asset/raw_material.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/device_model/agent_device.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/printer/json_printer.hpp" +#include "mtconnect/printer/xml_printer.hpp" +#include "mtconnect/sink/rest_sink/file_cache.hpp" +#include "mtconnect/sink/rest_sink/session.hpp" +#include "mtconnect/version.h" using namespace std; diff --git a/src/mtconnect/agent.hpp b/src/mtconnect/agent.hpp index 9367e34a5..302ab1edf 100644 --- a/src/mtconnect/agent.hpp +++ b/src/mtconnect/agent.hpp @@ -36,22 +36,22 @@ #include #include -#include "asset/asset_buffer.hpp" -#include "buffer/checkpoint.hpp" -#include "buffer/circular_buffer.hpp" -#include "configuration/service.hpp" -#include "device_model/agent_device.hpp" -#include "device_model/device.hpp" -#include "parser/xml_parser.hpp" -#include "pipeline/pipeline.hpp" -#include "pipeline/pipeline_contract.hpp" -#include "printer/printer.hpp" -#include "sink/rest_sink/rest_service.hpp" -#include "sink/rest_sink/server.hpp" -#include "sink/sink.hpp" -#include "source/adapter/adapter.hpp" -#include "source/loopback_source.hpp" -#include "source/source.hpp" +#include "mtconnect/asset/asset_buffer.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/buffer/circular_buffer.hpp" +#include "mtconnect/configuration/service.hpp" +#include "mtconnect/device_model/agent_device.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/parser/xml_parser.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/pipeline/pipeline_contract.hpp" +#include "mtconnect/printer//printer.hpp" +#include "mtconnect/sink/rest_sink/rest_service.hpp" +#include "mtconnect/sink/rest_sink/server.hpp" +#include "mtconnect/sink/sink.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/loopback_source.hpp" +#include "mtconnect/source/source.hpp" namespace mtconnect { namespace mic = boost::multi_index; diff --git a/src/mtconnect/asset/asset.cpp b/src/mtconnect/asset/asset.cpp index 31500a7f9..fe5eeab90 100644 --- a/src/mtconnect/asset/asset.cpp +++ b/src/mtconnect/asset/asset.cpp @@ -15,7 +15,7 @@ // limitations under the License. // -#include "asset/asset.hpp" +#include "mtconnect/asset/asset.hpp" #include #include diff --git a/src/mtconnect/asset/asset.hpp b/src/mtconnect/asset/asset.hpp index 7f29df59c..2bb2c2b51 100644 --- a/src/mtconnect/asset/asset.hpp +++ b/src/mtconnect/asset/asset.hpp @@ -21,9 +21,9 @@ #include #include -#include "entity/entity.hpp" -#include "entity/factory.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace asset { diff --git a/src/mtconnect/asset/asset_buffer.hpp b/src/mtconnect/asset/asset_buffer.hpp index b18819d53..62e35de41 100644 --- a/src/mtconnect/asset/asset_buffer.hpp +++ b/src/mtconnect/asset/asset_buffer.hpp @@ -42,7 +42,7 @@ #include "asset.hpp" #include "asset_storage.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::asset { namespace mic = boost::multi_index; diff --git a/src/mtconnect/asset/asset_storage.hpp b/src/mtconnect/asset/asset_storage.hpp index 455cd4929..4ebca5412 100644 --- a/src/mtconnect/asset/asset_storage.hpp +++ b/src/mtconnect/asset/asset_storage.hpp @@ -23,9 +23,9 @@ #include #include -#include "asset/asset.hpp" -#include "entity/entity.hpp" -#include "utilities.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace asset { diff --git a/src/mtconnect/asset/cutting_tool.cpp b/src/mtconnect/asset/cutting_tool.cpp index 5855f05a0..8dde2ab8a 100644 --- a/src/mtconnect/asset/cutting_tool.cpp +++ b/src/mtconnect/asset/cutting_tool.cpp @@ -15,11 +15,10 @@ // limitations under the License. // -#include "asset/cutting_tool.hpp" - #include -#include "printer/printer.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/printer//printer.hpp" using namespace std; diff --git a/src/mtconnect/asset/cutting_tool.hpp b/src/mtconnect/asset/cutting_tool.hpp index 9a30f7f2e..8cf7a30fc 100644 --- a/src/mtconnect/asset/cutting_tool.hpp +++ b/src/mtconnect/asset/cutting_tool.hpp @@ -22,7 +22,7 @@ #include #include "asset.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace asset { diff --git a/src/mtconnect/asset/file_asset.cpp b/src/mtconnect/asset/file_asset.cpp index 414fde28a..bd6dce904 100644 --- a/src/mtconnect/asset/file_asset.cpp +++ b/src/mtconnect/asset/file_asset.cpp @@ -15,7 +15,7 @@ // limitations under the License. // -#include "asset/file_asset.hpp" +#include "mtconnect/asset/file_asset.hpp" namespace mtconnect { namespace asset { diff --git a/src/mtconnect/asset/file_asset.hpp b/src/mtconnect/asset/file_asset.hpp index 4f96c0250..3db48319a 100644 --- a/src/mtconnect/asset/file_asset.hpp +++ b/src/mtconnect/asset/file_asset.hpp @@ -22,9 +22,9 @@ #include #include "asset.hpp" -#include "entity/entity.hpp" -#include "entity/factory.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace asset { diff --git a/src/mtconnect/asset/qif_document.cpp b/src/mtconnect/asset/qif_document.cpp index f1a758567..9a9e33e61 100644 --- a/src/mtconnect/asset/qif_document.cpp +++ b/src/mtconnect/asset/qif_document.cpp @@ -15,7 +15,7 @@ // limitations under the License. // -#include "asset/qif_document.hpp" +#include "mtconnect/asset/qif_document.hpp" using namespace std; diff --git a/src/mtconnect/asset/qif_document.hpp b/src/mtconnect/asset/qif_document.hpp index 51151f095..df75246c6 100644 --- a/src/mtconnect/asset/qif_document.hpp +++ b/src/mtconnect/asset/qif_document.hpp @@ -22,9 +22,9 @@ #include #include "asset.hpp" -#include "entity/entity.hpp" -#include "entity/factory.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::asset { class QIFDocumentWrapper : public Asset diff --git a/src/mtconnect/asset/raw_material.cpp b/src/mtconnect/asset/raw_material.cpp index abc3d0e55..beb8bc20c 100644 --- a/src/mtconnect/asset/raw_material.cpp +++ b/src/mtconnect/asset/raw_material.cpp @@ -15,7 +15,7 @@ // limitations under the License. // -#include "asset/raw_material.hpp" +#include "mtconnect/asset/raw_material.hpp" using namespace std; diff --git a/src/mtconnect/asset/raw_material.hpp b/src/mtconnect/asset/raw_material.hpp index d42441f02..24d92b837 100644 --- a/src/mtconnect/asset/raw_material.hpp +++ b/src/mtconnect/asset/raw_material.hpp @@ -22,9 +22,9 @@ #include #include "asset.hpp" -#include "entity/entity.hpp" -#include "entity/factory.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::asset { class RawMaterial : public Asset diff --git a/src/mtconnect/buffer/checkpoint.cpp b/src/mtconnect/buffer/checkpoint.cpp index f57e89f2c..da052170a 100644 --- a/src/mtconnect/buffer/checkpoint.cpp +++ b/src/mtconnect/buffer/checkpoint.cpp @@ -17,7 +17,7 @@ #include "checkpoint.hpp" -#include "device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" using namespace std; diff --git a/src/mtconnect/buffer/checkpoint.hpp b/src/mtconnect/buffer/checkpoint.hpp index d032883e9..54462f7c8 100644 --- a/src/mtconnect/buffer/checkpoint.hpp +++ b/src/mtconnect/buffer/checkpoint.hpp @@ -23,8 +23,8 @@ #include #include -#include "observation/observation.hpp" -#include "utilities.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::buffer { class Checkpoint diff --git a/src/mtconnect/buffer/circular_buffer.hpp b/src/mtconnect/buffer/circular_buffer.hpp index 912d267a8..8cb08ef74 100644 --- a/src/mtconnect/buffer/circular_buffer.hpp +++ b/src/mtconnect/buffer/circular_buffer.hpp @@ -24,8 +24,8 @@ #include #include "checkpoint.hpp" -#include "observation/observation.hpp" -#include "utilities.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::buffer { using SequenceNumber_t = uint64_t; diff --git a/src/mtconnect/configuration/agent_config.cpp b/src/mtconnect/configuration/agent_config.cpp index 581c9ebe4..9e98a6858 100644 --- a/src/mtconnect/configuration/agent_config.cpp +++ b/src/mtconnect/configuration/agent_config.cpp @@ -50,23 +50,23 @@ #include #include -#include "agent.hpp" -#include "configuration/config_options.hpp" -#include "device_model/device.hpp" -#include "printer/xml_printer.hpp" -#include "sink/mqtt_sink/mqtt_service.hpp" -#include "sink/rest_sink/rest_service.hpp" -#include "source/adapter/agent_adapter/agent_adapter.hpp" -#include "source/adapter/mqtt/mqtt_adapter.hpp" -#include "source/adapter/shdr/shdr_adapter.hpp" -#include "version.h" +#include "mtconnect/agent.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/printer/xml_printer.hpp" +#include "mtconnect/sink/mqtt_sink/mqtt_service.hpp" +#include "mtconnect/sink/rest_sink/rest_service.hpp" +#include "mtconnect/source/adapter/agent_adapter/agent_adapter.hpp" +#include "mtconnect/source/adapter/mqtt/mqtt_adapter.hpp" +#include "mtconnect/source/adapter/shdr/shdr_adapter.hpp" +#include "mtconnect/version.h" #ifdef WITH_PYTHON -#include "python/embedded.hpp" +#include "mtconnect/python/embedded.hpp" #endif #ifdef WITH_RUBY -#include "ruby/embedded.hpp" +#include "mtconnect/ruby/embedded.hpp" #endif // If Windows XP diff --git a/src/mtconnect/configuration/agent_config.hpp b/src/mtconnect/configuration/agent_config.hpp index 7f8fa583b..8cb70efdc 100644 --- a/src/mtconnect/configuration/agent_config.hpp +++ b/src/mtconnect/configuration/agent_config.hpp @@ -27,16 +27,17 @@ #include #include -#include "agent.hpp" #include "async_context.hpp" #include "parser.hpp" #include "service.hpp" -#include "sink/rest_sink/file_cache.hpp" -#include "sink/sink.hpp" -#include "source/adapter/adapter.hpp" -#include "source/adapter/shdr/shdr_pipeline.hpp" -#include "source/source.hpp" -#include "utilities.hpp" + +#include "mtconnect/agent.hpp" +#include "mtconnect/sink/rest_sink/file_cache.hpp" +#include "mtconnect/sink/sink.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/shdr/shdr_pipeline.hpp" +#include "mtconnect/source/source.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace rest_sink { diff --git a/src/mtconnect/configuration/async_context.hpp b/src/mtconnect/configuration/async_context.hpp index cf921f7bc..8f18b809d 100644 --- a/src/mtconnect/configuration/async_context.hpp +++ b/src/mtconnect/configuration/async_context.hpp @@ -20,7 +20,7 @@ #include #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" namespace mtconnect::configuration { diff --git a/src/mtconnect/configuration/parser.cpp b/src/mtconnect/configuration/parser.cpp index b487c9f39..b36735d1d 100644 --- a/src/mtconnect/configuration/parser.cpp +++ b/src/mtconnect/configuration/parser.cpp @@ -20,7 +20,7 @@ #include #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" //#define BOOST_SPIRIT_DEBUG 1 #ifdef BOOST_SPIRIT_DEBUG diff --git a/src/mtconnect/configuration/service.cpp b/src/mtconnect/configuration/service.cpp index bc395e42b..303e29eef 100644 --- a/src/mtconnect/configuration/service.cpp +++ b/src/mtconnect/configuration/service.cpp @@ -27,9 +27,9 @@ #include #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" #include "service.hpp" -#include "version.h" +#include "mtconnect/version.h" #ifdef _WINDOWS #define stricmp _stricmp diff --git a/src/mtconnect/configuration/service.hpp b/src/mtconnect/configuration/service.hpp index b791a17d5..d833bab3e 100644 --- a/src/mtconnect/configuration/service.hpp +++ b/src/mtconnect/configuration/service.hpp @@ -23,7 +23,7 @@ #include #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace configuration { diff --git a/src/mtconnect/device_model/agent_device.cpp b/src/mtconnect/device_model/agent_device.cpp index b79a184f0..ffeb9cf6a 100644 --- a/src/mtconnect/device_model/agent_device.cpp +++ b/src/mtconnect/device_model/agent_device.cpp @@ -17,11 +17,11 @@ #include "agent_device.hpp" -#include "configuration/config_options.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "data_item/constraints.hpp" #include "data_item/data_item.hpp" -#include "logging.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using namespace std; using namespace std::literals; diff --git a/src/mtconnect/device_model/agent_device.hpp b/src/mtconnect/device_model/agent_device.hpp index 84d1d026d..9abe99b6a 100644 --- a/src/mtconnect/device_model/agent_device.hpp +++ b/src/mtconnect/device_model/agent_device.hpp @@ -20,8 +20,8 @@ #include "component.hpp" #include "data_item/data_item.hpp" -#include "device_model/device.hpp" -#include "utilities.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace source::adapter { diff --git a/src/mtconnect/device_model/component.cpp b/src/mtconnect/device_model/component.cpp index 86184c80e..ba47ab233 100644 --- a/src/mtconnect/device_model/component.cpp +++ b/src/mtconnect/device_model/component.cpp @@ -20,14 +20,16 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/device_model/device.hpp" + #include "composition.hpp" #include "configuration/configuration.hpp" #include "data_item/data_item.hpp" #include "description.hpp" -#include "device_model/device.hpp" #include "reference.hpp" + using namespace std; namespace mtconnect { diff --git a/src/mtconnect/device_model/component.hpp b/src/mtconnect/device_model/component.hpp index 8683b2ac1..f703fd5ec 100644 --- a/src/mtconnect/device_model/component.hpp +++ b/src/mtconnect/device_model/component.hpp @@ -26,8 +26,8 @@ #include "composition.hpp" #include "configuration/configuration.hpp" -#include "entity/factory.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/composition.cpp b/src/mtconnect/device_model/composition.cpp index 306ace616..568aec495 100644 --- a/src/mtconnect/device_model/composition.cpp +++ b/src/mtconnect/device_model/composition.cpp @@ -21,7 +21,6 @@ #include "configuration/configuration.hpp" #include "description.hpp" -#include "entity/entity.hpp" using namespace std; diff --git a/src/mtconnect/device_model/composition.hpp b/src/mtconnect/device_model/composition.hpp index f832c376b..810ad9e30 100644 --- a/src/mtconnect/device_model/composition.hpp +++ b/src/mtconnect/device_model/composition.hpp @@ -17,7 +17,7 @@ #pragma once -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/configuration/configuration.cpp b/src/mtconnect/device_model/configuration/configuration.cpp index 0f356d4a4..f74637fc4 100644 --- a/src/mtconnect/device_model/configuration/configuration.cpp +++ b/src/mtconnect/device_model/configuration/configuration.cpp @@ -18,7 +18,7 @@ #include "configuration.hpp" #include "coordinate_systems.hpp" -#include "entity/factory.hpp" +#include "mtconnect/entity/factory.hpp" #include "motion.hpp" #include "relationships.hpp" #include "sensor_configuration.hpp" diff --git a/src/mtconnect/device_model/configuration/configuration.hpp b/src/mtconnect/device_model/configuration/configuration.hpp index b4d23bde3..c6db41312 100644 --- a/src/mtconnect/device_model/configuration/configuration.hpp +++ b/src/mtconnect/device_model/configuration/configuration.hpp @@ -17,8 +17,8 @@ #pragma once -#include "entity/entity.hpp" -#include "entity/factory.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/data_item/constraints.hpp b/src/mtconnect/device_model/data_item/constraints.hpp index 3be93d391..270bc2bd4 100644 --- a/src/mtconnect/device_model/data_item/constraints.hpp +++ b/src/mtconnect/device_model/data_item/constraints.hpp @@ -17,8 +17,8 @@ #pragma once -#include "entity/entity.hpp" -#include "entity/factory.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" #include "filter.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/data_item/data_item.cpp b/src/mtconnect/device_model/data_item/data_item.cpp index a07a60bc8..b4df08de0 100644 --- a/src/mtconnect/device_model/data_item/data_item.cpp +++ b/src/mtconnect/device_model/data_item/data_item.cpp @@ -24,9 +24,9 @@ #include #include -#include "device_model/device.hpp" -#include "entity/requirement.hpp" -#include "logging.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/requirement.hpp" +#include "mtconnect/logging.hpp" using namespace std; diff --git a/src/mtconnect/device_model/data_item/data_item.hpp b/src/mtconnect/device_model/data_item/data_item.hpp index fb680aa91..99371e769 100644 --- a/src/mtconnect/device_model/data_item/data_item.hpp +++ b/src/mtconnect/device_model/data_item/data_item.hpp @@ -20,14 +20,13 @@ #include "constraints.hpp" #include "definition.hpp" -#include "device_model/component.hpp" -#include "entity/entity.hpp" -#include "filter.hpp" -#include "observation/change_observer.hpp" #include "relationships.hpp" #include "source.hpp" #include "unit_conversion.hpp" -#include "utilities.hpp" +#include "filter.hpp" +#include "mtconnect/device_model/component.hpp" +#include "mtconnect/observation/change_observer.hpp" +#include "mtconnect/utilities.hpp" #ifdef PASCAL #undef PASCAL diff --git a/src/mtconnect/device_model/data_item/definition.hpp b/src/mtconnect/device_model/data_item/definition.hpp index 405b32d0c..f90316b5c 100644 --- a/src/mtconnect/device_model/data_item/definition.hpp +++ b/src/mtconnect/device_model/data_item/definition.hpp @@ -19,7 +19,7 @@ #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/data_item/filter.hpp b/src/mtconnect/device_model/data_item/filter.hpp index b29a635c0..860d8b8aa 100644 --- a/src/mtconnect/device_model/data_item/filter.hpp +++ b/src/mtconnect/device_model/data_item/filter.hpp @@ -17,8 +17,8 @@ #pragma once -#include "entity/entity.hpp" -#include "entity/factory.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/data_item/relationships.hpp b/src/mtconnect/device_model/data_item/relationships.hpp index 1402ed16b..a2fd17775 100644 --- a/src/mtconnect/device_model/data_item/relationships.hpp +++ b/src/mtconnect/device_model/data_item/relationships.hpp @@ -19,7 +19,7 @@ #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/data_item/source.hpp b/src/mtconnect/device_model/data_item/source.hpp index ff9fd06e9..b2f2df3cb 100644 --- a/src/mtconnect/device_model/data_item/source.hpp +++ b/src/mtconnect/device_model/data_item/source.hpp @@ -17,7 +17,7 @@ #pragma once -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" namespace mtconnect::device_model::data_item { class Source : public entity::Entity diff --git a/src/mtconnect/device_model/data_item/unit_conversion.hpp b/src/mtconnect/device_model/data_item/unit_conversion.hpp index 087a4e81c..128836100 100644 --- a/src/mtconnect/device_model/data_item/unit_conversion.hpp +++ b/src/mtconnect/device_model/data_item/unit_conversion.hpp @@ -22,7 +22,7 @@ #include #include -#include "entity/requirement.hpp" +#include "mtconnect/entity/requirement.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/description.hpp b/src/mtconnect/device_model/description.hpp index 0d30cbdb9..5ca97c68b 100644 --- a/src/mtconnect/device_model/description.hpp +++ b/src/mtconnect/device_model/description.hpp @@ -23,9 +23,9 @@ #include #include -#include "entity/entity.hpp" -#include "entity/factory.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/device.cpp b/src/mtconnect/device_model/device.cpp index 6a08c2027..1fa11d784 100644 --- a/src/mtconnect/device_model/device.cpp +++ b/src/mtconnect/device_model/device.cpp @@ -17,9 +17,9 @@ #include "device.hpp" -#include "configuration/config_options.hpp" -#include "entity/factory.hpp" -#include "logging.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/logging.hpp" using namespace std; diff --git a/src/mtconnect/device_model/device.hpp b/src/mtconnect/device_model/device.hpp index 33d5852f8..f8d00d1a6 100644 --- a/src/mtconnect/device_model/device.hpp +++ b/src/mtconnect/device_model/device.hpp @@ -31,7 +31,7 @@ #include "component.hpp" #include "data_item/data_item.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace mic = boost::multi_index; diff --git a/src/mtconnect/device_model/reference.cpp b/src/mtconnect/device_model/reference.cpp index 6aa8f9b3f..08d1e34f7 100644 --- a/src/mtconnect/device_model/reference.cpp +++ b/src/mtconnect/device_model/reference.cpp @@ -24,9 +24,9 @@ #include #include "device.hpp" -#include "entity/entity.hpp" -#include "logging.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/utilities.hpp" using namespace std; diff --git a/src/mtconnect/device_model/reference.hpp b/src/mtconnect/device_model/reference.hpp index 7093e8c4e..2c6d676f5 100644 --- a/src/mtconnect/device_model/reference.hpp +++ b/src/mtconnect/device_model/reference.hpp @@ -23,8 +23,8 @@ #include #include -#include "entity/entity.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/entity/data_set.cpp b/src/mtconnect/entity/data_set.cpp index 304ca4a1a..68186567e 100644 --- a/src/mtconnect/entity/data_set.cpp +++ b/src/mtconnect/entity/data_set.cpp @@ -17,7 +17,7 @@ #include "data_set.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" //#define BOOST_SPIRIT_DEBUG 1 diff --git a/src/mtconnect/entity/data_set.hpp b/src/mtconnect/entity/data_set.hpp index d2f93b277..446b9500d 100644 --- a/src/mtconnect/entity/data_set.hpp +++ b/src/mtconnect/entity/data_set.hpp @@ -25,8 +25,8 @@ #include #include -#include "logging.hpp" -#include "utilities.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::entity { struct DataSetEntry; diff --git a/src/mtconnect/entity/factory.cpp b/src/mtconnect/entity/factory.cpp index 4b48f352f..9b42b28b5 100644 --- a/src/mtconnect/entity/factory.cpp +++ b/src/mtconnect/entity/factory.cpp @@ -19,7 +19,7 @@ #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" using namespace std; diff --git a/src/mtconnect/entity/factory.hpp b/src/mtconnect/entity/factory.hpp index d6a571a4e..05d660d3c 100644 --- a/src/mtconnect/entity/factory.hpp +++ b/src/mtconnect/entity/factory.hpp @@ -21,7 +21,7 @@ #include #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" namespace mtconnect { namespace entity { diff --git a/src/mtconnect/entity/json_parser.cpp b/src/mtconnect/entity/json_parser.cpp index 136438933..03db5f97c 100644 --- a/src/mtconnect/entity/json_parser.cpp +++ b/src/mtconnect/entity/json_parser.cpp @@ -15,11 +15,11 @@ // limitations under the License. // -#include "entity/json_parser.hpp" +#include "mtconnect/entity/json_parser.hpp" #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" using namespace std; using json = nlohmann::json; diff --git a/src/mtconnect/entity/json_parser.hpp b/src/mtconnect/entity/json_parser.hpp index 0625489cd..825f79dda 100644 --- a/src/mtconnect/entity/json_parser.hpp +++ b/src/mtconnect/entity/json_parser.hpp @@ -21,10 +21,10 @@ #include #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" #include "factory.hpp" #include "requirement.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace entity { diff --git a/src/mtconnect/entity/json_printer.cpp b/src/mtconnect/entity/json_printer.cpp index 775c130f4..89eaa46a5 100644 --- a/src/mtconnect/entity/json_printer.cpp +++ b/src/mtconnect/entity/json_printer.cpp @@ -19,7 +19,7 @@ #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" using namespace std; using json = nlohmann::json; diff --git a/src/mtconnect/entity/json_printer.hpp b/src/mtconnect/entity/json_printer.hpp index 96f5d3f04..777efc15b 100644 --- a/src/mtconnect/entity/json_printer.hpp +++ b/src/mtconnect/entity/json_printer.hpp @@ -19,7 +19,7 @@ #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" using json = nlohmann::json; diff --git a/src/mtconnect/entity/requirement.cpp b/src/mtconnect/entity/requirement.cpp index 760a4f0ec..f39514583 100644 --- a/src/mtconnect/entity/requirement.cpp +++ b/src/mtconnect/entity/requirement.cpp @@ -26,9 +26,9 @@ #include #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" #include "factory.hpp" -#include "logging.hpp" +#include "mtconnect/logging.hpp" using namespace std; diff --git a/src/mtconnect/entity/requirement.hpp b/src/mtconnect/entity/requirement.hpp index 6b8356648..d80692a70 100644 --- a/src/mtconnect/entity/requirement.hpp +++ b/src/mtconnect/entity/requirement.hpp @@ -37,7 +37,7 @@ #include #include "data_set.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace entity { diff --git a/src/mtconnect/entity/xml_parser.cpp b/src/mtconnect/entity/xml_parser.cpp index 71a4f75f9..1190994b1 100644 --- a/src/mtconnect/entity/xml_parser.cpp +++ b/src/mtconnect/entity/xml_parser.cpp @@ -15,14 +15,14 @@ // limitations under the License. // -#include "entity/xml_parser.hpp" +#include "mtconnect/entity/xml_parser.hpp" #include #include #include -#include "logging.hpp" -#include "printer/xml_helper.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/printer/xml_helper.hpp" using namespace std; diff --git a/src/mtconnect/entity/xml_parser.hpp b/src/mtconnect/entity/xml_parser.hpp index 28e9c7c7c..1e3c54ba2 100644 --- a/src/mtconnect/entity/xml_parser.hpp +++ b/src/mtconnect/entity/xml_parser.hpp @@ -21,10 +21,10 @@ #include #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" #include "factory.hpp" #include "requirement.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" struct _xmlNode; namespace mtconnect { diff --git a/src/mtconnect/entity/xml_printer.cpp b/src/mtconnect/entity/xml_printer.cpp index 93892f30d..4eadbd197 100644 --- a/src/mtconnect/entity/xml_printer.cpp +++ b/src/mtconnect/entity/xml_printer.cpp @@ -21,8 +21,8 @@ #include -#include "logging.hpp" -#include "printer/xml_printer_helper.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/printer/xml_printer_helper.hpp" using namespace std; diff --git a/src/mtconnect/entity/xml_printer.hpp b/src/mtconnect/entity/xml_printer.hpp index 95a8c1738..3f90b638e 100644 --- a/src/mtconnect/entity/xml_printer.hpp +++ b/src/mtconnect/entity/xml_printer.hpp @@ -19,7 +19,7 @@ #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" extern "C" { diff --git a/src/mtconnect/mqtt/mqtt_client.hpp b/src/mtconnect/mqtt/mqtt_client.hpp index 0386f9233..eb4ef1fa1 100644 --- a/src/mtconnect/mqtt/mqtt_client.hpp +++ b/src/mtconnect/mqtt/mqtt_client.hpp @@ -17,8 +17,8 @@ #pragma once -#include "source/adapter/adapter.hpp" -#include "source/adapter/adapter_pipeline.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter_pipeline.hpp" namespace mtconnect { namespace mqtt_client { diff --git a/src/mtconnect/mqtt/mqtt_client_impl.hpp b/src/mtconnect/mqtt/mqtt_client_impl.hpp index ca6d19cd8..07e6c3d9e 100644 --- a/src/mtconnect/mqtt/mqtt_client_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_client_impl.hpp @@ -23,10 +23,10 @@ #include #include -#include "configuration/config_options.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "mqtt_client.hpp" -#include "source/adapter/adapter.hpp" -#include "source/adapter/mqtt/mqtt_adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/mqtt/mqtt_adapter.hpp" using namespace std; namespace asio = boost::asio; diff --git a/src/mtconnect/mqtt/mqtt_server.hpp b/src/mtconnect/mqtt/mqtt_server.hpp index 7708ecffe..b857431a5 100644 --- a/src/mtconnect/mqtt/mqtt_server.hpp +++ b/src/mtconnect/mqtt/mqtt_server.hpp @@ -13,8 +13,8 @@ #pragma once -#include "source/adapter/adapter.hpp" -#include "source/adapter/adapter_pipeline.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter_pipeline.hpp" namespace mtconnect { namespace mqtt_server { diff --git a/src/mtconnect/mqtt/mqtt_server_impl.hpp b/src/mtconnect/mqtt/mqtt_server_impl.hpp index 3461cfad8..dc122baea 100644 --- a/src/mtconnect/mqtt/mqtt_server_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_server_impl.hpp @@ -27,10 +27,10 @@ #include #include -#include "configuration/config_options.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "mqtt_server.hpp" -#include "source/adapter/adapter.hpp" -#include "source/adapter/mqtt/mqtt_adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/mqtt/mqtt_adapter.hpp" using namespace std; namespace asio = boost::asio; diff --git a/src/mtconnect/observation/change_observer.hpp b/src/mtconnect/observation/change_observer.hpp index 63eb7d633..1264e1fbe 100644 --- a/src/mtconnect/observation/change_observer.hpp +++ b/src/mtconnect/observation/change_observer.hpp @@ -24,7 +24,7 @@ #include #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace observation { diff --git a/src/mtconnect/observation/observation.cpp b/src/mtconnect/observation/observation.cpp index d5fcd722b..c97584094 100644 --- a/src/mtconnect/observation/observation.cpp +++ b/src/mtconnect/observation/observation.cpp @@ -20,9 +20,9 @@ #include #include -#include "device_model/data_item/data_item.hpp" -#include "entity/factory.hpp" -#include "logging.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/logging.hpp" #ifdef _WINDOWS #define strcasecmp stricmp diff --git a/src/mtconnect/observation/observation.hpp b/src/mtconnect/observation/observation.hpp index fafe1f954..b787e9d94 100644 --- a/src/mtconnect/observation/observation.hpp +++ b/src/mtconnect/observation/observation.hpp @@ -25,10 +25,10 @@ #include #include -#include "device_model/component.hpp" -#include "device_model/data_item/data_item.hpp" -#include "entity/entity.hpp" -#include "utilities.hpp" +#include "mtconnect/device_model/component.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace observation { diff --git a/src/mtconnect/parser/xml_parser.cpp b/src/mtconnect/parser/xml_parser.cpp index 773bbb5e2..b45e60bda 100644 --- a/src/mtconnect/parser/xml_parser.cpp +++ b/src/mtconnect/parser/xml_parser.cpp @@ -32,11 +32,11 @@ #include #include -#include "asset/cutting_tool.hpp" -#include "device_model/composition.hpp" -#include "entity/xml_parser.hpp" -#include "logging.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/device_model/composition.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/printer/xml_printer.hpp" #if _MSC_VER >= 1900 #define gets gets_s diff --git a/src/mtconnect/parser/xml_parser.hpp b/src/mtconnect/parser/xml_parser.hpp index 932052caa..5a3ccfb21 100644 --- a/src/mtconnect/parser/xml_parser.hpp +++ b/src/mtconnect/parser/xml_parser.hpp @@ -23,12 +23,12 @@ #include -#include "asset/cutting_tool.hpp" -#include "buffer/checkpoint.hpp" -#include "device_model/component.hpp" -#include "device_model/data_item/data_item.hpp" -#include "device_model/device.hpp" -#include "utilities.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/device_model/component.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::printer { class XmlPrinter; diff --git a/src/mtconnect/pipeline/convert_sample.hpp b/src/mtconnect/pipeline/convert_sample.hpp index b5ebb61b2..55efe94dd 100644 --- a/src/mtconnect/pipeline/convert_sample.hpp +++ b/src/mtconnect/pipeline/convert_sample.hpp @@ -17,8 +17,8 @@ #pragma once -#include "asset/asset.hpp" -#include "observation/observation.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/observation/observation.hpp" #include "transform.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/deliver.cpp b/src/mtconnect/pipeline/deliver.cpp index cbf4a27bc..02ce087b7 100644 --- a/src/mtconnect/pipeline/deliver.cpp +++ b/src/mtconnect/pipeline/deliver.cpp @@ -23,10 +23,10 @@ #include -#include "agent.hpp" -#include "asset/cutting_tool.hpp" -#include "asset/file_asset.hpp" -#include "logging.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/asset/file_asset.hpp" +#include "mtconnect/logging.hpp" using namespace std::literals::chrono_literals; diff --git a/src/mtconnect/pipeline/deliver.hpp b/src/mtconnect/pipeline/deliver.hpp index 8c2139a42..18690d7b3 100644 --- a/src/mtconnect/pipeline/deliver.hpp +++ b/src/mtconnect/pipeline/deliver.hpp @@ -21,8 +21,8 @@ #include -#include "asset/asset.hpp" -#include "observation/observation.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/observation/observation.hpp" #include "transform.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/delta_filter.hpp b/src/mtconnect/pipeline/delta_filter.hpp index 513cebca3..538ed59b1 100644 --- a/src/mtconnect/pipeline/delta_filter.hpp +++ b/src/mtconnect/pipeline/delta_filter.hpp @@ -17,7 +17,7 @@ #pragma once -#include "observation/observation.hpp" +#include "mtconnect/observation/observation.hpp" #include "transform.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/guard.hpp b/src/mtconnect/pipeline/guard.hpp index f6bf5a9e1..c5a166d8c 100644 --- a/src/mtconnect/pipeline/guard.hpp +++ b/src/mtconnect/pipeline/guard.hpp @@ -17,7 +17,7 @@ #pragma once -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" namespace mtconnect { namespace pipeline { diff --git a/src/mtconnect/pipeline/message_mapper.hpp b/src/mtconnect/pipeline/message_mapper.hpp index 9f7fd7398..6ecf72e8e 100644 --- a/src/mtconnect/pipeline/message_mapper.hpp +++ b/src/mtconnect/pipeline/message_mapper.hpp @@ -24,9 +24,9 @@ #include -#include "device_model/device.hpp" -#include "entity/entity.hpp" -#include "observation/observation.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/observation/observation.hpp" #include "shdr_tokenizer.hpp" #include "timestamp_extractor.hpp" #include "topic_mapper.hpp" diff --git a/src/mtconnect/pipeline/mtconnect_xml_transform.hpp b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp index a8aa4172c..a79eaa28b 100644 --- a/src/mtconnect/pipeline/mtconnect_xml_transform.hpp +++ b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp @@ -19,11 +19,11 @@ #include #include -#include "entity/entity.hpp" -#include "observation/observation.hpp" -#include "pipeline/transform.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/transform.hpp" #include "response_document.hpp" -#include "source/error_code.hpp" +#include "mtconnect/source/error_code.hpp" namespace mtconnect::pipeline { struct XmlTransformFeedback diff --git a/src/mtconnect/pipeline/period_filter.hpp b/src/mtconnect/pipeline/period_filter.hpp index 5277184e8..59e3124b5 100644 --- a/src/mtconnect/pipeline/period_filter.hpp +++ b/src/mtconnect/pipeline/period_filter.hpp @@ -17,7 +17,7 @@ #pragma once -#include "observation/observation.hpp" +#include "mtconnect/observation/observation.hpp" #include "transform.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/response_document.cpp b/src/mtconnect/pipeline/response_document.cpp index 3fb7ca56b..b9c793679 100644 --- a/src/mtconnect/pipeline/response_document.cpp +++ b/src/mtconnect/pipeline/response_document.cpp @@ -23,12 +23,12 @@ #include #include -#include "asset/asset.hpp" -#include "device_model/device.hpp" -#include "entity/data_set.hpp" -#include "entity/xml_parser.hpp" -#include "observation/observation.hpp" -#include "pipeline/timestamp_extractor.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/data_set.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" using namespace std; diff --git a/src/mtconnect/pipeline/response_document.hpp b/src/mtconnect/pipeline/response_document.hpp index f97b26572..9849fd83a 100644 --- a/src/mtconnect/pipeline/response_document.hpp +++ b/src/mtconnect/pipeline/response_document.hpp @@ -17,10 +17,10 @@ #pragma once -#include "entity/entity.hpp" -#include "pipeline/pipeline_context.hpp" -#include "printer/xml_helper.hpp" -#include "utilities.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/pipeline/pipeline_context.hpp" +#include "mtconnect/printer/xml_helper.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::pipeline { using namespace mtconnect; diff --git a/src/mtconnect/pipeline/shdr_token_mapper.cpp b/src/mtconnect/pipeline/shdr_token_mapper.cpp index 57c2387d8..3c878d437 100644 --- a/src/mtconnect/pipeline/shdr_token_mapper.cpp +++ b/src/mtconnect/pipeline/shdr_token_mapper.cpp @@ -17,12 +17,12 @@ #include "shdr_token_mapper.hpp" -#include "asset/asset.hpp" -#include "device_model/device.hpp" -#include "entity/factory.hpp" -#include "entity/xml_parser.hpp" -#include "logging.hpp" -#include "observation/observation.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/observation/observation.hpp" #include "upcase_value.hpp" using namespace std; diff --git a/src/mtconnect/pipeline/shdr_token_mapper.hpp b/src/mtconnect/pipeline/shdr_token_mapper.hpp index fe469d925..8dd6a1c74 100644 --- a/src/mtconnect/pipeline/shdr_token_mapper.hpp +++ b/src/mtconnect/pipeline/shdr_token_mapper.hpp @@ -19,8 +19,8 @@ #include #include -#include "entity/entity.hpp" -#include "observation/observation.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/observation/observation.hpp" #include "shdr_tokenizer.hpp" #include "timestamp_extractor.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/shdr_tokenizer.hpp b/src/mtconnect/pipeline/shdr_tokenizer.hpp index 9a1033f15..d3ee89d05 100644 --- a/src/mtconnect/pipeline/shdr_tokenizer.hpp +++ b/src/mtconnect/pipeline/shdr_tokenizer.hpp @@ -20,7 +20,7 @@ #include #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" #include "transform.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/timestamp_extractor.cpp b/src/mtconnect/pipeline/timestamp_extractor.cpp index 27641dc16..7ca5da872 100644 --- a/src/mtconnect/pipeline/timestamp_extractor.cpp +++ b/src/mtconnect/pipeline/timestamp_extractor.cpp @@ -20,7 +20,7 @@ #include #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" using namespace std; diff --git a/src/mtconnect/pipeline/timestamp_extractor.hpp b/src/mtconnect/pipeline/timestamp_extractor.hpp index d96badb36..0704c70da 100644 --- a/src/mtconnect/pipeline/timestamp_extractor.hpp +++ b/src/mtconnect/pipeline/timestamp_extractor.hpp @@ -19,7 +19,7 @@ #include "shdr_tokenizer.hpp" #include "transform.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { class Agent; diff --git a/src/mtconnect/pipeline/topic_mapper.hpp b/src/mtconnect/pipeline/topic_mapper.hpp index 84ffc72b3..f6007b7fe 100644 --- a/src/mtconnect/pipeline/topic_mapper.hpp +++ b/src/mtconnect/pipeline/topic_mapper.hpp @@ -22,9 +22,9 @@ #include #include -#include "device_model/device.hpp" -#include "entity/entity.hpp" -#include "observation/observation.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/observation/observation.hpp" #include "shdr_tokenizer.hpp" #include "timestamp_extractor.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/transform.hpp b/src/mtconnect/pipeline/transform.hpp index 2fcde0072..d4a282815 100644 --- a/src/mtconnect/pipeline/transform.hpp +++ b/src/mtconnect/pipeline/transform.hpp @@ -20,7 +20,7 @@ #include #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" #include "guard.hpp" #include "pipeline_context.hpp" diff --git a/src/mtconnect/pipeline/upcase_value.hpp b/src/mtconnect/pipeline/upcase_value.hpp index 9c6f0666c..207d81ea9 100644 --- a/src/mtconnect/pipeline/upcase_value.hpp +++ b/src/mtconnect/pipeline/upcase_value.hpp @@ -19,8 +19,8 @@ #include #include -#include "entity/entity.hpp" -#include "observation/observation.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/observation/observation.hpp" #include "shdr_tokenizer.hpp" #include "timestamp_extractor.hpp" #include "transform.hpp" diff --git a/src/mtconnect/printer/json_printer.cpp b/src/mtconnect/printer/json_printer.cpp index 86af54bc1..4e79ba057 100644 --- a/src/mtconnect/printer/json_printer.cpp +++ b/src/mtconnect/printer/json_printer.cpp @@ -25,13 +25,13 @@ #include -#include "device_model/composition.hpp" -#include "device_model/configuration/configuration.hpp" -#include "device_model/device.hpp" -#include "device_model/reference.hpp" -#include "entity/json_printer.hpp" -#include "logging.hpp" -#include "version.h" +#include "mtconnect/device_model/composition.hpp" +#include "mtconnect/device_model/configuration/configuration.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/device_model/reference.hpp" +#include "mtconnect/entity/json_printer.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/version.h" using namespace std; using json = nlohmann::json; diff --git a/src/mtconnect/printer/json_printer.hpp b/src/mtconnect/printer/json_printer.hpp index 759d9cbe4..2a988c546 100644 --- a/src/mtconnect/printer/json_printer.hpp +++ b/src/mtconnect/printer/json_printer.hpp @@ -17,9 +17,9 @@ #pragma once -#include "asset/cutting_tool.hpp" -#include "printer/printer.hpp" -#include "utilities.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/printer/printer.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::printer { class JsonPrinter : public Printer diff --git a/src/mtconnect/printer/printer.hpp b/src/mtconnect/printer/printer.hpp index e658029d8..555c506d5 100644 --- a/src/mtconnect/printer/printer.hpp +++ b/src/mtconnect/printer/printer.hpp @@ -22,10 +22,10 @@ #include #include -#include "asset/asset.hpp" -#include "observation/observation.hpp" -#include "utilities.hpp" -#include "version.h" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/utilities.hpp" +#include "mtconnect/version.h" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/printer/xml_printer.cpp b/src/mtconnect/printer/xml_printer.cpp index 5dfaf2672..7a659e6b4 100644 --- a/src/mtconnect/printer/xml_printer.cpp +++ b/src/mtconnect/printer/xml_printer.cpp @@ -15,7 +15,7 @@ // limitations under the License. // -#include "entity/xml_printer.hpp" +#include "mtconnect/entity/xml_printer.hpp" #include @@ -26,13 +26,13 @@ #include -#include "asset/asset.hpp" -#include "asset/cutting_tool.hpp" -#include "device_model/composition.hpp" -#include "device_model/configuration/configuration.hpp" -#include "device_model/device.hpp" -#include "logging.hpp" -#include "version.h" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/device_model/composition.hpp" +#include "mtconnect/device_model/configuration/configuration.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/version.h" #include "xml_printer.hpp" #define strfy(line) #line diff --git a/src/mtconnect/printer/xml_printer.hpp b/src/mtconnect/printer/xml_printer.hpp index 4f6a21eda..8538e4da4 100644 --- a/src/mtconnect/printer/xml_printer.hpp +++ b/src/mtconnect/printer/xml_printer.hpp @@ -19,9 +19,9 @@ #include -#include "asset/asset.hpp" -#include "printer/printer.hpp" -#include "utilities.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/printer/printer.hpp" +#include "mtconnect/utilities.hpp" extern "C" { diff --git a/src/mtconnect/printer/xml_printer_helper.hpp b/src/mtconnect/printer/xml_printer_helper.hpp index 598a08d1f..08c945047 100644 --- a/src/mtconnect/printer/xml_printer_helper.hpp +++ b/src/mtconnect/printer/xml_printer_helper.hpp @@ -19,7 +19,7 @@ #include -#include "printer/xml_helper.hpp" +#include "mtconnect/printer/xml_helper.hpp" namespace mtconnect::printer { class XmlWriter diff --git a/src/mtconnect/ruby/embedded.cpp b/src/mtconnect/ruby/embedded.cpp index 419f9f8d6..b3a2d8a7a 100644 --- a/src/mtconnect/ruby/embedded.cpp +++ b/src/mtconnect/ruby/embedded.cpp @@ -24,12 +24,12 @@ #include #include -#include "agent.hpp" -#include "entity/data_set.hpp" -#include "entity/entity.hpp" -#include "logging.hpp" -#include "pipeline/pipeline.hpp" -#include "utilities.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/entity/data_set.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/utilities.hpp" #ifdef _WINDOWS #undef timezone diff --git a/src/mtconnect/ruby/embedded.hpp b/src/mtconnect/ruby/embedded.hpp index 8f9d703a0..4b651ef29 100644 --- a/src/mtconnect/ruby/embedded.hpp +++ b/src/mtconnect/ruby/embedded.hpp @@ -21,7 +21,7 @@ #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace Rice { class Module; diff --git a/src/mtconnect/ruby/ruby_agent.hpp b/src/mtconnect/ruby/ruby_agent.hpp index 6ff22b069..f75c120d1 100644 --- a/src/mtconnect/ruby/ruby_agent.hpp +++ b/src/mtconnect/ruby/ruby_agent.hpp @@ -17,10 +17,10 @@ #pragma once -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "ruby_smart_ptr.hpp" -#include "sink/sink.hpp" -#include "source/source.hpp" +#include "mtconnect/sink/sink.hpp" +#include "mtconnect/source/source.hpp" namespace mtconnect::ruby { using namespace mtconnect::device_model; diff --git a/src/mtconnect/ruby/ruby_entity.hpp b/src/mtconnect/ruby/ruby_entity.hpp index ff07b0f95..7615574f8 100644 --- a/src/mtconnect/ruby/ruby_entity.hpp +++ b/src/mtconnect/ruby/ruby_entity.hpp @@ -22,12 +22,12 @@ #include #include -#include "device_model/data_item/data_item.hpp" -#include "device_model/device.hpp" -#include "entity/data_set.hpp" -#include "entity/entity.hpp" -#include "pipeline/shdr_tokenizer.hpp" -#include "pipeline/timestamp_extractor.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/data_set.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/pipeline/shdr_tokenizer.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" #include "ruby_smart_ptr.hpp" #include "ruby_type.hpp" diff --git a/src/mtconnect/ruby/ruby_observation.hpp b/src/mtconnect/ruby/ruby_observation.hpp index 1b6932f86..54f53068d 100644 --- a/src/mtconnect/ruby/ruby_observation.hpp +++ b/src/mtconnect/ruby/ruby_observation.hpp @@ -17,7 +17,7 @@ #pragma once -#include "observation/observation.hpp" +#include "mtconnect/observation/observation.hpp" #include "ruby_entity.hpp" #include "ruby_vm.hpp" diff --git a/src/mtconnect/ruby/ruby_pipeline.hpp b/src/mtconnect/ruby/ruby_pipeline.hpp index 24a3bc202..532b90447 100644 --- a/src/mtconnect/ruby/ruby_pipeline.hpp +++ b/src/mtconnect/ruby/ruby_pipeline.hpp @@ -17,9 +17,9 @@ #pragma once -#include "device_model/data_item/data_item.hpp" -#include "device_model/device.hpp" -#include "entity/entity.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/entity.hpp" #include "ruby_smart_ptr.hpp" namespace mtconnect::ruby { diff --git a/src/mtconnect/ruby/ruby_transform.hpp b/src/mtconnect/ruby/ruby_transform.hpp index af5220dd0..bc1fba72e 100644 --- a/src/mtconnect/ruby/ruby_transform.hpp +++ b/src/mtconnect/ruby/ruby_transform.hpp @@ -17,9 +17,9 @@ #pragma once -#include "pipeline/guard.hpp" -#include "pipeline/topic_mapper.hpp" -#include "pipeline/transform.hpp" +#include "mtconnect/pipeline/guard.hpp" +#include "mtconnect/pipeline/topic_mapper.hpp" +#include "mtconnect/pipeline/transform.hpp" #include "ruby_entity.hpp" #include "ruby_observation.hpp" #include "ruby_pipeline.hpp" diff --git a/src/mtconnect/ruby/ruby_type.hpp b/src/mtconnect/ruby/ruby_type.hpp index 25d5c35bc..37b8449cf 100644 --- a/src/mtconnect/ruby/ruby_type.hpp +++ b/src/mtconnect/ruby/ruby_type.hpp @@ -22,7 +22,7 @@ #include #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" namespace mtconnect::ruby { using namespace mtconnect; diff --git a/src/mtconnect/sink/mqtt_sink/mqtt_service.cpp b/src/mtconnect/sink/mqtt_sink/mqtt_service.cpp index e008f4a16..ef049f3d7 100644 --- a/src/mtconnect/sink/mqtt_sink/mqtt_service.cpp +++ b/src/mtconnect/sink/mqtt_sink/mqtt_service.cpp @@ -17,12 +17,12 @@ #include "mqtt_service.hpp" -#include "configuration/config_options.hpp" -#include "entity/entity.hpp" -#include "entity/factory.hpp" -#include "entity/json_parser.hpp" -#include "mqtt/mqtt_client_impl.hpp" -#include "printer/json_printer.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" +#include "mtconnect/entity/json_parser.hpp" +#include "mtconnect/mqtt/mqtt_client_impl.hpp" +#include "mtconnect/printer/json_printer.hpp" using json = nlohmann::json; using ptree = boost::property_tree::ptree; diff --git a/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp b/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp index 7ba0a782d..541ad9b6c 100644 --- a/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp +++ b/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp @@ -20,15 +20,15 @@ #include "boost/asio/io_context.hpp" #include -#include "buffer/checkpoint.hpp" -#include "configuration/agent_config.hpp" -#include "entity/json_printer.hpp" -#include "mqtt/mqtt_client.hpp" -#include "observation/observation.hpp" -#include "printer/printer.hpp" -#include "printer/xml_printer_helper.hpp" -#include "sink/sink.hpp" -#include "utilities.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/configuration/agent_config.hpp" +#include "mtconnect/entity/json_printer.hpp" +#include "mtconnect/mqtt/mqtt_client.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/printer/printer.hpp" +#include "mtconnect/printer/xml_printer_helper.hpp" +#include "mtconnect/sink/sink.hpp" +#include "mtconnect/utilities.hpp" using namespace std; using namespace mtconnect::entity; diff --git a/src/mtconnect/sink/rest_sink/cached_file.hpp b/src/mtconnect/sink/rest_sink/cached_file.hpp index 11a5f14d0..183a44061 100644 --- a/src/mtconnect/sink/rest_sink/cached_file.hpp +++ b/src/mtconnect/sink/rest_sink/cached_file.hpp @@ -22,7 +22,7 @@ #include #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace sink { diff --git a/src/mtconnect/sink/rest_sink/file_cache.cpp b/src/mtconnect/sink/rest_sink/file_cache.cpp index 3bad7e085..2e443641c 100644 --- a/src/mtconnect/sink/rest_sink/file_cache.cpp +++ b/src/mtconnect/sink/rest_sink/file_cache.cpp @@ -31,7 +31,7 @@ #include #include "cached_file.hpp" -#include "logging.hpp" +#include "mtconnect/logging.hpp" using namespace std; diff --git a/src/mtconnect/sink/rest_sink/response.hpp b/src/mtconnect/sink/rest_sink/response.hpp index 9feb3eb7e..c86a03075 100644 --- a/src/mtconnect/sink/rest_sink/response.hpp +++ b/src/mtconnect/sink/rest_sink/response.hpp @@ -25,7 +25,7 @@ #include "cached_file.hpp" #include "request.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace printer { diff --git a/src/mtconnect/sink/rest_sink/rest_service.cpp b/src/mtconnect/sink/rest_sink/rest_service.cpp index 3704000af..7154aed3d 100644 --- a/src/mtconnect/sink/rest_sink/rest_service.cpp +++ b/src/mtconnect/sink/rest_sink/rest_service.cpp @@ -17,12 +17,12 @@ #include "rest_service.hpp" -#include "configuration/config_options.hpp" -#include "entity/xml_parser.hpp" -#include "pipeline/shdr_token_mapper.hpp" -#include "pipeline/shdr_tokenizer.hpp" -#include "pipeline/timestamp_extractor.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/pipeline/shdr_token_mapper.hpp" +#include "mtconnect/pipeline/shdr_tokenizer.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" +#include "mtconnect/printer/xml_printer.hpp" #include "server.hpp" namespace asio = boost::asio; diff --git a/src/mtconnect/sink/rest_sink/rest_service.hpp b/src/mtconnect/sink/rest_sink/rest_service.hpp index 8f894a4f2..f7813e3ba 100644 --- a/src/mtconnect/sink/rest_sink/rest_service.hpp +++ b/src/mtconnect/sink/rest_sink/rest_service.hpp @@ -17,15 +17,15 @@ #pragma once -#include "boost/asio/io_context.hpp" +#include -#include "buffer/circular_buffer.hpp" #include "request.hpp" #include "response.hpp" #include "server.hpp" -#include "sink/sink.hpp" -#include "source/loopback_source.hpp" -#include "utilities.hpp" +#include "mtconnect/buffer/circular_buffer.hpp" +#include "mtconnect/sink/sink.hpp" +#include "mtconnect/source/loopback_source.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace printer { diff --git a/src/mtconnect/sink/rest_sink/routing.hpp b/src/mtconnect/sink/rest_sink/routing.hpp index 54c8c80fc..703b8ae29 100644 --- a/src/mtconnect/sink/rest_sink/routing.hpp +++ b/src/mtconnect/sink/rest_sink/routing.hpp @@ -27,7 +27,7 @@ #include #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" #include "parameter.hpp" #include "request.hpp" #include "session.hpp" diff --git a/src/mtconnect/sink/rest_sink/server.cpp b/src/mtconnect/sink/rest_sink/server.cpp index 88dada4f5..95cded059 100644 --- a/src/mtconnect/sink/rest_sink/server.cpp +++ b/src/mtconnect/sink/rest_sink/server.cpp @@ -29,7 +29,7 @@ #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" #include "session_impl.hpp" namespace mtconnect::sink::rest_sink { diff --git a/src/mtconnect/sink/rest_sink/server.hpp b/src/mtconnect/sink/rest_sink/server.hpp index 15db9d8e4..969eeadf5 100644 --- a/src/mtconnect/sink/rest_sink/server.hpp +++ b/src/mtconnect/sink/rest_sink/server.hpp @@ -33,13 +33,13 @@ #include #include -#include "configuration/config_options.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "file_cache.hpp" #include "response.hpp" #include "routing.hpp" #include "session.hpp" #include "tls_dector.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::sink::rest_sink { class Server diff --git a/src/mtconnect/sink/rest_sink/session_impl.cpp b/src/mtconnect/sink/rest_sink/session_impl.cpp index 46ba93826..e93e6f0be 100644 --- a/src/mtconnect/sink/rest_sink/session_impl.cpp +++ b/src/mtconnect/sink/rest_sink/session_impl.cpp @@ -30,7 +30,7 @@ #include #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" #include "request.hpp" #include "response.hpp" #include "tls_dector.hpp" diff --git a/src/mtconnect/sink/rest_sink/session_impl.hpp b/src/mtconnect/sink/rest_sink/session_impl.hpp index 7c49af48b..6053f9bed 100644 --- a/src/mtconnect/sink/rest_sink/session_impl.hpp +++ b/src/mtconnect/sink/rest_sink/session_impl.hpp @@ -24,9 +24,9 @@ #include #include -#include "configuration/config_options.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "session.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace printer { diff --git a/src/mtconnect/sink/rest_sink/tls_dector.hpp b/src/mtconnect/sink/rest_sink/tls_dector.hpp index 2cbc01f93..a3180300d 100644 --- a/src/mtconnect/sink/rest_sink/tls_dector.hpp +++ b/src/mtconnect/sink/rest_sink/tls_dector.hpp @@ -20,9 +20,9 @@ #include #include -#include "configuration/config_options.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "session.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::sink::rest_sink { class TlsDector : public std::enable_shared_from_this diff --git a/src/mtconnect/sink/sink.cpp b/src/mtconnect/sink/sink.cpp index 55982064f..4fb757485 100644 --- a/src/mtconnect/sink/sink.cpp +++ b/src/mtconnect/sink/sink.cpp @@ -17,7 +17,7 @@ #include "sink.hpp" -#include "logging.hpp" +#include "mtconnect/logging.hpp" namespace mtconnect { namespace sink { diff --git a/src/mtconnect/sink/sink.hpp b/src/mtconnect/sink/sink.hpp index cdbf94155..494e71f90 100644 --- a/src/mtconnect/sink/sink.hpp +++ b/src/mtconnect/sink/sink.hpp @@ -25,11 +25,11 @@ #include #include -#include "asset/asset_storage.hpp" -#include "buffer/circular_buffer.hpp" -#include "device_model/device.hpp" -#include "observation/observation.hpp" -#include "printer/printer.hpp" +#include "mtconnect/asset/asset_storage.hpp" +#include "mtconnect/buffer/circular_buffer.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/printer//printer.hpp" namespace mtconnect { namespace printer { diff --git a/src/mtconnect/source/adapter/adapter.hpp b/src/mtconnect/source/adapter/adapter.hpp index 3a36db3bb..aa3dd3bb8 100644 --- a/src/mtconnect/source/adapter/adapter.hpp +++ b/src/mtconnect/source/adapter/adapter.hpp @@ -17,8 +17,8 @@ #pragma once -#include "source/adapter/adapter_pipeline.hpp" -#include "source/source.hpp" +#include "mtconnect/source/adapter/adapter_pipeline.hpp" +#include "mtconnect/source/source.hpp" namespace mtconnect::source::adapter { class Adapter : public Source diff --git a/src/mtconnect/source/adapter/adapter_pipeline.cpp b/src/mtconnect/source/adapter/adapter_pipeline.cpp index 52d75ba53..393200489 100644 --- a/src/mtconnect/source/adapter/adapter_pipeline.cpp +++ b/src/mtconnect/source/adapter/adapter_pipeline.cpp @@ -15,20 +15,20 @@ // limitations under the License. // -#include "source/adapter/adapter_pipeline.hpp" - -#include "agent.hpp" -#include "configuration/agent_config.hpp" -#include "configuration/config_options.hpp" -#include "pipeline/convert_sample.hpp" -#include "pipeline/deliver.hpp" -#include "pipeline/delta_filter.hpp" -#include "pipeline/duplicate_filter.hpp" -#include "pipeline/period_filter.hpp" -#include "pipeline/timestamp_extractor.hpp" -#include "pipeline/topic_mapper.hpp" -#include "pipeline/upcase_value.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter_pipeline.hpp" + +#include "mtconnect/agent.hpp" +#include "mtconnect/configuration/agent_config.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/pipeline/convert_sample.hpp" +#include "mtconnect/pipeline/deliver.hpp" +#include "mtconnect/pipeline/delta_filter.hpp" +#include "mtconnect/pipeline/duplicate_filter.hpp" +#include "mtconnect/pipeline/period_filter.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" +#include "mtconnect/pipeline/topic_mapper.hpp" +#include "mtconnect/pipeline/upcase_value.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using namespace std; using namespace std::literals; diff --git a/src/mtconnect/source/adapter/adapter_pipeline.hpp b/src/mtconnect/source/adapter/adapter_pipeline.hpp index 7f885ac7a..aba3f1d4c 100644 --- a/src/mtconnect/source/adapter/adapter_pipeline.hpp +++ b/src/mtconnect/source/adapter/adapter_pipeline.hpp @@ -17,8 +17,8 @@ #pragma once -#include "pipeline/pipeline.hpp" -#include "pipeline/transform.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/pipeline/transform.hpp" namespace mtconnect::source::adapter { struct Handler diff --git a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp index 597f7290e..8bc6d24f6 100644 --- a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp +++ b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp @@ -29,11 +29,11 @@ #include #include -#include "configuration/config_options.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "http_session.hpp" #include "https_session.hpp" -#include "logging.hpp" -#include "pipeline/deliver.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/pipeline/deliver.hpp" #include "session_impl.hpp" using namespace std; diff --git a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp index cb83c2a49..3f894e178 100644 --- a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp @@ -17,12 +17,13 @@ #pragma once -#include "pipeline/mtconnect_xml_transform.hpp" #include "session.hpp" -#include "source/adapter/adapter.hpp" -#include "source/adapter/adapter_pipeline.hpp" #include "url_parser.hpp" +#include "mtconnect/pipeline/mtconnect_xml_transform.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter_pipeline.hpp" + namespace boost::asio::ssl { class context; } diff --git a/src/mtconnect/source/adapter/agent_adapter/session.hpp b/src/mtconnect/source/adapter/agent_adapter/session.hpp index 9c3d62fb7..bc96c4ad1 100644 --- a/src/mtconnect/source/adapter/agent_adapter/session.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/session.hpp @@ -22,7 +22,7 @@ #include -#include "entity/entity.hpp" +#include "mtconnect/entity/entity.hpp" #include "url_parser.hpp" namespace mtconnect::source::adapter { diff --git a/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp b/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp index 53c60b410..51f6daedc 100644 --- a/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp @@ -25,8 +25,8 @@ #include #include -#include "pipeline/mtconnect_xml_transform.hpp" -#include "pipeline/response_document.hpp" +#include "mtconnect/pipeline/mtconnect_xml_transform.hpp" +#include "mtconnect/pipeline/response_document.hpp" #include "session.hpp" namespace mtconnect::source::adapter::agent_adapter { diff --git a/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp index 641d98ad2..2645a264d 100644 --- a/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp @@ -27,7 +27,7 @@ #include #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::source::adapter::agent_adapter { using UrlQueryPair = std::pair; diff --git a/src/mtconnect/source/adapter/mqtt/mqtt_adapter.cpp b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.cpp index 577d90ea8..3e0d0ddaf 100644 --- a/src/mtconnect/source/adapter/mqtt/mqtt_adapter.cpp +++ b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.cpp @@ -23,20 +23,20 @@ #include #include -#include "configuration/config_options.hpp" -#include "device_model/device.hpp" -#include "mqtt/mqtt_client_impl.hpp" -#include "pipeline/convert_sample.hpp" -#include "pipeline/deliver.hpp" -#include "pipeline/delta_filter.hpp" -#include "pipeline/duplicate_filter.hpp" -#include "pipeline/message_mapper.hpp" -#include "pipeline/period_filter.hpp" -#include "pipeline/shdr_token_mapper.hpp" -#include "pipeline/shdr_tokenizer.hpp" -#include "pipeline/timestamp_extractor.hpp" -#include "pipeline/topic_mapper.hpp" -#include "pipeline/upcase_value.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/mqtt/mqtt_client_impl.hpp" +#include "mtconnect/pipeline/convert_sample.hpp" +#include "mtconnect/pipeline/deliver.hpp" +#include "mtconnect/pipeline/delta_filter.hpp" +#include "mtconnect/pipeline/duplicate_filter.hpp" +#include "mtconnect/pipeline/message_mapper.hpp" +#include "mtconnect/pipeline/period_filter.hpp" +#include "mtconnect/pipeline/shdr_token_mapper.hpp" +#include "mtconnect/pipeline/shdr_tokenizer.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" +#include "mtconnect/pipeline/topic_mapper.hpp" +#include "mtconnect/pipeline/upcase_value.hpp" using namespace std; namespace asio = boost::asio; diff --git a/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp index eba0f4a1d..5bef09711 100644 --- a/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp +++ b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp @@ -17,9 +17,9 @@ #pragma once -#include "mqtt/mqtt_client.hpp" -#include "source/adapter/adapter.hpp" -#include "source/adapter/adapter_pipeline.hpp" +#include "mtconnect/mqtt/mqtt_client.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter_pipeline.hpp" using namespace mtconnect::mqtt_client; diff --git a/src/mtconnect/source/adapter/shdr/connector.cpp b/src/mtconnect/source/adapter/shdr/connector.cpp index 03f62d01d..bb3db4b47 100644 --- a/src/mtconnect/source/adapter/shdr/connector.cpp +++ b/src/mtconnect/source/adapter/shdr/connector.cpp @@ -29,7 +29,7 @@ #include #include -#include "logging.hpp" +#include "mtconnect/logging.hpp" using namespace std; using namespace std::chrono; diff --git a/src/mtconnect/source/adapter/shdr/connector.hpp b/src/mtconnect/source/adapter/shdr/connector.hpp index 06a1005c5..5b25a43e2 100644 --- a/src/mtconnect/source/adapter/shdr/connector.hpp +++ b/src/mtconnect/source/adapter/shdr/connector.hpp @@ -24,7 +24,7 @@ #include #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" #define HEARTBEAT_FREQ 60000 diff --git a/src/mtconnect/source/adapter/shdr/shdr_adapter.cpp b/src/mtconnect/source/adapter/shdr/shdr_adapter.cpp index 59fa60365..0496ff38a 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_adapter.cpp +++ b/src/mtconnect/source/adapter/shdr/shdr_adapter.cpp @@ -26,9 +26,9 @@ #include #include -#include "configuration/config_options.hpp" -#include "device_model/device.hpp" -#include "logging.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/logging.hpp" using namespace std; using namespace std::literals; diff --git a/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp index 96ad7f7cd..2bd429aae 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp +++ b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp @@ -26,11 +26,11 @@ #include #include "connector.hpp" -#include "device_model/data_item/data_item.hpp" #include "shdr_pipeline.hpp" -#include "source/adapter/adapter.hpp" -#include "source/source.hpp" -#include "utilities.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/source.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { class Agent; diff --git a/src/mtconnect/source/adapter/shdr/shdr_pipeline.cpp b/src/mtconnect/source/adapter/shdr/shdr_pipeline.cpp index fe795ec6c..2a2f6d55a 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_pipeline.cpp +++ b/src/mtconnect/source/adapter/shdr/shdr_pipeline.cpp @@ -17,18 +17,18 @@ #include "shdr_pipeline.hpp" -#include "agent.hpp" -#include "configuration/agent_config.hpp" -#include "configuration/config_options.hpp" -#include "pipeline/convert_sample.hpp" -#include "pipeline/deliver.hpp" -#include "pipeline/delta_filter.hpp" -#include "pipeline/duplicate_filter.hpp" -#include "pipeline/period_filter.hpp" -#include "pipeline/shdr_token_mapper.hpp" -#include "pipeline/shdr_tokenizer.hpp" -#include "pipeline/timestamp_extractor.hpp" -#include "pipeline/upcase_value.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/configuration/agent_config.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/pipeline/convert_sample.hpp" +#include "mtconnect/pipeline/deliver.hpp" +#include "mtconnect/pipeline/delta_filter.hpp" +#include "mtconnect/pipeline/duplicate_filter.hpp" +#include "mtconnect/pipeline/period_filter.hpp" +#include "mtconnect/pipeline/shdr_token_mapper.hpp" +#include "mtconnect/pipeline/shdr_tokenizer.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" +#include "mtconnect/pipeline/upcase_value.hpp" #include "shdr_adapter.hpp" using namespace std; diff --git a/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp b/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp index 0148384cb..e816f07ca 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp +++ b/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp @@ -17,7 +17,7 @@ #pragma once -#include "source/adapter/adapter_pipeline.hpp" +#include "mtconnect/source/adapter/adapter_pipeline.hpp" namespace mtconnect::source::adapter::shdr { class ShdrPipeline : public AdapterPipeline diff --git a/src/mtconnect/source/loopback_source.cpp b/src/mtconnect/source/loopback_source.cpp index 86dc9a765..3ea7da945 100644 --- a/src/mtconnect/source/loopback_source.cpp +++ b/src/mtconnect/source/loopback_source.cpp @@ -15,18 +15,18 @@ // limitations under the License. // -#include "source/loopback_source.hpp" - -#include "configuration/config_options.hpp" -#include "device_model/device.hpp" -#include "entity/xml_parser.hpp" -#include "pipeline/convert_sample.hpp" -#include "pipeline/deliver.hpp" -#include "pipeline/delta_filter.hpp" -#include "pipeline/duplicate_filter.hpp" -#include "pipeline/period_filter.hpp" -#include "pipeline/timestamp_extractor.hpp" -#include "pipeline/upcase_value.hpp" +#include "mtconnect/source/loopback_source.hpp" + +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/pipeline/convert_sample.hpp" +#include "mtconnect/pipeline/deliver.hpp" +#include "mtconnect/pipeline/delta_filter.hpp" +#include "mtconnect/pipeline/duplicate_filter.hpp" +#include "mtconnect/pipeline/period_filter.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" +#include "mtconnect/pipeline/upcase_value.hpp" using namespace std; diff --git a/src/mtconnect/source/loopback_source.hpp b/src/mtconnect/source/loopback_source.hpp index b4f572641..4ede09a06 100644 --- a/src/mtconnect/source/loopback_source.hpp +++ b/src/mtconnect/source/loopback_source.hpp @@ -17,12 +17,12 @@ #pragma once -#include "asset/asset.hpp" -#include "observation/observation.hpp" -#include "pipeline/pipeline.hpp" -#include "pipeline/pipeline_context.hpp" -#include "source/source.hpp" -#include "utilities.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/pipeline/pipeline_context.hpp" +#include "mtconnect/source/source.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect::source { class LoopbackPipeline : public pipeline::Pipeline diff --git a/src/mtconnect/source/source.cpp b/src/mtconnect/source/source.cpp index 40fe71715..f529d708b 100644 --- a/src/mtconnect/source/source.cpp +++ b/src/mtconnect/source/source.cpp @@ -15,9 +15,9 @@ // limitations under the License. // -#include "source/source.hpp" +#include "mtconnect/source/source.hpp" -#include "logging.hpp" +#include "mtconnect/logging.hpp" namespace mtconnect::source { source::SourcePtr SourceFactory::make(const std::string &factoryName, const std::string &sinkName, diff --git a/src/mtconnect/source/source.hpp b/src/mtconnect/source/source.hpp index 0f6cf23fd..cfc6d3028 100644 --- a/src/mtconnect/source/source.hpp +++ b/src/mtconnect/source/source.hpp @@ -20,7 +20,7 @@ #include #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" namespace mtconnect { namespace pipeline { diff --git a/src/mtconnect/utilities.cpp b/src/mtconnect/utilities.cpp index 7c2a6e695..3b4d40524 100644 --- a/src/mtconnect/utilities.cpp +++ b/src/mtconnect/utilities.cpp @@ -15,7 +15,7 @@ // limitations under the License. // -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" #include #include diff --git a/src/mtconnect/utilities.hpp b/src/mtconnect/utilities.hpp index 7e0c29e83..82a7d2294 100644 --- a/src/mtconnect/utilities.hpp +++ b/src/mtconnect/utilities.hpp @@ -74,7 +74,7 @@ typedef unsigned __int64 uint64_t; #include #include -#include +#include //####### CONSTANTS ####### diff --git a/src/mtconnect/version.cpp b/src/mtconnect/version.cpp index 5568d78d5..b27f769f2 100644 --- a/src/mtconnect/version.cpp +++ b/src/mtconnect/version.cpp @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "version.h" +#include "mtconnect/version.h" #include #include diff --git a/test/adapter_test.cpp b/test/adapter_test.cpp index e3a55bdef..24d16b02e 100644 --- a/test/adapter_test.cpp +++ b/test/adapter_test.cpp @@ -27,9 +27,9 @@ #include #include -#include "configuration/config_options.hpp" -#include "pipeline/pipeline_context.hpp" -#include "source/adapter/shdr/shdr_adapter.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/pipeline/pipeline_context.hpp" +#include "mtconnect/source/adapter/shdr/shdr_adapter.hpp" using namespace std; using namespace mtconnect; diff --git a/test/agent_adapter_test.cpp b/test/agent_adapter_test.cpp index 1aafbd191..6c3ed0421 100644 --- a/test/agent_adapter_test.cpp +++ b/test/agent_adapter_test.cpp @@ -26,15 +26,15 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "device_model/reference.hpp" -#include "pipeline/mtconnect_xml_transform.hpp" -#include "pipeline/response_document.hpp" -#include "printer/xml_printer.hpp" -#include "source/adapter/adapter.hpp" -#include "source/adapter/agent_adapter/agent_adapter.hpp" -#include "source/adapter/agent_adapter/url_parser.hpp" +#include "mtconnect/device_model/reference.hpp" +#include "mtconnect/pipeline/mtconnect_xml_transform.hpp" +#include "mtconnect/pipeline/response_document.hpp" +#include "mtconnect/printer//xml_printer.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/agent_adapter/agent_adapter.hpp" +#include "mtconnect/source/adapter/agent_adapter/url_parser.hpp" #include "test_utilities.hpp" // Registers the fixture into the 'registry' diff --git a/test/agent_device_test.cpp b/test/agent_device_test.cpp index f30c21c3d..0be0b0ba9 100644 --- a/test/agent_device_test.cpp +++ b/test/agent_device_test.cpp @@ -22,12 +22,12 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "device_model/agent_device.hpp" +#include "mtconnect/device_model/agent_device.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" -#include "version.h" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/version.h" using namespace std; using namespace mtconnect; diff --git a/test/agent_test.cpp b/test/agent_test.cpp index eaae53269..b2f698301 100644 --- a/test/agent_test.cpp +++ b/test/agent_test.cpp @@ -26,12 +26,12 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "asset/file_asset.hpp" -#include "device_model/reference.hpp" -#include "printer/xml_printer.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/asset/file_asset.hpp" +#include "mtconnect/device_model/reference.hpp" +#include "mtconnect/printer//xml_printer.hpp" +#include "mtconnect/source/adapter/adapter.hpp" #include "test_utilities.hpp" #if defined(WIN32) && _MSC_VER < 1500 diff --git a/test/agent_test_helper.cpp b/test/agent_test_helper.cpp index 394d0e17b..0030da639 100644 --- a/test/agent_test_helper.cpp +++ b/test/agent_test_helper.cpp @@ -23,9 +23,9 @@ #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "sink/rest_sink/server.hpp" +#include "mtconnect/sink/rest_sink/server.hpp" using namespace std; using namespace std::chrono; diff --git a/test/agent_test_helper.hpp b/test/agent_test_helper.hpp index c8db23b2c..0ddd72e6b 100644 --- a/test/agent_test_helper.hpp +++ b/test/agent_test_helper.hpp @@ -24,18 +24,18 @@ #include -#include "agent.hpp" -#include "configuration/agent_config.hpp" -#include "configuration/config_options.hpp" -#include "pipeline/pipeline.hpp" -#include "sink/mqtt_sink/mqtt_service.hpp" -#include "sink/rest_sink/response.hpp" -#include "sink/rest_sink/rest_service.hpp" -#include "sink/rest_sink/routing.hpp" -#include "sink/rest_sink/server.hpp" -#include "sink/rest_sink/session.hpp" -#include "source/adapter/shdr/shdr_adapter.hpp" -#include "source/loopback_source.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/configuration/agent_config.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/sink/mqtt_sink/mqtt_service.hpp" +#include "mtconnect/sink/rest_sink/response.hpp" +#include "mtconnect/sink/rest_sink/rest_service.hpp" +#include "mtconnect/sink/rest_sink/routing.hpp" +#include "mtconnect/sink/rest_sink/server.hpp" +#include "mtconnect/sink/rest_sink/session.hpp" +#include "mtconnect/source/adapter/shdr/shdr_adapter.hpp" +#include "mtconnect/source/loopback_source.hpp" #include "test_utilities.hpp" namespace mtconnect { diff --git a/test/asset_buffer_test.cpp b/test/asset_buffer_test.cpp index b83e0c94b..0ffe93d59 100644 --- a/test/asset_buffer_test.cpp +++ b/test/asset_buffer_test.cpp @@ -26,9 +26,9 @@ #include #include "agent_test_helper.hpp" -#include "asset/asset_buffer.hpp" -#include "entity/entity.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/asset/asset_buffer.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/printer//xml_printer.hpp" #include "test_utilities.hpp" #if defined(WIN32) && _MSC_VER < 1500 diff --git a/test/asset_test.cpp b/test/asset_test.cpp index b2231b944..ae1127a4c 100644 --- a/test/asset_test.cpp +++ b/test/asset_test.cpp @@ -26,15 +26,15 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "asset/asset.hpp" -#include "entity/entity.hpp" -#include "entity/xml_parser.hpp" -#include "entity/xml_printer.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/entity/xml_printer.hpp" #include "json_helper.hpp" -#include "printer/xml_printer_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/printer//xml_printer_helper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/change_observer_test.cpp b/test/change_observer_test.cpp index f08627aea..7126404f8 100644 --- a/test/change_observer_test.cpp +++ b/test/change_observer_test.cpp @@ -22,7 +22,7 @@ #include #include -#include "observation/change_observer.hpp" +#include "mtconnect/observation/change_observer.hpp" using namespace std::chrono_literals; diff --git a/test/checkpoint_test.cpp b/test/checkpoint_test.cpp index 2540b516c..854fefebc 100644 --- a/test/checkpoint_test.cpp +++ b/test/checkpoint_test.cpp @@ -20,7 +20,7 @@ // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) #include "agent_test_helper.hpp" -#include "buffer/checkpoint.hpp" +#include "mtconnect/buffer/checkpoint.hpp" using namespace std; using namespace mtconnect; diff --git a/test/circular_buffer_test.cpp b/test/circular_buffer_test.cpp index 69c90a714..06b89c81f 100644 --- a/test/circular_buffer_test.cpp +++ b/test/circular_buffer_test.cpp @@ -20,8 +20,8 @@ // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) #include "agent_test_helper.hpp" -#include "buffer/checkpoint.hpp" -#include "buffer/circular_buffer.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/buffer/circular_buffer.hpp" using namespace std; using namespace mtconnect; diff --git a/test/component_test.cpp b/test/component_test.cpp index 8d86631d5..362852378 100644 --- a/test/component_test.cpp +++ b/test/component_test.cpp @@ -19,8 +19,8 @@ #include // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) -#include "device_model/component.hpp" -#include "device_model/device.hpp" +#include "mtconnect/device_model/component.hpp" +#include "mtconnect/device_model/device.hpp" using namespace std; using namespace mtconnect; diff --git a/test/composition_test.cpp b/test/composition_test.cpp index e97870ef1..5bce30fc1 100644 --- a/test/composition_test.cpp +++ b/test/composition_test.cpp @@ -27,11 +27,11 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "device_model/composition.hpp" +#include "mtconnect/device_model/composition.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/config_parser_test.cpp b/test/config_parser_test.cpp index 0278ed26c..0206c7dca 100644 --- a/test/config_parser_test.cpp +++ b/test/config_parser_test.cpp @@ -19,7 +19,7 @@ #include // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) -#include "configuration/parser.hpp" +#include "mtconnect/configuration/parser.hpp" using namespace mtconnect; using namespace configuration; diff --git a/test/config_test.cpp b/test/config_test.cpp index d1f888110..a3fdf1105 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -25,12 +25,12 @@ #include #include -#include "agent.hpp" -#include "configuration/agent_config.hpp" -#include "configuration/config_options.hpp" -#include "printer/xml_printer.hpp" -#include "sink/rest_sink/rest_service.hpp" -#include "source/adapter/shdr/shdr_adapter.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/configuration/agent_config.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/printer//xml_printer.hpp" +#include "mtconnect/sink/rest_sink/rest_service.hpp" +#include "mtconnect/source/adapter/shdr/shdr_adapter.hpp" #ifdef _WIN32 #include diff --git a/test/connector_test.cpp b/test/connector_test.cpp index bbee7e091..ed60b2a33 100644 --- a/test/connector_test.cpp +++ b/test/connector_test.cpp @@ -28,7 +28,7 @@ #include #include -#include "source/adapter/shdr/connector.hpp" +#include "mtconnect/source/adapter/shdr/connector.hpp" namespace date {}; using namespace date; diff --git a/test/coordinate_system_test.cpp b/test/coordinate_system_test.cpp index 587d19d49..908de0c86 100644 --- a/test/coordinate_system_test.cpp +++ b/test/coordinate_system_test.cpp @@ -26,10 +26,10 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/cutting_tool_test.cpp b/test/cutting_tool_test.cpp index 21ad82172..b96fb649a 100644 --- a/test/cutting_tool_test.cpp +++ b/test/cutting_tool_test.cpp @@ -26,17 +26,17 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "asset/cutting_tool.hpp" -#include "entity/entity.hpp" -#include "entity/json_printer.hpp" -#include "entity/xml_parser.hpp" -#include "entity/xml_printer.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/json_printer.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/entity/xml_printer.hpp" #include "json_helper.hpp" -#include "printer/xml_printer.hpp" -#include "printer/xml_printer_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/printer//xml_printer.hpp" +#include "mtconnect/printer//xml_printer_helper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/data_item_mapping_test.cpp b/test/data_item_mapping_test.cpp index c5678796a..57d3e15bd 100644 --- a/test/data_item_mapping_test.cpp +++ b/test/data_item_mapping_test.cpp @@ -21,10 +21,10 @@ #include -#include "observation/observation.hpp" -#include "pipeline/pipeline_context.hpp" -#include "pipeline/shdr_token_mapper.hpp" -#include "pipeline/timestamp_extractor.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/pipeline_context.hpp" +#include "mtconnect/pipeline/shdr_token_mapper.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" using namespace mtconnect; using namespace mtconnect::pipeline; diff --git a/test/data_item_test.cpp b/test/data_item_test.cpp index 413e83650..3b98a2df7 100644 --- a/test/data_item_test.cpp +++ b/test/data_item_test.cpp @@ -19,8 +19,8 @@ #include // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) -#include "device_model/data_item/data_item.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using namespace std; using namespace mtconnect; diff --git a/test/data_set_test.cpp b/test/data_set_test.cpp index f936d94bf..1f5da99fd 100644 --- a/test/data_set_test.cpp +++ b/test/data_set_test.cpp @@ -21,10 +21,10 @@ #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/device_test.cpp b/test/device_test.cpp index 5dd1ac029..35338312c 100644 --- a/test/device_test.cpp +++ b/test/device_test.cpp @@ -19,7 +19,7 @@ #include // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) -#include "device_model/device.hpp" +#include "mtconnect/device_model/device.hpp" using namespace std; using namespace mtconnect; using namespace entity; diff --git a/test/duplicate_filter_test.cpp b/test/duplicate_filter_test.cpp index 990fb9952..ded80f8b6 100644 --- a/test/duplicate_filter_test.cpp +++ b/test/duplicate_filter_test.cpp @@ -21,12 +21,12 @@ #include -#include "observation/observation.hpp" -#include "pipeline/delta_filter.hpp" -#include "pipeline/duplicate_filter.hpp" -#include "pipeline/period_filter.hpp" -#include "pipeline/pipeline.hpp" -#include "pipeline/shdr_token_mapper.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/delta_filter.hpp" +#include "mtconnect/pipeline/duplicate_filter.hpp" +#include "mtconnect/pipeline/period_filter.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/pipeline/shdr_token_mapper.hpp" using namespace mtconnect; using namespace mtconnect::pipeline; diff --git a/test/embedded_ruby_test.cpp b/test/embedded_ruby_test.cpp index 64ea3829d..b1dbb086e 100644 --- a/test/embedded_ruby_test.cpp +++ b/test/embedded_ruby_test.cpp @@ -39,16 +39,16 @@ #include #include -#include "agent.hpp" -#include "configuration/agent_config.hpp" -#include "configuration/config_options.hpp" -#include "device_model/data_item/data_item.hpp" -#include "pipeline/shdr_tokenizer.hpp" -#include "printer/xml_printer.hpp" -#include "ruby/ruby_smart_ptr.hpp" -#include "ruby/ruby_vm.hpp" -#include "sink/rest_sink/rest_service.hpp" -#include "source/adapter/shdr/shdr_adapter.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/configuration/agent_config.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/pipeline/shdr_tokenizer.hpp" +#include "mtconnect/printer//xml_printer.hpp" +#include "mtconnect/ruby/ruby_smart_ptr.hpp" +#include "mtconnect/ruby/ruby_vm.hpp" +#include "mtconnect/sink/rest_sink/rest_service.hpp" +#include "mtconnect/source/adapter/shdr/shdr_adapter.hpp" #ifdef _WIN32 #include diff --git a/test/entity_parser_test.cpp b/test/entity_parser_test.cpp index 9ba0ca7dd..20c4bb6f2 100644 --- a/test/entity_parser_test.cpp +++ b/test/entity_parser_test.cpp @@ -26,11 +26,11 @@ #include #include -#include "agent.hpp" -#include "entity/entity.hpp" -#include "entity/xml_parser.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/xml_parser.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/entity_printer_test.cpp b/test/entity_printer_test.cpp index 0fa14cb99..f922bf24e 100644 --- a/test/entity_printer_test.cpp +++ b/test/entity_printer_test.cpp @@ -28,12 +28,12 @@ #include -#include "agent.hpp" -#include "entity/entity.hpp" -#include "entity/xml_parser.hpp" -#include "entity/xml_printer.hpp" -#include "printer/xml_printer_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/entity/xml_printer.hpp" +#include "mtconnect/printer//xml_printer_helper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using namespace std; using namespace mtconnect; diff --git a/test/entity_test.cpp b/test/entity_test.cpp index 50880e28e..8efcc3366 100644 --- a/test/entity_test.cpp +++ b/test/entity_test.cpp @@ -26,8 +26,8 @@ #include #include -#include "entity/entity.hpp" -#include "entity/factory.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/factory.hpp" using namespace std; using namespace std::literals; diff --git a/test/file_asset_test.cpp b/test/file_asset_test.cpp index b5c75d012..0dc55b751 100644 --- a/test/file_asset_test.cpp +++ b/test/file_asset_test.cpp @@ -26,15 +26,15 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "asset/asset.hpp" -#include "asset/file_asset.hpp" -#include "entity/xml_parser.hpp" -#include "entity/xml_printer.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/asset/file_asset.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/entity/xml_printer.hpp" #include "json_helper.hpp" -#include "printer/xml_printer_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/printer//xml_printer_helper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/file_cache_test.cpp b/test/file_cache_test.cpp index 9d30232e6..815a37714 100644 --- a/test/file_cache_test.cpp +++ b/test/file_cache_test.cpp @@ -30,7 +30,7 @@ #include #include -#include "sink/rest_sink/file_cache.hpp" +#include "mtconnect/sink/rest_sink/file_cache.hpp" #ifndef _WINDOWS #include diff --git a/test/globals_test.cpp b/test/globals_test.cpp index 73d26a51d..7ea9c3235 100644 --- a/test/globals_test.cpp +++ b/test/globals_test.cpp @@ -22,7 +22,7 @@ #include #include -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" using namespace std; using namespace mtconnect; diff --git a/test/http_server_test.cpp b/test/http_server_test.cpp index ae35d0ec5..b300114aa 100644 --- a/test/http_server_test.cpp +++ b/test/http_server_test.cpp @@ -32,8 +32,8 @@ #include #include -#include "logging.hpp" -#include "sink/rest_sink/server.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/sink/rest_sink/server.hpp" using namespace std; using namespace mtconnect; diff --git a/test/json_parser_test.cpp b/test/json_parser_test.cpp index 40cae7598..7adb8d71c 100644 --- a/test/json_parser_test.cpp +++ b/test/json_parser_test.cpp @@ -28,9 +28,9 @@ #include -#include "entity/entity.hpp" -#include "entity/json_parser.cpp" -#include "entity/json_parser.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/json_parser.cpp" +#include "mtconnect/entity/json_parser.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/json_printer_asset_test.cpp b/test/json_printer_asset_test.cpp index bc25da63d..6c660e57b 100644 --- a/test/json_printer_asset_test.cpp +++ b/test/json_printer_asset_test.cpp @@ -27,19 +27,19 @@ #include -#include "asset/cutting_tool.hpp" -#include "asset/file_asset.hpp" -#include "buffer/checkpoint.hpp" -#include "device_model/data_item/data_item.hpp" -#include "device_model/device.hpp" -#include "entity/xml_parser.hpp" +#include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/asset/file_asset.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/entity/xml_parser.hpp" #include "json_helper.hpp" -#include "observation/observation.hpp" -#include "parser/xml_parser.hpp" -#include "printer/json_printer.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/parser/xml_parser.hpp" +#include "mtconnect/printer//json_printer.hpp" +#include "mtconnect/printer//xml_printer.hpp" #include "test_utilities.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/json_printer_error_test.cpp b/test/json_printer_error_test.cpp index 2f063d749..e1c192de2 100644 --- a/test/json_printer_error_test.cpp +++ b/test/json_printer_error_test.cpp @@ -27,13 +27,13 @@ #include -#include "buffer/checkpoint.hpp" -#include "device_model/data_item/data_item.hpp" -#include "device_model/device.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/device.hpp" #include "json_helper.hpp" -#include "observation/observation.hpp" -#include "printer/json_printer.hpp" -#include "utilities.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/printer//json_printer.hpp" +#include "mtconnect/utilities.hpp" using namespace std; using namespace mtconnect; diff --git a/test/json_printer_probe_test.cpp b/test/json_printer_probe_test.cpp index 40324b859..a5fc500cc 100644 --- a/test/json_printer_probe_test.cpp +++ b/test/json_printer_probe_test.cpp @@ -27,18 +27,18 @@ #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "buffer/checkpoint.hpp" -#include "device_model/data_item/data_item.hpp" -#include "device_model/device.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/device.hpp" #include "json_helper.hpp" -#include "observation/observation.hpp" -#include "parser/xml_parser.hpp" -#include "printer/json_printer.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/parser/xml_parser.hpp" +#include "mtconnect/printer//json_printer.hpp" +#include "mtconnect/printer//xml_printer.hpp" #include "test_utilities.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" using namespace std; using namespace mtconnect; diff --git a/test/json_printer_stream_test.cpp b/test/json_printer_stream_test.cpp index 48cdbc498..75f0a8c60 100644 --- a/test/json_printer_stream_test.cpp +++ b/test/json_printer_stream_test.cpp @@ -27,16 +27,16 @@ #include -#include "buffer/checkpoint.hpp" -#include "device_model/data_item/data_item.hpp" -#include "device_model/device.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/device.hpp" #include "json_helper.hpp" -#include "observation/observation.hpp" -#include "parser/xml_parser.hpp" -#include "printer/json_printer.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/parser/xml_parser.hpp" +#include "mtconnect/printer//json_printer.hpp" +#include "mtconnect/printer//xml_printer.hpp" #include "test_utilities.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/json_printer_test.cpp b/test/json_printer_test.cpp index efaaebffa..5aaaf1d2d 100644 --- a/test/json_printer_test.cpp +++ b/test/json_printer_test.cpp @@ -30,14 +30,14 @@ #include -#include "agent.hpp" -#include "configuration/config_options.hpp" -#include "entity/entity.hpp" -#include "entity/json_printer.hpp" -#include "entity/xml_parser.hpp" -#include "entity/xml_printer.hpp" -#include "printer/xml_printer_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/json_printer.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/entity/xml_printer.hpp" +#include "mtconnect/printer//xml_printer_helper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/kinematics_test.cpp b/test/kinematics_test.cpp index 35a735bd2..e8b18227f 100644 --- a/test/kinematics_test.cpp +++ b/test/kinematics_test.cpp @@ -26,10 +26,10 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/mqtt_adapter_test.cpp b/test/mqtt_adapter_test.cpp index bb249bf66..65be701f4 100644 --- a/test/mqtt_adapter_test.cpp +++ b/test/mqtt_adapter_test.cpp @@ -27,8 +27,8 @@ #include #include -#include "pipeline/pipeline_context.hpp" -#include "source/adapter/mqtt/mqtt_adapter.hpp" +#include "mtconnect/pipeline/pipeline_context.hpp" +#include "mtconnect/source/adapter/mqtt/mqtt_adapter.hpp" using namespace std; using namespace mtconnect; diff --git a/test/mqtt_isolated_test.cpp b/test/mqtt_isolated_test.cpp index e626c8702..3ce89633c 100644 --- a/test/mqtt_isolated_test.cpp +++ b/test/mqtt_isolated_test.cpp @@ -23,13 +23,13 @@ #include #include "agent_test_helper.hpp" -#include "buffer/checkpoint.hpp" -#include "device_model/data_item/data_item.hpp" -#include "entity/json_parser.hpp" -#include "mqtt/mqtt_client_impl.hpp" -#include "mqtt/mqtt_server_impl.hpp" -#include "printer/json_printer.hpp" -#include "sink/mqtt_sink/mqtt_service.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/entity/json_parser.hpp" +#include "mtconnect/mqtt/mqtt_client_impl.hpp" +#include "mtconnect/mqtt/mqtt_server_impl.hpp" +#include "mtconnect/printer//json_printer.hpp" +#include "mtconnect/sink/mqtt_sink/mqtt_service.hpp" using namespace std; using namespace mtconnect; diff --git a/test/mqtt_sink_test.cpp b/test/mqtt_sink_test.cpp index 6665b27d3..63fcb72c2 100644 --- a/test/mqtt_sink_test.cpp +++ b/test/mqtt_sink_test.cpp @@ -23,14 +23,14 @@ #include #include "agent_test_helper.hpp" -#include "buffer/checkpoint.hpp" -#include "device_model/data_item/data_item.hpp" -#include "entity/entity.hpp" -#include "entity/json_parser.hpp" -#include "mqtt/mqtt_client_impl.hpp" -#include "mqtt/mqtt_server_impl.hpp" -#include "printer/json_printer.hpp" -#include "sink/mqtt_sink/mqtt_service.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/json_parser.hpp" +#include "mtconnect/mqtt/mqtt_client_impl.hpp" +#include "mtconnect/mqtt/mqtt_server_impl.hpp" +#include "mtconnect/printer//json_printer.hpp" +#include "mtconnect/sink/mqtt_sink/mqtt_service.hpp" using namespace std; using namespace mtconnect; diff --git a/test/mtconnect_xml_transform_test.cpp b/test/mtconnect_xml_transform_test.cpp index 77f504bcc..3a9ee507d 100644 --- a/test/mtconnect_xml_transform_test.cpp +++ b/test/mtconnect_xml_transform_test.cpp @@ -21,10 +21,10 @@ #include -#include "agent.hpp" -#include "entity/entity.hpp" -#include "pipeline/mtconnect_xml_transform.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/pipeline/mtconnect_xml_transform.hpp" +#include "mtconnect/printer//xml_printer.hpp" using namespace mtconnect; using namespace mtconnect::pipeline; diff --git a/test/observation_test.cpp b/test/observation_test.cpp index 3e632e2d0..7cad0d1b2 100644 --- a/test/observation_test.cpp +++ b/test/observation_test.cpp @@ -21,13 +21,13 @@ #include -#include "device_model/data_item/data_item.hpp" -#include "entity/json_printer.hpp" -#include "entity/xml_parser.hpp" -#include "entity/xml_printer.hpp" -#include "observation/observation.hpp" -#include "pipeline/convert_sample.hpp" -#include "printer/xml_printer_helper.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/entity/json_printer.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/entity/xml_printer.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/convert_sample.hpp" +#include "mtconnect/printer//xml_printer_helper.hpp" #include "test_utilities.hpp" using namespace std; diff --git a/test/period_filter_test.cpp b/test/period_filter_test.cpp index cc2600742..e535cc26e 100644 --- a/test/period_filter_test.cpp +++ b/test/period_filter_test.cpp @@ -21,13 +21,13 @@ #include -#include "observation/observation.hpp" -#include "pipeline/deliver.hpp" -#include "pipeline/delta_filter.hpp" -#include "pipeline/duplicate_filter.hpp" -#include "pipeline/period_filter.hpp" -#include "pipeline/pipeline.hpp" -#include "pipeline/shdr_token_mapper.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/deliver.hpp" +#include "mtconnect/pipeline/delta_filter.hpp" +#include "mtconnect/pipeline/duplicate_filter.hpp" +#include "mtconnect/pipeline/period_filter.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/pipeline/shdr_token_mapper.hpp" using namespace mtconnect; using namespace mtconnect::pipeline; diff --git a/test/pipeline_deliver_test.cpp b/test/pipeline_deliver_test.cpp index 8b1aba6b9..ab692c940 100644 --- a/test/pipeline_deliver_test.cpp +++ b/test/pipeline_deliver_test.cpp @@ -22,13 +22,13 @@ #include #include "agent_test_helper.hpp" -#include "observation/observation.hpp" -#include "pipeline/deliver.hpp" -#include "pipeline/delta_filter.hpp" -#include "pipeline/duplicate_filter.hpp" -#include "pipeline/pipeline.hpp" -#include "pipeline/shdr_token_mapper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/deliver.hpp" +#include "mtconnect/pipeline/delta_filter.hpp" +#include "mtconnect/pipeline/duplicate_filter.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/pipeline/shdr_token_mapper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using namespace mtconnect; using namespace mtconnect::source::adapter; diff --git a/test/pipeline_edit_test.cpp b/test/pipeline_edit_test.cpp index 107064191..b32f31e0b 100644 --- a/test/pipeline_edit_test.cpp +++ b/test/pipeline_edit_test.cpp @@ -22,13 +22,13 @@ #include #include "agent_test_helper.hpp" -#include "observation/observation.hpp" -#include "pipeline/deliver.hpp" -#include "pipeline/delta_filter.hpp" -#include "pipeline/duplicate_filter.hpp" -#include "pipeline/pipeline.hpp" -#include "pipeline/shdr_token_mapper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/deliver.hpp" +#include "mtconnect/pipeline/delta_filter.hpp" +#include "mtconnect/pipeline/duplicate_filter.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/pipeline/shdr_token_mapper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using namespace mtconnect; using namespace mtconnect::source::adapter; diff --git a/test/qif_document_test.cpp b/test/qif_document_test.cpp index fc986d7d2..b7185f9ff 100644 --- a/test/qif_document_test.cpp +++ b/test/qif_document_test.cpp @@ -27,18 +27,18 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "asset/asset.hpp" -#include "asset/qif_document.hpp" -#include "entity/entity.hpp" -#include "entity/json_printer.hpp" -#include "entity/xml_parser.hpp" -#include "entity/xml_printer.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/asset/qif_document.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/json_printer.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/entity/xml_printer.hpp" #include "json_helper.hpp" -#include "printer/xml_printer.hpp" -#include "printer/xml_printer_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/printer//xml_printer.hpp" +#include "mtconnect/printer//xml_printer_helper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/qname_test.cpp b/test/qname_test.cpp index a47a0294e..c3857eabc 100644 --- a/test/qname_test.cpp +++ b/test/qname_test.cpp @@ -19,7 +19,7 @@ #include // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) -#include "entity/qname.hpp" +#include "mtconnect/entity/qname.hpp" using namespace mtconnect::entity; using namespace std; diff --git a/test/raw_material_test.cpp b/test/raw_material_test.cpp index 114e65cae..b3748149c 100644 --- a/test/raw_material_test.cpp +++ b/test/raw_material_test.cpp @@ -27,18 +27,18 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "asset/asset.hpp" -#include "asset/raw_material.hpp" -#include "entity/entity.hpp" -#include "entity/json_printer.hpp" -#include "entity/xml_parser.hpp" -#include "entity/xml_printer.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/asset/raw_material.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/entity/json_printer.hpp" +#include "mtconnect/entity/xml_parser.hpp" +#include "mtconnect/entity/xml_printer.hpp" #include "json_helper.hpp" -#include "printer/xml_printer.hpp" -#include "printer/xml_printer_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/printer//xml_printer.hpp" +#include "mtconnect/printer//xml_printer_helper.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/references_test.cpp b/test/references_test.cpp index 39e380d69..5e1786d38 100644 --- a/test/references_test.cpp +++ b/test/references_test.cpp @@ -26,10 +26,10 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/relationship_test.cpp b/test/relationship_test.cpp index eba64cc44..a22c6c8e1 100644 --- a/test/relationship_test.cpp +++ b/test/relationship_test.cpp @@ -26,11 +26,11 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "entity/json_printer.hpp" +#include "mtconnect/entity/json_printer.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/response_document_test.cpp b/test/response_document_test.cpp index 30a6bc5ab..c5e06ecb8 100644 --- a/test/response_document_test.cpp +++ b/test/response_document_test.cpp @@ -21,10 +21,10 @@ #include -#include "agent.hpp" -#include "entity/entity.hpp" -#include "pipeline/mtconnect_xml_transform.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/pipeline/mtconnect_xml_transform.hpp" +#include "mtconnect/printer//xml_printer.hpp" using namespace mtconnect; using namespace mtconnect::pipeline; diff --git a/test/routing_test.cpp b/test/routing_test.cpp index 9b7216c80..2ac2bd288 100644 --- a/test/routing_test.cpp +++ b/test/routing_test.cpp @@ -26,8 +26,8 @@ #include #include -#include "sink/rest_sink/response.hpp" -#include "sink/rest_sink/routing.hpp" +#include "mtconnect/sink/rest_sink/response.hpp" +#include "mtconnect/sink/rest_sink/routing.hpp" using namespace std; using namespace mtconnect; diff --git a/test/sensor_configuration_test.cpp b/test/sensor_configuration_test.cpp index 277890e11..5e9be20da 100644 --- a/test/sensor_configuration_test.cpp +++ b/test/sensor_configuration_test.cpp @@ -26,10 +26,10 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/shdr_tokenizer_test.cpp b/test/shdr_tokenizer_test.cpp index a2ad16b87..0dede5852 100644 --- a/test/shdr_tokenizer_test.cpp +++ b/test/shdr_tokenizer_test.cpp @@ -21,9 +21,9 @@ #include -#include "entity/entity.hpp" -#include "pipeline/shdr_tokenizer.hpp" -#include "pipeline/timestamp_extractor.hpp" +#include "mtconnect/entity/entity.hpp" +#include "mtconnect/pipeline/shdr_tokenizer.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" using namespace mtconnect; using namespace mtconnect::pipeline; diff --git a/test/solid_model_test.cpp b/test/solid_model_test.cpp index b3d35a057..c790f2637 100644 --- a/test/solid_model_test.cpp +++ b/test/solid_model_test.cpp @@ -26,10 +26,10 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/specification_test.cpp b/test/specification_test.cpp index 6f26c7523..19b3cc4a9 100644 --- a/test/specification_test.cpp +++ b/test/specification_test.cpp @@ -27,10 +27,10 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/table_test.cpp b/test/table_test.cpp index a6d3ea356..21b6f475a 100644 --- a/test/table_test.cpp +++ b/test/table_test.cpp @@ -26,10 +26,10 @@ #include #include -#include "agent.hpp" +#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" -#include "source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/testadapter_service.hpp b/test/testadapter_service.hpp index 3143f6154..29ec1c06e 100644 --- a/test/testadapter_service.hpp +++ b/test/testadapter_service.hpp @@ -19,11 +19,11 @@ #include -#include "configuration/agent_config.hpp" -#include "pipeline/pipeline.hpp" -#include "source/adapter/adapter.hpp" -#include "source/adapter/adapter_pipeline.hpp" -#include "source/source.hpp" +#include "mtconnect/configuration/agent_config.hpp" +#include "mtconnect/pipeline/pipeline.hpp" +#include "mtconnect/source/adapter/adapter.hpp" +#include "mtconnect/source/adapter/adapter_pipeline.hpp" +#include "mtconnect/source/source.hpp" using namespace std; diff --git a/test/testsink_service.hpp b/test/testsink_service.hpp index ad18d2d8a..96a726309 100644 --- a/test/testsink_service.hpp +++ b/test/testsink_service.hpp @@ -19,7 +19,7 @@ #include -#include "configuration/agent_config.hpp" +#include "mtconnect/configuration/agent_config.hpp" using namespace std; diff --git a/test/timestamp_extractor_test.cpp b/test/timestamp_extractor_test.cpp index a1149d355..f6d127448 100644 --- a/test/timestamp_extractor_test.cpp +++ b/test/timestamp_extractor_test.cpp @@ -21,8 +21,8 @@ #include -#include "pipeline/shdr_tokenizer.hpp" -#include "pipeline/timestamp_extractor.hpp" +#include "mtconnect/pipeline/shdr_tokenizer.hpp" +#include "mtconnect/pipeline/timestamp_extractor.hpp" using namespace mtconnect; using namespace mtconnect::pipeline; diff --git a/test/tls_http_server_test.cpp b/test/tls_http_server_test.cpp index 27910bed1..03c4077ff 100644 --- a/test/tls_http_server_test.cpp +++ b/test/tls_http_server_test.cpp @@ -33,8 +33,8 @@ #include #include -#include "logging.hpp" -#include "sink/rest_sink/server.hpp" +#include "mtconnect/logging.hpp" +#include "mtconnect/sink/rest_sink/server.hpp" using namespace std; using namespace mtconnect; diff --git a/test/topic_mapping_test.cpp b/test/topic_mapping_test.cpp index 8b7f55b80..4816f0ae4 100644 --- a/test/topic_mapping_test.cpp +++ b/test/topic_mapping_test.cpp @@ -21,10 +21,10 @@ #include -#include "device_model/device.hpp" -#include "observation/observation.hpp" -#include "pipeline/pipeline_context.hpp" -#include "pipeline/topic_mapper.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/pipeline/pipeline_context.hpp" +#include "mtconnect/pipeline/topic_mapper.hpp" using namespace mtconnect; using namespace mtconnect::pipeline; diff --git a/test/unit_conversion_test.cpp b/test/unit_conversion_test.cpp index 0203242d1..3d78eb219 100644 --- a/test/unit_conversion_test.cpp +++ b/test/unit_conversion_test.cpp @@ -19,7 +19,7 @@ #include // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) -#include "device_model/data_item/unit_conversion.hpp" +#include "mtconnect/device_model/data_item/unit_conversion.hpp" using namespace std; using namespace mtconnect::device_model::data_item; diff --git a/test/url_parser_test.cpp b/test/url_parser_test.cpp index 256993c2b..60f8e6549 100644 --- a/test/url_parser_test.cpp +++ b/test/url_parser_test.cpp @@ -19,7 +19,7 @@ #include // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) -#include "source/adapter/agent_adapter/url_parser.hpp" +#include "mtconnect/source/adapter/agent_adapter/url_parser.hpp" using namespace std; using namespace mtconnect; diff --git a/test/xml_parser_test.cpp b/test/xml_parser_test.cpp index e06dec731..c0a479393 100644 --- a/test/xml_parser_test.cpp +++ b/test/xml_parser_test.cpp @@ -23,9 +23,9 @@ #include #include -#include "device_model/reference.hpp" -#include "parser/xml_parser.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/device_model/reference.hpp" +#include "mtconnect/parser/xml_parser.hpp" +#include "mtconnect/printer//xml_printer.hpp" #include "test_utilities.hpp" using namespace std; diff --git a/test/xml_printer_test.cpp b/test/xml_printer_test.cpp index f87e2ad8d..a53cd454f 100644 --- a/test/xml_printer_test.cpp +++ b/test/xml_printer_test.cpp @@ -19,15 +19,15 @@ #include // Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) -#include "asset/asset.hpp" -#include "buffer/checkpoint.hpp" -#include "device_model/data_item/data_item.hpp" -#include "device_model/device.hpp" -#include "observation/observation.hpp" -#include "parser/xml_parser.hpp" -#include "printer/xml_printer.hpp" +#include "mtconnect/asset/asset.hpp" +#include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/device_model/data_item/data_item.hpp" +#include "mtconnect/device_model/device.hpp" +#include "mtconnect/observation/observation.hpp" +#include "mtconnect/parser/xml_parser.hpp" +#include "mtconnect/printer//xml_printer.hpp" #include "test_utilities.hpp" -#include "utilities.hpp" +#include "mtconnect/utilities.hpp" using namespace std; using namespace mtconnect; From 50dd4f094a9477916ec6435f417927509044265a Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 23 Dec 2022 18:54:40 -0800 Subject: [PATCH 03/50] Added hooks for agent initialization, start, and stop --- conanfile.py.bak | 116 ------------------------------------- src/mtconnect/agent.cpp | 13 +++++ src/mtconnect/agent.hpp | 17 +++++- test/agent_test.cpp | 67 +++++++++++++++++++++ test/agent_test_helper.hpp | 9 +++ test/config_test.cpp | 1 - 6 files changed, 105 insertions(+), 118 deletions(-) delete mode 100644 conanfile.py.bak diff --git a/conanfile.py.bak b/conanfile.py.bak deleted file mode 100644 index 5240fc098..000000000 --- a/conanfile.py.bak +++ /dev/null @@ -1,116 +0,0 @@ -from conans import ConanFile, CMake, tools - -class CppAgentConan(ConanFile): - name = "mtconnect_cppagent" - version = "2.0" - generators = "cmake" - url = "https://github.com/mtconnect/cppagent.git" - license = "Apache License 2.0" - settings = "os", "compiler", "arch", "build_type", "arch_build" - options = { "run_tests": [True, False], "build_tests": [True, False], "without_python": [True, False], - "without_ruby": [True, False], "without_ipv6": [True, False], "with_ruby": [True, False], - "with_python": [True, False] } - description = "MTConnect reference C++ agent copyright Association for Manufacturing Technology" - - requires = ["boost/1.77.0", "libxml2/2.9.10", "date/2.4.1", "nlohmann_json/3.9.1", - "mqtt_cpp/11.0.0", "openssl/1.1.1k"] - build_policy = "missing" - default_options = { - "run_tests": True, - "build_tests": True, - "without_python": True, - "without_ruby": False, - "without_ipv6": False, - "with_python": False, - "with_ruby": False, - - "boost:shared": False, - "boost:without_python": True, - "boost:without_test": True, - - "libxml2:shared": False, - "libxml2:include_utils": False, - "libxml2:http": False, - "libxml2:ftp": False, - "libxml2:iconv": False, - "libxml2:zlib": False, - - "gtest:shared": False, - - "date:use_system_tz_db": True - } - - def configure(self): - if not self.options.without_python: - self.options["boost"].without_python = False - - self.windows_xp = self.settings.os == 'Windows' and self.settings.compiler.toolset and \ - self.settings.compiler.toolset in ('v141_xp', 'v140_xp') - if self.settings.os == 'Windows': - if self.settings.build_type and self.settings.build_type == 'Debug': - self.settings.compiler.runtime = 'MTd' - else: - self.settings.compiler.runtime = 'MT' - self.settings.compiler.version = '16' - - if "libcxx" in self.settings.compiler.fields and self.settings.compiler.libcxx == "libstdc++": - raise Exception("This package is only compatible with libstdc++11, add -s compiler.libcxx=libstdc++11") - - self.settings.compiler.cppstd = 17 - - if self.windows_xp: - self.options.build_tests = False - - if not self.options.build_tests: - self.options.run_tests = False - - if not self.options.without_ruby: - self.options.with_ruby = True - - if not self.options.without_python: - self.options.with_python = True - - if self.settings.os == "Macos": - self.options["boost"].visibility = "hidden" - - def requirements(self): - if not self.windows_xp: - self.requires("gtest/1.10.0") - if self.options.with_ruby: - self.requires("mruby/3.1.0") - - def build(self): - cmake = CMake(self) - cmake.verbose = True - if not self.options.build_tests: - cmake.definitions['AGENT_ENABLE_UNITTESTS'] = 'OFF' - - if self.options.without_ipv6: - cmake.definitions['AGENT_WITHOUT_IPV6'] = 'ON' - - if self.options.with_python: - cmake.definitions['WITH_PYTHON'] = 'ON' - else: - cmake.definitions['WITH_PYTHON'] = 'OFF' - - if self.options.with_ruby: - cmake.definitions['WITH_RUBY'] = 'ON' - else: - cmake.definitions['WITH_RUBY'] = 'OFF' - - if self.windows_xp: - cmake.definitions['WINVER'] = '0x0501' - - cmake.configure() - cmake.build() - if self.options.run_tests: - cmake.test() - - def imports(self): - self.copy("*.dll", "bin", "bin") - self.copy("*.so*", "bin", "lib") - self.copy("*.dylib", "bin", "lib") - - - - diff --git a/src/mtconnect/agent.cpp b/src/mtconnect/agent.cpp index a45c799ae..24132e17d 100644 --- a/src/mtconnect/agent.cpp +++ b/src/mtconnect/agent.cpp @@ -114,6 +114,9 @@ namespace mtconnect { void Agent::initialize(pipeline::PipelineContextPtr context) { NAMED_SCOPE("Agent::initialize"); + + for (auto &hook : m_preInitializeHooks) + hook(*this); m_pipelineContext = context; m_loopback = @@ -140,7 +143,11 @@ namespace mtconnect { addDevice(device); loadCachedProbe(); + m_initialized = true; + + for (auto &hook : m_postInitializeHooks) + hook(*this); } void Agent::initialDataItemObservations() @@ -179,6 +186,9 @@ namespace mtconnect { NAMED_SCOPE("Agent::start"); try { + for (auto &hook : m_preStartHooks) + hook(*this); + for (auto sink : m_sinks) sink->start(); @@ -205,6 +215,9 @@ namespace mtconnect { { NAMED_SCOPE("Agent::stop"); + for (auto &hook : m_preStopHooks) + hook(*this); + // Stop all adapter threads... LOG(info) << "Shutting down sources"; for (auto source : m_sources) diff --git a/src/mtconnect/agent.hpp b/src/mtconnect/agent.hpp index 302ab1edf..19d7c82cd 100644 --- a/src/mtconnect/agent.hpp +++ b/src/mtconnect/agent.hpp @@ -73,16 +73,25 @@ namespace mtconnect { using WeakDataItemPtr = std::weak_ptr; using AssetChangeList = std::vector>; - + class Agent { public: + using Hook = std::function; + using HookList = std::list; + // Load agent with the xml configuration Agent(boost::asio::io_context &context, const std::string &deviceXmlPath, const ConfigOptions &options); // Virtual destructor ~Agent(); + + // Hooks + void addPreInitializeHook(Hook &hook) { m_preInitializeHooks.push_back(hook); } + void addPostInitializeHook(Hook &hook) { m_postInitializeHooks.push_back(hook); } + void addPreStartHook(Hook &hook) { m_preStartHooks.push_back(hook); } + void addPreStopHook(Hook &hook) { m_preStopHooks.push_back(hook); } // Initialize models and pipeline void initialize(pipeline::PipelineContextPtr context); @@ -307,6 +316,12 @@ namespace mtconnect { // For debugging bool m_pretty; + + // Agent hooks + HookList m_preInitializeHooks; + HookList m_postInitializeHooks; + HookList m_preStartHooks; + HookList m_preStopHooks; }; class AgentPipelineContract : public pipeline::PipelineContract diff --git a/test/agent_test.cpp b/test/agent_test.cpp index b2f698301..d2ab8d7a2 100644 --- a/test/agent_test.cpp +++ b/test/agent_test.cpp @@ -2870,3 +2870,70 @@ TEST_F(AgentTest, asset_should_also_work_using_post_with_assets) } } + +TEST_F(AgentTest, pre_start_hook_should_be_called) +{ + bool called = false; + Agent::Hook lambda = [&](Agent &agent) { + called = true; + }; + AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { + helper.getAgent()->addPreStartHook(lambda); + }; + m_agentTestHelper->setAgentCreateHook(helperHook); + auto agent = m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); + + ASSERT_FALSE(called); + agent->start(); + ASSERT_TRUE(called); + agent->stop(); +} + +TEST_F(AgentTest, pre_initialize_hooks_should_be_called) +{ + bool called = false; + Agent::Hook lambda = [&](Agent &agent) { + called = true; + }; + AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { + helper.getAgent()->addPreInitializeHook(lambda); + }; + m_agentTestHelper->setAgentCreateHook(helperHook); + m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); + + ASSERT_TRUE(called); +} + +TEST_F(AgentTest, post_initialize_hooks_should_be_called) +{ + bool called = false; + Agent::Hook lambda = [&](Agent &agent) { + called = true; + }; + AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { + helper.getAgent()->addPostInitializeHook(lambda); + }; + m_agentTestHelper->setAgentCreateHook(helperHook); + m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); + + ASSERT_TRUE(called); +} + +TEST_F(AgentTest, pre_stop_hook_should_be_called) +{ + bool called = false; + Agent::Hook lambda = [&](Agent &agent) { + called = true; + }; + AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { + helper.getAgent()->addPreStopHook(lambda); + }; + m_agentTestHelper->setAgentCreateHook(helperHook); + auto agent = m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); + + ASSERT_FALSE(called); + agent->start(); + ASSERT_FALSE(called); + agent->stop(); + ASSERT_TRUE(called); +} diff --git a/test/agent_test_helper.hpp b/test/agent_test_helper.hpp index 0ddd72e6b..0727dfd67 100644 --- a/test/agent_test_helper.hpp +++ b/test/agent_test_helper.hpp @@ -114,6 +114,8 @@ namespace observe = mtconnect::observation; class AgentTestHelper { public: + using Hook = std::function; + AgentTestHelper() : m_incomingIp("127.0.0.1"), m_strand(m_ioContext), m_socket(m_ioContext) {} ~AgentTestHelper() @@ -127,6 +129,8 @@ class AgentTestHelper } auto session() { return m_session; } + + void setAgentCreateHook(Hook &hook) { m_agentCreateHook = hook; } // Helper method to test expected string, given optional query, & run tests void responseHelper(const char *file, int line, @@ -194,6 +198,9 @@ class AgentTestHelper options.emplace(configuration::JsonVersion, 1); m_agent = std::make_unique(m_ioContext, PROJECT_ROOT_DIR + file, options); + if (m_agentCreateHook) + m_agentCreateHook(*this); + m_context = std::make_shared(); m_context->m_contract = m_agent->makePipelineContract(); @@ -308,6 +315,8 @@ class AgentTestHelper mtconnect::sink::SinkFactory m_sinkFactory; mtconnect::source::SourceFactory m_sourceFactory; + + Hook m_agentCreateHook; }; struct XmlDocFreer diff --git a/test/config_test.cpp b/test/config_test.cpp index a3fdf1105..0bb46b765 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -494,7 +494,6 @@ namespace { ASSERT_TRUE(rest); const auto server = rest->getServer(); - // TODO: Get headers working again const auto &headers = server->getHttpHeaders(); ASSERT_EQ(1, headers.size()); From ebd08da7672fb564a89178d22ddbf2748ece76d1 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Mon, 26 Dec 2022 19:58:09 -0800 Subject: [PATCH 04/50] Added extra hooks for plugin dev --- src/mtconnect/agent.cpp | 6 ++--- src/mtconnect/agent.hpp | 12 ++++++---- src/mtconnect/asset/cutting_tool.cpp | 3 ++- src/mtconnect/configuration/agent_config.cpp | 2 ++ src/mtconnect/configuration/agent_config.hpp | 13 ++++++++--- src/mtconnect/configuration/service.cpp | 2 +- src/mtconnect/device_model/agent_device.cpp | 2 +- src/mtconnect/device_model/component.cpp | 6 ++--- .../configuration/configuration.cpp | 2 +- .../device_model/data_item/constraints.hpp | 2 +- .../device_model/data_item/data_item.hpp | 6 ++--- src/mtconnect/device_model/device.hpp | 22 +++++++++++++++++- src/mtconnect/entity/json_parser.hpp | 4 ++-- src/mtconnect/entity/requirement.cpp | 2 +- src/mtconnect/entity/xml_parser.hpp | 4 ++-- src/mtconnect/mqtt/mqtt_client_impl.hpp | 2 +- src/mtconnect/mqtt/mqtt_server_impl.hpp | 2 +- src/mtconnect/pipeline/guard.hpp | 6 +++++ .../pipeline/mtconnect_xml_transform.hpp | 2 +- .../pipeline/timestamp_extractor.hpp | 2 +- src/mtconnect/pipeline/transform.hpp | 2 +- src/mtconnect/ruby/ruby_agent.hpp | 2 +- src/mtconnect/sink/rest_sink/response.hpp | 2 +- src/mtconnect/sink/rest_sink/rest_service.hpp | 6 ++--- src/mtconnect/sink/rest_sink/server.hpp | 4 ++-- src/mtconnect/sink/rest_sink/session_impl.hpp | 2 +- src/mtconnect/sink/rest_sink/tls_dector.hpp | 2 +- .../source/adapter/adapter_pipeline.hpp | 2 ++ .../adapter/agent_adapter/agent_adapter.cpp | 2 +- .../adapter/agent_adapter/agent_adapter.hpp | 5 ++-- .../source/adapter/shdr/shdr_adapter.hpp | 2 +- test/agent_adapter_test.cpp | 2 +- test/agent_device_test.cpp | 4 ++-- test/agent_test.cpp | 23 ++++++------------- test/agent_test_helper.cpp | 2 +- test/agent_test_helper.hpp | 10 ++++---- test/asset_test.cpp | 4 ++-- test/composition_test.cpp | 4 ++-- test/coordinate_system_test.cpp | 2 +- test/cutting_tool_test.cpp | 4 ++-- test/data_set_test.cpp | 2 +- test/entity_parser_test.cpp | 2 +- test/file_asset_test.cpp | 4 ++-- test/json_printer_asset_test.cpp | 4 ++-- test/json_printer_error_test.cpp | 2 +- test/json_printer_probe_test.cpp | 6 ++--- test/json_printer_stream_test.cpp | 4 ++-- test/kinematics_test.cpp | 2 +- test/qif_document_test.cpp | 4 ++-- test/raw_material_test.cpp | 4 ++-- test/references_test.cpp | 2 +- test/relationship_test.cpp | 4 ++-- test/sensor_configuration_test.cpp | 2 +- test/solid_model_test.cpp | 2 +- test/specification_test.cpp | 2 +- test/table_test.cpp | 2 +- test/xml_printer_test.cpp | 2 +- 57 files changed, 134 insertions(+), 104 deletions(-) diff --git a/src/mtconnect/agent.cpp b/src/mtconnect/agent.cpp index 24132e17d..9c492b064 100644 --- a/src/mtconnect/agent.cpp +++ b/src/mtconnect/agent.cpp @@ -114,7 +114,7 @@ namespace mtconnect { void Agent::initialize(pipeline::PipelineContextPtr context) { NAMED_SCOPE("Agent::initialize"); - + for (auto &hook : m_preInitializeHooks) hook(*this); @@ -143,7 +143,7 @@ namespace mtconnect { addDevice(device); loadCachedProbe(); - + m_initialized = true; for (auto &hook : m_postInitializeHooks) @@ -188,7 +188,7 @@ namespace mtconnect { { for (auto &hook : m_preStartHooks) hook(*this); - + for (auto sink : m_sinks) sink->start(); diff --git a/src/mtconnect/agent.hpp b/src/mtconnect/agent.hpp index 19d7c82cd..a9e61b4e7 100644 --- a/src/mtconnect/agent.hpp +++ b/src/mtconnect/agent.hpp @@ -73,11 +73,11 @@ namespace mtconnect { using WeakDataItemPtr = std::weak_ptr; using AssetChangeList = std::vector>; - + class Agent { public: - using Hook = std::function; + using Hook = std::function; using HookList = std::list; // Load agent with the xml configuration @@ -86,11 +86,15 @@ namespace mtconnect { // Virtual destructor ~Agent(); - + // Hooks + void addPreInitializeHook(Hook &&hook) { m_preInitializeHooks.push_back(std::move(hook)); } void addPreInitializeHook(Hook &hook) { m_preInitializeHooks.push_back(hook); } + void addPostInitializeHook(Hook &&hook) { m_postInitializeHooks.push_back(std::move(hook)); } void addPostInitializeHook(Hook &hook) { m_postInitializeHooks.push_back(hook); } + void addPreStartHook(Hook &&hook) { m_preStartHooks.push_back(std::move(hook)); } void addPreStartHook(Hook &hook) { m_preStartHooks.push_back(hook); } + void addPreStopHook(Hook &&hook) { m_preStopHooks.push_back(std::move(hook)); } void addPreStopHook(Hook &hook) { m_preStopHooks.push_back(hook); } // Initialize models and pipeline @@ -316,7 +320,7 @@ namespace mtconnect { // For debugging bool m_pretty; - + // Agent hooks HookList m_preInitializeHooks; HookList m_postInitializeHooks; diff --git a/src/mtconnect/asset/cutting_tool.cpp b/src/mtconnect/asset/cutting_tool.cpp index 8dde2ab8a..f18abea51 100644 --- a/src/mtconnect/asset/cutting_tool.cpp +++ b/src/mtconnect/asset/cutting_tool.cpp @@ -15,9 +15,10 @@ // limitations under the License. // +#include "mtconnect/asset/cutting_tool.hpp" + #include -#include "mtconnect/asset/cutting_tool.hpp" #include "mtconnect/printer//printer.hpp" using namespace std; diff --git a/src/mtconnect/configuration/agent_config.cpp b/src/mtconnect/configuration/agent_config.cpp index 9e98a6858..681c93c15 100644 --- a/src/mtconnect/configuration/agent_config.cpp +++ b/src/mtconnect/configuration/agent_config.cpp @@ -719,6 +719,8 @@ namespace mtconnect::configuration { // Make the Agent m_agent = make_unique(getAsyncContext(), m_devicesFile, options); + for (auto &hook : m_afterAgentHooks) + hook(*this); // Make the PipelineContext m_pipelineContext = std::make_shared(); diff --git a/src/mtconnect/configuration/agent_config.hpp b/src/mtconnect/configuration/agent_config.hpp index 8cb70efdc..34d337a15 100644 --- a/src/mtconnect/configuration/agent_config.hpp +++ b/src/mtconnect/configuration/agent_config.hpp @@ -28,9 +28,6 @@ #include #include "async_context.hpp" -#include "parser.hpp" -#include "service.hpp" - #include "mtconnect/agent.hpp" #include "mtconnect/sink/rest_sink/file_cache.hpp" #include "mtconnect/sink/sink.hpp" @@ -38,6 +35,8 @@ #include "mtconnect/source/adapter/shdr/shdr_pipeline.hpp" #include "mtconnect/source/source.hpp" #include "mtconnect/utilities.hpp" +#include "parser.hpp" +#include "service.hpp" namespace mtconnect { namespace rest_sink { @@ -65,6 +64,9 @@ namespace mtconnect { class AgentConfiguration : public MTConnectService { public: + using Hook = std::function; + using HookList = std::list; + using InitializationFn = void(const boost::property_tree::ptree &, AgentConfiguration &); using InitializationFunction = boost::function; @@ -73,6 +75,9 @@ namespace mtconnect { AgentConfiguration(); virtual ~AgentConfiguration(); + // Hooks + void addAfterAgentHook(Hook &&hook) { m_afterAgentHooks.push_back(std::move(hook)); } + // For MTConnectService void stop() override; void start() override; @@ -177,6 +182,8 @@ namespace mtconnect { #ifdef WITH_PYTHON std::unique_ptr m_python; #endif + + HookList m_afterAgentHooks; }; } // namespace configuration } // namespace mtconnect diff --git a/src/mtconnect/configuration/service.cpp b/src/mtconnect/configuration/service.cpp index 303e29eef..b9669dba0 100644 --- a/src/mtconnect/configuration/service.cpp +++ b/src/mtconnect/configuration/service.cpp @@ -28,8 +28,8 @@ #include #include "mtconnect/logging.hpp" -#include "service.hpp" #include "mtconnect/version.h" +#include "service.hpp" #ifdef _WINDOWS #define stricmp _stricmp diff --git a/src/mtconnect/device_model/agent_device.cpp b/src/mtconnect/device_model/agent_device.cpp index ffeb9cf6a..30c0edaab 100644 --- a/src/mtconnect/device_model/agent_device.cpp +++ b/src/mtconnect/device_model/agent_device.cpp @@ -17,9 +17,9 @@ #include "agent_device.hpp" -#include "mtconnect/configuration/config_options.hpp" #include "data_item/constraints.hpp" #include "data_item/data_item.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "mtconnect/logging.hpp" #include "mtconnect/source/adapter/adapter.hpp" diff --git a/src/mtconnect/device_model/component.cpp b/src/mtconnect/device_model/component.cpp index ba47ab233..1c9b6a139 100644 --- a/src/mtconnect/device_model/component.cpp +++ b/src/mtconnect/device_model/component.cpp @@ -20,16 +20,14 @@ #include #include -#include "mtconnect/agent.hpp" -#include "mtconnect/device_model/device.hpp" - #include "composition.hpp" #include "configuration/configuration.hpp" #include "data_item/data_item.hpp" #include "description.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/device_model/device.hpp" #include "reference.hpp" - using namespace std; namespace mtconnect { diff --git a/src/mtconnect/device_model/configuration/configuration.cpp b/src/mtconnect/device_model/configuration/configuration.cpp index f74637fc4..90040e883 100644 --- a/src/mtconnect/device_model/configuration/configuration.cpp +++ b/src/mtconnect/device_model/configuration/configuration.cpp @@ -18,8 +18,8 @@ #include "configuration.hpp" #include "coordinate_systems.hpp" -#include "mtconnect/entity/factory.hpp" #include "motion.hpp" +#include "mtconnect/entity/factory.hpp" #include "relationships.hpp" #include "sensor_configuration.hpp" #include "solid_model.hpp" diff --git a/src/mtconnect/device_model/data_item/constraints.hpp b/src/mtconnect/device_model/data_item/constraints.hpp index 270bc2bd4..c153ba53a 100644 --- a/src/mtconnect/device_model/data_item/constraints.hpp +++ b/src/mtconnect/device_model/data_item/constraints.hpp @@ -17,9 +17,9 @@ #pragma once +#include "filter.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" -#include "filter.hpp" namespace mtconnect { namespace device_model { diff --git a/src/mtconnect/device_model/data_item/data_item.hpp b/src/mtconnect/device_model/data_item/data_item.hpp index 99371e769..02ed5490c 100644 --- a/src/mtconnect/device_model/data_item/data_item.hpp +++ b/src/mtconnect/device_model/data_item/data_item.hpp @@ -20,13 +20,13 @@ #include "constraints.hpp" #include "definition.hpp" -#include "relationships.hpp" -#include "source.hpp" -#include "unit_conversion.hpp" #include "filter.hpp" #include "mtconnect/device_model/component.hpp" #include "mtconnect/observation/change_observer.hpp" #include "mtconnect/utilities.hpp" +#include "relationships.hpp" +#include "source.hpp" +#include "unit_conversion.hpp" #ifdef PASCAL #undef PASCAL diff --git a/src/mtconnect/device_model/device.hpp b/src/mtconnect/device_model/device.hpp index f8d00d1a6..b92cdaf23 100644 --- a/src/mtconnect/device_model/device.hpp +++ b/src/mtconnect/device_model/device.hpp @@ -50,6 +50,8 @@ namespace mtconnect { {}; struct BySource {}; + struct ByType + {}; struct ExtractId { @@ -96,11 +98,28 @@ namespace mtconnect { } }; + struct ExtractType + { + using result_type = std::string; + const result_type &operator()(const WeakDataItemPtr &d) const + { + const static result_type none {}; + if (d.expired()) + return none; + else + { + auto di = d.lock(); + return di->getType(); + } + } + }; + // Mapping of device names to data items using DataItemIndex = mic::multi_index_container< WeakDataItemPtr, mic::indexed_by, ExtractId>, mic::hashed_unique, ExtractName>, - mic::hashed_unique, ExtractSource>>>; + mic::hashed_unique, ExtractSource>, + mic::ordered_non_unique, ExtractType>>>; // Constructor that sets variables from an attribute map Device(const std::string &name, entity::Properties &props); @@ -145,6 +164,7 @@ namespace mtconnect { // Return the mapping of Device to data items const auto &getDeviceDataItems() const { return m_dataItems.get(); } + const auto &getDataItemIndex() const { return m_dataItems; } void addDataItem(DataItemPtr dataItem, entity::ErrorList &errors) override; diff --git a/src/mtconnect/entity/json_parser.hpp b/src/mtconnect/entity/json_parser.hpp index 825f79dda..00e535374 100644 --- a/src/mtconnect/entity/json_parser.hpp +++ b/src/mtconnect/entity/json_parser.hpp @@ -21,10 +21,10 @@ #include #include -#include "mtconnect/entity/entity.hpp" #include "factory.hpp" -#include "requirement.hpp" +#include "mtconnect/entity/entity.hpp" #include "mtconnect/utilities.hpp" +#include "requirement.hpp" namespace mtconnect { namespace entity { diff --git a/src/mtconnect/entity/requirement.cpp b/src/mtconnect/entity/requirement.cpp index f39514583..5ac1a4972 100644 --- a/src/mtconnect/entity/requirement.cpp +++ b/src/mtconnect/entity/requirement.cpp @@ -26,8 +26,8 @@ #include #include -#include "mtconnect/entity/entity.hpp" #include "factory.hpp" +#include "mtconnect/entity/entity.hpp" #include "mtconnect/logging.hpp" using namespace std; diff --git a/src/mtconnect/entity/xml_parser.hpp b/src/mtconnect/entity/xml_parser.hpp index 1e3c54ba2..65d024d7c 100644 --- a/src/mtconnect/entity/xml_parser.hpp +++ b/src/mtconnect/entity/xml_parser.hpp @@ -21,10 +21,10 @@ #include #include -#include "mtconnect/entity/entity.hpp" #include "factory.hpp" -#include "requirement.hpp" +#include "mtconnect/entity/entity.hpp" #include "mtconnect/utilities.hpp" +#include "requirement.hpp" struct _xmlNode; namespace mtconnect { diff --git a/src/mtconnect/mqtt/mqtt_client_impl.hpp b/src/mtconnect/mqtt/mqtt_client_impl.hpp index 07e6c3d9e..b33a47579 100644 --- a/src/mtconnect/mqtt/mqtt_client_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_client_impl.hpp @@ -23,8 +23,8 @@ #include #include -#include "mtconnect/configuration/config_options.hpp" #include "mqtt_client.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/mqtt/mqtt_adapter.hpp" diff --git a/src/mtconnect/mqtt/mqtt_server_impl.hpp b/src/mtconnect/mqtt/mqtt_server_impl.hpp index dc122baea..9fe6b1b4b 100644 --- a/src/mtconnect/mqtt/mqtt_server_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_server_impl.hpp @@ -27,8 +27,8 @@ #include #include -#include "mtconnect/configuration/config_options.hpp" #include "mqtt_server.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/mqtt/mqtt_adapter.hpp" diff --git a/src/mtconnect/pipeline/guard.hpp b/src/mtconnect/pipeline/guard.hpp index c5a166d8c..c0e96f531 100644 --- a/src/mtconnect/pipeline/guard.hpp +++ b/src/mtconnect/pipeline/guard.hpp @@ -55,6 +55,12 @@ namespace mtconnect { return *this; } + auto &operator||(GuardAction other) + { + m_alternative = GuardCls(other); + return *this; + } + protected: Guard m_alternative; GuardAction m_match; diff --git a/src/mtconnect/pipeline/mtconnect_xml_transform.hpp b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp index a79eaa28b..468ae1229 100644 --- a/src/mtconnect/pipeline/mtconnect_xml_transform.hpp +++ b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp @@ -22,8 +22,8 @@ #include "mtconnect/entity/entity.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/pipeline/transform.hpp" -#include "response_document.hpp" #include "mtconnect/source/error_code.hpp" +#include "response_document.hpp" namespace mtconnect::pipeline { struct XmlTransformFeedback diff --git a/src/mtconnect/pipeline/timestamp_extractor.hpp b/src/mtconnect/pipeline/timestamp_extractor.hpp index 0704c70da..6097056f8 100644 --- a/src/mtconnect/pipeline/timestamp_extractor.hpp +++ b/src/mtconnect/pipeline/timestamp_extractor.hpp @@ -17,9 +17,9 @@ #pragma once +#include "mtconnect/utilities.hpp" #include "shdr_tokenizer.hpp" #include "transform.hpp" -#include "mtconnect/utilities.hpp" namespace mtconnect { class Agent; diff --git a/src/mtconnect/pipeline/transform.hpp b/src/mtconnect/pipeline/transform.hpp index d4a282815..d9faccc4d 100644 --- a/src/mtconnect/pipeline/transform.hpp +++ b/src/mtconnect/pipeline/transform.hpp @@ -20,8 +20,8 @@ #include #include -#include "mtconnect/entity/entity.hpp" #include "guard.hpp" +#include "mtconnect/entity/entity.hpp" #include "pipeline_context.hpp" namespace mtconnect { diff --git a/src/mtconnect/ruby/ruby_agent.hpp b/src/mtconnect/ruby/ruby_agent.hpp index f75c120d1..c68140ad3 100644 --- a/src/mtconnect/ruby/ruby_agent.hpp +++ b/src/mtconnect/ruby/ruby_agent.hpp @@ -18,9 +18,9 @@ #pragma once #include "mtconnect/agent.hpp" -#include "ruby_smart_ptr.hpp" #include "mtconnect/sink/sink.hpp" #include "mtconnect/source/source.hpp" +#include "ruby_smart_ptr.hpp" namespace mtconnect::ruby { using namespace mtconnect::device_model; diff --git a/src/mtconnect/sink/rest_sink/response.hpp b/src/mtconnect/sink/rest_sink/response.hpp index c86a03075..587f33e68 100644 --- a/src/mtconnect/sink/rest_sink/response.hpp +++ b/src/mtconnect/sink/rest_sink/response.hpp @@ -24,8 +24,8 @@ #include #include "cached_file.hpp" -#include "request.hpp" #include "mtconnect/utilities.hpp" +#include "request.hpp" namespace mtconnect { namespace printer { diff --git a/src/mtconnect/sink/rest_sink/rest_service.hpp b/src/mtconnect/sink/rest_sink/rest_service.hpp index f7813e3ba..50ed45b08 100644 --- a/src/mtconnect/sink/rest_sink/rest_service.hpp +++ b/src/mtconnect/sink/rest_sink/rest_service.hpp @@ -19,13 +19,13 @@ #include -#include "request.hpp" -#include "response.hpp" -#include "server.hpp" #include "mtconnect/buffer/circular_buffer.hpp" #include "mtconnect/sink/sink.hpp" #include "mtconnect/source/loopback_source.hpp" #include "mtconnect/utilities.hpp" +#include "request.hpp" +#include "response.hpp" +#include "server.hpp" namespace mtconnect { namespace printer { diff --git a/src/mtconnect/sink/rest_sink/server.hpp b/src/mtconnect/sink/rest_sink/server.hpp index 969eeadf5..72b09a000 100644 --- a/src/mtconnect/sink/rest_sink/server.hpp +++ b/src/mtconnect/sink/rest_sink/server.hpp @@ -33,13 +33,13 @@ #include #include -#include "mtconnect/configuration/config_options.hpp" #include "file_cache.hpp" +#include "mtconnect/configuration/config_options.hpp" +#include "mtconnect/utilities.hpp" #include "response.hpp" #include "routing.hpp" #include "session.hpp" #include "tls_dector.hpp" -#include "mtconnect/utilities.hpp" namespace mtconnect::sink::rest_sink { class Server diff --git a/src/mtconnect/sink/rest_sink/session_impl.hpp b/src/mtconnect/sink/rest_sink/session_impl.hpp index 6053f9bed..29992efd4 100644 --- a/src/mtconnect/sink/rest_sink/session_impl.hpp +++ b/src/mtconnect/sink/rest_sink/session_impl.hpp @@ -25,8 +25,8 @@ #include #include "mtconnect/configuration/config_options.hpp" -#include "session.hpp" #include "mtconnect/utilities.hpp" +#include "session.hpp" namespace mtconnect { namespace printer { diff --git a/src/mtconnect/sink/rest_sink/tls_dector.hpp b/src/mtconnect/sink/rest_sink/tls_dector.hpp index a3180300d..1ec7ced26 100644 --- a/src/mtconnect/sink/rest_sink/tls_dector.hpp +++ b/src/mtconnect/sink/rest_sink/tls_dector.hpp @@ -21,8 +21,8 @@ #include #include "mtconnect/configuration/config_options.hpp" -#include "session.hpp" #include "mtconnect/utilities.hpp" +#include "session.hpp" namespace mtconnect::sink::rest_sink { class TlsDector : public std::enable_shared_from_this diff --git a/src/mtconnect/source/adapter/adapter_pipeline.hpp b/src/mtconnect/source/adapter/adapter_pipeline.hpp index aba3f1d4c..d85aad089 100644 --- a/src/mtconnect/source/adapter/adapter_pipeline.hpp +++ b/src/mtconnect/source/adapter/adapter_pipeline.hpp @@ -47,6 +47,8 @@ namespace mtconnect::source::adapter { void build(const ConfigOptions &options) override; virtual std::unique_ptr makeHandler(); + const auto &getDevice() const { return m_device; } + protected: void buildDeviceList(); void buildCommandAndStatusDelivery(); diff --git a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp index 8bc6d24f6..c2eb9648c 100644 --- a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp +++ b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.cpp @@ -29,9 +29,9 @@ #include #include -#include "mtconnect/configuration/config_options.hpp" #include "http_session.hpp" #include "https_session.hpp" +#include "mtconnect/configuration/config_options.hpp" #include "mtconnect/logging.hpp" #include "mtconnect/pipeline/deliver.hpp" #include "session_impl.hpp" diff --git a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp index 3f894e178..8c256e629 100644 --- a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp @@ -17,12 +17,11 @@ #pragma once -#include "session.hpp" -#include "url_parser.hpp" - #include "mtconnect/pipeline/mtconnect_xml_transform.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" +#include "session.hpp" +#include "url_parser.hpp" namespace boost::asio::ssl { class context; diff --git a/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp index 2bd429aae..d484353c5 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp +++ b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp @@ -26,11 +26,11 @@ #include #include "connector.hpp" -#include "shdr_pipeline.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/source.hpp" #include "mtconnect/utilities.hpp" +#include "shdr_pipeline.hpp" namespace mtconnect { class Agent; diff --git a/test/agent_adapter_test.cpp b/test/agent_adapter_test.cpp index 6c3ed0421..e20d4ca2b 100644 --- a/test/agent_adapter_test.cpp +++ b/test/agent_adapter_test.cpp @@ -26,8 +26,8 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/device_model/reference.hpp" #include "mtconnect/pipeline/mtconnect_xml_transform.hpp" #include "mtconnect/pipeline/response_document.hpp" diff --git a/test/agent_device_test.cpp b/test/agent_device_test.cpp index 0be0b0ba9..bdfe773a9 100644 --- a/test/agent_device_test.cpp +++ b/test/agent_device_test.cpp @@ -22,10 +22,10 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "mtconnect/device_model/agent_device.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/device_model/agent_device.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/version.h" diff --git a/test/agent_test.cpp b/test/agent_test.cpp index d2ab8d7a2..bbf34a581 100644 --- a/test/agent_test.cpp +++ b/test/agent_test.cpp @@ -26,8 +26,8 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/asset/file_asset.hpp" #include "mtconnect/device_model/reference.hpp" #include "mtconnect/printer//xml_printer.hpp" @@ -2855,11 +2855,11 @@ TEST_F(AgentTest, asset_count_should_track_asset_additions_by_type) TEST_F(AgentTest, asset_should_also_work_using_post_with_assets) { auto agent = m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); - + string body = "TEST 1"; QueryMap queries; const auto &storage = agent->getAssetStorage(); - + { PARSE_XML_RESPONSE_PUT("/assets", body, queries); ASSERT_EQ((unsigned int)1, storage->getCount()); @@ -2868,15 +2868,12 @@ TEST_F(AgentTest, asset_should_also_work_using_post_with_assets) PARSE_XML_RESPONSE_PUT("/assets/P2", body, queries); ASSERT_EQ((unsigned int)2, storage->getCount()); } - } TEST_F(AgentTest, pre_start_hook_should_be_called) { bool called = false; - Agent::Hook lambda = [&](Agent &agent) { - called = true; - }; + Agent::Hook lambda = [&](Agent &agent) { called = true; }; AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { helper.getAgent()->addPreStartHook(lambda); }; @@ -2892,9 +2889,7 @@ TEST_F(AgentTest, pre_start_hook_should_be_called) TEST_F(AgentTest, pre_initialize_hooks_should_be_called) { bool called = false; - Agent::Hook lambda = [&](Agent &agent) { - called = true; - }; + Agent::Hook lambda = [&](Agent &agent) { called = true; }; AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { helper.getAgent()->addPreInitializeHook(lambda); }; @@ -2907,9 +2902,7 @@ TEST_F(AgentTest, pre_initialize_hooks_should_be_called) TEST_F(AgentTest, post_initialize_hooks_should_be_called) { bool called = false; - Agent::Hook lambda = [&](Agent &agent) { - called = true; - }; + Agent::Hook lambda = [&](Agent &agent) { called = true; }; AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { helper.getAgent()->addPostInitializeHook(lambda); }; @@ -2922,9 +2915,7 @@ TEST_F(AgentTest, post_initialize_hooks_should_be_called) TEST_F(AgentTest, pre_stop_hook_should_be_called) { bool called = false; - Agent::Hook lambda = [&](Agent &agent) { - called = true; - }; + Agent::Hook lambda = [&](Agent &agent) { called = true; }; AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { helper.getAgent()->addPreStopHook(lambda); }; diff --git a/test/agent_test_helper.cpp b/test/agent_test_helper.cpp index 0030da639..8cc85fba0 100644 --- a/test/agent_test_helper.cpp +++ b/test/agent_test_helper.cpp @@ -23,8 +23,8 @@ #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/sink/rest_sink/server.hpp" using namespace std; diff --git a/test/agent_test_helper.hpp b/test/agent_test_helper.hpp index 0727dfd67..7dfb7144c 100644 --- a/test/agent_test_helper.hpp +++ b/test/agent_test_helper.hpp @@ -114,8 +114,8 @@ namespace observe = mtconnect::observation; class AgentTestHelper { public: - using Hook = std::function; - + using Hook = std::function; + AgentTestHelper() : m_incomingIp("127.0.0.1"), m_strand(m_ioContext), m_socket(m_ioContext) {} ~AgentTestHelper() @@ -129,7 +129,7 @@ class AgentTestHelper } auto session() { return m_session; } - + void setAgentCreateHook(Hook &hook) { m_agentCreateHook = hook; } // Helper method to test expected string, given optional query, & run tests @@ -200,7 +200,7 @@ class AgentTestHelper m_agent = std::make_unique(m_ioContext, PROJECT_ROOT_DIR + file, options); if (m_agentCreateHook) m_agentCreateHook(*this); - + m_context = std::make_shared(); m_context->m_contract = m_agent->makePipelineContract(); @@ -315,7 +315,7 @@ class AgentTestHelper mtconnect::sink::SinkFactory m_sinkFactory; mtconnect::source::SourceFactory m_sourceFactory; - + Hook m_agentCreateHook; }; diff --git a/test/asset_test.cpp b/test/asset_test.cpp index ae1127a4c..988943541 100644 --- a/test/asset_test.cpp +++ b/test/asset_test.cpp @@ -26,13 +26,13 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/asset/asset.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/xml_parser.hpp" #include "mtconnect/entity/xml_printer.hpp" -#include "json_helper.hpp" #include "mtconnect/printer//xml_printer_helper.hpp" #include "mtconnect/source/adapter/adapter.hpp" diff --git a/test/composition_test.cpp b/test/composition_test.cpp index 5bce30fc1..156b41ca2 100644 --- a/test/composition_test.cpp +++ b/test/composition_test.cpp @@ -27,10 +27,10 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "mtconnect/device_model/composition.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/device_model/composition.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/coordinate_system_test.cpp b/test/coordinate_system_test.cpp index 908de0c86..a5b3b0327 100644 --- a/test/coordinate_system_test.cpp +++ b/test/coordinate_system_test.cpp @@ -26,9 +26,9 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/cutting_tool_test.cpp b/test/cutting_tool_test.cpp index b96fb649a..e3fddc0fa 100644 --- a/test/cutting_tool_test.cpp +++ b/test/cutting_tool_test.cpp @@ -26,14 +26,14 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/asset/cutting_tool.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/json_printer.hpp" #include "mtconnect/entity/xml_parser.hpp" #include "mtconnect/entity/xml_printer.hpp" -#include "json_helper.hpp" #include "mtconnect/printer//xml_printer.hpp" #include "mtconnect/printer//xml_printer_helper.hpp" #include "mtconnect/source/adapter/adapter.hpp" diff --git a/test/data_set_test.cpp b/test/data_set_test.cpp index 1f5da99fd..ff92bf752 100644 --- a/test/data_set_test.cpp +++ b/test/data_set_test.cpp @@ -21,9 +21,9 @@ #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/entity_parser_test.cpp b/test/entity_parser_test.cpp index 20c4bb6f2..dc2601a46 100644 --- a/test/entity_parser_test.cpp +++ b/test/entity_parser_test.cpp @@ -26,10 +26,10 @@ #include #include +#include "json_helper.hpp" #include "mtconnect/agent.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/xml_parser.hpp" -#include "json_helper.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/file_asset_test.cpp b/test/file_asset_test.cpp index 0dc55b751..cb04fa5e6 100644 --- a/test/file_asset_test.cpp +++ b/test/file_asset_test.cpp @@ -26,13 +26,13 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/asset/asset.hpp" #include "mtconnect/asset/file_asset.hpp" #include "mtconnect/entity/xml_parser.hpp" #include "mtconnect/entity/xml_printer.hpp" -#include "json_helper.hpp" #include "mtconnect/printer//xml_printer_helper.hpp" #include "mtconnect/source/adapter/adapter.hpp" diff --git a/test/json_printer_asset_test.cpp b/test/json_printer_asset_test.cpp index 6c660e57b..7e1cba209 100644 --- a/test/json_printer_asset_test.cpp +++ b/test/json_printer_asset_test.cpp @@ -27,19 +27,19 @@ #include +#include "json_helper.hpp" #include "mtconnect/asset/cutting_tool.hpp" #include "mtconnect/asset/file_asset.hpp" #include "mtconnect/buffer/checkpoint.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/device_model/device.hpp" #include "mtconnect/entity/xml_parser.hpp" -#include "json_helper.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/parser/xml_parser.hpp" #include "mtconnect/printer//json_printer.hpp" #include "mtconnect/printer//xml_printer.hpp" -#include "test_utilities.hpp" #include "mtconnect/utilities.hpp" +#include "test_utilities.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/json_printer_error_test.cpp b/test/json_printer_error_test.cpp index e1c192de2..9e7633b2c 100644 --- a/test/json_printer_error_test.cpp +++ b/test/json_printer_error_test.cpp @@ -27,10 +27,10 @@ #include +#include "json_helper.hpp" #include "mtconnect/buffer/checkpoint.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/device_model/device.hpp" -#include "json_helper.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/printer//json_printer.hpp" #include "mtconnect/utilities.hpp" diff --git a/test/json_printer_probe_test.cpp b/test/json_printer_probe_test.cpp index a5fc500cc..d772ec8c9 100644 --- a/test/json_printer_probe_test.cpp +++ b/test/json_printer_probe_test.cpp @@ -27,18 +27,18 @@ #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/buffer/checkpoint.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/device_model/device.hpp" -#include "json_helper.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/parser/xml_parser.hpp" #include "mtconnect/printer//json_printer.hpp" #include "mtconnect/printer//xml_printer.hpp" -#include "test_utilities.hpp" #include "mtconnect/utilities.hpp" +#include "test_utilities.hpp" using namespace std; using namespace mtconnect; diff --git a/test/json_printer_stream_test.cpp b/test/json_printer_stream_test.cpp index 75f0a8c60..dc5857e1c 100644 --- a/test/json_printer_stream_test.cpp +++ b/test/json_printer_stream_test.cpp @@ -27,16 +27,16 @@ #include +#include "json_helper.hpp" #include "mtconnect/buffer/checkpoint.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/device_model/device.hpp" -#include "json_helper.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/parser/xml_parser.hpp" #include "mtconnect/printer//json_printer.hpp" #include "mtconnect/printer//xml_printer.hpp" -#include "test_utilities.hpp" #include "mtconnect/utilities.hpp" +#include "test_utilities.hpp" using json = nlohmann::json; using namespace std; diff --git a/test/kinematics_test.cpp b/test/kinematics_test.cpp index e8b18227f..5705c0005 100644 --- a/test/kinematics_test.cpp +++ b/test/kinematics_test.cpp @@ -26,9 +26,9 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/qif_document_test.cpp b/test/qif_document_test.cpp index b7185f9ff..f5619369a 100644 --- a/test/qif_document_test.cpp +++ b/test/qif_document_test.cpp @@ -27,15 +27,15 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/asset/asset.hpp" #include "mtconnect/asset/qif_document.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/json_printer.hpp" #include "mtconnect/entity/xml_parser.hpp" #include "mtconnect/entity/xml_printer.hpp" -#include "json_helper.hpp" #include "mtconnect/printer//xml_printer.hpp" #include "mtconnect/printer//xml_printer_helper.hpp" #include "mtconnect/source/adapter/adapter.hpp" diff --git a/test/raw_material_test.cpp b/test/raw_material_test.cpp index b3748149c..ef010e1f8 100644 --- a/test/raw_material_test.cpp +++ b/test/raw_material_test.cpp @@ -27,15 +27,15 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" +#include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/asset/asset.hpp" #include "mtconnect/asset/raw_material.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/json_printer.hpp" #include "mtconnect/entity/xml_parser.hpp" #include "mtconnect/entity/xml_printer.hpp" -#include "json_helper.hpp" #include "mtconnect/printer//xml_printer.hpp" #include "mtconnect/printer//xml_printer_helper.hpp" #include "mtconnect/source/adapter/adapter.hpp" diff --git a/test/references_test.cpp b/test/references_test.cpp index 5e1786d38..c20a5fe51 100644 --- a/test/references_test.cpp +++ b/test/references_test.cpp @@ -26,9 +26,9 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/relationship_test.cpp b/test/relationship_test.cpp index a22c6c8e1..6b63983a8 100644 --- a/test/relationship_test.cpp +++ b/test/relationship_test.cpp @@ -26,10 +26,10 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" -#include "mtconnect/entity/json_printer.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" +#include "mtconnect/entity/json_printer.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/sensor_configuration_test.cpp b/test/sensor_configuration_test.cpp index 5e9be20da..61122ae3b 100644 --- a/test/sensor_configuration_test.cpp +++ b/test/sensor_configuration_test.cpp @@ -26,9 +26,9 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/solid_model_test.cpp b/test/solid_model_test.cpp index c790f2637..8d2f254b0 100644 --- a/test/solid_model_test.cpp +++ b/test/solid_model_test.cpp @@ -26,9 +26,9 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/specification_test.cpp b/test/specification_test.cpp index 19b3cc4a9..402b2e2fa 100644 --- a/test/specification_test.cpp +++ b/test/specification_test.cpp @@ -27,9 +27,9 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/table_test.cpp b/test/table_test.cpp index 21b6f475a..441fead7d 100644 --- a/test/table_test.cpp +++ b/test/table_test.cpp @@ -26,9 +26,9 @@ #include #include -#include "mtconnect/agent.hpp" #include "agent_test_helper.hpp" #include "json_helper.hpp" +#include "mtconnect/agent.hpp" #include "mtconnect/source/adapter/adapter.hpp" using json = nlohmann::json; diff --git a/test/xml_printer_test.cpp b/test/xml_printer_test.cpp index a53cd454f..61e833764 100644 --- a/test/xml_printer_test.cpp +++ b/test/xml_printer_test.cpp @@ -26,8 +26,8 @@ #include "mtconnect/observation/observation.hpp" #include "mtconnect/parser/xml_parser.hpp" #include "mtconnect/printer//xml_printer.hpp" -#include "test_utilities.hpp" #include "mtconnect/utilities.hpp" +#include "test_utilities.hpp" using namespace std; using namespace mtconnect; From 9c29b45ade9ab87189e5be823f4454bad37c790f Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Tue, 27 Dec 2022 21:26:15 -0800 Subject: [PATCH 05/50] First cut at shared lib version of agent --- CMakeLists.txt | 13 +++++++++++-- agent/CMakeLists.txt | 2 +- agent_lib/CMakeLists.txt | 6 +++++- conanfile.py | 19 +++++++++++++++---- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45e47305f..b4aca74e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ if(POLICY CMP0077) endif() option(AGENT_ENABLE_UNITTESTS "Enables the agent's unit tests" ON) +option(SHARED_AGENT_LIB "Generate shared agent library. Conan options: shared" OFF) set(INSTALL_GTEST OFF FORCE) project(cppagent LANGUAGES C CXX) @@ -64,7 +65,11 @@ if(MSVC) endif() if (UNIX) - add_compile_options(-fPIC -Wno-psabi -fvisibility-inlines-hidden -fvisibility=hidden) + if (SHARED_AGENT_LIB) + add_compile_options(-fPIC -Wno-psabi -fvisibility-inlines-hidden) + else() + add_compile_options(-fPIC -Wno-psabi -fvisibility-inlines-hidden -fvisibility=hidden) + endif() ENDIF() include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) @@ -73,7 +78,11 @@ if (CONAN_USER_MRUBY_mruby) set(WITH_RUBY ON FORCE) endif() -conan_basic_setup(TARGETS) +conan_basic_setup(KEEP_RPATHS TARGETS) + +if(SHARED_AGENT_LIB) + set(CMAKE_BUILD_RPATH "@load_path/;@executable_path/;@load_path/../lib;@executable_path/../lib") +endif() if(WITH_PYTHON) set(Python_USE_STATIC_LIBS ON) diff --git a/agent/CMakeLists.txt b/agent/CMakeLists.txt index d7d9efb92..af4ca2cdf 100644 --- a/agent/CMakeLists.txt +++ b/agent/CMakeLists.txt @@ -36,7 +36,7 @@ endif() target_link_libraries( agent - PRIVATE + PUBLIC agent_lib $<$:shlwapi> ) diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index 25eb183ba..1b8f41b21 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -323,8 +323,12 @@ if(MSVC) PROPERTY COMPILE_FLAGS "/bigobj") endif() +if(SHARED_AGENT_LIB) + add_library(agent_lib SHARED ${AGENT_SOURCES}) +else() + add_library(agent_lib STATIC ${AGENT_SOURCES}) +endif() -add_library(agent_lib STATIC ${AGENT_SOURCES}) target_include_directories( agent_lib PUBLIC diff --git a/conanfile.py b/conanfile.py index 7d98b550c..4a580f85d 100644 --- a/conanfile.py +++ b/conanfile.py @@ -15,7 +15,7 @@ class MTConnectAgentConan(ConanFile): settings = "os", "compiler", "arch", "build_type", "arch_build" options = { "run_tests": [True, False], "build_tests": [True, False], "without_python": [True, False], "without_ruby": [True, False], "without_ipv6": [True, False], "with_ruby": [True, False], - "with_python": [True, False], "development" : [True, False] } + "with_python": [True, False], "development" : [True, False], "shared": [True, False] } description = "MTConnect reference C++ agent copyright Association for Manufacturing Technology" requires = ["boost/1.79.0@#3249d9bd2b863a9489767bf9c8a05b4b", @@ -35,6 +35,7 @@ class MTConnectAgentConan(ConanFile): "with_python": False, "with_ruby": False, "development": False, + "shared": False, "boost:shared": False, "boost:without_python": True, @@ -62,6 +63,9 @@ class MTConnectAgentConan(ConanFile): # git.clone("https://github.com/mtconnect/cppagent") def configure(self): + if self.options.shared: + self.options["boost"].shared = True + if not self.options.without_python: self.options["boost"].without_python = False @@ -93,7 +97,7 @@ def configure(self): if not self.options.without_python: self.options.with_python = True - if self.settings.os == "Macos": + if not self.options.shared and self.settings.os == "Macos": self.options["boost"].visibility = "hidden" def requirements(self): @@ -124,6 +128,9 @@ def build(self): if self.windows_xp: cmake.definitions['WINVER'] = '0x0501' + if self.options.shared: + cmake.definitions['SHARED_AGENT_LIB'] = 'ON' + cmake.configure() cmake.build() if self.options.run_tests: @@ -131,8 +138,8 @@ def build(self): def imports(self): self.copy("*.dll", "bin", "bin") - self.copy("*.so*", "bin", "lib") - self.copy("*.dylib", "bin", "lib") + self.copy("*.so*", "lib", "lib") + self.copy("*.dylib", "lib", "lib") def package_info(self): self.cpp_info.includedirs = ['include'] @@ -143,10 +150,14 @@ def package_info(self): self.cpp_info.defines.append("WITH_RUBY=1") if self.options.without_ipv6: self.cpp_info.defines.append("AGENT_WITHOUT_IPV6=1") + if self.options.shared: + self.user_info.SHARED = 'ON' def package(self): self.copy("*", src=os.path.join(self.build_folder, "bin"), dst="bin", keep_path=False) self.copy("*.a", src=os.path.join(self.build_folder, "lib"), dst="lib", keep_path=False) + self.copy("*.dylib", src=os.path.join(self.build_folder, "lib"), dst="lib", keep_path=False) + self.copy("*.so", src=os.path.join(self.build_folder, "lib"), dst="lib", keep_path=False) self.copy("*.h", src=os.path.join(self.build_folder, "agent_lib"), dst="include") self.copy("*.h", src="src", dst="include") self.copy("*.hpp", src="src", dst="include") From 223b444d08b10ea3194f7ef7de88daaa58027a8c Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Tue, 27 Dec 2022 22:26:16 -0800 Subject: [PATCH 06/50] Added default visibility to inline methods with static local vars. --- src/mtconnect/ruby/ruby_smart_ptr.hpp | 3 +++ src/mtconnect/source/error_code.hpp | 3 ++- test/agent_adapter_test.cpp | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mtconnect/ruby/ruby_smart_ptr.hpp b/src/mtconnect/ruby/ruby_smart_ptr.hpp index bf8a3d521..fe74dd992 100644 --- a/src/mtconnect/ruby/ruby_smart_ptr.hpp +++ b/src/mtconnect/ruby/ruby_smart_ptr.hpp @@ -23,6 +23,7 @@ namespace mtconnect::ruby { { using SharedPtr = std::shared_ptr; + __attribute__((visibility("default"))) static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; @@ -128,6 +129,7 @@ namespace mtconnect::ruby { { using Ptr = T *; + __attribute__((visibility("default"))) static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; @@ -186,6 +188,7 @@ namespace mtconnect::ruby { { using UniquePtr = std::unique_ptr; + __attribute__((visibility("default"))) static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; diff --git a/src/mtconnect/source/error_code.hpp b/src/mtconnect/source/error_code.hpp index e269f8519..50137afd7 100644 --- a/src/mtconnect/source/error_code.hpp +++ b/src/mtconnect/source/error_code.hpp @@ -78,7 +78,8 @@ namespace mtconnect::source { } } }; - + + __attribute__((visibility("default"))) inline const std::error_category &TheErrorCategory() { static const ErrorCategory theErrorCategory {}; diff --git a/test/agent_adapter_test.cpp b/test/agent_adapter_test.cpp index e20d4ca2b..1cc9bc642 100644 --- a/test/agent_adapter_test.cpp +++ b/test/agent_adapter_test.cpp @@ -502,7 +502,10 @@ TEST_F(AgentAdapterTest, should_check_instance_id_on_recovery) handler->m_connecting = [&](const string id) {}; handler->m_connected = [&](const string id) {}; - handler->m_disconnected = [&](const string id) { disconnected = true; }; + handler->m_disconnected = [&](const string id) + { + disconnected = true; + }; adapter->setHandler(handler); adapter->start(); From 50303fbf21b5c1f84d6bdb4ac9fc7a9a4451d29b Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Tue, 27 Dec 2022 23:07:54 -0800 Subject: [PATCH 07/50] Formated with clang format --- src/mtconnect/ruby/ruby_smart_ptr.hpp | 9 +++------ src/mtconnect/source/error_code.hpp | 5 ++--- test/agent_adapter_test.cpp | 5 +---- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/mtconnect/ruby/ruby_smart_ptr.hpp b/src/mtconnect/ruby/ruby_smart_ptr.hpp index fe74dd992..51253cdb6 100644 --- a/src/mtconnect/ruby/ruby_smart_ptr.hpp +++ b/src/mtconnect/ruby/ruby_smart_ptr.hpp @@ -23,8 +23,7 @@ namespace mtconnect::ruby { { using SharedPtr = std::shared_ptr; - __attribute__((visibility("default"))) - static mrb_data_type *type() + __attribute__((visibility("default"))) static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; if (s_type.struct_name == nullptr) @@ -129,8 +128,7 @@ namespace mtconnect::ruby { { using Ptr = T *; - __attribute__((visibility("default"))) - static mrb_data_type *type() + __attribute__((visibility("default"))) static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; @@ -188,8 +186,7 @@ namespace mtconnect::ruby { { using UniquePtr = std::unique_ptr; - __attribute__((visibility("default"))) - static mrb_data_type *type() + __attribute__((visibility("default"))) static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; if (s_type.struct_name == nullptr) diff --git a/src/mtconnect/source/error_code.hpp b/src/mtconnect/source/error_code.hpp index 50137afd7..57250a78e 100644 --- a/src/mtconnect/source/error_code.hpp +++ b/src/mtconnect/source/error_code.hpp @@ -78,9 +78,8 @@ namespace mtconnect::source { } } }; - - __attribute__((visibility("default"))) - inline const std::error_category &TheErrorCategory() + + __attribute__((visibility("default"))) inline const std::error_category &TheErrorCategory() { static const ErrorCategory theErrorCategory {}; return theErrorCategory; diff --git a/test/agent_adapter_test.cpp b/test/agent_adapter_test.cpp index 1cc9bc642..e20d4ca2b 100644 --- a/test/agent_adapter_test.cpp +++ b/test/agent_adapter_test.cpp @@ -502,10 +502,7 @@ TEST_F(AgentAdapterTest, should_check_instance_id_on_recovery) handler->m_connecting = [&](const string id) {}; handler->m_connected = [&](const string id) {}; - handler->m_disconnected = [&](const string id) - { - disconnected = true; - }; + handler->m_disconnected = [&](const string id) { disconnected = true; }; adapter->setHandler(handler); adapter->start(); From 246dac282491a464ede0bcb12ab98b76c98f98ea Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Tue, 27 Dec 2022 23:18:28 -0800 Subject: [PATCH 08/50] Made boost static link to agent_lib. Now only have single dylib depend --- conanfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/conanfile.py b/conanfile.py index 4a580f85d..2be8fcae2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -63,9 +63,6 @@ class MTConnectAgentConan(ConanFile): # git.clone("https://github.com/mtconnect/cppagent") def configure(self): - if self.options.shared: - self.options["boost"].shared = True - if not self.options.without_python: self.options["boost"].without_python = False From 5c2f56f49c4901b3ca1c43e874340303ca893cc4 Mon Sep 17 00:00:00 2001 From: William Sobel Date: Wed, 28 Dec 2022 18:58:38 -0800 Subject: [PATCH 09/50] Added config with exports --- agent_lib/CMakeLists.txt | 9 ++ conan/profiles/vsxp | 1 + src/mtconnect/config.hpp | 97 ++++++++++++++++++++ src/mtconnect/configuration/agent_config.hpp | 2 +- src/mtconnect/configuration/service.hpp | 4 +- src/mtconnect/ruby/ruby_smart_ptr.hpp | 8 +- src/mtconnect/source/error_code.hpp | 4 +- src/mtconnect/utilities.hpp | 52 +---------- 8 files changed, 120 insertions(+), 57 deletions(-) create mode 100644 src/mtconnect/config.hpp diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index 1b8f41b21..55bc537d3 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -4,6 +4,7 @@ set(AGENT_SOURCES # src HEADER_FILE_ONLY "${SOURCE_DIR}/agent.hpp" + "${SOURCE_DIR}/config.hpp" "${SOURCE_DIR}/logging.hpp" "${SOURCE_DIR}/utilities.hpp" @@ -325,6 +326,14 @@ endif() if(SHARED_AGENT_LIB) add_library(agent_lib SHARED ${AGENT_SOURCES}) + target_compile_definitions( + agent_lib + PRIVATE + AGENT_BUILD_SHARED_LIB) + target_compile_definitions( + agent_lib + PUBLIC + SHARED_AGENT_LIB) else() add_library(agent_lib STATIC ${AGENT_SOURCES}) endif() diff --git a/conan/profiles/vsxp b/conan/profiles/vsxp index 952c8f997..3f4897b2e 100644 --- a/conan/profiles/vsxp +++ b/conan/profiles/vsxp @@ -1,6 +1,7 @@ include(default) [settings] +compiler=Visual Studio arch=x86 arch_build=x86 compiler.toolset=v141_xp diff --git a/src/mtconnect/config.hpp b/src/mtconnect/config.hpp new file mode 100644 index 000000000..0209415ab --- /dev/null +++ b/src/mtconnect/config.hpp @@ -0,0 +1,97 @@ +#pragma once + +// +// Copyright Copyright 2009-2022, AMT � The Association For Manufacturing Technology (�AMT�) +// All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif +#if _MSC_VER > 1500 +#include +#else +#endif +#ifndef UINT64_MAX +#define UINT64_MAX 0xFFFFFFFFFFFFFFFFull +#endif +#ifndef NOMINMAX +#define NOMINMAX 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) || defined(_WIN64) +#ifndef _WINDOWS +#define _WINDOWS 1 +#endif +#define ISNAN(x) _isnan(x) +#if _MSC_VER < 1800 +#define NAN numeric_limits::quiet_NaN() +#endif +#if _MSC_VER >= 1900 +#define gets gets_s +#define timezone _timezone +#endif +typedef unsigned __int64 uint64_t; +#else +#define O_BINARY 0 +#define ISNAN(x) std::isnan(x) +#include +#include +#include +#include +#endif + +#ifdef _WINDOWS +#define AGENT_SYMBOL_EXPORT __declspec(dllexport) +#define AGENT_SYMBOL_IMPORT __declspec(dllimport) +#else // _WINDOWS +#define AGENT_SYMBOL_EXPORT __attribute__((visibility("default"))) +#define AGENT_SYMBOL_IMPORT __attribute__((visibility("default"))) +#endif // _WINDOWS + +#ifdef SHARED_AGENT_LIB + +#ifdef AGENT_BUILD_SHARED_LIB +#define AGENT_LIB_API AGENT_SYMBOL_EXPORT +#else +#define AGENT_LIB_API AGENT_SYMBOL_IMPORT +#endif + +#define AGENT_SYMBOL_VISIBLE AGENT_LIB_API + +#else // SHARED_AGENT_LIB + +#define AGENT_LIB_API +#define AGENT_SYMBOL_VISIBLE + +#endif + + diff --git a/src/mtconnect/configuration/agent_config.hpp b/src/mtconnect/configuration/agent_config.hpp index 34d337a15..d5df7219e 100644 --- a/src/mtconnect/configuration/agent_config.hpp +++ b/src/mtconnect/configuration/agent_config.hpp @@ -61,7 +61,7 @@ namespace mtconnect { namespace configuration { using DevicePtr = std::shared_ptr; - class AgentConfiguration : public MTConnectService + class AGENT_LIB_API AgentConfiguration : public MTConnectService { public: using Hook = std::function; diff --git a/src/mtconnect/configuration/service.hpp b/src/mtconnect/configuration/service.hpp index d833bab3e..8570f03af 100644 --- a/src/mtconnect/configuration/service.hpp +++ b/src/mtconnect/configuration/service.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -27,7 +29,7 @@ namespace mtconnect { namespace configuration { - class MTConnectService + class AGENT_LIB_API MTConnectService { public: MTConnectService() = default; diff --git a/src/mtconnect/ruby/ruby_smart_ptr.hpp b/src/mtconnect/ruby/ruby_smart_ptr.hpp index 51253cdb6..97e34f3d3 100644 --- a/src/mtconnect/ruby/ruby_smart_ptr.hpp +++ b/src/mtconnect/ruby/ruby_smart_ptr.hpp @@ -17,13 +17,15 @@ #pragma once +#include "mtconnect/config.hpp" + namespace mtconnect::ruby { template struct MRubySharedPtr { using SharedPtr = std::shared_ptr; - __attribute__((visibility("default"))) static mrb_data_type *type() + AGENT_SYMBOL_VISIBLE static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; if (s_type.struct_name == nullptr) @@ -128,7 +130,7 @@ namespace mtconnect::ruby { { using Ptr = T *; - __attribute__((visibility("default"))) static mrb_data_type *type() + AGENT_SYMBOL_VISIBLE static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; @@ -186,7 +188,7 @@ namespace mtconnect::ruby { { using UniquePtr = std::unique_ptr; - __attribute__((visibility("default"))) static mrb_data_type *type() + AGENT_SYMBOL_VISIBLE static mrb_data_type *type() { static mrb_data_type s_type {nullptr, nullptr}; if (s_type.struct_name == nullptr) diff --git a/src/mtconnect/source/error_code.hpp b/src/mtconnect/source/error_code.hpp index 57250a78e..01178e39c 100644 --- a/src/mtconnect/source/error_code.hpp +++ b/src/mtconnect/source/error_code.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -79,7 +81,7 @@ namespace mtconnect::source { } }; - __attribute__((visibility("default"))) inline const std::error_category &TheErrorCategory() + AGENT_SYMBOL_VISIBLE inline const std::error_category &TheErrorCategory() { static const ErrorCategory theErrorCategory {}; return theErrorCategory; diff --git a/src/mtconnect/utilities.hpp b/src/mtconnect/utilities.hpp index 82a7d2294..92e1ba8c8 100644 --- a/src/mtconnect/utilities.hpp +++ b/src/mtconnect/utilities.hpp @@ -17,57 +17,7 @@ #pragma once -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif -#if _MSC_VER > 1500 -#include -#else -#endif -#ifndef UINT64_MAX -#define UINT64_MAX 0xFFFFFFFFFFFFFFFFull -#endif -#ifndef NOMINMAX -#define NOMINMAX 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) || defined(_WIN64) -#ifndef _WINDOWS -#define _WINDOWS 1 -#endif -#define ISNAN(x) _isnan(x) -#if _MSC_VER < 1800 -#define NAN numeric_limits::quiet_NaN() -#endif -#if _MSC_VER >= 1900 -#define gets gets_s -#define timezone _timezone -#endif -typedef unsigned __int64 uint64_t; -#else -#define O_BINARY 0 -#define ISNAN(x) std::isnan(x) -#include -#include -#include -#include -#endif +#include "mtconnect/config.hpp" #include #include From 0367e74655b573906d1518daf6e1e6df77a7921c Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Wed, 28 Dec 2022 19:59:59 -0800 Subject: [PATCH 10/50] Exported all classes --- src/mtconnect/agent.hpp | 8 ++++-- src/mtconnect/asset/asset.hpp | 6 ++-- src/mtconnect/asset/asset_buffer.hpp | 4 ++- src/mtconnect/asset/asset_storage.hpp | 4 ++- src/mtconnect/asset/cutting_tool.hpp | 6 ++-- src/mtconnect/asset/file_asset.hpp | 6 ++-- src/mtconnect/asset/qif_document.hpp | 4 ++- src/mtconnect/asset/raw_material.hpp | 4 ++- src/mtconnect/buffer/checkpoint.hpp | 4 ++- src/mtconnect/buffer/circular_buffer.hpp | 4 ++- src/mtconnect/configuration/agent_config.hpp | 2 ++ src/mtconnect/configuration/async_context.hpp | 4 ++- .../configuration/config_options.hpp | 2 ++ src/mtconnect/configuration/parser.hpp | 4 ++- src/mtconnect/device_model/agent_device.hpp | 4 ++- src/mtconnect/device_model/component.hpp | 4 ++- src/mtconnect/device_model/composition.hpp | 4 ++- .../configuration/configuration.hpp | 2 ++ .../configuration/coordinate_systems.hpp | 2 ++ .../device_model/configuration/motion.hpp | 2 ++ .../configuration/relationships.hpp | 2 ++ .../configuration/sensor_configuration.hpp | 2 ++ .../configuration/solid_model.hpp | 2 ++ .../configuration/specifications.hpp | 2 ++ .../device_model/data_item/constraints.hpp | 4 ++- .../device_model/data_item/data_item.hpp | 5 +++- .../device_model/data_item/definition.hpp | 6 ++-- .../device_model/data_item/filter.hpp | 4 ++- .../device_model/data_item/relationships.hpp | 6 ++-- .../device_model/data_item/source.hpp | 4 ++- .../data_item/unit_conversion.hpp | 4 ++- src/mtconnect/device_model/description.hpp | 2 ++ src/mtconnect/device_model/device.hpp | 4 ++- src/mtconnect/device_model/reference.hpp | 4 ++- src/mtconnect/entity/data_set.hpp | 4 ++- src/mtconnect/entity/entity.hpp | 4 ++- src/mtconnect/entity/factory.hpp | 4 ++- src/mtconnect/entity/json_parser.hpp | 4 ++- src/mtconnect/entity/json_printer.hpp | 4 ++- src/mtconnect/entity/qname.hpp | 4 ++- src/mtconnect/entity/requirement.hpp | 9 ++++-- src/mtconnect/entity/xml_parser.hpp | 4 ++- src/mtconnect/entity/xml_printer.hpp | 4 ++- src/mtconnect/logging.hpp | 2 ++ src/mtconnect/mqtt/mqtt_client.hpp | 4 ++- src/mtconnect/mqtt/mqtt_client_impl.hpp | 6 ++-- src/mtconnect/mqtt/mqtt_server.hpp | 4 ++- src/mtconnect/mqtt/mqtt_server_impl.hpp | 6 ++-- src/mtconnect/observation/change_observer.hpp | 6 ++-- src/mtconnect/observation/observation.hpp | 28 ++++++++++--------- src/mtconnect/parser/xml_parser.hpp | 4 ++- src/mtconnect/pipeline/convert_sample.hpp | 4 ++- src/mtconnect/pipeline/deliver.hpp | 14 ++++++---- src/mtconnect/pipeline/delta_filter.hpp | 4 ++- src/mtconnect/pipeline/duplicate_filter.hpp | 4 ++- src/mtconnect/pipeline/guard.hpp | 2 ++ src/mtconnect/pipeline/message_mapper.hpp | 6 ++-- .../pipeline/mtconnect_xml_transform.hpp | 4 ++- src/mtconnect/pipeline/period_filter.hpp | 4 ++- src/mtconnect/pipeline/pipeline.hpp | 6 ++-- src/mtconnect/pipeline/pipeline_context.hpp | 4 ++- src/mtconnect/pipeline/pipeline_contract.hpp | 4 ++- src/mtconnect/pipeline/response_document.hpp | 2 ++ src/mtconnect/pipeline/shdr_token_mapper.hpp | 4 ++- src/mtconnect/pipeline/shdr_tokenizer.hpp | 6 ++-- .../pipeline/timestamp_extractor.hpp | 12 ++++---- src/mtconnect/pipeline/topic_mapper.hpp | 10 ++++--- src/mtconnect/pipeline/transform.hpp | 6 ++-- src/mtconnect/pipeline/upcase_value.hpp | 4 ++- src/mtconnect/printer/json_printer.cpp | 6 ++-- src/mtconnect/printer/json_printer.hpp | 4 ++- src/mtconnect/printer/printer.hpp | 4 ++- src/mtconnect/printer/xml_helper.hpp | 4 ++- src/mtconnect/printer/xml_printer.cpp | 4 +-- src/mtconnect/printer/xml_printer.hpp | 4 ++- src/mtconnect/printer/xml_printer_helper.hpp | 6 ++-- src/mtconnect/ruby/embedded.hpp | 4 ++- src/mtconnect/ruby/ruby_agent.hpp | 2 ++ src/mtconnect/ruby/ruby_entity.hpp | 2 ++ src/mtconnect/ruby/ruby_observation.hpp | 2 ++ src/mtconnect/ruby/ruby_pipeline.hpp | 2 ++ src/mtconnect/ruby/ruby_smart_ptr.hpp | 2 ++ src/mtconnect/ruby/ruby_transform.hpp | 4 ++- src/mtconnect/ruby/ruby_type.hpp | 2 ++ src/mtconnect/ruby/ruby_vm.hpp | 4 ++- src/mtconnect/sink/mqtt_sink/mqtt_service.hpp | 4 ++- src/mtconnect/sink/rest_sink/cached_file.hpp | 2 ++ src/mtconnect/sink/rest_sink/file_cache.hpp | 4 ++- src/mtconnect/sink/rest_sink/parameter.hpp | 4 ++- src/mtconnect/sink/rest_sink/request.hpp | 4 ++- src/mtconnect/sink/rest_sink/response.hpp | 2 ++ src/mtconnect/sink/rest_sink/rest_service.hpp | 4 ++- src/mtconnect/sink/rest_sink/routing.hpp | 4 ++- src/mtconnect/sink/rest_sink/server.hpp | 4 ++- src/mtconnect/sink/rest_sink/session.hpp | 2 ++ src/mtconnect/sink/rest_sink/session_impl.hpp | 2 ++ src/mtconnect/sink/sink.hpp | 8 ++++-- src/mtconnect/source/adapter/adapter.hpp | 4 ++- .../source/adapter/adapter_pipeline.hpp | 4 ++- .../adapter/agent_adapter/agent_adapter.hpp | 6 ++-- .../adapter/agent_adapter/http_session.hpp | 2 ++ .../adapter/agent_adapter/https_session.hpp | 2 ++ .../source/adapter/agent_adapter/session.hpp | 2 ++ .../adapter/agent_adapter/session_impl.hpp | 2 ++ .../adapter/agent_adapter/url_parser.hpp | 2 ++ .../source/adapter/mqtt/mqtt_adapter.hpp | 6 ++-- .../source/adapter/shdr/connector.hpp | 4 ++- .../source/adapter/shdr/shdr_adapter.hpp | 4 ++- .../source/adapter/shdr/shdr_pipeline.hpp | 4 ++- src/mtconnect/source/error_code.hpp | 2 ++ src/mtconnect/source/loopback_source.hpp | 6 ++-- src/mtconnect/source/source.hpp | 6 ++-- 112 files changed, 353 insertions(+), 135 deletions(-) diff --git a/src/mtconnect/agent.hpp b/src/mtconnect/agent.hpp index a9e61b4e7..f6c533841 100644 --- a/src/mtconnect/agent.hpp +++ b/src/mtconnect/agent.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -74,7 +76,7 @@ namespace mtconnect { using AssetChangeList = std::vector>; - class Agent + class AGENT_LIB_API Agent { public: using Hook = std::function; @@ -328,7 +330,7 @@ namespace mtconnect { HookList m_preStopHooks; }; - class AgentPipelineContract : public pipeline::PipelineContract + class AGENT_LIB_API AgentPipelineContract : public pipeline::PipelineContract { public: AgentPipelineContract(Agent *agent) : m_agent(agent) {} @@ -378,7 +380,7 @@ namespace mtconnect { return std::make_unique(this); } - class AgentSinkContract : public sink::SinkContract + class AGENT_LIB_API AgentSinkContract : public sink::SinkContract { public: AgentSinkContract(Agent *agent) : m_agent(agent) {} diff --git a/src/mtconnect/asset/asset.hpp b/src/mtconnect/asset/asset.hpp index 2bb2c2b51..9ecb0314b 100644 --- a/src/mtconnect/asset/asset.hpp +++ b/src/mtconnect/asset/asset.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -31,7 +33,7 @@ namespace mtconnect { using AssetPtr = std::shared_ptr; using AssetList = std::list; - class Asset : public entity::Entity + class AGENT_LIB_API Asset : public entity::Entity { public: Asset(const std::string &name, const entity::Properties &props) @@ -112,7 +114,7 @@ namespace mtconnect { bool m_removed; }; - class ExtendedAsset : public Asset + class AGENT_LIB_API ExtendedAsset : public Asset { public: static entity::FactoryPtr getFactory(); diff --git a/src/mtconnect/asset/asset_buffer.hpp b/src/mtconnect/asset/asset_buffer.hpp index 62e35de41..c45b1922b 100644 --- a/src/mtconnect/asset/asset_buffer.hpp +++ b/src/mtconnect/asset/asset_buffer.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -47,7 +49,7 @@ namespace mtconnect::asset { namespace mic = boost::multi_index; - class AssetBuffer : public AssetStorage + class AGENT_LIB_API AssetBuffer : public AssetStorage { public: struct AssetNode diff --git a/src/mtconnect/asset/asset_storage.hpp b/src/mtconnect/asset/asset_storage.hpp index 4ebca5412..0714c3119 100644 --- a/src/mtconnect/asset/asset_storage.hpp +++ b/src/mtconnect/asset/asset_storage.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -29,7 +31,7 @@ namespace mtconnect { namespace asset { - class AssetStorage + class AGENT_LIB_API AssetStorage { public: using TypeCount = std::map; diff --git a/src/mtconnect/asset/cutting_tool.hpp b/src/mtconnect/asset/cutting_tool.hpp index 8cf7a30fc..7c799ea6d 100644 --- a/src/mtconnect/asset/cutting_tool.hpp +++ b/src/mtconnect/asset/cutting_tool.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -26,14 +28,14 @@ namespace mtconnect { namespace asset { - class CuttingToolArchetype : public Asset + class AGENT_LIB_API CuttingToolArchetype : public Asset { public: static entity::FactoryPtr getFactory(); static void registerAsset(); }; - class CuttingTool : public Asset + class AGENT_LIB_API CuttingTool : public Asset { public: static entity::FactoryPtr getFactory(); diff --git a/src/mtconnect/asset/file_asset.hpp b/src/mtconnect/asset/file_asset.hpp index 3db48319a..c2792e02b 100644 --- a/src/mtconnect/asset/file_asset.hpp +++ b/src/mtconnect/asset/file_asset.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -28,14 +30,14 @@ namespace mtconnect { namespace asset { - class FileArchetypeAsset : public entity::Entity + class AGENT_LIB_API FileArchetypeAsset : public entity::Entity { public: static entity::FactoryPtr getFactory(); static void registerAsset(); }; - class FileAsset : public FileArchetypeAsset + class AGENT_LIB_API FileAsset : public FileArchetypeAsset { public: static entity::FactoryPtr getFactory(); diff --git a/src/mtconnect/asset/qif_document.hpp b/src/mtconnect/asset/qif_document.hpp index df75246c6..ca5d53666 100644 --- a/src/mtconnect/asset/qif_document.hpp +++ b/src/mtconnect/asset/qif_document.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -27,7 +29,7 @@ #include "mtconnect/utilities.hpp" namespace mtconnect::asset { - class QIFDocumentWrapper : public Asset + class AGENT_LIB_API QIFDocumentWrapper : public Asset { public: static entity::FactoryPtr getFactory(); diff --git a/src/mtconnect/asset/raw_material.hpp b/src/mtconnect/asset/raw_material.hpp index 24d92b837..cb310b746 100644 --- a/src/mtconnect/asset/raw_material.hpp +++ b/src/mtconnect/asset/raw_material.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -27,7 +29,7 @@ #include "mtconnect/utilities.hpp" namespace mtconnect::asset { - class RawMaterial : public Asset + class AGENT_LIB_API RawMaterial : public Asset { public: static entity::FactoryPtr getFactory(); diff --git a/src/mtconnect/buffer/checkpoint.hpp b/src/mtconnect/buffer/checkpoint.hpp index 54462f7c8..f20d8f933 100644 --- a/src/mtconnect/buffer/checkpoint.hpp +++ b/src/mtconnect/buffer/checkpoint.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -27,7 +29,7 @@ #include "mtconnect/utilities.hpp" namespace mtconnect::buffer { - class Checkpoint + class AGENT_LIB_API Checkpoint { public: Checkpoint() = default; diff --git a/src/mtconnect/buffer/circular_buffer.hpp b/src/mtconnect/buffer/circular_buffer.hpp index 8cb08ef74..630273e02 100644 --- a/src/mtconnect/buffer/circular_buffer.hpp +++ b/src/mtconnect/buffer/circular_buffer.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -30,7 +32,7 @@ namespace mtconnect::buffer { using SequenceNumber_t = uint64_t; - class CircularBuffer + class AGENT_LIB_API CircularBuffer { public: CircularBuffer(unsigned int bufferSize, int checkpointFreq) diff --git a/src/mtconnect/configuration/agent_config.hpp b/src/mtconnect/configuration/agent_config.hpp index d5df7219e..00079b621 100644 --- a/src/mtconnect/configuration/agent_config.hpp +++ b/src/mtconnect/configuration/agent_config.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include diff --git a/src/mtconnect/configuration/async_context.hpp b/src/mtconnect/configuration/async_context.hpp index 8f18b809d..1caec64a8 100644 --- a/src/mtconnect/configuration/async_context.hpp +++ b/src/mtconnect/configuration/async_context.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -26,7 +28,7 @@ namespace mtconnect::configuration { // Manages the boost asio context and allows for a syncronous // callback to execute when all the worker threads have stopped. - class AsyncContext + class AGENT_LIB_API AsyncContext { public: using SyncCallback = std::function; diff --git a/src/mtconnect/configuration/config_options.hpp b/src/mtconnect/configuration/config_options.hpp index 752040102..9bd98101a 100644 --- a/src/mtconnect/configuration/config_options.hpp +++ b/src/mtconnect/configuration/config_options.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + namespace mtconnect { namespace configuration { #define DECLARE_CONFIGURATION(name) inline const char *name = #name; diff --git a/src/mtconnect/configuration/parser.hpp b/src/mtconnect/configuration/parser.hpp index 0b874991c..40791615f 100644 --- a/src/mtconnect/configuration/parser.hpp +++ b/src/mtconnect/configuration/parser.hpp @@ -17,13 +17,15 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include namespace mtconnect { namespace configuration { - class ParseError : public std::runtime_error + class AGENT_LIB_API ParseError : public std::runtime_error { public: using std::runtime_error::runtime_error; diff --git a/src/mtconnect/device_model/agent_device.hpp b/src/mtconnect/device_model/agent_device.hpp index 9abe99b6a..ffcf994c9 100644 --- a/src/mtconnect/device_model/agent_device.hpp +++ b/src/mtconnect/device_model/agent_device.hpp @@ -16,6 +16,8 @@ // #pragma once + +#include "mtconnect/config.hpp" #include #include "component.hpp" @@ -30,7 +32,7 @@ namespace mtconnect { } // namespace source::adapter namespace device_model { - class AgentDevice : public Device + class AGENT_LIB_API AgentDevice : public Device { public: // Constructor that sets variables from an attribute map diff --git a/src/mtconnect/device_model/component.hpp b/src/mtconnect/device_model/component.hpp index f703fd5ec..885a2e3f0 100644 --- a/src/mtconnect/device_model/component.hpp +++ b/src/mtconnect/device_model/component.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -42,7 +44,7 @@ namespace mtconnect { using DevicePtr = std::shared_ptr; using DataItemPtr = std::shared_ptr; - class Component : public entity::Entity + class AGENT_LIB_API Component : public entity::Entity { public: Component(const std::string &name, const entity::Properties &props); diff --git a/src/mtconnect/device_model/composition.hpp b/src/mtconnect/device_model/composition.hpp index 810ad9e30..993514847 100644 --- a/src/mtconnect/device_model/composition.hpp +++ b/src/mtconnect/device_model/composition.hpp @@ -17,12 +17,14 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/entity/entity.hpp" namespace mtconnect { namespace device_model { class Component; - class Composition : public entity::Entity + class AGENT_LIB_API Composition : public entity::Entity { public: using entity::Entity::Entity; diff --git a/src/mtconnect/device_model/configuration/configuration.hpp b/src/mtconnect/device_model/configuration/configuration.hpp index c6db41312..77fdc1409 100644 --- a/src/mtconnect/device_model/configuration/configuration.hpp +++ b/src/mtconnect/device_model/configuration/configuration.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" diff --git a/src/mtconnect/device_model/configuration/coordinate_systems.hpp b/src/mtconnect/device_model/configuration/coordinate_systems.hpp index 001b6280f..a33c9e055 100644 --- a/src/mtconnect/device_model/configuration/coordinate_systems.hpp +++ b/src/mtconnect/device_model/configuration/coordinate_systems.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "configuration.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/configuration/motion.hpp b/src/mtconnect/device_model/configuration/motion.hpp index eee7d6443..b1fa809e4 100644 --- a/src/mtconnect/device_model/configuration/motion.hpp +++ b/src/mtconnect/device_model/configuration/motion.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "configuration.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/configuration/relationships.hpp b/src/mtconnect/device_model/configuration/relationships.hpp index 55766ac3c..ffaecbb47 100644 --- a/src/mtconnect/device_model/configuration/relationships.hpp +++ b/src/mtconnect/device_model/configuration/relationships.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "configuration.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/configuration/sensor_configuration.hpp b/src/mtconnect/device_model/configuration/sensor_configuration.hpp index 73dac26c3..107abc66c 100644 --- a/src/mtconnect/device_model/configuration/sensor_configuration.hpp +++ b/src/mtconnect/device_model/configuration/sensor_configuration.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "configuration.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/configuration/solid_model.hpp b/src/mtconnect/device_model/configuration/solid_model.hpp index a1c58239a..a75410972 100644 --- a/src/mtconnect/device_model/configuration/solid_model.hpp +++ b/src/mtconnect/device_model/configuration/solid_model.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "configuration.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/configuration/specifications.hpp b/src/mtconnect/device_model/configuration/specifications.hpp index 533034cae..802390418 100644 --- a/src/mtconnect/device_model/configuration/specifications.hpp +++ b/src/mtconnect/device_model/configuration/specifications.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "configuration.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/data_item/constraints.hpp b/src/mtconnect/device_model/data_item/constraints.hpp index c153ba53a..457757f4c 100644 --- a/src/mtconnect/device_model/data_item/constraints.hpp +++ b/src/mtconnect/device_model/data_item/constraints.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "filter.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" @@ -24,7 +26,7 @@ namespace mtconnect { namespace device_model { namespace data_item { - class Constraints : public entity::Entity + class AGENT_LIB_API Constraints : public entity::Entity { public: static entity::FactoryPtr getFactory() diff --git a/src/mtconnect/device_model/data_item/data_item.hpp b/src/mtconnect/device_model/data_item/data_item.hpp index 02ed5490c..d7a4ed3d9 100644 --- a/src/mtconnect/device_model/data_item/data_item.hpp +++ b/src/mtconnect/device_model/data_item/data_item.hpp @@ -16,6 +16,9 @@ // #pragma once + +#include "mtconnect/config.hpp" + #include #include "constraints.hpp" @@ -40,7 +43,7 @@ namespace mtconnect { class Composition; namespace data_item { - class DataItem : public entity::Entity, public observation::ChangeSignaler + class AGENT_LIB_API DataItem : public entity::Entity, public observation::ChangeSignaler { public: // Enumeration for data item category diff --git a/src/mtconnect/device_model/data_item/definition.hpp b/src/mtconnect/device_model/data_item/definition.hpp index f90316b5c..94ff0c77c 100644 --- a/src/mtconnect/device_model/data_item/definition.hpp +++ b/src/mtconnect/device_model/data_item/definition.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "mtconnect/entity/entity.hpp" @@ -24,10 +26,10 @@ namespace mtconnect { namespace device_model { namespace data_item { - class Definition : public entity::Entity + class AGENT_LIB_API Definition : public entity::Entity { public: - class Entry : public entity::Entity + class AGENT_LIB_API Entry : public entity::Entity { public: using entity::Entity::Entity; diff --git a/src/mtconnect/device_model/data_item/filter.hpp b/src/mtconnect/device_model/data_item/filter.hpp index 860d8b8aa..458be3488 100644 --- a/src/mtconnect/device_model/data_item/filter.hpp +++ b/src/mtconnect/device_model/data_item/filter.hpp @@ -17,13 +17,15 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" namespace mtconnect { namespace device_model { namespace data_item { - class Filter : public entity::Entity + class AGENT_LIB_API Filter : public entity::Entity { public: static entity::FactoryPtr getFactory() diff --git a/src/mtconnect/device_model/data_item/relationships.hpp b/src/mtconnect/device_model/data_item/relationships.hpp index a2fd17775..07dc17686 100644 --- a/src/mtconnect/device_model/data_item/relationships.hpp +++ b/src/mtconnect/device_model/data_item/relationships.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "mtconnect/entity/entity.hpp" @@ -25,7 +27,7 @@ namespace mtconnect { namespace device_model { namespace data_item { class DataItem; - class Relationship : public entity::Entity + class AGENT_LIB_API Relationship : public entity::Entity { public: using entity::Entity::Entity; @@ -73,7 +75,7 @@ namespace mtconnect { std::weak_ptr m_target; }; - class Relationships : public entity::Entity + class AGENT_LIB_API Relationships : public entity::Entity { public: using entity::Entity::Entity; diff --git a/src/mtconnect/device_model/data_item/source.hpp b/src/mtconnect/device_model/data_item/source.hpp index b2f2df3cb..4d655d97b 100644 --- a/src/mtconnect/device_model/data_item/source.hpp +++ b/src/mtconnect/device_model/data_item/source.hpp @@ -17,10 +17,12 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/entity/entity.hpp" namespace mtconnect::device_model::data_item { - class Source : public entity::Entity + class AGENT_LIB_API Source : public entity::Entity { public: static entity::FactoryPtr getFactory() diff --git a/src/mtconnect/device_model/data_item/unit_conversion.hpp b/src/mtconnect/device_model/data_item/unit_conversion.hpp index 128836100..7fc360a7b 100644 --- a/src/mtconnect/device_model/data_item/unit_conversion.hpp +++ b/src/mtconnect/device_model/data_item/unit_conversion.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -27,7 +29,7 @@ namespace mtconnect { namespace device_model { namespace data_item { - class UnitConversion + class AGENT_LIB_API UnitConversion { public: UnitConversion(double factor = 1.0, double offset = 0.0) diff --git a/src/mtconnect/device_model/description.hpp b/src/mtconnect/device_model/description.hpp index 5ca97c68b..4b8a07c8d 100644 --- a/src/mtconnect/device_model/description.hpp +++ b/src/mtconnect/device_model/description.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include diff --git a/src/mtconnect/device_model/device.hpp b/src/mtconnect/device_model/device.hpp index b92cdaf23..e7672f715 100644 --- a/src/mtconnect/device_model/device.hpp +++ b/src/mtconnect/device_model/device.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -41,7 +43,7 @@ namespace mtconnect { } namespace device_model { - class Device : public Component + class AGENT_LIB_API Device : public Component { public: struct ByName diff --git a/src/mtconnect/device_model/reference.hpp b/src/mtconnect/device_model/reference.hpp index 2c6d676f5..84eb431f2 100644 --- a/src/mtconnect/device_model/reference.hpp +++ b/src/mtconnect/device_model/reference.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -35,7 +37,7 @@ namespace mtconnect { class Device; using DevicePtr = std::shared_ptr; - class Reference : public entity::Entity + class AGENT_LIB_API Reference : public entity::Entity { public: using entity::Entity::Entity; diff --git a/src/mtconnect/entity/data_set.hpp b/src/mtconnect/entity/data_set.hpp index 446b9500d..111e04f04 100644 --- a/src/mtconnect/entity/data_set.hpp +++ b/src/mtconnect/entity/data_set.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -31,7 +33,7 @@ namespace mtconnect::entity { struct DataSetEntry; - class DataSet : public std::set + class AGENT_LIB_API DataSet : public std::set { public: using base = std::set; diff --git a/src/mtconnect/entity/entity.hpp b/src/mtconnect/entity/entity.hpp index 6452fbb45..f23067f0f 100644 --- a/src/mtconnect/entity/entity.hpp +++ b/src/mtconnect/entity/entity.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -57,7 +59,7 @@ namespace mtconnect { return std::nullopt; } - class Entity : public std::enable_shared_from_this + class AGENT_LIB_API Entity : public std::enable_shared_from_this { public: using super = std::nullptr_t; diff --git a/src/mtconnect/entity/factory.hpp b/src/mtconnect/entity/factory.hpp index 05d660d3c..ef280935a 100644 --- a/src/mtconnect/entity/factory.hpp +++ b/src/mtconnect/entity/factory.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -27,7 +29,7 @@ namespace mtconnect { namespace entity { using Requirements = std::list; - class Factory : public Matcher, public std::enable_shared_from_this + class AGENT_LIB_API Factory : public Matcher, public std::enable_shared_from_this { public: using Function = std::function; diff --git a/src/mtconnect/entity/json_parser.hpp b/src/mtconnect/entity/json_parser.hpp index 00e535374..40a4eb3a5 100644 --- a/src/mtconnect/entity/json_parser.hpp +++ b/src/mtconnect/entity/json_parser.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -28,7 +30,7 @@ namespace mtconnect { namespace entity { - class JsonParser + class AGENT_LIB_API JsonParser { public: JsonParser(uint32_t version = 1) : m_version(version) {} diff --git a/src/mtconnect/entity/json_printer.hpp b/src/mtconnect/entity/json_printer.hpp index 777efc15b..326c96c44 100644 --- a/src/mtconnect/entity/json_printer.hpp +++ b/src/mtconnect/entity/json_printer.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "mtconnect/entity/entity.hpp" @@ -25,7 +27,7 @@ using json = nlohmann::json; namespace mtconnect { namespace entity { - class JsonPrinter + class AGENT_LIB_API JsonPrinter { public: JsonPrinter(uint32_t version) : m_version(version) {}; diff --git a/src/mtconnect/entity/qname.hpp b/src/mtconnect/entity/qname.hpp index db5cb43ed..c8de40ad9 100644 --- a/src/mtconnect/entity/qname.hpp +++ b/src/mtconnect/entity/qname.hpp @@ -17,13 +17,15 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include namespace mtconnect { namespace entity { - class QName : public std::string + class AGENT_LIB_API QName : public std::string { public: QName() = default; diff --git a/src/mtconnect/entity/requirement.hpp b/src/mtconnect/entity/requirement.hpp index d80692a70..e780598ae 100644 --- a/src/mtconnect/entity/requirement.hpp +++ b/src/mtconnect/entity/requirement.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -77,7 +79,7 @@ namespace mtconnect { bool ConvertValueToType(Value &value, ValueType type, bool table = false); - class EntityError : public std::logic_error + class AGENT_LIB_API EntityError : public std::logic_error { public: explicit EntityError(const std::string &s, const std::string &e = "") @@ -112,7 +114,8 @@ namespace mtconnect { std::string m_text; std::string m_entity; }; - class PropertyError : public EntityError + + class AGENT_LIB_API PropertyError : public EntityError { public: explicit PropertyError(const std::string &s, const std::string &p = "", @@ -158,7 +161,7 @@ namespace mtconnect { using MatcherPtr = std::weak_ptr; - class Requirement + class AGENT_LIB_API Requirement { public: const static auto Infinite {std::numeric_limits::max()}; diff --git a/src/mtconnect/entity/xml_parser.hpp b/src/mtconnect/entity/xml_parser.hpp index 65d024d7c..85a036a3c 100644 --- a/src/mtconnect/entity/xml_parser.hpp +++ b/src/mtconnect/entity/xml_parser.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -29,7 +31,7 @@ struct _xmlNode; namespace mtconnect { namespace entity { - class XmlParser + class AGENT_LIB_API XmlParser { public: XmlParser() = default; diff --git a/src/mtconnect/entity/xml_printer.hpp b/src/mtconnect/entity/xml_printer.hpp index 3f90b638e..dafc4cee5 100644 --- a/src/mtconnect/entity/xml_printer.hpp +++ b/src/mtconnect/entity/xml_printer.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "mtconnect/entity/entity.hpp" @@ -29,7 +31,7 @@ extern "C" namespace mtconnect { namespace entity { - class XmlPrinter + class AGENT_LIB_API XmlPrinter { public: XmlPrinter() = default; diff --git a/src/mtconnect/logging.hpp b/src/mtconnect/logging.hpp index 4f2b396d4..147d7364f 100644 --- a/src/mtconnect/logging.hpp +++ b/src/mtconnect/logging.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include diff --git a/src/mtconnect/mqtt/mqtt_client.hpp b/src/mtconnect/mqtt/mqtt_client.hpp index eb4ef1fa1..cf51f037d 100644 --- a/src/mtconnect/mqtt/mqtt_client.hpp +++ b/src/mtconnect/mqtt/mqtt_client.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" @@ -36,7 +38,7 @@ namespace mtconnect { Received m_receive; }; - class MqttClient : public std::enable_shared_from_this + class AGENT_LIB_API MqttClient : public std::enable_shared_from_this { public: MqttClient(boost::asio::io_context &ioc, std::unique_ptr &&handler) diff --git a/src/mtconnect/mqtt/mqtt_client_impl.hpp b/src/mtconnect/mqtt/mqtt_client_impl.hpp index b33a47579..c919b09fb 100644 --- a/src/mtconnect/mqtt/mqtt_client_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_client_impl.hpp @@ -335,7 +335,7 @@ namespace mtconnect { boost::asio::steady_timer m_reconnectTimer; }; - class MqttTcpClient : public MqttClientImpl + class AGENT_LIB_API MqttTcpClient : public MqttClientImpl { public: using base = MqttClientImpl; @@ -359,7 +359,7 @@ namespace mtconnect { mqtt_client m_client; }; - class MqttTlsClient : public MqttClientImpl + class AGENT_LIB_API MqttTlsClient : public MqttClientImpl { public: using base = MqttClientImpl; @@ -399,7 +399,7 @@ namespace mtconnect { mqtt_tls_client m_client; }; - class MqttTlsWSClient : public MqttClientImpl + class AGENT_LIB_API MqttTlsWSClient : public MqttClientImpl { public: using base = MqttClientImpl; diff --git a/src/mtconnect/mqtt/mqtt_server.hpp b/src/mtconnect/mqtt/mqtt_server.hpp index b857431a5..74e231f7e 100644 --- a/src/mtconnect/mqtt/mqtt_server.hpp +++ b/src/mtconnect/mqtt/mqtt_server.hpp @@ -13,12 +13,14 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" namespace mtconnect { namespace mqtt_server { - class MqttServer : public std::enable_shared_from_this + class AGENT_LIB_API MqttServer : public std::enable_shared_from_this { public: MqttServer(boost::asio::io_context &ioc) : m_ioContext(ioc), m_port(1883) {} diff --git a/src/mtconnect/mqtt/mqtt_server_impl.hpp b/src/mtconnect/mqtt/mqtt_server_impl.hpp index 9fe6b1b4b..e27a2e9d3 100644 --- a/src/mtconnect/mqtt/mqtt_server_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_server_impl.hpp @@ -248,7 +248,7 @@ namespace mtconnect { std::string m_host; }; - class MqttTcpServer : public MqttServerImpl + class AGENT_LIB_API MqttTcpServer : public MqttServerImpl { public: using base = MqttServerImpl; @@ -278,7 +278,7 @@ namespace mtconnect { std::optional m_server; }; - class MqttTlsServer : public MqttServerImpl + class AGENT_LIB_API MqttTlsServer : public MqttServerImpl { public: using base = MqttServerImpl; @@ -324,7 +324,7 @@ namespace mtconnect { std::optional m_server; }; - class MqttTlsWSServer : public MqttServerImpl + class AGENT_LIB_API MqttTlsWSServer : public MqttServerImpl { public: using base = MqttServerImpl; diff --git a/src/mtconnect/observation/change_observer.hpp b/src/mtconnect/observation/change_observer.hpp index 1264e1fbe..64d881c3d 100644 --- a/src/mtconnect/observation/change_observer.hpp +++ b/src/mtconnect/observation/change_observer.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -29,7 +31,7 @@ namespace mtconnect { namespace observation { class ChangeSignaler; - class ChangeObserver + class AGENT_LIB_API ChangeObserver { public: ChangeObserver(boost::asio::io_context::strand &strand) @@ -90,7 +92,7 @@ namespace mtconnect { bool removeSignaler(ChangeSignaler *sig); }; - class ChangeSignaler + class AGENT_LIB_API ChangeSignaler { public: // Observer Management diff --git a/src/mtconnect/observation/observation.hpp b/src/mtconnect/observation/observation.hpp index b787e9d94..fd47e684e 100644 --- a/src/mtconnect/observation/observation.hpp +++ b/src/mtconnect/observation/observation.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -40,7 +42,7 @@ namespace mtconnect { using ObservationPtr = std::shared_ptr; using ObservationList = std::list; - class Observation : public entity::Entity + class AGENT_LIB_API Observation : public entity::Entity { public: using super = entity::Entity; @@ -148,7 +150,7 @@ namespace mtconnect { uint64_t m_sequence {0}; }; - class Sample : public Observation + class AGENT_LIB_API Sample : public Observation { public: using super = Observation; @@ -160,7 +162,7 @@ namespace mtconnect { ObservationPtr copy() const override { return std::make_shared(*this); } }; - class ThreeSpaceSample : public Sample + class AGENT_LIB_API ThreeSpaceSample : public Sample { public: using super = Sample; @@ -170,7 +172,7 @@ namespace mtconnect { ~ThreeSpaceSample() override = default; }; - class Timeseries : public Sample + class AGENT_LIB_API Timeseries : public Sample { public: using super = Sample; @@ -186,7 +188,7 @@ namespace mtconnect { using ConditionPtr = std::shared_ptr; using ConditionList = std::list; - class Condition : public Observation + class AGENT_LIB_API Condition : public Observation { public: using super = Observation; @@ -309,7 +311,7 @@ namespace mtconnect { ConditionPtr m_prev; }; - class Event : public Observation + class AGENT_LIB_API Event : public Observation { public: using super = Observation; @@ -320,7 +322,7 @@ namespace mtconnect { ObservationPtr copy() const override { return std::make_shared(*this); } }; - class DoubleEvent : public Observation + class AGENT_LIB_API DoubleEvent : public Observation { public: using super = Observation; @@ -331,7 +333,7 @@ namespace mtconnect { ObservationPtr copy() const override { return std::make_shared(*this); } }; - class IntEvent : public Observation + class AGENT_LIB_API IntEvent : public Observation { public: using super = Observation; @@ -342,7 +344,7 @@ namespace mtconnect { ObservationPtr copy() const override { return std::make_shared(*this); } }; - class DataSetEvent : public Event + class AGENT_LIB_API DataSetEvent : public Event { public: using super = Event; @@ -372,7 +374,7 @@ namespace mtconnect { using DataSetEventPtr = std::shared_ptr; - class TableEvent : public DataSetEvent + class AGENT_LIB_API TableEvent : public DataSetEvent { public: using DataSetEvent::DataSetEvent; @@ -380,7 +382,7 @@ namespace mtconnect { ObservationPtr copy() const override { return std::make_shared(*this); } }; - class AssetEvent : public Event + class AGENT_LIB_API AssetEvent : public Event { public: using Event::Event; @@ -391,7 +393,7 @@ namespace mtconnect { protected: }; - class Message : public Event + class AGENT_LIB_API Message : public Event { public: using super = Event; @@ -402,7 +404,7 @@ namespace mtconnect { ObservationPtr copy() const override { return std::make_shared(*this); } }; - class Alarm : public Event + class AGENT_LIB_API Alarm : public Event { public: using super = Event; diff --git a/src/mtconnect/parser/xml_parser.hpp b/src/mtconnect/parser/xml_parser.hpp index 5a3ccfb21..cdbc3bfc4 100644 --- a/src/mtconnect/parser/xml_parser.hpp +++ b/src/mtconnect/parser/xml_parser.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -35,7 +37,7 @@ namespace mtconnect::printer { } namespace mtconnect::parser { - class XmlParser + class AGENT_LIB_API XmlParser { public: // Constructor to set the open the correct file diff --git a/src/mtconnect/pipeline/convert_sample.hpp b/src/mtconnect/pipeline/convert_sample.hpp index 55efe94dd..9be5c2d02 100644 --- a/src/mtconnect/pipeline/convert_sample.hpp +++ b/src/mtconnect/pipeline/convert_sample.hpp @@ -17,13 +17,15 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/asset/asset.hpp" #include "mtconnect/observation/observation.hpp" #include "transform.hpp" namespace mtconnect { namespace pipeline { - class ConvertSample : public Transform + class AGENT_LIB_API ConvertSample : public Transform { public: ConvertSample() : Transform("ConvertSample") diff --git a/src/mtconnect/pipeline/deliver.hpp b/src/mtconnect/pipeline/deliver.hpp index 18690d7b3..d0ec8d812 100644 --- a/src/mtconnect/pipeline/deliver.hpp +++ b/src/mtconnect/pipeline/deliver.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -63,7 +65,7 @@ namespace mtconnect { double m_lastAvg {0.0}; }; - class MeteredTransform : public Transform + class AGENT_LIB_API MeteredTransform : public Transform { public: MeteredTransform(const std::string &name, PipelineContextPtr context, @@ -107,7 +109,7 @@ namespace mtconnect { std::optional m_dataItem; }; - class DeliverObservation : public MeteredTransform + class AGENT_LIB_API DeliverObservation : public MeteredTransform { public: using Deliver = std::function; @@ -120,7 +122,7 @@ namespace mtconnect { const entity::EntityPtr operator()(const entity::EntityPtr entity) override; }; - class DeliverAsset : public MeteredTransform + class AGENT_LIB_API DeliverAsset : public MeteredTransform { public: using Deliver = std::function; @@ -133,7 +135,7 @@ namespace mtconnect { const entity::EntityPtr operator()(const entity::EntityPtr entity) override; }; - class DeliverConnectionStatus : public Transform + class AGENT_LIB_API DeliverConnectionStatus : public Transform { public: using Deliver = std::function; @@ -154,7 +156,7 @@ namespace mtconnect { bool m_autoAvailable; }; - class DeliverAssetCommand : public Transform + class AGENT_LIB_API DeliverAssetCommand : public Transform { public: using Deliver = std::function; @@ -169,7 +171,7 @@ namespace mtconnect { PipelineContract *m_contract; }; - class DeliverCommand : public Transform + class AGENT_LIB_API DeliverCommand : public Transform { public: using Deliver = std::function; diff --git a/src/mtconnect/pipeline/delta_filter.hpp b/src/mtconnect/pipeline/delta_filter.hpp index 538ed59b1..25e17a5aa 100644 --- a/src/mtconnect/pipeline/delta_filter.hpp +++ b/src/mtconnect/pipeline/delta_filter.hpp @@ -17,13 +17,15 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/observation/observation.hpp" #include "transform.hpp" namespace mtconnect { class Agent; namespace pipeline { - class DeltaFilter : public Transform + class AGENT_LIB_API DeltaFilter : public Transform { public: struct State : TransformState diff --git a/src/mtconnect/pipeline/duplicate_filter.hpp b/src/mtconnect/pipeline/duplicate_filter.hpp index adfe05793..d5c59d026 100644 --- a/src/mtconnect/pipeline/duplicate_filter.hpp +++ b/src/mtconnect/pipeline/duplicate_filter.hpp @@ -17,11 +17,13 @@ #pragma once +#include "mtconnect/config.hpp" + #include "transform.hpp" namespace mtconnect { namespace pipeline { - class DuplicateFilter : public Transform + class AGENT_LIB_API DuplicateFilter : public Transform { public: struct State : TransformState diff --git a/src/mtconnect/pipeline/guard.hpp b/src/mtconnect/pipeline/guard.hpp index c0e96f531..1322e0807 100644 --- a/src/mtconnect/pipeline/guard.hpp +++ b/src/mtconnect/pipeline/guard.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/entity/entity.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/message_mapper.hpp b/src/mtconnect/pipeline/message_mapper.hpp index 6ecf72e8e..a8fd4d162 100644 --- a/src/mtconnect/pipeline/message_mapper.hpp +++ b/src/mtconnect/pipeline/message_mapper.hpp @@ -16,6 +16,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -36,7 +38,7 @@ namespace mtconnect { class Device; namespace pipeline { - class JsonMapper : public Transform + class AGENT_LIB_API JsonMapper : public Transform { public: JsonMapper(const JsonMapper &) = default; @@ -56,7 +58,7 @@ namespace mtconnect { PipelineContextPtr m_context; }; - class DataMapper : public Transform + class AGENT_LIB_API DataMapper : public Transform { public: DataMapper(const DataMapper &) = default; diff --git a/src/mtconnect/pipeline/mtconnect_xml_transform.hpp b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp index 468ae1229..510edc5e6 100644 --- a/src/mtconnect/pipeline/mtconnect_xml_transform.hpp +++ b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp @@ -16,6 +16,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -35,7 +37,7 @@ namespace mtconnect::pipeline { }; using namespace mtconnect::entity; - class MTConnectXmlTransform : public Transform + class AGENT_LIB_API MTConnectXmlTransform : public Transform { public: MTConnectXmlTransform(const MTConnectXmlTransform &) = default; diff --git a/src/mtconnect/pipeline/period_filter.hpp b/src/mtconnect/pipeline/period_filter.hpp index 59e3124b5..f842c53c9 100644 --- a/src/mtconnect/pipeline/period_filter.hpp +++ b/src/mtconnect/pipeline/period_filter.hpp @@ -17,13 +17,15 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/observation/observation.hpp" #include "transform.hpp" namespace mtconnect { class Agent; namespace pipeline { - class PeriodFilter : public Transform + class AGENT_LIB_API PeriodFilter : public Transform { public: struct LastObservation diff --git a/src/mtconnect/pipeline/pipeline.hpp b/src/mtconnect/pipeline/pipeline.hpp index e42015905..2041fa2c2 100644 --- a/src/mtconnect/pipeline/pipeline.hpp +++ b/src/mtconnect/pipeline/pipeline.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "pipeline_context.hpp" @@ -37,7 +39,7 @@ namespace mtconnect { class Adapter; } // namespace source::adapter namespace pipeline { - class Pipeline + class AGENT_LIB_API Pipeline { public: using Splice = std::function; @@ -229,7 +231,7 @@ namespace mtconnect { const auto &getContract() { return m_context->m_contract; } protected: - class Start : public Transform + class AGENT_LIB_API Start : public Transform { public: Start() : Transform("Start") diff --git a/src/mtconnect/pipeline/pipeline_context.hpp b/src/mtconnect/pipeline/pipeline_context.hpp index df58df515..3ebb31430 100644 --- a/src/mtconnect/pipeline/pipeline_context.hpp +++ b/src/mtconnect/pipeline/pipeline_context.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -37,7 +39,7 @@ namespace mtconnect { }; using TransformStatePtr = std::shared_ptr; - class PipelineContext : public std::enable_shared_from_this + class AGENT_LIB_API PipelineContext : public std::enable_shared_from_this { public: auto getptr() { return shared_from_this(); } diff --git a/src/mtconnect/pipeline/pipeline_contract.hpp b/src/mtconnect/pipeline/pipeline_contract.hpp index bc4981f97..a98a4209d 100644 --- a/src/mtconnect/pipeline/pipeline_contract.hpp +++ b/src/mtconnect/pipeline/pipeline_contract.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -46,7 +48,7 @@ namespace mtconnect { } // namespace entity namespace pipeline { - class PipelineContract + class AGENT_LIB_API PipelineContract { public: PipelineContract() = default; diff --git a/src/mtconnect/pipeline/response_document.hpp b/src/mtconnect/pipeline/response_document.hpp index 9849fd83a..c8a90857f 100644 --- a/src/mtconnect/pipeline/response_document.hpp +++ b/src/mtconnect/pipeline/response_document.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/entity/entity.hpp" #include "mtconnect/pipeline/pipeline_context.hpp" #include "mtconnect/printer/xml_helper.hpp" diff --git a/src/mtconnect/pipeline/shdr_token_mapper.hpp b/src/mtconnect/pipeline/shdr_token_mapper.hpp index 8dd6a1c74..bcf7006bb 100644 --- a/src/mtconnect/pipeline/shdr_token_mapper.hpp +++ b/src/mtconnect/pipeline/shdr_token_mapper.hpp @@ -16,6 +16,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -30,7 +32,7 @@ namespace mtconnect { namespace pipeline { using namespace entity; - class ShdrTokenMapper : public Transform + class AGENT_LIB_API ShdrTokenMapper : public Transform { public: ShdrTokenMapper(const ShdrTokenMapper &) = default; diff --git a/src/mtconnect/pipeline/shdr_tokenizer.hpp b/src/mtconnect/pipeline/shdr_tokenizer.hpp index d3ee89d05..9f1bf0830 100644 --- a/src/mtconnect/pipeline/shdr_tokenizer.hpp +++ b/src/mtconnect/pipeline/shdr_tokenizer.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -28,7 +30,7 @@ namespace mtconnect { namespace pipeline { using TokenList = std::list; - class Tokens : public entity::Entity + class AGENT_LIB_API Tokens : public entity::Entity { public: using entity::Entity::Entity; @@ -39,7 +41,7 @@ namespace mtconnect { TokenList m_tokens; }; - class ShdrTokenizer : public Transform + class AGENT_LIB_API ShdrTokenizer : public Transform { public: ShdrTokenizer(const ShdrTokenizer &) = default; diff --git a/src/mtconnect/pipeline/timestamp_extractor.hpp b/src/mtconnect/pipeline/timestamp_extractor.hpp index 6097056f8..1796e3aae 100644 --- a/src/mtconnect/pipeline/timestamp_extractor.hpp +++ b/src/mtconnect/pipeline/timestamp_extractor.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/utilities.hpp" #include "shdr_tokenizer.hpp" #include "transform.hpp" @@ -27,7 +29,7 @@ namespace mtconnect { namespace pipeline { using namespace entity; - class Timestamped : public Tokens + class AGENT_LIB_API Timestamped : public Tokens { public: using Tokens::Tokens; @@ -42,19 +44,19 @@ namespace mtconnect { }; using TimestampedPtr = std::shared_ptr; - class AssetCommand : public Timestamped + class AGENT_LIB_API AssetCommand : public Timestamped { public: using Timestamped::Timestamped; }; - class Observations : public Timestamped + class AGENT_LIB_API Observations : public Timestamped { public: using Timestamped::Timestamped; }; - class ExtractTimestamp : public Transform + class AGENT_LIB_API ExtractTimestamp : public Transform { public: ExtractTimestamp(const ExtractTimestamp &) = default; @@ -104,7 +106,7 @@ namespace mtconnect { Microseconds m_offset; }; - class IgnoreTimestamp : public ExtractTimestamp + class AGENT_LIB_API IgnoreTimestamp : public ExtractTimestamp { public: IgnoreTimestamp() : ExtractTimestamp("IgnoreTimestamp") {} diff --git a/src/mtconnect/pipeline/topic_mapper.hpp b/src/mtconnect/pipeline/topic_mapper.hpp index f6007b7fe..43e2f7276 100644 --- a/src/mtconnect/pipeline/topic_mapper.hpp +++ b/src/mtconnect/pipeline/topic_mapper.hpp @@ -16,6 +16,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -31,7 +33,7 @@ namespace mtconnect { namespace pipeline { - class PipelineMessage : public Entity + class AGENT_LIB_API PipelineMessage : public Entity { public: using Entity::Entity; @@ -42,18 +44,18 @@ namespace mtconnect { }; using PipelineMessagePtr = std::shared_ptr; - class JsonMessage : public PipelineMessage + class AGENT_LIB_API JsonMessage : public PipelineMessage { public: using PipelineMessage::PipelineMessage; }; - class DataMessage : public PipelineMessage + class AGENT_LIB_API DataMessage : public PipelineMessage { public: using PipelineMessage::PipelineMessage; }; - class TopicMapper : public Transform + class AGENT_LIB_API TopicMapper : public Transform { public: TopicMapper(const TopicMapper &) = default; diff --git a/src/mtconnect/pipeline/transform.hpp b/src/mtconnect/pipeline/transform.hpp index d9faccc4d..4dd26bf43 100644 --- a/src/mtconnect/pipeline/transform.hpp +++ b/src/mtconnect/pipeline/transform.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -46,7 +48,7 @@ namespace mtconnect { using EachDataItem = std::function; using FindDataItem = std::function; - class Transform : public std::enable_shared_from_this + class AGENT_LIB_API Transform : public std::enable_shared_from_this { public: Transform(const Transform &) = default; @@ -211,7 +213,7 @@ namespace mtconnect { Guard m_guard; }; - class NullTransform : public Transform + class AGENT_LIB_API NullTransform : public Transform { public: NullTransform(Guard guard) : Transform("NullTransform") { m_guard = guard; } diff --git a/src/mtconnect/pipeline/upcase_value.hpp b/src/mtconnect/pipeline/upcase_value.hpp index 207d81ea9..4b6db8bb2 100644 --- a/src/mtconnect/pipeline/upcase_value.hpp +++ b/src/mtconnect/pipeline/upcase_value.hpp @@ -16,6 +16,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -36,7 +38,7 @@ namespace mtconnect { return s; } - class UpcaseValue : public Transform + class AGENT_LIB_API UpcaseValue : public Transform { public: UpcaseValue(const UpcaseValue &) = default; diff --git a/src/mtconnect/printer/json_printer.cpp b/src/mtconnect/printer/json_printer.cpp index 4e79ba057..67bfe4ace 100644 --- a/src/mtconnect/printer/json_printer.cpp +++ b/src/mtconnect/printer/json_printer.cpp @@ -200,7 +200,7 @@ namespace mtconnect::printer { return print(doc, m_pretty); } - class CategoryRef + class AGENT_LIB_API CategoryRef { public: CategoryRef(const char *cat, uint32_t version) : m_category(cat), m_version(version) {} @@ -244,7 +244,7 @@ namespace mtconnect::printer { uint32_t m_version; }; - class ComponentRef + class AGENT_LIB_API ComponentRef { public: ComponentRef(const ComponentPtr component, uint32_t version) @@ -307,7 +307,7 @@ namespace mtconnect::printer { uint32_t m_version; }; - class DeviceRef + class AGENT_LIB_API DeviceRef { public: DeviceRef(const DevicePtr device, uint32_t version) : m_device(device), m_version(version) {} diff --git a/src/mtconnect/printer/json_printer.hpp b/src/mtconnect/printer/json_printer.hpp index 2a988c546..c6df5a338 100644 --- a/src/mtconnect/printer/json_printer.hpp +++ b/src/mtconnect/printer/json_printer.hpp @@ -17,12 +17,14 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/asset/cutting_tool.hpp" #include "mtconnect/printer/printer.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect::printer { - class JsonPrinter : public Printer + class AGENT_LIB_API JsonPrinter : public Printer { public: JsonPrinter(uint32_t jsonVersion, bool pretty = false); diff --git a/src/mtconnect/printer/printer.hpp b/src/mtconnect/printer/printer.hpp index 555c506d5..c5c616010 100644 --- a/src/mtconnect/printer/printer.hpp +++ b/src/mtconnect/printer/printer.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -41,7 +43,7 @@ namespace mtconnect { using ProtoErrorList = std::list>; - class Printer + class AGENT_LIB_API Printer { public: Printer(bool pretty = false) : m_pretty(pretty) {} diff --git a/src/mtconnect/printer/xml_helper.hpp b/src/mtconnect/printer/xml_helper.hpp index 089b5ae71..ca0bae75c 100644 --- a/src/mtconnect/printer/xml_helper.hpp +++ b/src/mtconnect/printer/xml_helper.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #define xml_strfy(line) #line @@ -32,7 +34,7 @@ } namespace mtconnect::printer { - class XmlError : public std::logic_error + class AGENT_LIB_API XmlError : public std::logic_error { public: using std::logic_error::logic_error; diff --git a/src/mtconnect/printer/xml_printer.cpp b/src/mtconnect/printer/xml_printer.cpp index 7a659e6b4..ec0ffea58 100644 --- a/src/mtconnect/printer/xml_printer.cpp +++ b/src/mtconnect/printer/xml_printer.cpp @@ -54,7 +54,7 @@ namespace mtconnect::printer { using namespace asset; using namespace device_model::configuration; - class XmlWriter + class AGENT_LIB_API XmlWriter { public: XmlWriter(bool pretty) : m_writer(nullptr), m_buf(nullptr) @@ -272,7 +272,7 @@ namespace mtconnect::printer { THROW_IF_XML2_ERROR(xmlTextWriterEndElement(writer)); } - class AutoElement + class AGENT_LIB_API AutoElement { public: AutoElement(xmlTextWriterPtr writer) : m_writer(writer) {} diff --git a/src/mtconnect/printer/xml_printer.hpp b/src/mtconnect/printer/xml_printer.hpp index 8538e4da4..35aab9979 100644 --- a/src/mtconnect/printer/xml_printer.hpp +++ b/src/mtconnect/printer/xml_printer.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "mtconnect/asset/asset.hpp" @@ -35,7 +37,7 @@ namespace mtconnect { namespace printer { class XmlWriter; - class XmlPrinter : public Printer + class AGENT_LIB_API XmlPrinter : public Printer { public: XmlPrinter(bool pretty = false); diff --git a/src/mtconnect/printer/xml_printer_helper.hpp b/src/mtconnect/printer/xml_printer_helper.hpp index 08c945047..18dd8d37d 100644 --- a/src/mtconnect/printer/xml_printer_helper.hpp +++ b/src/mtconnect/printer/xml_printer_helper.hpp @@ -17,12 +17,14 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "mtconnect/printer/xml_helper.hpp" namespace mtconnect::printer { - class XmlWriter + class AGENT_LIB_API XmlWriter { public: XmlWriter(bool pretty) : m_writer(nullptr), m_buf(nullptr) @@ -78,7 +80,7 @@ namespace mtconnect::printer { THROW_IF_XML2_ERROR(xmlTextWriterEndElement(writer)); } - class AutoElement + class AGENT_LIB_API AutoElement { public: AutoElement(xmlTextWriterPtr writer) : m_writer(writer) {} diff --git a/src/mtconnect/ruby/embedded.hpp b/src/mtconnect/ruby/embedded.hpp index 4b651ef29..8263546dd 100644 --- a/src/mtconnect/ruby/embedded.hpp +++ b/src/mtconnect/ruby/embedded.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -32,7 +34,7 @@ namespace mtconnect { class Agent; namespace ruby { class RubyVM; - class Embedded + class AGENT_LIB_API Embedded { public: Embedded(Agent *agent, const ConfigOptions &options); diff --git a/src/mtconnect/ruby/ruby_agent.hpp b/src/mtconnect/ruby/ruby_agent.hpp index c68140ad3..e7a0c2cb1 100644 --- a/src/mtconnect/ruby/ruby_agent.hpp +++ b/src/mtconnect/ruby/ruby_agent.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/agent.hpp" #include "mtconnect/sink/sink.hpp" #include "mtconnect/source/source.hpp" diff --git a/src/mtconnect/ruby/ruby_entity.hpp b/src/mtconnect/ruby/ruby_entity.hpp index 7615574f8..2d9298c0a 100644 --- a/src/mtconnect/ruby/ruby_entity.hpp +++ b/src/mtconnect/ruby/ruby_entity.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include diff --git a/src/mtconnect/ruby/ruby_observation.hpp b/src/mtconnect/ruby/ruby_observation.hpp index 54f53068d..f63761727 100644 --- a/src/mtconnect/ruby/ruby_observation.hpp +++ b/src/mtconnect/ruby/ruby_observation.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/observation/observation.hpp" #include "ruby_entity.hpp" #include "ruby_vm.hpp" diff --git a/src/mtconnect/ruby/ruby_pipeline.hpp b/src/mtconnect/ruby/ruby_pipeline.hpp index 532b90447..e297e2413 100644 --- a/src/mtconnect/ruby/ruby_pipeline.hpp +++ b/src/mtconnect/ruby/ruby_pipeline.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/device_model/device.hpp" #include "mtconnect/entity/entity.hpp" diff --git a/src/mtconnect/ruby/ruby_smart_ptr.hpp b/src/mtconnect/ruby/ruby_smart_ptr.hpp index 97e34f3d3..09ffd5072 100644 --- a/src/mtconnect/ruby/ruby_smart_ptr.hpp +++ b/src/mtconnect/ruby/ruby_smart_ptr.hpp @@ -19,6 +19,8 @@ #include "mtconnect/config.hpp" +#include "mtconnect/config.hpp" + namespace mtconnect::ruby { template struct MRubySharedPtr diff --git a/src/mtconnect/ruby/ruby_transform.hpp b/src/mtconnect/ruby/ruby_transform.hpp index bc1fba72e..03dd3106c 100644 --- a/src/mtconnect/ruby/ruby_transform.hpp +++ b/src/mtconnect/ruby/ruby_transform.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/pipeline/guard.hpp" #include "mtconnect/pipeline/topic_mapper.hpp" #include "mtconnect/pipeline/transform.hpp" @@ -31,7 +33,7 @@ namespace mtconnect::ruby { using namespace entity; using namespace observation; - class RubyTransform : public pipeline::Transform + class AGENT_LIB_API RubyTransform : public pipeline::Transform { public: static void initialize(mrb_state *mrb, RClass *module) diff --git a/src/mtconnect/ruby/ruby_type.hpp b/src/mtconnect/ruby/ruby_type.hpp index 37b8449cf..0d3ef76ca 100644 --- a/src/mtconnect/ruby/ruby_type.hpp +++ b/src/mtconnect/ruby/ruby_type.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include diff --git a/src/mtconnect/ruby/ruby_vm.hpp b/src/mtconnect/ruby/ruby_vm.hpp index c60438dbc..d33134ba9 100644 --- a/src/mtconnect/ruby/ruby_vm.hpp +++ b/src/mtconnect/ruby/ruby_vm.hpp @@ -17,8 +17,10 @@ #pragma once +#include "mtconnect/config.hpp" + namespace mtconnect::ruby { - class RubyVM + class AGENT_LIB_API RubyVM { public: RubyVM() diff --git a/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp b/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp index 541ad9b6c..d8bc58e82 100644 --- a/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp +++ b/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "boost/asio/io_context.hpp" #include @@ -39,7 +41,7 @@ namespace mtconnect { namespace sink { namespace mqtt_sink { - class MqttService : public sink::Sink + class AGENT_LIB_API MqttService : public sink::Sink { // dynamic loading of sink diff --git a/src/mtconnect/sink/rest_sink/cached_file.hpp b/src/mtconnect/sink/rest_sink/cached_file.hpp index 183a44061..06374475e 100644 --- a/src/mtconnect/sink/rest_sink/cached_file.hpp +++ b/src/mtconnect/sink/rest_sink/cached_file.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include diff --git a/src/mtconnect/sink/rest_sink/file_cache.hpp b/src/mtconnect/sink/rest_sink/file_cache.hpp index 790d3b0a7..e5beed6bd 100644 --- a/src/mtconnect/sink/rest_sink/file_cache.hpp +++ b/src/mtconnect/sink/rest_sink/file_cache.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -33,7 +35,7 @@ namespace boost { namespace mtconnect::sink::rest_sink { using XmlNamespace = std::pair; using XmlNamespaceList = std::list; - class FileCache + class AGENT_LIB_API FileCache { public: using Directory = std::pair>; diff --git a/src/mtconnect/sink/rest_sink/parameter.hpp b/src/mtconnect/sink/rest_sink/parameter.hpp index adc3fee3f..45a216d8b 100644 --- a/src/mtconnect/sink/rest_sink/parameter.hpp +++ b/src/mtconnect/sink/rest_sink/parameter.hpp @@ -17,13 +17,15 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include #include namespace mtconnect::sink::rest_sink { - class ParameterError : public std::logic_error + class AGENT_LIB_API ParameterError : public std::logic_error { using std::logic_error::logic_error; }; diff --git a/src/mtconnect/sink/rest_sink/request.hpp b/src/mtconnect/sink/rest_sink/request.hpp index e18f2f3dd..07ccddabf 100644 --- a/src/mtconnect/sink/rest_sink/request.hpp +++ b/src/mtconnect/sink/rest_sink/request.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -25,7 +27,7 @@ #include "parameter.hpp" namespace mtconnect::sink::rest_sink { - class RequestError : public std::logic_error + class AGENT_LIB_API RequestError : public std::logic_error { public: RequestError(const char *w) : std::logic_error::logic_error(w) {} diff --git a/src/mtconnect/sink/rest_sink/response.hpp b/src/mtconnect/sink/rest_sink/response.hpp index 587f33e68..6496537d3 100644 --- a/src/mtconnect/sink/rest_sink/response.hpp +++ b/src/mtconnect/sink/rest_sink/response.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include diff --git a/src/mtconnect/sink/rest_sink/rest_service.hpp b/src/mtconnect/sink/rest_sink/rest_service.hpp index 50ed45b08..ad2bae45a 100644 --- a/src/mtconnect/sink/rest_sink/rest_service.hpp +++ b/src/mtconnect/sink/rest_sink/rest_service.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "mtconnect/buffer/circular_buffer.hpp" @@ -41,7 +43,7 @@ namespace mtconnect { const std::string &); using StyleFunction = void (printer::XmlPrinter::*)(const std::string &); - class RestService : public Sink + class AGENT_LIB_API RestService : public Sink { public: RestService(boost::asio::io_context &context, SinkContractPtr &&contract, diff --git a/src/mtconnect/sink/rest_sink/routing.hpp b/src/mtconnect/sink/rest_sink/routing.hpp index 703b8ae29..4b216ae42 100644 --- a/src/mtconnect/sink/rest_sink/routing.hpp +++ b/src/mtconnect/sink/rest_sink/routing.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -36,7 +38,7 @@ namespace mtconnect::sink::rest_sink { class Session; using SessionPtr = std::shared_ptr; - class Routing + class AGENT_LIB_API Routing { public: using Function = std::function; diff --git a/src/mtconnect/sink/rest_sink/server.hpp b/src/mtconnect/sink/rest_sink/server.hpp index 72b09a000..59c1255ae 100644 --- a/src/mtconnect/sink/rest_sink/server.hpp +++ b/src/mtconnect/sink/rest_sink/server.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -42,7 +44,7 @@ #include "tls_dector.hpp" namespace mtconnect::sink::rest_sink { - class Server + class AGENT_LIB_API Server { public: Server(boost::asio::io_context &context, const ConfigOptions &options = {}) diff --git a/src/mtconnect/sink/rest_sink/session.hpp b/src/mtconnect/sink/rest_sink/session.hpp index 1b9792fca..ba619cfea 100644 --- a/src/mtconnect/sink/rest_sink/session.hpp +++ b/src/mtconnect/sink/rest_sink/session.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include diff --git a/src/mtconnect/sink/rest_sink/session_impl.hpp b/src/mtconnect/sink/rest_sink/session_impl.hpp index 29992efd4..8b2a36b25 100644 --- a/src/mtconnect/sink/rest_sink/session_impl.hpp +++ b/src/mtconnect/sink/rest_sink/session_impl.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include diff --git a/src/mtconnect/sink/sink.hpp b/src/mtconnect/sink/sink.hpp index 494e71f90..5d6aa1e1a 100644 --- a/src/mtconnect/sink/sink.hpp +++ b/src/mtconnect/sink/sink.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -47,7 +49,7 @@ namespace mtconnect { } namespace sink { - class SinkContract + class AGENT_LIB_API SinkContract { public: virtual ~SinkContract() = default; @@ -79,7 +81,7 @@ namespace mtconnect { const std::string &name, boost::asio::io_context &io, SinkContractPtr &&contract, const ConfigOptions &options, const boost::property_tree::ptree &block)>; - class Sink + class AGENT_LIB_API Sink { public: Sink(const std::string &name, SinkContractPtr &&contract) @@ -101,7 +103,7 @@ namespace mtconnect { std::string m_name; }; - class SinkFactory + class AGENT_LIB_API SinkFactory { public: void registerFactory(const std::string &name, SinkFactoryFn function) diff --git a/src/mtconnect/source/adapter/adapter.hpp b/src/mtconnect/source/adapter/adapter.hpp index aa3dd3bb8..492cda5c2 100644 --- a/src/mtconnect/source/adapter/adapter.hpp +++ b/src/mtconnect/source/adapter/adapter.hpp @@ -17,11 +17,13 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/source/adapter/adapter_pipeline.hpp" #include "mtconnect/source/source.hpp" namespace mtconnect::source::adapter { - class Adapter : public Source + class AGENT_LIB_API Adapter : public Source { public: Adapter(const std::string &name, boost::asio::io_context &io, const ConfigOptions &options) diff --git a/src/mtconnect/source/adapter/adapter_pipeline.hpp b/src/mtconnect/source/adapter/adapter_pipeline.hpp index d85aad089..a35f6bed1 100644 --- a/src/mtconnect/source/adapter/adapter_pipeline.hpp +++ b/src/mtconnect/source/adapter/adapter_pipeline.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/pipeline/pipeline.hpp" #include "mtconnect/pipeline/transform.hpp" @@ -37,7 +39,7 @@ namespace mtconnect::source::adapter { Connect m_disconnected; }; - class AdapterPipeline : public pipeline::Pipeline + class AGENT_LIB_API AdapterPipeline : public pipeline::Pipeline { public: AdapterPipeline(pipeline::PipelineContextPtr context, boost::asio::io_context::strand &st) diff --git a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp index 8c256e629..67e0b1fcc 100644 --- a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/pipeline/mtconnect_xml_transform.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" @@ -31,7 +33,7 @@ namespace mtconnect::source::adapter::agent_adapter { using namespace mtconnect; using namespace source::adapter; - class AgentAdapterPipeline : public AdapterPipeline + class AGENT_LIB_API AgentAdapterPipeline : public AdapterPipeline { public: AgentAdapterPipeline(pipeline::PipelineContextPtr context, boost::asio::io_context::strand &st, @@ -44,7 +46,7 @@ namespace mtconnect::source::adapter::agent_adapter { pipeline::XmlTransformFeedback &m_feedback; }; - class AgentAdapter : public Adapter + class AGENT_LIB_API AgentAdapter : public Adapter { public: AgentAdapter(boost::asio::io_context &io, pipeline::PipelineContextPtr context, diff --git a/src/mtconnect/source/adapter/agent_adapter/http_session.hpp b/src/mtconnect/source/adapter/agent_adapter/http_session.hpp index 70a8be475..b871f4a09 100644 --- a/src/mtconnect/source/adapter/agent_adapter/http_session.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/http_session.hpp @@ -18,6 +18,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "session_impl.hpp" namespace mtconnect::source::adapter::agent_adapter { diff --git a/src/mtconnect/source/adapter/agent_adapter/https_session.hpp b/src/mtconnect/source/adapter/agent_adapter/https_session.hpp index b55a031b0..94cb297ed 100644 --- a/src/mtconnect/source/adapter/agent_adapter/https_session.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/https_session.hpp @@ -18,6 +18,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include "session_impl.hpp" diff --git a/src/mtconnect/source/adapter/agent_adapter/session.hpp b/src/mtconnect/source/adapter/agent_adapter/session.hpp index bc96c4ad1..1628f2bd5 100644 --- a/src/mtconnect/source/adapter/agent_adapter/session.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/session.hpp @@ -18,6 +18,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include diff --git a/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp b/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp index 51f6daedc..e6701c86f 100644 --- a/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp @@ -18,6 +18,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include diff --git a/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp index 2645a264d..fc0e4e840 100644 --- a/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include diff --git a/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp index 5bef09711..f21025a26 100644 --- a/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp +++ b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/mqtt/mqtt_client.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" @@ -25,7 +27,7 @@ using namespace mtconnect::mqtt_client; namespace mtconnect::source::adapter::mqtt_adapter { - class MqttPipeline : public AdapterPipeline + class AGENT_LIB_API MqttPipeline : public AdapterPipeline { public: MqttPipeline(pipeline::PipelineContextPtr context, boost::asio::io_context::strand &strand) @@ -38,7 +40,7 @@ namespace mtconnect::source::adapter::mqtt_adapter { ConfigOptions m_options; }; - class MqttAdapter : public Adapter + class AGENT_LIB_API MqttAdapter : public Adapter { public: MqttAdapter(boost::asio::io_context &io, pipeline::PipelineContextPtr pipelineContext, diff --git a/src/mtconnect/source/adapter/shdr/connector.hpp b/src/mtconnect/source/adapter/shdr/connector.hpp index 5b25a43e2..9eae5de63 100644 --- a/src/mtconnect/source/adapter/shdr/connector.hpp +++ b/src/mtconnect/source/adapter/shdr/connector.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -29,7 +31,7 @@ #define HEARTBEAT_FREQ 60000 namespace mtconnect::source::adapter::shdr { - class Connector + class AGENT_LIB_API Connector { public: // Instantiate the server by assigning it a server and port/ diff --git a/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp index d484353c5..9578acaa5 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp +++ b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -39,7 +41,7 @@ namespace mtconnect { } namespace source::adapter::shdr { - class ShdrAdapter : public adapter::Adapter, public Connector + class AGENT_LIB_API ShdrAdapter : public adapter::Adapter, public Connector { public: // Associate adapter with a device & connect to the server & port diff --git a/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp b/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp index e816f07ca..665cb9e5b 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp +++ b/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp @@ -17,10 +17,12 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/source/adapter/adapter_pipeline.hpp" namespace mtconnect::source::adapter::shdr { - class ShdrPipeline : public AdapterPipeline + class AGENT_LIB_API ShdrPipeline : public AdapterPipeline { public: ShdrPipeline(pipeline::PipelineContextPtr context, boost::asio::io_context::strand &st) diff --git a/src/mtconnect/source/error_code.hpp b/src/mtconnect/source/error_code.hpp index 01178e39c..1494e02e8 100644 --- a/src/mtconnect/source/error_code.hpp +++ b/src/mtconnect/source/error_code.hpp @@ -19,6 +19,8 @@ #include "mtconnect/config.hpp" +#include "mtconnect/config.hpp" + #include #include #include diff --git a/src/mtconnect/source/loopback_source.hpp b/src/mtconnect/source/loopback_source.hpp index 4ede09a06..585eba757 100644 --- a/src/mtconnect/source/loopback_source.hpp +++ b/src/mtconnect/source/loopback_source.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include "mtconnect/asset/asset.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/pipeline/pipeline.hpp" @@ -25,7 +27,7 @@ #include "mtconnect/utilities.hpp" namespace mtconnect::source { - class LoopbackPipeline : public pipeline::Pipeline + class AGENT_LIB_API LoopbackPipeline : public pipeline::Pipeline { public: LoopbackPipeline(pipeline::PipelineContextPtr context, boost::asio::io_context::strand &st) @@ -37,7 +39,7 @@ namespace mtconnect::source { ConfigOptions m_options; }; - class LoopbackSource : public Source + class AGENT_LIB_API LoopbackSource : public Source { public: LoopbackSource(const std::string &name, boost::asio::io_context::strand &io, diff --git a/src/mtconnect/source/source.hpp b/src/mtconnect/source/source.hpp index cfc6d3028..db3d42fd9 100644 --- a/src/mtconnect/source/source.hpp +++ b/src/mtconnect/source/source.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include @@ -36,7 +38,7 @@ namespace mtconnect { std::shared_ptr pipelineContext, const ConfigOptions &options, const boost::property_tree::ptree &block)>; - class Source : public std::enable_shared_from_this + class AGENT_LIB_API Source : public std::enable_shared_from_this { public: Source(boost::asio::io_context &io) : m_strand(io) {} @@ -64,7 +66,7 @@ namespace mtconnect { boost::asio::io_context::strand m_strand; }; - class SourceFactory + class AGENT_LIB_API SourceFactory { public: SourcePtr make(const std::string &factoryName, const std::string &sinkName, From 091d4eaac5b9c07e79565421e36bc2f65c197bcd Mon Sep 17 00:00:00 2001 From: William Sobel Date: Thu, 29 Dec 2022 23:10:33 -0800 Subject: [PATCH 11/50] First cut at windows port using shared libraries for agent lib --- CMakeLists.txt | 5 ++++- agent/CMakeLists.txt | 10 +++++++--- agent_lib/CMakeLists.txt | 11 ++++++++--- cmake/msvc_use_static_runtime.cmake | 16 ---------------- conanfile.py | 24 ++++++++++++++++++------ test/CMakeLists.txt | 9 +-------- 6 files changed, 38 insertions(+), 37 deletions(-) delete mode 100644 cmake/msvc_use_static_runtime.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b4aca74e9..7d6dfe983 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,10 @@ conan_basic_setup(KEEP_RPATHS TARGETS) if(SHARED_AGENT_LIB) set(CMAKE_BUILD_RPATH "@load_path/;@executable_path/;@load_path/../lib;@executable_path/../lib") + + if (MSVC) + include(InstallRequiredSystemLibraries) + endif() endif() if(WITH_PYTHON) @@ -92,7 +96,6 @@ if(WITH_PYTHON) message("Libs of Python: " ${Python3_LIBRARIES} ) endif() -include(cmake/msvc_use_static_runtime.cmake) include(cmake/osx_no_app_or_frameworks.cmake) include(cmake/ClangFormat.cmake) include(cmake/ClangTidy.cmake) diff --git a/agent/CMakeLists.txt b/agent/CMakeLists.txt index af4ca2cdf..ca5ab2963 100644 --- a/agent/CMakeLists.txt +++ b/agent/CMakeLists.txt @@ -10,9 +10,6 @@ endif() add_executable(agent ${AGENT_SOURCES}) -set_property(TARGET agent PROPERTY - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - if(WITH_PYTHON) target_compile_definitions( agent @@ -44,3 +41,10 @@ target_link_libraries( target_clangtidy_setup(agent_lib) install(TARGETS agent RUNTIME DESTINATION bin) + + +if(SHARED_AGENT_LIB and MSVC) + set(CMAKE_INSTALL_DEBUG_LIBRARIES ON) + include(InstallRequiredSystemLibraries) + install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION bin COMPONENT Libraries) +endif() diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index 55bc537d3..ac1470544 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -321,6 +321,14 @@ if(MSVC) "${SOURCE_DIR}/sink/rest_sink/session_impl.cpp" "${SOURCE_DIR}/source/adapter/mqtt/mqtt_adapter.cpp" "${SOURCE_DIR}/source/adapter/agent_adapter/agent_adapter.cpp" + "${SOURCE_DIR}/source/adapter/shdr/shdr_pipeline.cpp" + "${SOURCE_DIR}/source/adapter/adapter_pipeline.cpp" + "${SOURCE_DIR}/device_model/component.cpp" + "${SOURCE_DIR}/configuration/agent_config.cpp" + "${SOURCE_DIR}/sink/rest_sink/rest_service.cpp" + "${SOURCE_DIR}/ruby/embedded.cpp" + "${SOURCE_DIR}/pipeline/deliver.cpp" + "${SOURCE_DIR}/agent.cpp" PROPERTY COMPILE_FLAGS "/bigobj") endif() @@ -346,9 +354,6 @@ target_include_directories( "${CMAKE_CURRENT_LIST_DIR}/../src" ) -set_property(TARGET agent_lib PROPERTY - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - target_link_libraries( agent_lib PUBLIC diff --git a/cmake/msvc_use_static_runtime.cmake b/cmake/msvc_use_static_runtime.cmake deleted file mode 100644 index af912d7ab..000000000 --- a/cmake/msvc_use_static_runtime.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# When building for Windows using the Microsoft compiler we wish to use -# the static multi-threaded runtime libraries (this makes deployment easier). -# -# By default CMake targets the dynamic runtime libaries using the '/MD' and 'MDd' options -# Change these to use the static variants 'MT' and 'MTd' -# -# Note: This must be done before adding any CMake targets (executables, libraries etc...) - -if(MSVC) - foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif() - endforeach() -endif() diff --git a/conanfile.py b/conanfile.py index 2be8fcae2..91442a898 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,10 +1,11 @@ from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration import os import io import re import itertools as it import glob - +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime class MTConnectAgentConan(ConanFile): name = "mtconnect_agent" @@ -62,6 +63,10 @@ class MTConnectAgentConan(ConanFile): # else: # git.clone("https://github.com/mtconnect/cppagent") + def validate(self): + if is_msvc(self) and self.options.shared and not is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Shared can only be built with DLL runtime.") + def configure(self): if not self.options.without_python: self.options["boost"].without_python = False @@ -69,11 +74,12 @@ def configure(self): self.windows_xp = self.settings.os == 'Windows' and self.settings.compiler.toolset and \ self.settings.compiler.toolset in ('v141_xp', 'v140_xp') if self.settings.os == 'Windows': - if self.settings.build_type and self.settings.build_type == 'Debug': - self.settings.compiler.runtime = 'MTd' - else: - self.settings.compiler.runtime = 'MT' - + if not self.options.shared: + if self.settings.build_type and self.settings.build_type == 'Debug': + self.settings.compiler.runtime = 'MTd' + else: + self.settings.compiler.runtime = 'MT' + if not self.settings.compiler.version: self.settings.compiler.version = '16' @@ -96,6 +102,10 @@ def configure(self): if not self.options.shared and self.settings.os == "Macos": self.options["boost"].visibility = "hidden" + + # Make sure shared builds use shared boost + if is_msvc(self) and self.options.shared: + self.options["boost"].shared = True def requirements(self): if not self.windows_xp: @@ -135,6 +145,8 @@ def build(self): def imports(self): self.copy("*.dll", "bin", "bin") + self.copy("*.pdb", "bin", "bin", keep_path=False) + self.copy("*.pdb", "lib", "bin", keep_path=False) self.copy("*.so*", "lib", "lib") self.copy("*.dylib", "lib", "lib") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e1e296d79..df0aad9eb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,8 +18,6 @@ target_compile_definitions(sink_plugin_test $<$:_WIN32_WINNT=${WINVER}>) target_compile_features(sink_plugin_test PUBLIC ${CXX_COMPILE_FEATURES}) -set_property(TARGET sink_plugin_test PROPERTY - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" ) target_link_libraries( sink_plugin_test @@ -68,8 +66,6 @@ if (APPLE) endif() target_compile_features(adapter_plugin_test PUBLIC ${CXX_COMPILE_FEATURES}) -set_property(TARGET adapter_plugin_test PROPERTY - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" ) target_link_libraries( adapter_plugin_test @@ -93,8 +89,7 @@ target_include_directories( "${PROJECT_BINARY_DIR}/agent_lib" "${CMAKE_CURRENT_LIST_DIR}/../src" ) -set_property(TARGET agent_test_lib PROPERTY - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + target_link_libraries( agent_test_lib PUBLIC @@ -112,8 +107,6 @@ set_target_properties(agent_test_lib PROPERTIES FOLDER "test") macro(add_agent_test AGENT_TEST_NAME ADD_TEST_HELPER SUB_FOLDER) set(_sources ${AGENT_TEST_NAME}_test.cpp) add_executable(${AGENT_TEST_NAME}_test ${_sources}) - set_property(TARGET ${AGENT_TEST_NAME}_test PROPERTY - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" ) # set_property(TARGET ${AGENT_TEST_NAME}_test PROPERTY LINK_FLAGS_DEBUG "${COVERAGE_FLAGS}") target_link_libraries(${AGENT_TEST_NAME}_test agent_lib agent_test_lib CONAN_PKG::gtest) From 33287ad7f1c8de75f8fc5bfe733b75c406021f24 Mon Sep 17 00:00:00 2001 From: William Sobel Date: Thu, 29 Dec 2022 23:33:04 -0800 Subject: [PATCH 12/50] Fixed shared lib settings --- CMakeLists.txt | 1 + agent/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d6dfe983..363a67923 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CXX_COMPILE_FEATURES cxx_std_17) +set(SHARED_AGENT_LIB OFF CACHE BOOL "Build Agent Lib as shared library") set(WITH_PYTHON OFF CACHE STRING "With Python Support") set(WITH_RUBY OFF CACHE STRING "With Ruby Support") diff --git a/agent/CMakeLists.txt b/agent/CMakeLists.txt index ca5ab2963..e5800c8a6 100644 --- a/agent/CMakeLists.txt +++ b/agent/CMakeLists.txt @@ -43,7 +43,7 @@ target_clangtidy_setup(agent_lib) install(TARGETS agent RUNTIME DESTINATION bin) -if(SHARED_AGENT_LIB and MSVC) +if(SHARED_AGENT_LIB AND MSVC) set(CMAKE_INSTALL_DEBUG_LIBRARIES ON) include(InstallRequiredSystemLibraries) install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION bin COMPONENT Libraries) From 6572951c0eef24429651624a72710bfb550e6d70 Mon Sep 17 00:00:00 2001 From: William Sobel Date: Fri, 30 Dec 2022 14:14:16 -0800 Subject: [PATCH 13/50] Made test util methods inline to remove multiple defined symbol issues --- CMakeLists.txt | 11 +- agent_lib/CMakeLists.txt | 15 - conanfile.py | 26 +- src/mtconnect/agent.hpp | 3 +- src/mtconnect/asset/asset.hpp | 3 +- src/mtconnect/asset/asset_buffer.hpp | 3 +- src/mtconnect/asset/asset_storage.hpp | 3 +- src/mtconnect/asset/cutting_tool.hpp | 3 +- src/mtconnect/asset/file_asset.hpp | 3 +- src/mtconnect/asset/qif_document.hpp | 3 +- src/mtconnect/asset/raw_material.hpp | 3 +- src/mtconnect/buffer/checkpoint.hpp | 3 +- src/mtconnect/buffer/circular_buffer.hpp | 3 +- src/mtconnect/config.hpp | 8 +- src/mtconnect/configuration/agent_config.cpp | 1 + src/mtconnect/configuration/agent_config.hpp | 3 +- src/mtconnect/configuration/async_context.hpp | 3 +- src/mtconnect/configuration/parser.hpp | 4 +- src/mtconnect/configuration/service.hpp | 3 +- src/mtconnect/device_model/agent_device.hpp | 2 +- src/mtconnect/device_model/component.hpp | 3 +- src/mtconnect/device_model/composition.hpp | 1 - .../configuration/configuration.hpp | 1 - .../configuration/coordinate_systems.hpp | 3 +- .../device_model/configuration/motion.hpp | 3 +- .../configuration/relationships.hpp | 3 +- .../configuration/sensor_configuration.hpp | 3 +- .../configuration/solid_model.hpp | 3 +- .../configuration/specifications.hpp | 3 +- .../device_model/data_item/constraints.hpp | 3 +- .../device_model/data_item/data_item.hpp | 3 +- .../device_model/data_item/definition.hpp | 3 +- .../device_model/data_item/filter.hpp | 1 - .../device_model/data_item/relationships.hpp | 3 +- .../device_model/data_item/source.hpp | 1 - .../data_item/unit_conversion.hpp | 3 +- src/mtconnect/device_model/description.hpp | 3 +- src/mtconnect/device_model/device.hpp | 3 +- src/mtconnect/device_model/reference.hpp | 3 +- src/mtconnect/entity/data_set.hpp | 3 +- src/mtconnect/entity/entity.hpp | 3 +- src/mtconnect/entity/factory.hpp | 3 +- src/mtconnect/entity/json_parser.hpp | 3 +- src/mtconnect/entity/json_printer.hpp | 3 +- src/mtconnect/entity/qname.hpp | 4 +- src/mtconnect/entity/requirement.hpp | 5 +- src/mtconnect/entity/xml_parser.hpp | 3 +- src/mtconnect/entity/xml_printer.hpp | 3 +- src/mtconnect/logging.hpp | 7 +- src/mtconnect/mqtt/mqtt_client.hpp | 1 - src/mtconnect/mqtt/mqtt_server.hpp | 1 - src/mtconnect/observation/change_observer.hpp | 3 +- src/mtconnect/observation/observation.hpp | 3 +- src/mtconnect/parser/xml_parser.hpp | 3 +- src/mtconnect/pipeline/convert_sample.hpp | 3 +- src/mtconnect/pipeline/deliver.hpp | 3 +- src/mtconnect/pipeline/delta_filter.hpp | 1 - src/mtconnect/pipeline/duplicate_filter.hpp | 1 - src/mtconnect/pipeline/guard.hpp | 1 - src/mtconnect/pipeline/message_mapper.hpp | 3 +- .../pipeline/mtconnect_xml_transform.hpp | 3 +- src/mtconnect/pipeline/period_filter.hpp | 1 - src/mtconnect/pipeline/pipeline.hpp | 3 +- src/mtconnect/pipeline/pipeline_context.hpp | 3 +- src/mtconnect/pipeline/pipeline_contract.hpp | 4 +- src/mtconnect/pipeline/response_document.hpp | 1 - src/mtconnect/pipeline/shdr_token_mapper.hpp | 3 +- src/mtconnect/pipeline/shdr_tokenizer.hpp | 3 +- .../pipeline/timestamp_extractor.hpp | 1 - src/mtconnect/pipeline/topic_mapper.hpp | 3 +- src/mtconnect/pipeline/transform.hpp | 3 +- src/mtconnect/pipeline/upcase_value.hpp | 3 +- src/mtconnect/printer/json_printer.hpp | 3 +- src/mtconnect/printer/printer.hpp | 3 +- src/mtconnect/printer/xml_helper.hpp | 4 +- src/mtconnect/printer/xml_printer.hpp | 3 +- src/mtconnect/printer/xml_printer_helper.hpp | 3 +- src/mtconnect/ruby/embedded.hpp | 3 +- src/mtconnect/ruby/ruby_agent.hpp | 3 +- src/mtconnect/ruby/ruby_entity.hpp | 3 +- src/mtconnect/ruby/ruby_observation.hpp | 1 - src/mtconnect/ruby/ruby_pipeline.hpp | 1 - src/mtconnect/ruby/ruby_smart_ptr.hpp | 2 - src/mtconnect/ruby/ruby_transform.hpp | 1 - src/mtconnect/ruby/ruby_type.hpp | 3 +- src/mtconnect/sink/mqtt_sink/mqtt_service.hpp | 3 +- src/mtconnect/sink/rest_sink/cached_file.hpp | 3 +- src/mtconnect/sink/rest_sink/file_cache.hpp | 3 +- src/mtconnect/sink/rest_sink/parameter.hpp | 4 +- src/mtconnect/sink/rest_sink/request.hpp | 3 +- src/mtconnect/sink/rest_sink/response.hpp | 3 +- src/mtconnect/sink/rest_sink/rest_service.hpp | 3 +- src/mtconnect/sink/rest_sink/routing.hpp | 3 +- src/mtconnect/sink/rest_sink/server.hpp | 3 +- src/mtconnect/sink/rest_sink/session.hpp | 3 +- src/mtconnect/sink/rest_sink/session_impl.hpp | 3 +- src/mtconnect/sink/sink.hpp | 3 +- src/mtconnect/source/adapter/adapter.hpp | 1 - .../source/adapter/adapter_pipeline.hpp | 1 - .../adapter/agent_adapter/agent_adapter.hpp | 1 - .../adapter/agent_adapter/http_session.hpp | 1 - .../adapter/agent_adapter/https_session.hpp | 3 +- .../source/adapter/agent_adapter/session.hpp | 3 +- .../adapter/agent_adapter/session_impl.hpp | 3 +- .../adapter/agent_adapter/url_parser.cpp | 13 +- .../adapter/agent_adapter/url_parser.hpp | 3 +- .../source/adapter/mqtt/mqtt_adapter.hpp | 1 - .../source/adapter/shdr/connector.hpp | 3 +- .../source/adapter/shdr/shdr_adapter.hpp | 3 +- .../source/adapter/shdr/shdr_pipeline.hpp | 1 - src/mtconnect/source/error_code.hpp | 6 +- src/mtconnect/source/loopback_source.hpp | 3 +- src/mtconnect/source/source.hpp | 3 +- src/mtconnect/utilities.hpp | 4 +- test/CMakeLists.txt | 4 +- test/agent_test_helper.hpp | 1 + test/test_utilities.cpp | 338 ------------------ test/test_utilities.hpp | 296 ++++++++++++++- 118 files changed, 406 insertions(+), 602 deletions(-) delete mode 100644 test/test_utilities.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 363a67923..2a7c9581b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CXX_COMPILE_FEATURES cxx_std_17) set(SHARED_AGENT_LIB OFF CACHE BOOL "Build Agent Lib as shared library") -set(WITH_PYTHON OFF CACHE STRING "With Python Support") -set(WITH_RUBY OFF CACHE STRING "With Ruby Support") +set(WITH_RUBY ON CACHE STRING "With Ruby Support") # By default only generate 2 configurations (Debug and Release) for simplicity. # The user can change this option if required for the additional ones such as 'RelWithDebInfo'. @@ -89,14 +88,6 @@ if(SHARED_AGENT_LIB) endif() endif() -if(WITH_PYTHON) - set(Python_USE_STATIC_LIBS ON) - - find_package(Python3 COMPONENTS Interpreter Development Development.Embed) - message("Include dirs of Python: " ${Python3_INCLUDE_DIRS} ) - message("Libs of Python: " ${Python3_LIBRARIES} ) -endif() - include(cmake/osx_no_app_or_frameworks.cmake) include(cmake/ClangFormat.cmake) include(cmake/ClangTidy.cmake) diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index ac1470544..2f4b98dcb 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -266,14 +266,6 @@ set(AGENT_SOURCES "${SOURCE_DIR}/sink/rest_sink/session_impl.cpp" ) -if(WITH_PYTHON) - set(AGENT_SOURCES ${AGENT_SOURCES} - - "${SOURCE_DIR}/python/embedded.hpp" - "${SOURCE_DIR}/python/embedded.cpp" - ) -endif() - if(WITH_RUBY) set(AGENT_SOURCES ${AGENT_SOURCES} # HEADER_FILE_ONLY @@ -363,13 +355,6 @@ target_link_libraries( $<$:bcrypt> ) -if(WITH_PYTHON) - target_link_libraries( - agent_lib - PUBLIC - Python3::Python) -endif() - if(WITH_RUBY) target_link_libraries( agent_lib diff --git a/conanfile.py b/conanfile.py index 91442a898..ab7e2550e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -14,9 +14,9 @@ class MTConnectAgentConan(ConanFile): url = "https://github.com/mtconnect/cppagent.git" license = "Apache License 2.0" settings = "os", "compiler", "arch", "build_type", "arch_build" - options = { "run_tests": [True, False], "build_tests": [True, False], "without_python": [True, False], - "without_ruby": [True, False], "without_ipv6": [True, False], "with_ruby": [True, False], - "with_python": [True, False], "development" : [True, False], "shared": [True, False] } + options = { "run_tests": [True, False], "build_tests": [True, False], + "without_ruby": [True, False], "without_ipv6": [True, False], "with_ruby": [True, False], + "development" : [True, False], "shared": [True, False] } description = "MTConnect reference C++ agent copyright Association for Manufacturing Technology" requires = ["boost/1.79.0@#3249d9bd2b863a9489767bf9c8a05b4b", @@ -30,11 +30,9 @@ class MTConnectAgentConan(ConanFile): default_options = { "run_tests": True, "build_tests": True, - "without_python": True, "without_ruby": False, "without_ipv6": False, - "with_python": False, - "with_ruby": False, + "with_ruby": True, "development": False, "shared": False, @@ -50,6 +48,8 @@ class MTConnectAgentConan(ConanFile): "libxml2:zlib": False, "gtest:shared": False, + + "openssl:shared": False, "date:use_system_tz_db": True } @@ -68,9 +68,6 @@ def validate(self): raise ConanInvalidConfiguration("Shared can only be built with DLL runtime.") def configure(self): - if not self.options.without_python: - self.options["boost"].without_python = False - self.windows_xp = self.settings.os == 'Windows' and self.settings.compiler.toolset and \ self.settings.compiler.toolset in ('v141_xp', 'v140_xp') if self.settings.os == 'Windows': @@ -97,15 +94,15 @@ def configure(self): if not self.options.without_ruby: self.options.with_ruby = True - if not self.options.without_python: - self.options.with_python = True - if not self.options.shared and self.settings.os == "Macos": self.options["boost"].visibility = "hidden" # Make sure shared builds use shared boost if is_msvc(self) and self.options.shared: self.options["boost"].shared = True + self.options["libxml2"].shared = True + self.options["gtest"].shared = True + self.options["openssl"].shared = True def requirements(self): if not self.windows_xp: @@ -122,11 +119,6 @@ def build(self): if self.options.without_ipv6: cmake.definitions['AGENT_WITHOUT_IPV6'] = 'ON' - if self.options.with_python: - cmake.definitions['WITH_PYTHON'] = 'ON' - else: - cmake.definitions['WITH_PYTHON'] = 'OFF' - if self.options.with_ruby: cmake.definitions['WITH_RUBY'] = 'ON' else: diff --git a/src/mtconnect/agent.hpp b/src/mtconnect/agent.hpp index f6c533841..5899360cb 100644 --- a/src/mtconnect/agent.hpp +++ b/src/mtconnect/agent.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -41,6 +39,7 @@ #include "mtconnect/asset/asset_buffer.hpp" #include "mtconnect/buffer/checkpoint.hpp" #include "mtconnect/buffer/circular_buffer.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/configuration/service.hpp" #include "mtconnect/device_model/agent_device.hpp" #include "mtconnect/device_model/device.hpp" diff --git a/src/mtconnect/asset/asset.hpp b/src/mtconnect/asset/asset.hpp index 9ecb0314b..ce71319fa 100644 --- a/src/mtconnect/asset/asset.hpp +++ b/src/mtconnect/asset/asset.hpp @@ -17,12 +17,11 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/asset/asset_buffer.hpp b/src/mtconnect/asset/asset_buffer.hpp index c45b1922b..41c53cd01 100644 --- a/src/mtconnect/asset/asset_buffer.hpp +++ b/src/mtconnect/asset/asset_buffer.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -44,6 +42,7 @@ #include "asset.hpp" #include "asset_storage.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect::asset { diff --git a/src/mtconnect/asset/asset_storage.hpp b/src/mtconnect/asset/asset_storage.hpp index 0714c3119..b3f2e6f73 100644 --- a/src/mtconnect/asset/asset_storage.hpp +++ b/src/mtconnect/asset/asset_storage.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -26,6 +24,7 @@ #include #include "mtconnect/asset/asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/asset/cutting_tool.hpp b/src/mtconnect/asset/cutting_tool.hpp index 7c799ea6d..6f090fa7c 100644 --- a/src/mtconnect/asset/cutting_tool.hpp +++ b/src/mtconnect/asset/cutting_tool.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include "asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect { diff --git a/src/mtconnect/asset/file_asset.hpp b/src/mtconnect/asset/file_asset.hpp index c2792e02b..35d5c5c3b 100644 --- a/src/mtconnect/asset/file_asset.hpp +++ b/src/mtconnect/asset/file_asset.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include "asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/asset/qif_document.hpp b/src/mtconnect/asset/qif_document.hpp index ca5d53666..ca7d61a91 100644 --- a/src/mtconnect/asset/qif_document.hpp +++ b/src/mtconnect/asset/qif_document.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include "asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/asset/raw_material.hpp b/src/mtconnect/asset/raw_material.hpp index cb310b746..0fc60aeba 100644 --- a/src/mtconnect/asset/raw_material.hpp +++ b/src/mtconnect/asset/raw_material.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include "asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/buffer/checkpoint.hpp b/src/mtconnect/buffer/checkpoint.hpp index f20d8f933..f5dca83a3 100644 --- a/src/mtconnect/buffer/checkpoint.hpp +++ b/src/mtconnect/buffer/checkpoint.hpp @@ -17,14 +17,13 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/buffer/circular_buffer.hpp b/src/mtconnect/buffer/circular_buffer.hpp index 630273e02..06c63951a 100644 --- a/src/mtconnect/buffer/circular_buffer.hpp +++ b/src/mtconnect/buffer/circular_buffer.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -26,6 +24,7 @@ #include #include "checkpoint.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/config.hpp b/src/mtconnect/config.hpp index 0209415ab..b5a22be29 100644 --- a/src/mtconnect/config.hpp +++ b/src/mtconnect/config.hpp @@ -75,23 +75,21 @@ typedef unsigned __int64 uint64_t; #else // _WINDOWS #define AGENT_SYMBOL_EXPORT __attribute__((visibility("default"))) #define AGENT_SYMBOL_IMPORT __attribute__((visibility("default"))) -#endif // _WINDOWS +#endif // _WINDOWS #ifdef SHARED_AGENT_LIB #ifdef AGENT_BUILD_SHARED_LIB #define AGENT_LIB_API AGENT_SYMBOL_EXPORT -#else +#else #define AGENT_LIB_API AGENT_SYMBOL_IMPORT #endif #define AGENT_SYMBOL_VISIBLE AGENT_LIB_API -#else // SHARED_AGENT_LIB +#else // SHARED_AGENT_LIB #define AGENT_LIB_API #define AGENT_SYMBOL_VISIBLE #endif - - diff --git a/src/mtconnect/configuration/agent_config.cpp b/src/mtconnect/configuration/agent_config.cpp index 681c93c15..e7a1ac815 100644 --- a/src/mtconnect/configuration/agent_config.cpp +++ b/src/mtconnect/configuration/agent_config.cpp @@ -96,6 +96,7 @@ BOOST_LOG_ATTRIBUTE_KEYWORD(named_scope, "Scope", logr::attributes::named_scope: BOOST_LOG_ATTRIBUTE_KEYWORD(utc_timestamp, "Timestamp", logr::attributes::utc_clock::value_type); namespace mtconnect::configuration { + AGENT_LIB_API boost::log::trivial::logger_type *gAgentLogger = nullptr; AgentConfiguration::AgentConfiguration() diff --git a/src/mtconnect/configuration/agent_config.hpp b/src/mtconnect/configuration/agent_config.hpp index 00079b621..d8262b1de 100644 --- a/src/mtconnect/configuration/agent_config.hpp +++ b/src/mtconnect/configuration/agent_config.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -31,6 +29,7 @@ #include "async_context.hpp" #include "mtconnect/agent.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/sink/rest_sink/file_cache.hpp" #include "mtconnect/sink/sink.hpp" #include "mtconnect/source/adapter/adapter.hpp" diff --git a/src/mtconnect/configuration/async_context.hpp b/src/mtconnect/configuration/async_context.hpp index 1caec64a8..23de00498 100644 --- a/src/mtconnect/configuration/async_context.hpp +++ b/src/mtconnect/configuration/async_context.hpp @@ -17,11 +17,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" #include "mtconnect/logging.hpp" namespace mtconnect::configuration { diff --git a/src/mtconnect/configuration/parser.hpp b/src/mtconnect/configuration/parser.hpp index 40791615f..576df2a5f 100644 --- a/src/mtconnect/configuration/parser.hpp +++ b/src/mtconnect/configuration/parser.hpp @@ -17,12 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" + namespace mtconnect { namespace configuration { class AGENT_LIB_API ParseError : public std::runtime_error diff --git a/src/mtconnect/configuration/service.hpp b/src/mtconnect/configuration/service.hpp index 8570f03af..a5cf7ac74 100644 --- a/src/mtconnect/configuration/service.hpp +++ b/src/mtconnect/configuration/service.hpp @@ -17,14 +17,13 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/agent_device.hpp b/src/mtconnect/device_model/agent_device.hpp index ffcf994c9..de62dabff 100644 --- a/src/mtconnect/device_model/agent_device.hpp +++ b/src/mtconnect/device_model/agent_device.hpp @@ -17,11 +17,11 @@ #pragma once -#include "mtconnect/config.hpp" #include #include "component.hpp" #include "data_item/data_item.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/device_model/device.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/device_model/component.hpp b/src/mtconnect/device_model/component.hpp index 885a2e3f0..ee79b216a 100644 --- a/src/mtconnect/device_model/component.hpp +++ b/src/mtconnect/device_model/component.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -28,6 +26,7 @@ #include "composition.hpp" #include "configuration/configuration.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/factory.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/device_model/composition.hpp b/src/mtconnect/device_model/composition.hpp index 993514847..386ec6d9c 100644 --- a/src/mtconnect/device_model/composition.hpp +++ b/src/mtconnect/device_model/composition.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/entity/entity.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/configuration/configuration.hpp b/src/mtconnect/device_model/configuration/configuration.hpp index 77fdc1409..bcce229df 100644 --- a/src/mtconnect/device_model/configuration/configuration.hpp +++ b/src/mtconnect/device_model/configuration/configuration.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" diff --git a/src/mtconnect/device_model/configuration/coordinate_systems.hpp b/src/mtconnect/device_model/configuration/coordinate_systems.hpp index a33c9e055..fe57bd943 100644 --- a/src/mtconnect/device_model/configuration/coordinate_systems.hpp +++ b/src/mtconnect/device_model/configuration/coordinate_systems.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "configuration.hpp" +#include "mtconnect/config.hpp" namespace mtconnect { using namespace entity; diff --git a/src/mtconnect/device_model/configuration/motion.hpp b/src/mtconnect/device_model/configuration/motion.hpp index b1fa809e4..4bd3e2524 100644 --- a/src/mtconnect/device_model/configuration/motion.hpp +++ b/src/mtconnect/device_model/configuration/motion.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "configuration.hpp" +#include "mtconnect/config.hpp" namespace mtconnect { using namespace entity; diff --git a/src/mtconnect/device_model/configuration/relationships.hpp b/src/mtconnect/device_model/configuration/relationships.hpp index ffaecbb47..bd36349ba 100644 --- a/src/mtconnect/device_model/configuration/relationships.hpp +++ b/src/mtconnect/device_model/configuration/relationships.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "configuration.hpp" +#include "mtconnect/config.hpp" namespace mtconnect { using namespace entity; diff --git a/src/mtconnect/device_model/configuration/sensor_configuration.hpp b/src/mtconnect/device_model/configuration/sensor_configuration.hpp index 107abc66c..ec026b908 100644 --- a/src/mtconnect/device_model/configuration/sensor_configuration.hpp +++ b/src/mtconnect/device_model/configuration/sensor_configuration.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "configuration.hpp" +#include "mtconnect/config.hpp" namespace mtconnect { using namespace entity; diff --git a/src/mtconnect/device_model/configuration/solid_model.hpp b/src/mtconnect/device_model/configuration/solid_model.hpp index a75410972..b810b60f8 100644 --- a/src/mtconnect/device_model/configuration/solid_model.hpp +++ b/src/mtconnect/device_model/configuration/solid_model.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "configuration.hpp" +#include "mtconnect/config.hpp" namespace mtconnect { using namespace entity; diff --git a/src/mtconnect/device_model/configuration/specifications.hpp b/src/mtconnect/device_model/configuration/specifications.hpp index 802390418..c4dd2b0cf 100644 --- a/src/mtconnect/device_model/configuration/specifications.hpp +++ b/src/mtconnect/device_model/configuration/specifications.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "configuration.hpp" +#include "mtconnect/config.hpp" namespace mtconnect { using namespace entity; diff --git a/src/mtconnect/device_model/data_item/constraints.hpp b/src/mtconnect/device_model/data_item/constraints.hpp index 457757f4c..2c8f328bd 100644 --- a/src/mtconnect/device_model/data_item/constraints.hpp +++ b/src/mtconnect/device_model/data_item/constraints.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "filter.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" diff --git a/src/mtconnect/device_model/data_item/data_item.hpp b/src/mtconnect/device_model/data_item/data_item.hpp index d7a4ed3d9..fe7991a95 100644 --- a/src/mtconnect/device_model/data_item/data_item.hpp +++ b/src/mtconnect/device_model/data_item/data_item.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include "constraints.hpp" #include "definition.hpp" #include "filter.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/device_model/component.hpp" #include "mtconnect/observation/change_observer.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/device_model/data_item/definition.hpp b/src/mtconnect/device_model/data_item/definition.hpp index 94ff0c77c..50cded529 100644 --- a/src/mtconnect/device_model/data_item/definition.hpp +++ b/src/mtconnect/device_model/data_item/definition.hpp @@ -17,10 +17,9 @@ #pragma once -#include "mtconnect/config.hpp" - #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/data_item/filter.hpp b/src/mtconnect/device_model/data_item/filter.hpp index 458be3488..50d93720c 100644 --- a/src/mtconnect/device_model/data_item/filter.hpp +++ b/src/mtconnect/device_model/data_item/filter.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" diff --git a/src/mtconnect/device_model/data_item/relationships.hpp b/src/mtconnect/device_model/data_item/relationships.hpp index 07dc17686..e78e10ad0 100644 --- a/src/mtconnect/device_model/data_item/relationships.hpp +++ b/src/mtconnect/device_model/data_item/relationships.hpp @@ -17,10 +17,9 @@ #pragma once -#include "mtconnect/config.hpp" - #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/data_item/source.hpp b/src/mtconnect/device_model/data_item/source.hpp index 4d655d97b..35d549b4f 100644 --- a/src/mtconnect/device_model/data_item/source.hpp +++ b/src/mtconnect/device_model/data_item/source.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/entity/entity.hpp" namespace mtconnect::device_model::data_item { diff --git a/src/mtconnect/device_model/data_item/unit_conversion.hpp b/src/mtconnect/device_model/data_item/unit_conversion.hpp index 7fc360a7b..cc3baa17d 100644 --- a/src/mtconnect/device_model/data_item/unit_conversion.hpp +++ b/src/mtconnect/device_model/data_item/unit_conversion.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/requirement.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/description.hpp b/src/mtconnect/device_model/description.hpp index 4b8a07c8d..bbaf8da9e 100644 --- a/src/mtconnect/device_model/description.hpp +++ b/src/mtconnect/device_model/description.hpp @@ -17,14 +17,13 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/entity/factory.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/device_model/device.hpp b/src/mtconnect/device_model/device.hpp index e7672f715..078a01173 100644 --- a/src/mtconnect/device_model/device.hpp +++ b/src/mtconnect/device_model/device.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -33,6 +31,7 @@ #include "component.hpp" #include "data_item/data_item.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect { diff --git a/src/mtconnect/device_model/reference.hpp b/src/mtconnect/device_model/reference.hpp index 84eb431f2..5681d1146 100644 --- a/src/mtconnect/device_model/reference.hpp +++ b/src/mtconnect/device_model/reference.hpp @@ -17,14 +17,13 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/entity/data_set.hpp b/src/mtconnect/entity/data_set.hpp index 111e04f04..8bfb7b68b 100644 --- a/src/mtconnect/entity/data_set.hpp +++ b/src/mtconnect/entity/data_set.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -27,6 +25,7 @@ #include #include +#include "mtconnect/config.hpp" #include "mtconnect/logging.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/entity/entity.hpp b/src/mtconnect/entity/entity.hpp index f23067f0f..70cdfbc4e 100644 --- a/src/mtconnect/entity/entity.hpp +++ b/src/mtconnect/entity/entity.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include "data_set.hpp" +#include "mtconnect/config.hpp" #include "qname.hpp" #include "requirement.hpp" diff --git a/src/mtconnect/entity/factory.hpp b/src/mtconnect/entity/factory.hpp index ef280935a..bff6bb132 100644 --- a/src/mtconnect/entity/factory.hpp +++ b/src/mtconnect/entity/factory.hpp @@ -17,12 +17,11 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" namespace mtconnect { diff --git a/src/mtconnect/entity/json_parser.hpp b/src/mtconnect/entity/json_parser.hpp index 40a4eb3a5..9e4e1652e 100644 --- a/src/mtconnect/entity/json_parser.hpp +++ b/src/mtconnect/entity/json_parser.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include "factory.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/utilities.hpp" #include "requirement.hpp" diff --git a/src/mtconnect/entity/json_printer.hpp b/src/mtconnect/entity/json_printer.hpp index 326c96c44..5c84904af 100644 --- a/src/mtconnect/entity/json_printer.hpp +++ b/src/mtconnect/entity/json_printer.hpp @@ -17,10 +17,9 @@ #pragma once -#include "mtconnect/config.hpp" - #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" using json = nlohmann::json; diff --git a/src/mtconnect/entity/qname.hpp b/src/mtconnect/entity/qname.hpp index c8de40ad9..30194e136 100644 --- a/src/mtconnect/entity/qname.hpp +++ b/src/mtconnect/entity/qname.hpp @@ -17,12 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include +#include "mtconnect/config.hpp" + namespace mtconnect { namespace entity { class AGENT_LIB_API QName : public std::string diff --git a/src/mtconnect/entity/requirement.hpp b/src/mtconnect/entity/requirement.hpp index e780598ae..ccf29351c 100644 --- a/src/mtconnect/entity/requirement.hpp +++ b/src/mtconnect/entity/requirement.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -39,6 +37,7 @@ #include #include "data_set.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect { @@ -114,7 +113,7 @@ namespace mtconnect { std::string m_text; std::string m_entity; }; - + class AGENT_LIB_API PropertyError : public EntityError { public: diff --git a/src/mtconnect/entity/xml_parser.hpp b/src/mtconnect/entity/xml_parser.hpp index 85a036a3c..3e8cca740 100644 --- a/src/mtconnect/entity/xml_parser.hpp +++ b/src/mtconnect/entity/xml_parser.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include "factory.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/utilities.hpp" #include "requirement.hpp" diff --git a/src/mtconnect/entity/xml_printer.hpp b/src/mtconnect/entity/xml_printer.hpp index dafc4cee5..1d92435a5 100644 --- a/src/mtconnect/entity/xml_printer.hpp +++ b/src/mtconnect/entity/xml_printer.hpp @@ -17,10 +17,9 @@ #pragma once -#include "mtconnect/config.hpp" - #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" extern "C" diff --git a/src/mtconnect/logging.hpp b/src/mtconnect/logging.hpp index 147d7364f..b420259fc 100644 --- a/src/mtconnect/logging.hpp +++ b/src/mtconnect/logging.hpp @@ -17,11 +17,11 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" + #define LOG BOOST_LOG_TRIVIAL #define NAMED_SCOPE BOOST_LOG_NAMED_SCOPE @@ -30,8 +30,9 @@ // After that, use PLUGIN_LOG(lvl) << ...; namespace mtconnect { namespace configuration { + AGENT_LIB_API extern boost::log::trivial::logger_type *gAgentLogger; - } + } // namespace configuration } // namespace mtconnect #define PLUGIN_LOG(lvl) \ diff --git a/src/mtconnect/mqtt/mqtt_client.hpp b/src/mtconnect/mqtt/mqtt_client.hpp index cf51f037d..66eb41da7 100644 --- a/src/mtconnect/mqtt/mqtt_client.hpp +++ b/src/mtconnect/mqtt/mqtt_client.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" diff --git a/src/mtconnect/mqtt/mqtt_server.hpp b/src/mtconnect/mqtt/mqtt_server.hpp index 74e231f7e..2d7289952 100644 --- a/src/mtconnect/mqtt/mqtt_server.hpp +++ b/src/mtconnect/mqtt/mqtt_server.hpp @@ -14,7 +14,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" diff --git a/src/mtconnect/observation/change_observer.hpp b/src/mtconnect/observation/change_observer.hpp index 64d881c3d..fbb4c383c 100644 --- a/src/mtconnect/observation/change_observer.hpp +++ b/src/mtconnect/observation/change_observer.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -26,6 +24,7 @@ #include #include +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect { diff --git a/src/mtconnect/observation/observation.hpp b/src/mtconnect/observation/observation.hpp index fd47e684e..b730e94ad 100644 --- a/src/mtconnect/observation/observation.hpp +++ b/src/mtconnect/observation/observation.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -27,6 +25,7 @@ #include #include +#include "mtconnect/config.hpp" #include "mtconnect/device_model/component.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/entity/entity.hpp" diff --git a/src/mtconnect/parser/xml_parser.hpp b/src/mtconnect/parser/xml_parser.hpp index cdbc3bfc4..5c0edcf68 100644 --- a/src/mtconnect/parser/xml_parser.hpp +++ b/src/mtconnect/parser/xml_parser.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -27,6 +25,7 @@ #include "mtconnect/asset/cutting_tool.hpp" #include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/device_model/component.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/device_model/device.hpp" diff --git a/src/mtconnect/pipeline/convert_sample.hpp b/src/mtconnect/pipeline/convert_sample.hpp index 9be5c2d02..4c920575a 100644 --- a/src/mtconnect/pipeline/convert_sample.hpp +++ b/src/mtconnect/pipeline/convert_sample.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "mtconnect/asset/asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/observation/observation.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/deliver.hpp b/src/mtconnect/pipeline/deliver.hpp index d0ec8d812..4724e2985 100644 --- a/src/mtconnect/pipeline/deliver.hpp +++ b/src/mtconnect/pipeline/deliver.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include "mtconnect/asset/asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/observation/observation.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/delta_filter.hpp b/src/mtconnect/pipeline/delta_filter.hpp index 25e17a5aa..860e9d96e 100644 --- a/src/mtconnect/pipeline/delta_filter.hpp +++ b/src/mtconnect/pipeline/delta_filter.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/observation/observation.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/duplicate_filter.hpp b/src/mtconnect/pipeline/duplicate_filter.hpp index d5c59d026..f2f01fb96 100644 --- a/src/mtconnect/pipeline/duplicate_filter.hpp +++ b/src/mtconnect/pipeline/duplicate_filter.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "transform.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/guard.hpp b/src/mtconnect/pipeline/guard.hpp index 1322e0807..a5595523b 100644 --- a/src/mtconnect/pipeline/guard.hpp +++ b/src/mtconnect/pipeline/guard.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/entity/entity.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/message_mapper.hpp b/src/mtconnect/pipeline/message_mapper.hpp index a8fd4d162..958016ea5 100644 --- a/src/mtconnect/pipeline/message_mapper.hpp +++ b/src/mtconnect/pipeline/message_mapper.hpp @@ -16,8 +16,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -26,6 +24,7 @@ #include +#include "mtconnect/config.hpp" #include "mtconnect/device_model/device.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/observation/observation.hpp" diff --git a/src/mtconnect/pipeline/mtconnect_xml_transform.hpp b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp index 510edc5e6..0eb6d436a 100644 --- a/src/mtconnect/pipeline/mtconnect_xml_transform.hpp +++ b/src/mtconnect/pipeline/mtconnect_xml_transform.hpp @@ -16,11 +16,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/pipeline/transform.hpp" diff --git a/src/mtconnect/pipeline/period_filter.hpp b/src/mtconnect/pipeline/period_filter.hpp index f842c53c9..237411170 100644 --- a/src/mtconnect/pipeline/period_filter.hpp +++ b/src/mtconnect/pipeline/period_filter.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/observation/observation.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/pipeline.hpp b/src/mtconnect/pipeline/pipeline.hpp index 2041fa2c2..0cfc21dd8 100644 --- a/src/mtconnect/pipeline/pipeline.hpp +++ b/src/mtconnect/pipeline/pipeline.hpp @@ -17,10 +17,9 @@ #pragma once -#include "mtconnect/config.hpp" - #include +#include "mtconnect/config.hpp" #include "pipeline_context.hpp" #include "pipeline_contract.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/pipeline_context.hpp b/src/mtconnect/pipeline/pipeline_context.hpp index 3ebb31430..63b1fdcd6 100644 --- a/src/mtconnect/pipeline/pipeline_context.hpp +++ b/src/mtconnect/pipeline/pipeline_context.hpp @@ -17,12 +17,11 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include +#include "mtconnect/config.hpp" #include "pipeline_contract.hpp" namespace mtconnect { diff --git a/src/mtconnect/pipeline/pipeline_contract.hpp b/src/mtconnect/pipeline/pipeline_contract.hpp index a98a4209d..51f824488 100644 --- a/src/mtconnect/pipeline/pipeline_contract.hpp +++ b/src/mtconnect/pipeline/pipeline_contract.hpp @@ -17,12 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include +#include "mtconnect/config.hpp" + namespace mtconnect { namespace device_model { namespace data_item { diff --git a/src/mtconnect/pipeline/response_document.hpp b/src/mtconnect/pipeline/response_document.hpp index c8a90857f..e08c3838b 100644 --- a/src/mtconnect/pipeline/response_document.hpp +++ b/src/mtconnect/pipeline/response_document.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/entity/entity.hpp" #include "mtconnect/pipeline/pipeline_context.hpp" #include "mtconnect/printer/xml_helper.hpp" diff --git a/src/mtconnect/pipeline/shdr_token_mapper.hpp b/src/mtconnect/pipeline/shdr_token_mapper.hpp index bcf7006bb..595061527 100644 --- a/src/mtconnect/pipeline/shdr_token_mapper.hpp +++ b/src/mtconnect/pipeline/shdr_token_mapper.hpp @@ -16,11 +16,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/observation/observation.hpp" #include "shdr_tokenizer.hpp" diff --git a/src/mtconnect/pipeline/shdr_tokenizer.hpp b/src/mtconnect/pipeline/shdr_tokenizer.hpp index 9f1bf0830..7e09090ec 100644 --- a/src/mtconnect/pipeline/shdr_tokenizer.hpp +++ b/src/mtconnect/pipeline/shdr_tokenizer.hpp @@ -17,11 +17,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/timestamp_extractor.hpp b/src/mtconnect/pipeline/timestamp_extractor.hpp index 1796e3aae..e378a873a 100644 --- a/src/mtconnect/pipeline/timestamp_extractor.hpp +++ b/src/mtconnect/pipeline/timestamp_extractor.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/utilities.hpp" #include "shdr_tokenizer.hpp" #include "transform.hpp" diff --git a/src/mtconnect/pipeline/topic_mapper.hpp b/src/mtconnect/pipeline/topic_mapper.hpp index 43e2f7276..f9531496b 100644 --- a/src/mtconnect/pipeline/topic_mapper.hpp +++ b/src/mtconnect/pipeline/topic_mapper.hpp @@ -16,14 +16,13 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/device_model/device.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/observation/observation.hpp" diff --git a/src/mtconnect/pipeline/transform.hpp b/src/mtconnect/pipeline/transform.hpp index 4dd26bf43..cf57661f1 100644 --- a/src/mtconnect/pipeline/transform.hpp +++ b/src/mtconnect/pipeline/transform.hpp @@ -17,12 +17,11 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include "guard.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "pipeline_context.hpp" diff --git a/src/mtconnect/pipeline/upcase_value.hpp b/src/mtconnect/pipeline/upcase_value.hpp index 4b6db8bb2..baa7cb36f 100644 --- a/src/mtconnect/pipeline/upcase_value.hpp +++ b/src/mtconnect/pipeline/upcase_value.hpp @@ -16,11 +16,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "mtconnect/observation/observation.hpp" #include "shdr_tokenizer.hpp" diff --git a/src/mtconnect/printer/json_printer.hpp b/src/mtconnect/printer/json_printer.hpp index c6df5a338..2179715c0 100644 --- a/src/mtconnect/printer/json_printer.hpp +++ b/src/mtconnect/printer/json_printer.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "mtconnect/asset/cutting_tool.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/printer/printer.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/printer/printer.hpp b/src/mtconnect/printer/printer.hpp index c5c616010..aeb1929b3 100644 --- a/src/mtconnect/printer/printer.hpp +++ b/src/mtconnect/printer/printer.hpp @@ -17,14 +17,13 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include #include "mtconnect/asset/asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/utilities.hpp" #include "mtconnect/version.h" diff --git a/src/mtconnect/printer/xml_helper.hpp b/src/mtconnect/printer/xml_helper.hpp index ca0bae75c..8f3de51e6 100644 --- a/src/mtconnect/printer/xml_helper.hpp +++ b/src/mtconnect/printer/xml_helper.hpp @@ -17,10 +17,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include +#include "mtconnect/config.hpp" + #define xml_strfy(line) #line #define THROW_IF_XML2_ERROR(expr) \ if ((expr) < 0) \ diff --git a/src/mtconnect/printer/xml_printer.hpp b/src/mtconnect/printer/xml_printer.hpp index 35aab9979..50cfacc3f 100644 --- a/src/mtconnect/printer/xml_printer.hpp +++ b/src/mtconnect/printer/xml_printer.hpp @@ -17,11 +17,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include "mtconnect/asset/asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/printer/printer.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/printer/xml_printer_helper.hpp b/src/mtconnect/printer/xml_printer_helper.hpp index 18dd8d37d..826c8032f 100644 --- a/src/mtconnect/printer/xml_printer_helper.hpp +++ b/src/mtconnect/printer/xml_printer_helper.hpp @@ -17,10 +17,9 @@ #pragma once -#include "mtconnect/config.hpp" - #include +#include "mtconnect/config.hpp" #include "mtconnect/printer/xml_helper.hpp" namespace mtconnect::printer { diff --git a/src/mtconnect/ruby/embedded.hpp b/src/mtconnect/ruby/embedded.hpp index 8263546dd..71f85b8f8 100644 --- a/src/mtconnect/ruby/embedded.hpp +++ b/src/mtconnect/ruby/embedded.hpp @@ -17,12 +17,11 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace Rice { diff --git a/src/mtconnect/ruby/ruby_agent.hpp b/src/mtconnect/ruby/ruby_agent.hpp index e7a0c2cb1..2e171e18f 100644 --- a/src/mtconnect/ruby/ruby_agent.hpp +++ b/src/mtconnect/ruby/ruby_agent.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "mtconnect/agent.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/sink/sink.hpp" #include "mtconnect/source/source.hpp" #include "ruby_smart_ptr.hpp" diff --git a/src/mtconnect/ruby/ruby_entity.hpp b/src/mtconnect/ruby/ruby_entity.hpp index 2d9298c0a..c63a44695 100644 --- a/src/mtconnect/ruby/ruby_entity.hpp +++ b/src/mtconnect/ruby/ruby_entity.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/device_model/device.hpp" #include "mtconnect/entity/data_set.hpp" diff --git a/src/mtconnect/ruby/ruby_observation.hpp b/src/mtconnect/ruby/ruby_observation.hpp index f63761727..40b5c5934 100644 --- a/src/mtconnect/ruby/ruby_observation.hpp +++ b/src/mtconnect/ruby/ruby_observation.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/observation/observation.hpp" #include "ruby_entity.hpp" #include "ruby_vm.hpp" diff --git a/src/mtconnect/ruby/ruby_pipeline.hpp b/src/mtconnect/ruby/ruby_pipeline.hpp index e297e2413..079a02b82 100644 --- a/src/mtconnect/ruby/ruby_pipeline.hpp +++ b/src/mtconnect/ruby/ruby_pipeline.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/device_model/device.hpp" #include "mtconnect/entity/entity.hpp" diff --git a/src/mtconnect/ruby/ruby_smart_ptr.hpp b/src/mtconnect/ruby/ruby_smart_ptr.hpp index 09ffd5072..97e34f3d3 100644 --- a/src/mtconnect/ruby/ruby_smart_ptr.hpp +++ b/src/mtconnect/ruby/ruby_smart_ptr.hpp @@ -19,8 +19,6 @@ #include "mtconnect/config.hpp" -#include "mtconnect/config.hpp" - namespace mtconnect::ruby { template struct MRubySharedPtr diff --git a/src/mtconnect/ruby/ruby_transform.hpp b/src/mtconnect/ruby/ruby_transform.hpp index 03dd3106c..e181fb29b 100644 --- a/src/mtconnect/ruby/ruby_transform.hpp +++ b/src/mtconnect/ruby/ruby_transform.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/pipeline/guard.hpp" #include "mtconnect/pipeline/topic_mapper.hpp" #include "mtconnect/pipeline/transform.hpp" diff --git a/src/mtconnect/ruby/ruby_type.hpp b/src/mtconnect/ruby/ruby_type.hpp index 0d3ef76ca..9968a984a 100644 --- a/src/mtconnect/ruby/ruby_type.hpp +++ b/src/mtconnect/ruby/ruby_type.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" namespace mtconnect::ruby { diff --git a/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp b/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp index d8bc58e82..2fa4192f4 100644 --- a/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp +++ b/src/mtconnect/sink/mqtt_sink/mqtt_service.hpp @@ -17,12 +17,11 @@ #pragma once -#include "mtconnect/config.hpp" - #include "boost/asio/io_context.hpp" #include #include "mtconnect/buffer/checkpoint.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/configuration/agent_config.hpp" #include "mtconnect/entity/json_printer.hpp" #include "mtconnect/mqtt/mqtt_client.hpp" diff --git a/src/mtconnect/sink/rest_sink/cached_file.hpp b/src/mtconnect/sink/rest_sink/cached_file.hpp index 06374475e..1d8220c1a 100644 --- a/src/mtconnect/sink/rest_sink/cached_file.hpp +++ b/src/mtconnect/sink/rest_sink/cached_file.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect { diff --git a/src/mtconnect/sink/rest_sink/file_cache.hpp b/src/mtconnect/sink/rest_sink/file_cache.hpp index e5beed6bd..9a9773367 100644 --- a/src/mtconnect/sink/rest_sink/file_cache.hpp +++ b/src/mtconnect/sink/rest_sink/file_cache.hpp @@ -17,14 +17,13 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include #include "cached_file.hpp" +#include "mtconnect/config.hpp" namespace boost { namespace asio { diff --git a/src/mtconnect/sink/rest_sink/parameter.hpp b/src/mtconnect/sink/rest_sink/parameter.hpp index 45a216d8b..ebe4040af 100644 --- a/src/mtconnect/sink/rest_sink/parameter.hpp +++ b/src/mtconnect/sink/rest_sink/parameter.hpp @@ -17,13 +17,13 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include +#include "mtconnect/config.hpp" + namespace mtconnect::sink::rest_sink { class AGENT_LIB_API ParameterError : public std::logic_error { diff --git a/src/mtconnect/sink/rest_sink/request.hpp b/src/mtconnect/sink/rest_sink/request.hpp index 07ccddabf..71b0a148d 100644 --- a/src/mtconnect/sink/rest_sink/request.hpp +++ b/src/mtconnect/sink/rest_sink/request.hpp @@ -17,13 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include +#include "mtconnect/config.hpp" #include "parameter.hpp" namespace mtconnect::sink::rest_sink { diff --git a/src/mtconnect/sink/rest_sink/response.hpp b/src/mtconnect/sink/rest_sink/response.hpp index 6496537d3..2e0954104 100644 --- a/src/mtconnect/sink/rest_sink/response.hpp +++ b/src/mtconnect/sink/rest_sink/response.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -26,6 +24,7 @@ #include #include "cached_file.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" #include "request.hpp" diff --git a/src/mtconnect/sink/rest_sink/rest_service.hpp b/src/mtconnect/sink/rest_sink/rest_service.hpp index ad2bae45a..7980955a8 100644 --- a/src/mtconnect/sink/rest_sink/rest_service.hpp +++ b/src/mtconnect/sink/rest_sink/rest_service.hpp @@ -17,11 +17,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include "mtconnect/buffer/circular_buffer.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/sink/sink.hpp" #include "mtconnect/source/loopback_source.hpp" #include "mtconnect/utilities.hpp" diff --git a/src/mtconnect/sink/rest_sink/routing.hpp b/src/mtconnect/sink/rest_sink/routing.hpp index 4b216ae42..9bd1ac5f4 100644 --- a/src/mtconnect/sink/rest_sink/routing.hpp +++ b/src/mtconnect/sink/rest_sink/routing.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -29,6 +27,7 @@ #include #include +#include "mtconnect/config.hpp" #include "mtconnect/logging.hpp" #include "parameter.hpp" #include "request.hpp" diff --git a/src/mtconnect/sink/rest_sink/server.hpp b/src/mtconnect/sink/rest_sink/server.hpp index 59c1255ae..f6e5005e2 100644 --- a/src/mtconnect/sink/rest_sink/server.hpp +++ b/src/mtconnect/sink/rest_sink/server.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -36,6 +34,7 @@ #include #include "file_cache.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/configuration/config_options.hpp" #include "mtconnect/utilities.hpp" #include "response.hpp" diff --git a/src/mtconnect/sink/rest_sink/session.hpp b/src/mtconnect/sink/rest_sink/session.hpp index ba619cfea..1cca5c7c4 100644 --- a/src/mtconnect/sink/rest_sink/session.hpp +++ b/src/mtconnect/sink/rest_sink/session.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -26,6 +24,7 @@ #include #include +#include "mtconnect/config.hpp" #include "routing.hpp" namespace mtconnect::sink::rest_sink { diff --git a/src/mtconnect/sink/rest_sink/session_impl.hpp b/src/mtconnect/sink/rest_sink/session_impl.hpp index 8b2a36b25..f9ca17151 100644 --- a/src/mtconnect/sink/rest_sink/session_impl.hpp +++ b/src/mtconnect/sink/rest_sink/session_impl.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -26,6 +24,7 @@ #include #include +#include "mtconnect/config.hpp" #include "mtconnect/configuration/config_options.hpp" #include "mtconnect/utilities.hpp" #include "session.hpp" diff --git a/src/mtconnect/sink/sink.hpp b/src/mtconnect/sink/sink.hpp index 5d6aa1e1a..ea4a39ff4 100644 --- a/src/mtconnect/sink/sink.hpp +++ b/src/mtconnect/sink/sink.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -29,6 +27,7 @@ #include "mtconnect/asset/asset_storage.hpp" #include "mtconnect/buffer/circular_buffer.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/device_model/device.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/printer//printer.hpp" diff --git a/src/mtconnect/source/adapter/adapter.hpp b/src/mtconnect/source/adapter/adapter.hpp index 492cda5c2..d4cbe925b 100644 --- a/src/mtconnect/source/adapter/adapter.hpp +++ b/src/mtconnect/source/adapter/adapter.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/source/adapter/adapter_pipeline.hpp" #include "mtconnect/source/source.hpp" diff --git a/src/mtconnect/source/adapter/adapter_pipeline.hpp b/src/mtconnect/source/adapter/adapter_pipeline.hpp index a35f6bed1..c342e7950 100644 --- a/src/mtconnect/source/adapter/adapter_pipeline.hpp +++ b/src/mtconnect/source/adapter/adapter_pipeline.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/pipeline/pipeline.hpp" #include "mtconnect/pipeline/transform.hpp" diff --git a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp index 67e0b1fcc..7de6887d4 100644 --- a/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/agent_adapter.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/pipeline/mtconnect_xml_transform.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" diff --git a/src/mtconnect/source/adapter/agent_adapter/http_session.hpp b/src/mtconnect/source/adapter/agent_adapter/http_session.hpp index b871f4a09..a8b1eead6 100644 --- a/src/mtconnect/source/adapter/agent_adapter/http_session.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/http_session.hpp @@ -19,7 +19,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "session_impl.hpp" namespace mtconnect::source::adapter::agent_adapter { diff --git a/src/mtconnect/source/adapter/agent_adapter/https_session.hpp b/src/mtconnect/source/adapter/agent_adapter/https_session.hpp index 94cb297ed..43b31fe30 100644 --- a/src/mtconnect/source/adapter/agent_adapter/https_session.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/https_session.hpp @@ -18,10 +18,9 @@ #pragma once -#include "mtconnect/config.hpp" - #include +#include "mtconnect/config.hpp" #include "session_impl.hpp" namespace mtconnect::source::adapter::agent_adapter { diff --git a/src/mtconnect/source/adapter/agent_adapter/session.hpp b/src/mtconnect/source/adapter/agent_adapter/session.hpp index 1628f2bd5..7872cf693 100644 --- a/src/mtconnect/source/adapter/agent_adapter/session.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/session.hpp @@ -18,12 +18,11 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" #include "mtconnect/entity/entity.hpp" #include "url_parser.hpp" diff --git a/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp b/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp index e6701c86f..5d727eba5 100644 --- a/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/session_impl.hpp @@ -18,8 +18,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -27,6 +25,7 @@ #include #include +#include "mtconnect/config.hpp" #include "mtconnect/pipeline/mtconnect_xml_transform.hpp" #include "mtconnect/pipeline/response_document.hpp" #include "session.hpp" diff --git a/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp b/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp index 675ea2132..4334bdfbc 100644 --- a/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp +++ b/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp @@ -36,10 +36,15 @@ BOOST_FUSION_ADAPT_STRUCT(mtconnect::source::adapter::agent_adapter::UrlQueryPai BOOST_FUSION_ADAPT_STRUCT( mtconnect::source::adapter::agent_adapter::Url, - (std::string, m_protocol)(mtconnect::source::adapter::agent_adapter::Url::Host, - m_host)(std::optional, m_username)( - std::optional, m_password)(std::optional, m_port)(std::string, m_path)( - mtconnect::source::adapter::agent_adapter::UrlQuery, m_query)(std::string, m_fragment)) + (std::string, + m_protocol)(mtconnect::source::adapter::agent_adapter::Url::Host, + m_host)(std::optional, + m_username)(std::optional, + m_password)(std::optional, + m_port)(std::string, + m_path)(mtconnect::source::adapter:: + agent_adapter::UrlQuery, + m_query)(std::string, m_fragment)) namespace mtconnect::source::adapter::agent_adapter { diff --git a/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp index fc0e4e840..69efa6b0c 100644 --- a/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -29,6 +27,7 @@ #include #include +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect::source::adapter::agent_adapter { diff --git a/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp index f21025a26..30e4ea0a2 100644 --- a/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp +++ b/src/mtconnect/source/adapter/mqtt/mqtt_adapter.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/mqtt/mqtt_client.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/adapter/adapter_pipeline.hpp" diff --git a/src/mtconnect/source/adapter/shdr/connector.hpp b/src/mtconnect/source/adapter/shdr/connector.hpp index 9eae5de63..183a48d4c 100644 --- a/src/mtconnect/source/adapter/shdr/connector.hpp +++ b/src/mtconnect/source/adapter/shdr/connector.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include @@ -26,6 +24,7 @@ #include #include +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" #define HEARTBEAT_FREQ 60000 diff --git a/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp index 9578acaa5..4c839b100 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp +++ b/src/mtconnect/source/adapter/shdr/shdr_adapter.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -28,6 +26,7 @@ #include #include "connector.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/device_model/data_item/data_item.hpp" #include "mtconnect/source/adapter/adapter.hpp" #include "mtconnect/source/source.hpp" diff --git a/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp b/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp index 665cb9e5b..29177e785 100644 --- a/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp +++ b/src/mtconnect/source/adapter/shdr/shdr_pipeline.hpp @@ -18,7 +18,6 @@ #pragma once #include "mtconnect/config.hpp" - #include "mtconnect/source/adapter/adapter_pipeline.hpp" namespace mtconnect::source::adapter::shdr { diff --git a/src/mtconnect/source/error_code.hpp b/src/mtconnect/source/error_code.hpp index 1494e02e8..e3fd8b900 100644 --- a/src/mtconnect/source/error_code.hpp +++ b/src/mtconnect/source/error_code.hpp @@ -17,14 +17,12 @@ #pragma once -#include "mtconnect/config.hpp" - -#include "mtconnect/config.hpp" - #include #include #include +#include "mtconnect/config.hpp" + namespace mtconnect::source { enum class ErrorCode { diff --git a/src/mtconnect/source/loopback_source.hpp b/src/mtconnect/source/loopback_source.hpp index 585eba757..5d9b85e07 100644 --- a/src/mtconnect/source/loopback_source.hpp +++ b/src/mtconnect/source/loopback_source.hpp @@ -17,9 +17,8 @@ #pragma once -#include "mtconnect/config.hpp" - #include "mtconnect/asset/asset.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/observation/observation.hpp" #include "mtconnect/pipeline/pipeline.hpp" #include "mtconnect/pipeline/pipeline_context.hpp" diff --git a/src/mtconnect/source/source.hpp b/src/mtconnect/source/source.hpp index db3d42fd9..b98ce27b6 100644 --- a/src/mtconnect/source/source.hpp +++ b/src/mtconnect/source/source.hpp @@ -17,11 +17,10 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include +#include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" namespace mtconnect { diff --git a/src/mtconnect/utilities.hpp b/src/mtconnect/utilities.hpp index 92e1ba8c8..6c721d06f 100644 --- a/src/mtconnect/utilities.hpp +++ b/src/mtconnect/utilities.hpp @@ -17,8 +17,6 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include @@ -26,6 +24,8 @@ #include +#include "mtconnect/config.hpp" + //####### CONSTANTS ####### // Port number to put server on diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index df0aad9eb..968b539c1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -80,7 +80,7 @@ target_clangformat_setup(adapter_plugin_test) ########### -set(AGENT_TEST_LIB_SOURCES test_utilities.cpp agent_test_helper.cpp agent_test_helper.hpp test_utilities.hpp json_helper.hpp) +set(AGENT_TEST_LIB_SOURCES agent_test_helper.cpp agent_test_helper.hpp test_utilities.hpp json_helper.hpp) add_library(agent_test_lib STATIC ${AGENT_TEST_LIB_SOURCES}) target_include_directories( agent_test_lib @@ -93,7 +93,7 @@ target_include_directories( target_link_libraries( agent_test_lib PUBLIC - agent_lib + agent_lib CONAN_PKG::gtest ) target_compile_definitions(agent_test_lib PUBLIC diff --git a/test/agent_test_helper.hpp b/test/agent_test_helper.hpp index 7dfb7144c..4a3beeec6 100644 --- a/test/agent_test_helper.hpp +++ b/test/agent_test_helper.hpp @@ -25,6 +25,7 @@ #include #include "mtconnect/agent.hpp" +#include "mtconnect/config.hpp" #include "mtconnect/configuration/agent_config.hpp" #include "mtconnect/configuration/config_options.hpp" #include "mtconnect/pipeline/pipeline.hpp" diff --git a/test/test_utilities.cpp b/test/test_utilities.cpp deleted file mode 100644 index 682f5c521..000000000 --- a/test/test_utilities.cpp +++ /dev/null @@ -1,338 +0,0 @@ -// -// Copyright Copyright 2009-2022, AMT – The Association For Manufacturing Technology (“AMT”) -// All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Ensure that gtest is the first header otherwise Windows raises an error -#include -// Keep this comment to keep gtest.h above. (clang-format off/on is not working here!) - -#include - -#include -#include -#include - -#include "test_utilities.hpp" - -using namespace std; - -namespace { - template - std::string toString(T value) - { - std::ostringstream stm; - stm << value; - return stm.str(); - } -} // namespace - -string getFile(string file) -{ - string path = string(PROJECT_ROOT_DIR "/test/resources/") + file; - ifstream ifs(path.c_str()); - stringstream stream; - stream << ifs.rdbuf(); - return stream.str(); -} - -void fillErrorText(string &errorXml, const string &text) -{ - size_t pos = errorXml.find(""); - - // Error in case was not found - if (pos == string::npos) - { - return; - } - - // Trim everything between >.... - size_t gT = pos; - - while (errorXml[gT - 1] != '>') - { - gT--; - } - - errorXml.erase(gT, pos - gT); - - // Insert new text into pos - pos = errorXml.find(""); - errorXml.insert(pos, text); -} - -void fillAttribute(string &xmlString, const string &attribute, const string &value) -{ - size_t pos = xmlString.find(attribute + "=\"\""); - - if (pos == string::npos) - { - return; - } - else - { - pos += attribute.length() + 2; - } - - xmlString.insert(pos, value); -} - -void xpathTest(xmlDocPtr doc, const char *xpath, const char *expected, const std::string &file, - int line) -{ - xmlNodePtr root = xmlDocGetRootElement(doc); - - string path(xpath), attribute; - size_t pos = path.find_first_of('@'); - - while (pos != string::npos && attribute.empty()) - { - if (xpath[pos - 1] != '[') - { - attribute = path.substr(pos + 1); - path = path.substr(0, pos); - } - - pos = path.find_first_of('@', pos + 1); - } - - xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc); - - bool any = false; - - for (xmlNsPtr ns = root->nsDef; ns; ns = ns->next) - { - if (ns->prefix) - { - xmlXPathRegisterNs(xpathCtx, ns->prefix, ns->href); - any = true; - } - } - - if (!any) - xmlXPathRegisterNs(xpathCtx, BAD_CAST "m", root->ns->href); - - xmlXPathObjectPtr obj = xmlXPathEvalExpression(BAD_CAST path.c_str(), xpathCtx); - - if (!obj || !obj->nodesetval || obj->nodesetval->nodeNr == 0) - { - int size; - xmlChar *memory; - xmlDocDumpFormatMemory(doc, &memory, &size, 1); - - stringstream message; - message << file << "(" << line << "): " - << "Xpath " << xpath << " did not match any nodes in XML document" << endl - << ((const char *)memory); - xmlFree(memory); - - FAIL() << message.str(); - - if (obj) - xmlXPathFreeObject(obj); - - xmlXPathFreeContext(xpathCtx); - return; - } - - // Special case when no children are expected - xmlNodePtr first = obj->nodesetval->nodeTab[0]; - - if (expected == nullptr) - { - bool has_content = false; - stringstream message; - - if (attribute.empty()) - { - message << "Xpath " << xpath << " was not supposed to have any children."; - - for (xmlNodePtr child = first->children; !has_content && child; child = child->next) - { - if (child->type == XML_ELEMENT_NODE) - { - has_content = true; - } - else if (child->type == XML_TEXT_NODE) - { - string res = (const char *)child->content; - has_content = !trim(res).empty(); - } - } - } - else - { - message << "Xpath " << xpath << " was not supposed to have an attribute."; - xmlChar *text = xmlGetProp(first, BAD_CAST attribute.c_str()); - - if (text) - { - message << "Value was: " << text; - has_content = true; - xmlFree(text); - } - } - - xmlXPathFreeObject(obj); - xmlXPathFreeContext(xpathCtx); - - failIf(has_content, message.str(), file, line); - return; - } - - string actual; - xmlChar *text = nullptr; - - switch (first->type) - { - case XML_ELEMENT_NODE: - if (attribute.empty()) - { - text = xmlNodeGetContent(first); - } - else if (first->properties) - { - text = xmlGetProp(first, BAD_CAST attribute.c_str()); - if (text == nullptr) - { - text = xmlStrdup(BAD_CAST "ATTRIBUTE NOT FOUND"); - } - } - - if (text) - { - actual = (const char *)text; - xmlFree(text); - } - - break; - - case XML_ATTRIBUTE_NODE: - actual = (const char *)first->content; - break; - - case XML_TEXT_NODE: - actual = (const char *)first->content; - break; - - default: - cerr << "Cannot handle type: " << first->type << endl; - } - - xmlXPathFreeObject(obj); - xmlXPathFreeContext(xpathCtx); - - trim(actual); - string message = (string) "Incorrect value for path " + xpath; - - if (expected[0] != '!') - { - failNotEqualIf(actual != expected, expected, actual, message, file, line); - } - else - { - expected += 1; - failNotEqualIf(actual == expected, expected, actual, message, file, line); - } -} - -void xpathTestCount(xmlDocPtr doc, const char *xpath, int expected, const std::string &file, - int line) - -{ - xmlNodePtr root = xmlDocGetRootElement(doc); - - xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc); - - bool any = false; - - for (xmlNsPtr ns = root->nsDef; ns; ns = ns->next) - { - if (ns->prefix) - { - xmlXPathRegisterNs(xpathCtx, ns->prefix, ns->href); - any = true; - } - } - - if (!any) - xmlXPathRegisterNs(xpathCtx, BAD_CAST "m", root->ns->href); - - xmlXPathObjectPtr obj = xmlXPathEvalExpression(BAD_CAST xpath, xpathCtx); - - if (!obj || !obj->nodesetval) - { - stringstream message; - message << "Xpath " << xpath << " did not match any nodes in XML document"; - failIf(true, message.str(), file, line); - - if (obj) - xmlXPathFreeObject(obj); - - xmlXPathFreeContext(xpathCtx); - return; - } - - string message = (string) "Incorrect count of elements for path " + xpath; - - int actual = obj->nodesetval->nodeNr; - - xmlXPathFreeObject(obj); - xmlXPathFreeContext(xpathCtx); - - failNotEqualIf(actual != expected, toString(expected), toString(actual), message, file, line); -} - -string &trim(string &str) -{ - char const *delims = " \t\r\n"; - - // trim leading whitespace - string::size_type not_white = str.find_first_not_of(delims); - - if (not_white == string::npos) - str.erase(); - else if (not_white > 0) - str.erase(0, not_white); - - if (not_white != string::npos) - { - // trim trailing whitespace - not_white = str.find_last_not_of(delims); - - if (not_white < (str.length() - 1)) - str.erase(not_white + 1); - } - - return str; -} - -void failIf(bool condition, const std::string &message, const std::string &file, int line) -{ - ASSERT_FALSE(condition) << file << "(" << line << "): Failed " << message; -} - -void failNotEqualIf(bool condition, const std::string &expected, const std::string &actual, - const std::string &message, const std::string &file, int line) -{ - ASSERT_FALSE(condition) << file << "(" << line << "): Failed not equal " << message << "\n" - << " Expected: " << expected << "\n" - << " Actual: " << actual; -} - -void assertIf(bool condition, const std::string &message, const std::string &file, int line) -{ - ASSERT_TRUE(condition) << file << "(" << line << "): Failed " << message; -} diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp index 35fb3a349..ea9b55deb 100644 --- a/test/test_utilities.hpp +++ b/test/test_utilities.hpp @@ -17,6 +17,8 @@ #pragma once +#include "mtconnect/config.hpp" + #include #include #include @@ -24,25 +26,74 @@ #include #include #include +#include +#include // Retrieve a sample file, open it, and return it as a string -std::string getFile(std::string fileLoc); +inline std::string getFile(std::string file) +{ + using namespace std; + + string path = string(PROJECT_ROOT_DIR "/test/resources/") + file; + ifstream ifs(path.c_str()); + stringstream stream; + stream << ifs.rdbuf(); + return stream.str(); +} + // Fill the error -void fillErrorText(std::string &errorXml, const std::string &text); +inline void fillErrorText(std::string& errorXml, const std::string& text) +{ +using namespace std; + +size_t pos = errorXml.find(""); + +// Error in case was not found +if (pos == string::npos) +{ + return; +} + +// Trim everything between >.... +size_t gT = pos; + +while (errorXml[gT - 1] != '>') +{ + gT--; +} + +errorXml.erase(gT, pos - gT); + +// Insert new text into pos +pos = errorXml.find(""); +errorXml.insert(pos, text); +} // Search the xml and insert a value into an attribute (attribute="") -void fillAttribute(std::string &xmlString, const std::string &attribute, const std::string &value); +inline void fillAttribute(std::string & xmlString, const std::string &attribute, + const std::string &value) +{ +using namespace std; + +size_t pos = xmlString.find(attribute + "=\"\""); -// Trim white space from string -std::string &trim(std::string &str); +if (pos == string::npos) +{ + return; +} +else +{ + pos += attribute.length() + 2; +} + +xmlString.insert(pos, value); +} /// Asserts that two XML strings are equivalent. #define ASSERT_XML_PATH_EQUAL(doc, path, expected) \ xpathTest(doc, path, expected, __FILE__, __LINE__) -void xpathTest(xmlDocPtr doc, const char *xpath, const char *expected, const std::string &file, - int line); #define PARSE_XML(expr) \ string result = expr; \ @@ -53,12 +104,231 @@ void xpathTest(xmlDocPtr doc, const char *xpath, const char *expected, const std #define ASSERT_XML_PATH_COUNT(doc, path, expected) \ xpathTestCount(doc, path, expected, __FILE__, __LINE__) -void xpathTestCount(xmlDocPtr doc, const char *xpath, int expected, const std::string &file, - int line); +inline void failIf(bool condition, const std::string &message, const std::string &file, int line) +{ + ASSERT_FALSE(condition) << file << "(" << line << "): Failed " << message; +} + +inline void failNotEqualIf(bool condition, const std::string &expected, const std::string &actual, + const std::string &message, const std::string &file, int line) +{ + ASSERT_FALSE(condition) << file << "(" << line << "): Failed not equal " << message << "\n" + << " Expected: " << expected << "\n" + << " Actual: " << actual; +} + +inline void assertIf(bool condition, const std::string &message, const std::string &file, int line) +{ + ASSERT_TRUE(condition) << file << "(" << line << "): Failed " << message; +} + +inline void xpathTest(xmlDocPtr doc, const char *xpath, const char *expected, + const std::string &file, int line) +{ + using namespace std; + + xmlNodePtr root = xmlDocGetRootElement(doc); + + string path(xpath), attribute; + size_t pos = path.find_first_of('@'); + + while (pos != string::npos && attribute.empty()) + { + if (xpath[pos - 1] != '[') + { + attribute = path.substr(pos + 1); + path = path.substr(0, pos); + } + + pos = path.find_first_of('@', pos + 1); + } + + xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc); + + bool any = false; + + for (xmlNsPtr ns = root->nsDef; ns; ns = ns->next) + { + if (ns->prefix) + { + xmlXPathRegisterNs(xpathCtx, ns->prefix, ns->href); + any = true; + } + } + + if (!any) + xmlXPathRegisterNs(xpathCtx, BAD_CAST "m", root->ns->href); + + xmlXPathObjectPtr obj = xmlXPathEvalExpression(BAD_CAST path.c_str(), xpathCtx); + + if (!obj || !obj->nodesetval || obj->nodesetval->nodeNr == 0) + { + int size; + xmlChar *memory; + xmlDocDumpFormatMemory(doc, &memory, &size, 1); + + stringstream message; + message << file << "(" << line << "): " + << "Xpath " << xpath << " did not match any nodes in XML document" << endl + << ((const char *)memory); + xmlFree(memory); + + FAIL() << message.str(); + + if (obj) + xmlXPathFreeObject(obj); + + xmlXPathFreeContext(xpathCtx); + return; + } + + // Special case when no children are expected + xmlNodePtr first = obj->nodesetval->nodeTab[0]; + + if (expected == nullptr) + { + bool has_content = false; + stringstream message; + + if (attribute.empty()) + { + message << "Xpath " << xpath << " was not supposed to have any children."; + + for (xmlNodePtr child = first->children; !has_content && child; child = child->next) + { + if (child->type == XML_ELEMENT_NODE) + { + has_content = true; + } + else if (child->type == XML_TEXT_NODE) + { + string res = (const char *)child->content; + has_content = !mtconnect::trim(res).empty(); + } + } + } + else + { + message << "Xpath " << xpath << " was not supposed to have an attribute."; + xmlChar *text = xmlGetProp(first, BAD_CAST attribute.c_str()); + + if (text) + { + message << "Value was: " << text; + has_content = true; + xmlFree(text); + } + } + + xmlXPathFreeObject(obj); + xmlXPathFreeContext(xpathCtx); + + failIf(has_content, message.str(), file, line); + return; + } + + string actual; + xmlChar *text = nullptr; + + switch (first->type) + { + case XML_ELEMENT_NODE: + if (attribute.empty()) + { + text = xmlNodeGetContent(first); + } + else if (first->properties) + { + text = xmlGetProp(first, BAD_CAST attribute.c_str()); + if (text == nullptr) + { + text = xmlStrdup(BAD_CAST "ATTRIBUTE NOT FOUND"); + } + } + + if (text) + { + actual = (const char *)text; + xmlFree(text); + } + + break; + + case XML_ATTRIBUTE_NODE: + actual = (const char *)first->content; + break; + + case XML_TEXT_NODE: + actual = (const char *)first->content; + break; + + default: + cerr << "Cannot handle type: " << first->type << endl; + } + + xmlXPathFreeObject(obj); + xmlXPathFreeContext(xpathCtx); + + mtconnect::trim(actual); + string message = (string) "Incorrect value for path " + xpath; + + if (expected[0] != '!') + { + failNotEqualIf(actual != expected, expected, actual, message, file, line); + } + else + { + expected += 1; + failNotEqualIf(actual == expected, expected, actual, message, file, line); + } +} + +inline void xpathTestCount(xmlDocPtr doc, const char *xpath, int expected, const std::string &file, + int line) + +{ + using namespace std; + + xmlNodePtr root = xmlDocGetRootElement(doc); + + xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc); + + bool any = false; + + for (xmlNsPtr ns = root->nsDef; ns; ns = ns->next) + { + if (ns->prefix) + { + xmlXPathRegisterNs(xpathCtx, ns->prefix, ns->href); + any = true; + } + } + + if (!any) + xmlXPathRegisterNs(xpathCtx, BAD_CAST "m", root->ns->href); + + xmlXPathObjectPtr obj = xmlXPathEvalExpression(BAD_CAST xpath, xpathCtx); + + if (!obj || !obj->nodesetval) + { + stringstream message; + message << "Xpath " << xpath << " did not match any nodes in XML document"; + failIf(true, message.str(), file, line); + + if (obj) + xmlXPathFreeObject(obj); + + xmlXPathFreeContext(xpathCtx); + return; + } + + string message = (string) "Incorrect count of elements for path " + xpath; -void failIf(bool condition, const std::string &message, const std::string &file, int line); + int actual = obj->nodesetval->nodeNr; -void failNotEqualIf(bool condition, const std::string &expected, const std::string &actual, - const std::string &message, const std::string &file, int line); + xmlXPathFreeObject(obj); + xmlXPathFreeContext(xpathCtx); -void assertIf(bool condition, const std::string &message, const std::string &file, int line); + failNotEqualIf(actual != expected, boost::lexical_cast(expected), + boost::lexical_cast(actual), message, file, line); +} From 23591a3c225240bc46b69f4449ae16e9c989fadc Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 30 Dec 2022 14:21:36 -0800 Subject: [PATCH 14/50] Formatted --- .../adapter/agent_adapter/url_parser.cpp | 13 ++-- test/test_utilities.hpp | 66 +++++++++---------- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp b/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp index 4334bdfbc..675ea2132 100644 --- a/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp +++ b/src/mtconnect/source/adapter/agent_adapter/url_parser.cpp @@ -36,15 +36,10 @@ BOOST_FUSION_ADAPT_STRUCT(mtconnect::source::adapter::agent_adapter::UrlQueryPai BOOST_FUSION_ADAPT_STRUCT( mtconnect::source::adapter::agent_adapter::Url, - (std::string, - m_protocol)(mtconnect::source::adapter::agent_adapter::Url::Host, - m_host)(std::optional, - m_username)(std::optional, - m_password)(std::optional, - m_port)(std::string, - m_path)(mtconnect::source::adapter:: - agent_adapter::UrlQuery, - m_query)(std::string, m_fragment)) + (std::string, m_protocol)(mtconnect::source::adapter::agent_adapter::Url::Host, + m_host)(std::optional, m_username)( + std::optional, m_password)(std::optional, m_port)(std::string, m_path)( + mtconnect::source::adapter::agent_adapter::UrlQuery, m_query)(std::string, m_fragment)) namespace mtconnect::source::adapter::agent_adapter { diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp index ea9b55deb..3de9addb6 100644 --- a/test/test_utilities.hpp +++ b/test/test_utilities.hpp @@ -17,18 +17,18 @@ #pragma once -#include "mtconnect/config.hpp" - #include #include #include #include #include -#include #include +#include #include +#include "mtconnect/config.hpp" + // Retrieve a sample file, open it, and return it as a string inline std::string getFile(std::string file) { @@ -41,60 +41,58 @@ inline std::string getFile(std::string file) return stream.str(); } - // Fill the error -inline void fillErrorText(std::string& errorXml, const std::string& text) +inline void fillErrorText(std::string &errorXml, const std::string &text) { -using namespace std; + using namespace std; -size_t pos = errorXml.find(""); + size_t pos = errorXml.find(""); -// Error in case was not found -if (pos == string::npos) -{ + // Error in case was not found + if (pos == string::npos) + { return; -} + } -// Trim everything between >.... -size_t gT = pos; + // Trim everything between >.... + size_t gT = pos; -while (errorXml[gT - 1] != '>') -{ + while (errorXml[gT - 1] != '>') + { gT--; -} + } -errorXml.erase(gT, pos - gT); + errorXml.erase(gT, pos - gT); -// Insert new text into pos -pos = errorXml.find(""); -errorXml.insert(pos, text); + // Insert new text into pos + pos = errorXml.find(""); + errorXml.insert(pos, text); } // Search the xml and insert a value into an attribute (attribute="") -inline void fillAttribute(std::string & xmlString, const std::string &attribute, - const std::string &value) +inline void fillAttribute(std::string &xmlString, const std::string &attribute, + const std::string &value) { -using namespace std; + using namespace std; -size_t pos = xmlString.find(attribute + "=\"\""); + size_t pos = xmlString.find(attribute + "=\"\""); -if (pos == string::npos) -{ + if (pos == string::npos) + { return; -} -else -{ + } + else + { pos += attribute.length() + 2; -} + } -xmlString.insert(pos, value); + xmlString.insert(pos, value); } /// Asserts that two XML strings are equivalent. #define ASSERT_XML_PATH_EQUAL(doc, path, expected) \ xpathTest(doc, path, expected, __FILE__, __LINE__) - #define PARSE_XML(expr) \ string result = expr; \ auto doc = xmlParseMemory(result.c_str(), static_cast(result.length())); \ @@ -110,7 +108,7 @@ inline void failIf(bool condition, const std::string &message, const std::string } inline void failNotEqualIf(bool condition, const std::string &expected, const std::string &actual, - const std::string &message, const std::string &file, int line) + const std::string &message, const std::string &file, int line) { ASSERT_FALSE(condition) << file << "(" << line << "): Failed not equal " << message << "\n" << " Expected: " << expected << "\n" @@ -284,7 +282,7 @@ inline void xpathTest(xmlDocPtr doc, const char *xpath, const char *expected, } inline void xpathTestCount(xmlDocPtr doc, const char *xpath, int expected, const std::string &file, - int line) + int line) { using namespace std; From c61e797f6374242e85d1896a7f3050cd6b83006d Mon Sep 17 00:00:00 2001 From: William Sobel Date: Fri, 30 Dec 2022 14:25:15 -0800 Subject: [PATCH 15/50] merged changes from format --- test/test_utilities.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp index 3de9addb6..2d80b5f1f 100644 --- a/test/test_utilities.hpp +++ b/test/test_utilities.hpp @@ -17,6 +17,9 @@ #pragma once +#include "mtconnect/config.hpp" +#include "mtconnect/utilities.hpp" + #include #include #include From 6dec8ee89feb282e5ce98cfa93f19a7c3d91c2e9 Mon Sep 17 00:00:00 2001 From: William Sobel Date: Fri, 30 Dec 2022 18:31:05 -0800 Subject: [PATCH 16/50] added main to tests for shared windows --- src/mtconnect/configuration/parser.hpp | 2 +- src/mtconnect/mqtt/mqtt_client.hpp | 2 +- src/mtconnect/mqtt/mqtt_client_impl.hpp | 4 ++-- src/mtconnect/mqtt/mqtt_server.hpp | 2 +- src/mtconnect/mqtt/mqtt_server_impl.hpp | 6 +++--- src/mtconnect/pipeline/response_document.hpp | 2 +- .../source/adapter/agent_adapter/url_parser.hpp | 4 ++-- src/mtconnect/utilities.cpp | 6 +++--- src/mtconnect/utilities.hpp | 9 +++------ test/CMakeLists.txt | 3 ++- test/adapter_test.cpp | 7 +++++++ test/agent_adapter_test.cpp | 8 ++++++++ test/agent_device_test.cpp | 7 +++++++ test/agent_test.cpp | 7 +++++++ test/asset_buffer_test.cpp | 9 +++++++++ test/asset_test.cpp | 7 +++++++ test/change_observer_test.cpp | 7 +++++++ test/checkpoint_test.cpp | 7 +++++++ test/circular_buffer_test.cpp | 7 +++++++ test/component_test.cpp | 7 +++++++ test/composition_test.cpp | 7 +++++++ test/config_parser_test.cpp | 7 +++++++ test/config_test.cpp | 7 +++++++ test/connector_test.cpp | 7 +++++++ test/coordinate_system_test.cpp | 7 +++++++ test/cutting_tool_test.cpp | 7 +++++++ test/data_item_mapping_test.cpp | 7 +++++++ test/data_item_test.cpp | 7 +++++++ test/data_set_test.cpp | 7 +++++++ test/device_test.cpp | 7 +++++++ test/duplicate_filter_test.cpp | 7 +++++++ test/embedded_ruby_test.cpp | 7 +++++++ test/entity_parser_test.cpp | 7 +++++++ test/entity_printer_test.cpp | 7 +++++++ test/entity_test.cpp | 7 +++++++ test/file_asset_test.cpp | 7 +++++++ test/file_cache_test.cpp | 7 +++++++ test/globals_test.cpp | 7 +++++++ test/http_server_test.cpp | 7 +++++++ test/json_parser_test.cpp | 7 +++++++ test/json_printer_asset_test.cpp | 7 +++++++ test/json_printer_error_test.cpp | 7 +++++++ test/json_printer_probe_test.cpp | 7 +++++++ test/json_printer_stream_test.cpp | 7 +++++++ test/json_printer_test.cpp | 7 +++++++ test/kinematics_test.cpp | 7 +++++++ test/mqtt_adapter_test.cpp | 7 +++++++ test/mqtt_isolated_test.cpp | 7 +++++++ test/mqtt_sink_test.cpp | 7 +++++++ test/mtconnect_xml_transform_test.cpp | 7 +++++++ test/observation_test.cpp | 7 +++++++ test/period_filter_test.cpp | 7 +++++++ test/pipeline_deliver_test.cpp | 7 +++++++ test/pipeline_edit_test.cpp | 7 +++++++ test/python_transform_test.cpp | 7 +++++++ test/qif_document_test.cpp | 7 +++++++ test/qname_test.cpp | 7 +++++++ test/raw_material_test.cpp | 7 +++++++ test/references_test.cpp | 7 +++++++ test/relationship_test.cpp | 7 +++++++ test/response_document_test.cpp | 7 +++++++ test/routing_test.cpp | 7 +++++++ test/sensor_configuration_test.cpp | 7 +++++++ test/shdr_tokenizer_test.cpp | 7 +++++++ test/solid_model_test.cpp | 7 +++++++ test/specification_test.cpp | 7 +++++++ test/table_test.cpp | 7 +++++++ test/test_utilities.hpp | 5 +++++ test/timestamp_extractor_test.cpp | 7 +++++++ test/tls_http_server_test.cpp | 7 +++++++ test/topic_mapping_test.cpp | 7 +++++++ test/unit_conversion_test.cpp | 7 +++++++ test/url_parser_test.cpp | 7 +++++++ test/xml_parser_test.cpp | 7 +++++++ test/xml_printer_test.cpp | 7 +++++++ 75 files changed, 475 insertions(+), 21 deletions(-) diff --git a/src/mtconnect/configuration/parser.hpp b/src/mtconnect/configuration/parser.hpp index 576df2a5f..2786c481a 100644 --- a/src/mtconnect/configuration/parser.hpp +++ b/src/mtconnect/configuration/parser.hpp @@ -31,7 +31,7 @@ namespace mtconnect { using std::runtime_error::runtime_error; }; - struct Parser + struct AGENT_LIB_API Parser { static boost::property_tree::ptree parse(const std::string &text); static boost::property_tree::ptree parse(const std::filesystem::path &path); diff --git a/src/mtconnect/mqtt/mqtt_client.hpp b/src/mtconnect/mqtt/mqtt_client.hpp index 66eb41da7..f44ac89fe 100644 --- a/src/mtconnect/mqtt/mqtt_client.hpp +++ b/src/mtconnect/mqtt/mqtt_client.hpp @@ -37,7 +37,7 @@ namespace mtconnect { Received m_receive; }; - class AGENT_LIB_API MqttClient : public std::enable_shared_from_this + class MqttClient : public std::enable_shared_from_this { public: MqttClient(boost::asio::io_context &ioc, std::unique_ptr &&handler) diff --git a/src/mtconnect/mqtt/mqtt_client_impl.hpp b/src/mtconnect/mqtt/mqtt_client_impl.hpp index c919b09fb..a57c926b7 100644 --- a/src/mtconnect/mqtt/mqtt_client_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_client_impl.hpp @@ -359,7 +359,7 @@ namespace mtconnect { mqtt_client m_client; }; - class AGENT_LIB_API MqttTlsClient : public MqttClientImpl + class MqttTlsClient : public MqttClientImpl { public: using base = MqttClientImpl; @@ -399,7 +399,7 @@ namespace mtconnect { mqtt_tls_client m_client; }; - class AGENT_LIB_API MqttTlsWSClient : public MqttClientImpl + class MqttTlsWSClient : public MqttClientImpl { public: using base = MqttClientImpl; diff --git a/src/mtconnect/mqtt/mqtt_server.hpp b/src/mtconnect/mqtt/mqtt_server.hpp index 2d7289952..95231374b 100644 --- a/src/mtconnect/mqtt/mqtt_server.hpp +++ b/src/mtconnect/mqtt/mqtt_server.hpp @@ -19,7 +19,7 @@ namespace mtconnect { namespace mqtt_server { - class AGENT_LIB_API MqttServer : public std::enable_shared_from_this + class MqttServer : public std::enable_shared_from_this { public: MqttServer(boost::asio::io_context &ioc) : m_ioContext(ioc), m_port(1883) {} diff --git a/src/mtconnect/mqtt/mqtt_server_impl.hpp b/src/mtconnect/mqtt/mqtt_server_impl.hpp index e27a2e9d3..9fe6b1b4b 100644 --- a/src/mtconnect/mqtt/mqtt_server_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_server_impl.hpp @@ -248,7 +248,7 @@ namespace mtconnect { std::string m_host; }; - class AGENT_LIB_API MqttTcpServer : public MqttServerImpl + class MqttTcpServer : public MqttServerImpl { public: using base = MqttServerImpl; @@ -278,7 +278,7 @@ namespace mtconnect { std::optional m_server; }; - class AGENT_LIB_API MqttTlsServer : public MqttServerImpl + class MqttTlsServer : public MqttServerImpl { public: using base = MqttServerImpl; @@ -324,7 +324,7 @@ namespace mtconnect { std::optional m_server; }; - class AGENT_LIB_API MqttTlsWSServer : public MqttServerImpl + class MqttTlsWSServer : public MqttServerImpl { public: using base = MqttServerImpl; diff --git a/src/mtconnect/pipeline/response_document.hpp b/src/mtconnect/pipeline/response_document.hpp index e08c3838b..50471ffb3 100644 --- a/src/mtconnect/pipeline/response_document.hpp +++ b/src/mtconnect/pipeline/response_document.hpp @@ -26,7 +26,7 @@ namespace mtconnect::pipeline { using namespace mtconnect; - struct ResponseDocument + struct AGENT_LIB_API ResponseDocument { struct Error { diff --git a/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp index 69efa6b0c..7d0f58ba1 100644 --- a/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp +++ b/src/mtconnect/source/adapter/agent_adapter/url_parser.hpp @@ -33,7 +33,7 @@ namespace mtconnect::source::adapter::agent_adapter { using UrlQueryPair = std::pair; - struct UrlQuery : public std::map + struct AGENT_LIB_API UrlQuery : public std::map { using std::map::map; std::string join() const @@ -62,7 +62,7 @@ namespace mtconnect::source::adapter::agent_adapter { } }; - struct Url + struct AGENT_LIB_API Url { using Host = std::variant; diff --git a/src/mtconnect/utilities.cpp b/src/mtconnect/utilities.cpp index 3b4d40524..2089997bf 100644 --- a/src/mtconnect/utilities.cpp +++ b/src/mtconnect/utilities.cpp @@ -45,9 +45,9 @@ using namespace std; using namespace std::chrono; namespace mtconnect { - void mt_localtime(const time_t *time, struct tm *buf) { localtime_r(time, buf); } + AGENT_LIB_API void mt_localtime(const time_t *time, struct tm *buf) { localtime_r(time, buf); } - uint64_t parseTimeMicro(const std::string &aTime) + AGENT_LIB_API uint64_t parseTimeMicro(const std::string &aTime) { struct tm timeinfo; memset(&timeinfo, 0, sizeof(timeinfo)); @@ -119,7 +119,7 @@ namespace mtconnect { return false; } - string addNamespace(const string aPath, const string aPrefix) + AGENT_LIB_API string addNamespace(const string aPath, const string aPrefix) { if (aPrefix.empty()) return aPath; diff --git a/src/mtconnect/utilities.hpp b/src/mtconnect/utilities.hpp index 6c721d06f..16e22e64c 100644 --- a/src/mtconnect/utilities.hpp +++ b/src/mtconnect/utilities.hpp @@ -153,7 +153,7 @@ namespace mtconnect { return true; } - void mt_localtime(const time_t *time, struct tm *buf); + AGENT_LIB_API void mt_localtime(const time_t *time, struct tm *buf); // Get a specified time formatted inline std::string getCurrentTime(std::chrono::time_point timePoint, @@ -202,10 +202,7 @@ namespace mtconnect { inline uint64_t getCurrentTimeInSec() { return getCurrentTimeIn(); } - // Get the current time in number of seconds as an integer - uint64_t getCurrentTimeInSec(); - - uint64_t parseTimeMicro(const std::string &aTime); + AGENT_LIB_API uint64_t parseTimeMicro(const std::string &aTime); // Replace illegal XML characters with the correct corresponding characters inline void replaceIllegalCharacters(std::string &data) @@ -231,7 +228,7 @@ namespace mtconnect { } } - std::string addNamespace(const std::string aPath, const std::string aPrefix); + AGENT_LIB_API std::string addNamespace(const std::string aPath, const std::string aPrefix); // Ends with inline bool ends_with(const std::string &value, const std::string_view &ending) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 968b539c1..1ac613660 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,6 @@ include(GoogleTest) +enable_testing() add_library(sink_plugin_test SHARED testsink_service.cpp testsink_service.hpp) target_include_directories( @@ -124,7 +125,7 @@ macro(add_agent_test AGENT_TEST_NAME ADD_TEST_HELPER SUB_FOLDER) message(info ": Setting /bigobj for ${_sources}") set_property(SOURCE ${_sources} - PROPERTY COMPILE_FLAGS "/bigobj") + PROPERTY COMPILE_FLAGS "/bigobj") endif() target_clangformat_setup(${AGENT_TEST_NAME}_test) diff --git a/test/adapter_test.cpp b/test/adapter_test.cpp index 24d16b02e..c30b4ea52 100644 --- a/test/adapter_test.cpp +++ b/test/adapter_test.cpp @@ -38,6 +38,13 @@ using namespace mtconnect::source::adapter::shdr; namespace asio = boost::asio; using namespace std::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + TEST(AdapterTest, MultilineData) { asio::io_context ioc; diff --git a/test/agent_adapter_test.cpp b/test/agent_adapter_test.cpp index e20d4ca2b..ae7336fa0 100644 --- a/test/agent_adapter_test.cpp +++ b/test/agent_adapter_test.cpp @@ -52,6 +52,14 @@ using namespace mtconnect::observation; using status = boost::beast::http::status; namespace asio = boost::asio; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + + struct MockPipelineContract : public PipelineContract { MockPipelineContract(DevicePtr &device) : m_device(device) {} diff --git a/test/agent_device_test.cpp b/test/agent_device_test.cpp index bdfe773a9..c0062f0be 100644 --- a/test/agent_device_test.cpp +++ b/test/agent_device_test.cpp @@ -41,6 +41,13 @@ namespace ip = boost::asio::ip; namespace sys = boost::system; namespace config = mtconnect::configuration; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class AgentDeviceTest : public testing::Test { protected: diff --git a/test/agent_test.cpp b/test/agent_test.cpp index bbf34a581..1b85a65e0 100644 --- a/test/agent_test.cpp +++ b/test/agent_test.cpp @@ -48,6 +48,13 @@ using namespace mtconnect::observation; using status = boost::beast::http::status; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class AgentTest : public testing::Test { public: diff --git a/test/asset_buffer_test.cpp b/test/asset_buffer_test.cpp index 0ffe93d59..f0334f1b5 100644 --- a/test/asset_buffer_test.cpp +++ b/test/asset_buffer_test.cpp @@ -42,6 +42,15 @@ using namespace mtconnect; using namespace mtconnect::entity; using namespace mtconnect::asset; + +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + + class AssetBufferTest : public testing::Test { protected: diff --git a/test/asset_test.cpp b/test/asset_test.cpp index 988943541..a2a91f460 100644 --- a/test/asset_test.cpp +++ b/test/asset_test.cpp @@ -42,6 +42,13 @@ using namespace mtconnect; using namespace mtconnect::entity; using namespace mtconnect::asset; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class AssetTest : public testing::Test { protected: diff --git a/test/change_observer_test.cpp b/test/change_observer_test.cpp index 7126404f8..561e7d9f9 100644 --- a/test/change_observer_test.cpp +++ b/test/change_observer_test.cpp @@ -26,6 +26,13 @@ using namespace std::chrono_literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + namespace mtconnect { using namespace observation; class ChangeObserverTest : public testing::Test diff --git a/test/checkpoint_test.cpp b/test/checkpoint_test.cpp index 854fefebc..5af6a77b2 100644 --- a/test/checkpoint_test.cpp +++ b/test/checkpoint_test.cpp @@ -34,6 +34,13 @@ using namespace data_item; using namespace std::literals; using namespace date::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + inline ConditionPtr Cond(ObservationPtr &ptr) { return dynamic_pointer_cast(ptr); } class CheckpointTest : public testing::Test diff --git a/test/circular_buffer_test.cpp b/test/circular_buffer_test.cpp index 06b89c81f..ca19a6ea2 100644 --- a/test/circular_buffer_test.cpp +++ b/test/circular_buffer_test.cpp @@ -35,6 +35,13 @@ using namespace data_item; using namespace std::literals; using namespace date::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + inline ConditionPtr Cond(ObservationPtr &ptr) { return dynamic_pointer_cast(ptr); } class CircularBufferTest : public testing::Test diff --git a/test/component_test.cpp b/test/component_test.cpp index 362852378..53c8c583c 100644 --- a/test/component_test.cpp +++ b/test/component_test.cpp @@ -28,6 +28,13 @@ using namespace device_model; using namespace data_item; using namespace entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class ComponentTest : public testing::Test { protected: diff --git a/test/composition_test.cpp b/test/composition_test.cpp index 156b41ca2..b9e75879b 100644 --- a/test/composition_test.cpp +++ b/test/composition_test.cpp @@ -39,6 +39,13 @@ using namespace mtconnect; using namespace device_model; using namespace entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class CompositionTest : public testing::Test { protected: diff --git a/test/config_parser_test.cpp b/test/config_parser_test.cpp index 0206c7dca..2bc8f9872 100644 --- a/test/config_parser_test.cpp +++ b/test/config_parser_test.cpp @@ -25,6 +25,13 @@ using namespace mtconnect; using namespace configuration; using namespace std; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + TEST(ConfigParserTest, parse_simple_properties) { string cfg = R"DOC( diff --git a/test/config_test.cpp b/test/config_test.cpp index 0bb46b765..08c75b6c6 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -45,6 +45,13 @@ namespace fs = std::filesystem; using namespace std::chrono_literals; using namespace boost::algorithm; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + namespace { class ConfigTest : public testing::Test { diff --git a/test/connector_test.cpp b/test/connector_test.cpp index ed60b2a33..e2fbacc7d 100644 --- a/test/connector_test.cpp +++ b/test/connector_test.cpp @@ -44,6 +44,13 @@ using tcp = boost::asio::ip::tcp; namespace ip = boost::asio::ip; namespace sys = boost::system; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class TestConnector : public Connector { public: diff --git a/test/coordinate_system_test.cpp b/test/coordinate_system_test.cpp index a5b3b0327..3b9c380a0 100644 --- a/test/coordinate_system_test.cpp +++ b/test/coordinate_system_test.cpp @@ -37,6 +37,13 @@ using namespace mtconnect; using namespace mtconnect::source::adapter; using namespace entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class CoordinateSystemTest : public testing::Test { protected: diff --git a/test/cutting_tool_test.cpp b/test/cutting_tool_test.cpp index e3fddc0fa..4ff96a0c8 100644 --- a/test/cutting_tool_test.cpp +++ b/test/cutting_tool_test.cpp @@ -45,6 +45,13 @@ using namespace mtconnect::entity; using namespace mtconnect::source::adapter; using namespace mtconnect::asset; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class CuttingToolTest : public testing::Test { protected: diff --git a/test/data_item_mapping_test.cpp b/test/data_item_mapping_test.cpp index 57d3e15bd..eda6f9229 100644 --- a/test/data_item_mapping_test.cpp +++ b/test/data_item_mapping_test.cpp @@ -34,6 +34,13 @@ using namespace device_model; using namespace data_item; using namespace std; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class MockPipelineContract : public PipelineContract { public: diff --git a/test/data_item_test.cpp b/test/data_item_test.cpp index 3b98a2df7..178bb1ca0 100644 --- a/test/data_item_test.cpp +++ b/test/data_item_test.cpp @@ -28,6 +28,13 @@ using namespace mtconnect::source::adapter; using namespace mtconnect::entity; using namespace mtconnect::device_model::data_item; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class DataItemTest : public testing::Test { protected: diff --git a/test/data_set_test.cpp b/test/data_set_test.cpp index ff92bf752..e8b789040 100644 --- a/test/data_set_test.cpp +++ b/test/data_set_test.cpp @@ -35,6 +35,13 @@ using namespace mtconnect::observation; using namespace mtconnect::sink::rest_sink; using namespace mtconnect::buffer; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class DataSetTest : public testing::Test { protected: diff --git a/test/device_test.cpp b/test/device_test.cpp index 35338312c..a0a728922 100644 --- a/test/device_test.cpp +++ b/test/device_test.cpp @@ -26,6 +26,13 @@ using namespace entity; using namespace device_model; using namespace data_item; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class DeviceTest : public testing::Test { protected: diff --git a/test/duplicate_filter_test.cpp b/test/duplicate_filter_test.cpp index ded80f8b6..a96d8e951 100644 --- a/test/duplicate_filter_test.cpp +++ b/test/duplicate_filter_test.cpp @@ -39,6 +39,13 @@ using namespace std; using namespace std::literals; using namespace std::chrono_literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class MockPipelineContract : public PipelineContract { public: diff --git a/test/embedded_ruby_test.cpp b/test/embedded_ruby_test.cpp index b1dbb086e..f5290eff7 100644 --- a/test/embedded_ruby_test.cpp +++ b/test/embedded_ruby_test.cpp @@ -56,6 +56,13 @@ #define chdir _chdir #endif +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + namespace { using namespace std; using namespace mtconnect; diff --git a/test/entity_parser_test.cpp b/test/entity_parser_test.cpp index dc2601a46..91a8f029b 100644 --- a/test/entity_parser_test.cpp +++ b/test/entity_parser_test.cpp @@ -37,6 +37,13 @@ using namespace std; using namespace mtconnect; using namespace mtconnect::entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class EntityParserTest : public testing::Test { protected: diff --git a/test/entity_printer_test.cpp b/test/entity_printer_test.cpp index f922bf24e..d8b844b54 100644 --- a/test/entity_printer_test.cpp +++ b/test/entity_printer_test.cpp @@ -40,6 +40,13 @@ using namespace mtconnect; using namespace mtconnect::entity; using namespace std::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class EntityPrinterTest : public testing::Test { protected: diff --git a/test/entity_test.cpp b/test/entity_test.cpp index 8efcc3366..974c0992e 100644 --- a/test/entity_test.cpp +++ b/test/entity_test.cpp @@ -34,6 +34,13 @@ using namespace std::literals; using namespace mtconnect; using namespace mtconnect::entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + static inline int64_t operator"" _i64(unsigned long long int i) { return int64_t(i); } class EntityTest : public testing::Test diff --git a/test/file_asset_test.cpp b/test/file_asset_test.cpp index cb04fa5e6..c4ee12878 100644 --- a/test/file_asset_test.cpp +++ b/test/file_asset_test.cpp @@ -44,6 +44,13 @@ using namespace mtconnect::source::adapter; using namespace mtconnect::asset; using namespace mtconnect::printer; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class FileAssetTest : public testing::Test { protected: diff --git a/test/file_cache_test.cpp b/test/file_cache_test.cpp index 815a37714..049802002 100644 --- a/test/file_cache_test.cpp +++ b/test/file_cache_test.cpp @@ -40,6 +40,13 @@ using namespace std; using namespace mtconnect; using namespace mtconnect::sink::rest_sink; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + #define RESOURCE_ROOT PROJECT_ROOT_DIR "/test/resources" class FileCacheTest : public testing::Test diff --git a/test/globals_test.cpp b/test/globals_test.cpp index 7ea9c3235..1db17c32e 100644 --- a/test/globals_test.cpp +++ b/test/globals_test.cpp @@ -27,6 +27,13 @@ using namespace std; using namespace mtconnect; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + TEST(GlobalsTest, IntToString) { ASSERT_EQ((string) "1234", to_string(1234)); diff --git a/test/http_server_test.cpp b/test/http_server_test.cpp index b300114aa..f9bfb335c 100644 --- a/test/http_server_test.cpp +++ b/test/http_server_test.cpp @@ -44,6 +44,13 @@ namespace beast = boost::beast; namespace http = boost::beast::http; using tcp = boost::asio::ip::tcp; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class Client { public: diff --git a/test/json_parser_test.cpp b/test/json_parser_test.cpp index 7adb8d71c..f36422994 100644 --- a/test/json_parser_test.cpp +++ b/test/json_parser_test.cpp @@ -37,6 +37,13 @@ using namespace std; using namespace mtconnect; using namespace mtconnect::entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class JsonParserTest : public testing::Test { protected: diff --git a/test/json_printer_asset_test.cpp b/test/json_printer_asset_test.cpp index 7e1cba209..02d40c792 100644 --- a/test/json_printer_asset_test.cpp +++ b/test/json_printer_asset_test.cpp @@ -47,6 +47,13 @@ using namespace mtconnect; using namespace mtconnect::buffer; using namespace mtconnect::asset; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class JsonPrinterAssetTest : public testing::Test { protected: diff --git a/test/json_printer_error_test.cpp b/test/json_printer_error_test.cpp index 9e7633b2c..147ce7967 100644 --- a/test/json_printer_error_test.cpp +++ b/test/json_printer_error_test.cpp @@ -39,6 +39,13 @@ using namespace std; using namespace mtconnect; using json = nlohmann::json; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class JsonPrinterErrorTest : public testing::Test { protected: diff --git a/test/json_printer_probe_test.cpp b/test/json_printer_probe_test.cpp index d772ec8c9..064c757f8 100644 --- a/test/json_printer_probe_test.cpp +++ b/test/json_printer_probe_test.cpp @@ -44,6 +44,13 @@ using namespace std; using namespace mtconnect; using json = nlohmann::json; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class JsonPrinterProbeTest : public testing::Test { protected: diff --git a/test/json_printer_stream_test.cpp b/test/json_printer_stream_test.cpp index dc5857e1c..d37023f79 100644 --- a/test/json_printer_stream_test.cpp +++ b/test/json_printer_stream_test.cpp @@ -45,6 +45,13 @@ using namespace mtconnect::buffer; using namespace mtconnect::observation; using namespace mtconnect::entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class JsonPrinterStreamTest : public testing::Test { protected: diff --git a/test/json_printer_test.cpp b/test/json_printer_test.cpp index 5aaaf1d2d..815983cf8 100644 --- a/test/json_printer_test.cpp +++ b/test/json_printer_test.cpp @@ -44,6 +44,13 @@ using namespace std; using namespace mtconnect; using namespace mtconnect::entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class JsonPrinterTest : public testing::Test { protected: diff --git a/test/kinematics_test.cpp b/test/kinematics_test.cpp index 5705c0005..1dd927cb1 100644 --- a/test/kinematics_test.cpp +++ b/test/kinematics_test.cpp @@ -36,6 +36,13 @@ using namespace std; using namespace mtconnect; using namespace mtconnect::entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class KinematicsTest : public testing::Test { protected: diff --git a/test/mqtt_adapter_test.cpp b/test/mqtt_adapter_test.cpp index 65be701f4..9a14699be 100644 --- a/test/mqtt_adapter_test.cpp +++ b/test/mqtt_adapter_test.cpp @@ -36,6 +36,13 @@ using namespace mtconnect::source::adapter; using namespace mtconnect::source::adapter::mqtt_adapter; namespace asio = boost::asio; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class MqttAdapterTest : public testing::Test { protected: diff --git a/test/mqtt_isolated_test.cpp b/test/mqtt_isolated_test.cpp index 3ce89633c..45e7478f0 100644 --- a/test/mqtt_isolated_test.cpp +++ b/test/mqtt_isolated_test.cpp @@ -48,6 +48,13 @@ const string ServerCertFile(PROJECT_ROOT_DIR "/test/resources/user.crt"); const string ServerKeyFile {PROJECT_ROOT_DIR "/test/resources/user.key"}; const string ServerDhFile {PROJECT_ROOT_DIR "/test/resources/dh2048.pem"}; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class MqttIsolatedUnitTest : public testing::Test { protected: diff --git a/test/mqtt_sink_test.cpp b/test/mqtt_sink_test.cpp index 63fcb72c2..213ad4c37 100644 --- a/test/mqtt_sink_test.cpp +++ b/test/mqtt_sink_test.cpp @@ -39,6 +39,13 @@ using namespace mtconnect::sink::mqtt_sink; using namespace mtconnect::asset; using namespace mtconnect::configuration; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + using json = nlohmann::json; class MqttSinkTest : public testing::Test diff --git a/test/mtconnect_xml_transform_test.cpp b/test/mtconnect_xml_transform_test.cpp index 3a9ee507d..32e9cdc0f 100644 --- a/test/mtconnect_xml_transform_test.cpp +++ b/test/mtconnect_xml_transform_test.cpp @@ -34,6 +34,13 @@ using namespace std; using namespace date::literals; using namespace std::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class MockPipelineContract : public PipelineContract { public: diff --git a/test/observation_test.cpp b/test/observation_test.cpp index 7cad0d1b2..867e549b3 100644 --- a/test/observation_test.cpp +++ b/test/observation_test.cpp @@ -40,6 +40,13 @@ using namespace data_item; using namespace std::literals; using namespace date::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class ObservationTest : public testing::Test { protected: diff --git a/test/period_filter_test.cpp b/test/period_filter_test.cpp index e535cc26e..351a950ca 100644 --- a/test/period_filter_test.cpp +++ b/test/period_filter_test.cpp @@ -40,6 +40,13 @@ using namespace std; using namespace std::literals; using namespace std::chrono_literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + struct MockPipelineContract : public PipelineContract { MockPipelineContract(std::map &items) : m_dataItems(items) {} diff --git a/test/pipeline_deliver_test.cpp b/test/pipeline_deliver_test.cpp index ab692c940..6399837f1 100644 --- a/test/pipeline_deliver_test.cpp +++ b/test/pipeline_deliver_test.cpp @@ -39,6 +39,13 @@ using namespace std::literals; using namespace std::chrono_literals; using namespace mtconnect::sink::rest_sink; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class PipelineDeliverTest : public testing::Test { protected: diff --git a/test/pipeline_edit_test.cpp b/test/pipeline_edit_test.cpp index b32f31e0b..b2ea1c830 100644 --- a/test/pipeline_edit_test.cpp +++ b/test/pipeline_edit_test.cpp @@ -40,6 +40,13 @@ using namespace std::literals; using namespace std::chrono_literals; using namespace mtconnect::sink::rest_sink; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + using TransformFun = std::function; class TestTransform : public Transform { diff --git a/test/python_transform_test.cpp b/test/python_transform_test.cpp index 8f06cab6d..06fff49dc 100644 --- a/test/python_transform_test.cpp +++ b/test/python_transform_test.cpp @@ -45,6 +45,13 @@ using namespace std::literals; using namespace std::chrono_literals; using namespace mtconnect::rest_sink; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class PythonTransformTest : public testing::Test { protected: diff --git a/test/qif_document_test.cpp b/test/qif_document_test.cpp index f5619369a..9e4ec6afd 100644 --- a/test/qif_document_test.cpp +++ b/test/qif_document_test.cpp @@ -48,6 +48,13 @@ using namespace mtconnect::source::adapter; using namespace mtconnect::asset; using namespace mtconnect::printer; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class QIFDocumentTest : public testing::Test { protected: diff --git a/test/qname_test.cpp b/test/qname_test.cpp index c3857eabc..9462d1e0e 100644 --- a/test/qname_test.cpp +++ b/test/qname_test.cpp @@ -24,6 +24,13 @@ using namespace mtconnect::entity; using namespace std; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + TEST(QNameTest, should_handle_simple_name_without_prefix) { QName qname("SomeName"); diff --git a/test/raw_material_test.cpp b/test/raw_material_test.cpp index ef010e1f8..f9586c1df 100644 --- a/test/raw_material_test.cpp +++ b/test/raw_material_test.cpp @@ -48,6 +48,13 @@ using namespace mtconnect::source::adapter; using namespace mtconnect::asset; using namespace mtconnect::printer; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class RawMaterialTest : public testing::Test { protected: diff --git a/test/references_test.cpp b/test/references_test.cpp index c20a5fe51..c87835386 100644 --- a/test/references_test.cpp +++ b/test/references_test.cpp @@ -38,6 +38,13 @@ using namespace device_model; using namespace mtconnect::source::adapter; using namespace entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class ReferencesTest : public testing::Test { protected: diff --git a/test/relationship_test.cpp b/test/relationship_test.cpp index 6b63983a8..683953e4d 100644 --- a/test/relationship_test.cpp +++ b/test/relationship_test.cpp @@ -39,6 +39,13 @@ using namespace mtconnect::source::adapter; using namespace entity; using namespace device_model; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class RelationshipTest : public testing::Test { protected: diff --git a/test/response_document_test.cpp b/test/response_document_test.cpp index c5e06ecb8..92a650798 100644 --- a/test/response_document_test.cpp +++ b/test/response_document_test.cpp @@ -36,6 +36,13 @@ using namespace std; using namespace date::literals; using namespace std::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class MockPipelineContract : public PipelineContract { public: diff --git a/test/routing_test.cpp b/test/routing_test.cpp index 2ac2bd288..b26a86576 100644 --- a/test/routing_test.cpp +++ b/test/routing_test.cpp @@ -34,6 +34,13 @@ using namespace mtconnect; using namespace mtconnect::sink::rest_sink; using verb = boost::beast::http::verb; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class RoutingTest : public testing::Test { protected: diff --git a/test/sensor_configuration_test.cpp b/test/sensor_configuration_test.cpp index 61122ae3b..1d94d46ab 100644 --- a/test/sensor_configuration_test.cpp +++ b/test/sensor_configuration_test.cpp @@ -37,6 +37,13 @@ using namespace mtconnect; using namespace mtconnect::source::adapter; using namespace entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class SensorConfigurationTest : public testing::Test { protected: diff --git a/test/shdr_tokenizer_test.cpp b/test/shdr_tokenizer_test.cpp index 0dede5852..1e426eb2d 100644 --- a/test/shdr_tokenizer_test.cpp +++ b/test/shdr_tokenizer_test.cpp @@ -32,6 +32,13 @@ using namespace std; using namespace date::literals; using namespace std::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class ShdrTokenizerTest : public testing::Test { protected: diff --git a/test/solid_model_test.cpp b/test/solid_model_test.cpp index 8d2f254b0..169eea1ef 100644 --- a/test/solid_model_test.cpp +++ b/test/solid_model_test.cpp @@ -37,6 +37,13 @@ using namespace mtconnect; using namespace mtconnect::source::adapter; using namespace entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class SolidModelTest : public testing::Test { protected: diff --git a/test/specification_test.cpp b/test/specification_test.cpp index 402b2e2fa..dff297813 100644 --- a/test/specification_test.cpp +++ b/test/specification_test.cpp @@ -38,6 +38,13 @@ using namespace mtconnect; using namespace entity; using namespace device_model; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class SpecificationTest : public testing::Test { protected: diff --git a/test/table_test.cpp b/test/table_test.cpp index 441fead7d..8da67faa2 100644 --- a/test/table_test.cpp +++ b/test/table_test.cpp @@ -43,6 +43,13 @@ using namespace std::literals; using namespace chrono_literals; using namespace date::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class TableTest : public testing::Test { protected: diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp index 2d80b5f1f..bc450fc70 100644 --- a/test/test_utilities.hpp +++ b/test/test_utilities.hpp @@ -17,12 +17,17 @@ #pragma once +// Must be first +#include +// Here + #include "mtconnect/config.hpp" #include "mtconnect/utilities.hpp" #include #include #include +#include #include #include diff --git a/test/timestamp_extractor_test.cpp b/test/timestamp_extractor_test.cpp index f6d127448..49f05525d 100644 --- a/test/timestamp_extractor_test.cpp +++ b/test/timestamp_extractor_test.cpp @@ -32,6 +32,13 @@ using namespace std::literals; using namespace date; using namespace date::literals; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + TEST(TimestampExtractorTest, TestTimeExtraction) { auto tokens = make_shared("Tokens", Properties()); diff --git a/test/tls_http_server_test.cpp b/test/tls_http_server_test.cpp index 03c4077ff..a2e146ce7 100644 --- a/test/tls_http_server_test.cpp +++ b/test/tls_http_server_test.cpp @@ -46,6 +46,13 @@ namespace http = boost::beast::http; namespace ssl = boost::asio::ssl; using tcp = boost::asio::ip::tcp; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class Client { public: diff --git a/test/topic_mapping_test.cpp b/test/topic_mapping_test.cpp index 4816f0ae4..ab277ad0e 100644 --- a/test/topic_mapping_test.cpp +++ b/test/topic_mapping_test.cpp @@ -34,6 +34,13 @@ using namespace device_model; using namespace data_item; using namespace std; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class MockPipelineContract : public PipelineContract { public: diff --git a/test/unit_conversion_test.cpp b/test/unit_conversion_test.cpp index 3d78eb219..970778cab 100644 --- a/test/unit_conversion_test.cpp +++ b/test/unit_conversion_test.cpp @@ -25,6 +25,13 @@ using namespace std; using namespace mtconnect::device_model::data_item; using namespace mtconnect::entity; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + TEST(UnitConversionTest, check_inch_3d) { auto conv = UnitConversion::make("INCH_3D", "MILLIMETER_3D"); diff --git a/test/url_parser_test.cpp b/test/url_parser_test.cpp index 60f8e6549..51afc286f 100644 --- a/test/url_parser_test.cpp +++ b/test/url_parser_test.cpp @@ -28,6 +28,13 @@ using namespace std::literals; using namespace mtconnect::source::adapter::agent_adapter; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + TEST(UrlParserTest, should_parse_url_with_port) { Url url = Url::parse("http://127.0.0.1:5000/Device"); diff --git a/test/xml_parser_test.cpp b/test/xml_parser_test.cpp index c0a479393..7ce318b93 100644 --- a/test/xml_parser_test.cpp +++ b/test/xml_parser_test.cpp @@ -35,6 +35,13 @@ using namespace entity; using namespace device_model; using namespace data_item; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + class XmlParserTest : public testing::Test { protected: diff --git a/test/xml_printer_test.cpp b/test/xml_printer_test.cpp index 61e833764..a929b2f1d 100644 --- a/test/xml_printer_test.cpp +++ b/test/xml_printer_test.cpp @@ -37,6 +37,13 @@ using namespace mtconnect::entity; using namespace mtconnect::printer; using namespace mtconnect::parser; +// main +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + Properties operator"" _value(const char *value, size_t s) { return Properties {{"VALUE", string(value)}}; From 30949e8cdc660e6441303038c6dbdcfc68f3c44c Mon Sep 17 00:00:00 2001 From: William Sobel Date: Fri, 30 Dec 2022 23:41:44 -0800 Subject: [PATCH 17/50] Windows porting issues with strands when crossing dll boundry in tests --- agent_lib/CMakeLists.txt | 3 +- src/mtconnect/pipeline/period_filter.hpp | 6 +- .../source/adapter/shdr/connector.cpp | 89 ++++++++++--------- test/connector_test.cpp | 12 ++- 4 files changed, 62 insertions(+), 48 deletions(-) diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index 2f4b98dcb..5f4584b9a 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -333,7 +333,8 @@ if(SHARED_AGENT_LIB) target_compile_definitions( agent_lib PUBLIC - SHARED_AGENT_LIB) + SHARED_AGENT_LIB + BOOST_ALL_DYN_LINK) else() add_library(agent_lib STATIC ${AGENT_SOURCES}) endif() diff --git a/src/mtconnect/pipeline/period_filter.hpp b/src/mtconnect/pipeline/period_filter.hpp index 237411170..0b9acf0e3 100644 --- a/src/mtconnect/pipeline/period_filter.hpp +++ b/src/mtconnect/pipeline/period_filter.hpp @@ -196,8 +196,10 @@ namespace mtconnect { // Bind the strand so we do not have races. Use the data item id so there are // no race conditions due to LastObservation lifecycle. - last.m_timer.async_wait(boost::asio::bind_executor( - m_strand, boost::bind(&PeriodFilter::sendObservation, this, id, _1))); + last.m_timer.async_wait([this, id](boost::system::error_code ec) { + boost::asio::dispatch(m_strand, + boost::bind(&PeriodFilter::sendObservation, this, id, ec)); + }); } void sendObservation(const std::string id, boost::system::error_code ec) diff --git a/src/mtconnect/source/adapter/shdr/connector.cpp b/src/mtconnect/source/adapter/shdr/connector.cpp index bb3db4b47..64dc4e75f 100644 --- a/src/mtconnect/source/adapter/shdr/connector.cpp +++ b/src/mtconnect/source/adapter/shdr/connector.cpp @@ -102,13 +102,13 @@ namespace mtconnect::source::adapter::shdr { << " milliseconds"; m_timer.expires_from_now(m_reconnectInterval); - m_timer.async_wait(asio::bind_executor(m_strand, [this](boost::system::error_code ec) { + m_timer.async_wait([this](boost::system::error_code ec) { if (ec != boost::asio::error::operation_aborted) { - LOG(info) << "reconnect: retrying connection"; - resolve(); + LOG(info) << "resolve: retrying connection"; + asio::dispatch(m_strand, boost::bind(&Connector::resolve, this)); } - })); + }); } else { @@ -129,9 +129,10 @@ namespace mtconnect::source::adapter::shdr { // Using a smart pointer to ensure connection is deleted if exception thrown LOG(debug) << "Connecting to data source: " << m_server << " on port: " << m_port; - asio::async_connect( - m_socket, m_results.begin(), m_results.end(), - asio::bind_executor(m_strand, boost::bind(&Connector::connected, this, _1, _2))); + asio::async_connect(m_socket, m_results.begin(), m_results.end(), + [this](const boost::system::error_code &ec, ip::tcp::resolver::iterator it) { + asio::dispatch(m_strand, boost::bind(&Connector::connected, this, ec, it)); + }); return true; } @@ -141,13 +142,13 @@ namespace mtconnect::source::adapter::shdr { NAMED_SCOPE("Connector::asyncTryConnect"); m_timer.expires_from_now(m_reconnectInterval); - m_timer.async_wait(asio::bind_executor(m_strand, [this](boost::system::error_code ec) { + m_timer.async_wait([this](boost::system::error_code ec) { if (ec != boost::asio::error::operation_aborted) { LOG(info) << "reconnect: retrying connection"; - connect(); + asio::dispatch(m_strand, boost::bind(&Connector::connect, this)); } - })); + }); } void Connector::reconnect() @@ -199,8 +200,6 @@ namespace mtconnect::source::adapter::shdr { } } -#include - void Connector::reader(sys::error_code ec, size_t len) { NAMED_SCOPE("Connector::reader"); @@ -215,33 +214,35 @@ namespace mtconnect::source::adapter::shdr { } else { - reenter(m_coroutine) + if (!m_socket.is_open()) { - while (m_connected && m_socket.is_open()) - { - m_timer.expires_from_now(m_receiveTimeLimit); - m_timer.async_wait(asio::bind_executor(m_strand, [this](boost::system::error_code ec) { - if (ec != boost::asio::error::operation_aborted) - { - LOG(warning) << "operation timed out after " << m_receiveTimeLimit.count() << "ms"; - reconnect(); - } - })); - yield asio::async_read_until( - m_socket, m_incoming, '\n', - asio::bind_executor(m_strand, boost::bind(&Connector::reader, this, _1, _2))); - m_timer.cancel(); - while (parseSocketBuffer()) - ; - } + LOG(error) << "Socket closed"; reconnect(); + return; } + + m_timer.cancel(); + + while (parseSocketBuffer()) + ; + + m_timer.expires_from_now(m_receiveTimeLimit); + m_timer.async_wait([this](boost::system::error_code ec) { + if (ec != boost::asio::error::operation_aborted) + { + LOG(warning) << "operation timed out after " << m_receiveTimeLimit.count() << "ms"; + asio::dispatch(m_strand, boost::bind(&Connector::reconnect, this)); + } + }); + + asio::async_read_until(m_socket, m_incoming, '\n', + [this](sys::error_code ec, size_t len) { + asio::dispatch(m_strand, boost::bind(&Connector::reader, this, ec, len)); + }); } } -#include - - void Connector::writer(sys::error_code ec, size_t lenght) + void Connector::writer(sys::error_code ec, size_t length) { NAMED_SCOPE("Connector::writer"); @@ -265,20 +266,20 @@ namespace mtconnect::source::adapter::shdr { NAMED_SCOPE("Connector::setReceiveTimeout"); m_receiveTimeout.expires_from_now(m_receiveTimeLimit); - m_receiveTimeout.async_wait(asio::bind_executor(m_strand, [this](sys::error_code ec) { + m_receiveTimeout.async_wait([this](sys::error_code ec) { if (!ec) { LOG(error) << "(Port:" << m_localPort << ")" << " connect: Did not receive data for over: " << m_receiveTimeLimit.count() << " ms"; - reconnect(); + asio::dispatch(m_strand, boost::bind(&Connector::reconnect, this)); } else if (ec != boost::asio::error::operation_aborted) { LOG(error) << "Receive timeout: " << ec.category().message(ec.value()) << ": " << ec.message(); } - })); + }); } inline void Connector::processLine(const std::string &line) @@ -375,9 +376,10 @@ namespace mtconnect::source::adapter::shdr { << "Sending " << command; ostream os(&m_outgoing); os << "* " << command << "\n"; - asio::async_write( - m_socket, m_outgoing, - asio::bind_executor(m_strand, boost::bind(&Connector::writer, this, _1, _2))); + asio::async_write(m_socket, m_outgoing, + [this](sys::error_code ec, size_t length) { + asio::dispatch(m_strand, boost::bind(&Connector::writer, this, ec, length)); + }); } } @@ -390,8 +392,9 @@ namespace mtconnect::source::adapter::shdr { LOG(debug) << "Sending heartbeat"; sendCommand("PING"); m_heartbeatTimer.expires_from_now(m_heartbeatFrequency); - m_heartbeatTimer.async_wait( - asio::bind_executor(m_strand, boost::bind(&Connector::heartbeat, this, _1))); + m_heartbeatTimer.async_wait([this](boost::system::error_code ec) { + asio::dispatch(m_strand, boost::bind(&Connector::heartbeat, this, ec)); + }); } else if (ec != boost::asio::error::operation_aborted) { @@ -421,7 +424,9 @@ namespace mtconnect::source::adapter::shdr { m_heartbeatTimer.expires_from_now(m_heartbeatFrequency); m_heartbeatTimer.async_wait( - asio::bind_executor(m_strand, boost::bind(&Connector::heartbeat, this, _1))); + [this](boost::system::error_code ec) { + asio::dispatch(m_strand, boost::bind(&Connector::heartbeat, this, ec)); + }); } else { diff --git a/test/connector_test.cpp b/test/connector_test.cpp index e2fbacc7d..70c09ff8d 100644 --- a/test/connector_test.cpp +++ b/test/connector_test.cpp @@ -76,7 +76,9 @@ class TestConnector : public Connector void connecting() override {} void disconnected() override { m_disconnected = true; } - void connected() override { m_disconnected = false; } + void connected() override { + m_disconnected = false; + } bool heartbeats() { return m_heartbeats; } void startHeartbeats(std::string &aString) { Connector::startHeartbeats(aString); } @@ -135,7 +137,8 @@ class ConnectorTest : public testing::Test template void runUntil(chrono::duration to, function pred) { - for (int runs = 0; runs < 10 && !pred(); runs++) + int runs; + for (runs = 0; runs < 50 && !pred(); runs++) { if (m_context.run_one_for(to) == 0) break; @@ -200,7 +203,10 @@ TEST_F(ConnectorTest, Connection) m_connector->start(m_port); - runUntil(2s, [this]() -> bool { return m_connected && m_connector->isConnected(); }); + runUntil(5s, [this]() -> bool + { + return m_connected && m_connector->isConnected(); + }); EXPECT_FALSE(m_connector->m_disconnected); auto line = read(1s); From b66123023b0ebdc9ca5f4885c038cc530f7471c1 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 30 Dec 2022 23:53:34 -0800 Subject: [PATCH 18/50] Fixed xml text to trim using boost --- test/test_utilities.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp index bc450fc70..88a066b8d 100644 --- a/test/test_utilities.hpp +++ b/test/test_utilities.hpp @@ -275,7 +275,7 @@ inline void xpathTest(xmlDocPtr doc, const char *xpath, const char *expected, xmlXPathFreeObject(obj); xmlXPathFreeContext(xpathCtx); - mtconnect::trim(actual); + actual = mtconnect::trim(actual); string message = (string) "Incorrect value for path " + xpath; if (expected[0] != '!') From 9b6b70f0a35233451d1900a94d3bcf92cad26302 Mon Sep 17 00:00:00 2001 From: William Sobel Date: Sat, 31 Dec 2022 01:06:36 -0800 Subject: [PATCH 19/50] package the lib files for windows. --- conanfile.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/conanfile.py b/conanfile.py index ab7e2550e..de0fd86f7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -63,9 +63,9 @@ class MTConnectAgentConan(ConanFile): # else: # git.clone("https://github.com/mtconnect/cppagent") - def validate(self): - if is_msvc(self) and self.options.shared and not is_msvc_static_runtime(self): - raise ConanInvalidConfiguration("Shared can only be built with DLL runtime.") +# def validate(self): +# if is_msvc(self) and self.options.shared and not is_msvc_static_runtime(self): +# raise ConanInvalidConfiguration("Shared can only be built with DLL runtime.") def configure(self): self.windows_xp = self.settings.os == 'Windows' and self.settings.compiler.toolset and \ @@ -153,10 +153,13 @@ def package_info(self): self.cpp_info.defines.append("AGENT_WITHOUT_IPV6=1") if self.options.shared: self.user_info.SHARED = 'ON' + self.cpp_info.defines.append("SHARED_AGENT_LIB=1") + self.cpp_info.defines.append("BOOST_ALL_DYN_LINK") def package(self): self.copy("*", src=os.path.join(self.build_folder, "bin"), dst="bin", keep_path=False) self.copy("*.a", src=os.path.join(self.build_folder, "lib"), dst="lib", keep_path=False) + self.copy("*.lib", src=os.path.join(self.build_folder, "lib"), dst="lib", keep_path=False) self.copy("*.dylib", src=os.path.join(self.build_folder, "lib"), dst="lib", keep_path=False) self.copy("*.so", src=os.path.join(self.build_folder, "lib"), dst="lib", keep_path=False) self.copy("*.h", src=os.path.join(self.build_folder, "agent_lib"), dst="include") From ac6a6fbc50804e96a58809e412bd8e8ef045fcfb Mon Sep 17 00:00:00 2001 From: Simon Yeung Date: Sat, 31 Dec 2022 13:20:02 -0800 Subject: [PATCH 20/50] set BOOST_ALL_DYN_LINK only for MSVC --- agent_lib/CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index 5f4584b9a..dd5ac0c47 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -330,11 +330,18 @@ if(SHARED_AGENT_LIB) agent_lib PRIVATE AGENT_BUILD_SHARED_LIB) - target_compile_definitions( - agent_lib - PUBLIC - SHARED_AGENT_LIB - BOOST_ALL_DYN_LINK) + if(MSVC) + target_compile_definitions( + agent_lib + PUBLIC + SHARED_AGENT_LIB + BOOST_ALL_DYN_LINK) + else() + target_compile_definitions( + agent_lib + PUBLIC + SHARED_AGENT_LIB) + endif() else() add_library(agent_lib STATIC ${AGENT_SOURCES}) endif() From 26ad3a56ba68727a33d3d5055337dd1331fc6199 Mon Sep 17 00:00:00 2001 From: Simon Yeung Date: Sat, 31 Dec 2022 13:24:17 -0800 Subject: [PATCH 21/50] BOOST_ALL_DYN_LINK only for Windows --- conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index de0fd86f7..3e22ba617 100644 --- a/conanfile.py +++ b/conanfile.py @@ -154,7 +154,8 @@ def package_info(self): if self.options.shared: self.user_info.SHARED = 'ON' self.cpp_info.defines.append("SHARED_AGENT_LIB=1") - self.cpp_info.defines.append("BOOST_ALL_DYN_LINK") + if self.settings.os == 'Windows': + self.cpp_info.defines.append("BOOST_ALL_DYN_LINK") def package(self): self.copy("*", src=os.path.join(self.build_folder, "bin"), dst="bin", keep_path=False) From ddb723611cc13a3b731f6962e1432e05b83f1b0b Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Mon, 2 Jan 2023 16:06:14 -0800 Subject: [PATCH 22/50] Merged --- agent_lib/CMakeLists.txt | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index dd5ac0c47..2f4b98dcb 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -330,18 +330,10 @@ if(SHARED_AGENT_LIB) agent_lib PRIVATE AGENT_BUILD_SHARED_LIB) - if(MSVC) - target_compile_definitions( - agent_lib - PUBLIC - SHARED_AGENT_LIB - BOOST_ALL_DYN_LINK) - else() - target_compile_definitions( - agent_lib - PUBLIC - SHARED_AGENT_LIB) - endif() + target_compile_definitions( + agent_lib + PUBLIC + SHARED_AGENT_LIB) else() add_library(agent_lib STATIC ${AGENT_SOURCES}) endif() From 92563a20d9f62556ba0e24b0115602b914bf404a Mon Sep 17 00:00:00 2001 From: Simon Yeung Date: Tue, 3 Jan 2023 15:58:56 -0800 Subject: [PATCH 23/50] Windows LNK2005 issue --- src/mtconnect/config.hpp | 4 ++++ src/mtconnect/version.cpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/mtconnect/config.hpp b/src/mtconnect/config.hpp index b5a22be29..70389c02c 100644 --- a/src/mtconnect/config.hpp +++ b/src/mtconnect/config.hpp @@ -81,6 +81,10 @@ typedef unsigned __int64 uint64_t; #ifdef AGENT_BUILD_SHARED_LIB #define AGENT_LIB_API AGENT_SYMBOL_EXPORT +#ifdef _WINDOWS + extern template class std::allocator; + extern template class std::basic_string; +#endif #else #define AGENT_LIB_API AGENT_SYMBOL_IMPORT #endif diff --git a/src/mtconnect/version.cpp b/src/mtconnect/version.cpp index b27f769f2..08c094100 100644 --- a/src/mtconnect/version.cpp +++ b/src/mtconnect/version.cpp @@ -34,3 +34,10 @@ void PrintMTConnectAgentVersion() { printf("%s - built on " __TIMESTAMP__ "\n", GetAgentVersion().c_str()); } + +#ifdef AGENT_BUILD_SHARED_LIB +#ifdef _WINDOWS + template class std::allocator; + template class std::basic_string; +#endif +#endif From c1519a5fe58e80e9c19cde7321c2db09d8c31ffa Mon Sep 17 00:00:00 2001 From: Simon Yeung Date: Tue, 3 Jan 2023 17:20:49 -0800 Subject: [PATCH 24/50] undo last changes --- src/mtconnect/config.hpp | 4 ---- src/mtconnect/version.cpp | 6 ------ 2 files changed, 10 deletions(-) diff --git a/src/mtconnect/config.hpp b/src/mtconnect/config.hpp index 70389c02c..b5a22be29 100644 --- a/src/mtconnect/config.hpp +++ b/src/mtconnect/config.hpp @@ -81,10 +81,6 @@ typedef unsigned __int64 uint64_t; #ifdef AGENT_BUILD_SHARED_LIB #define AGENT_LIB_API AGENT_SYMBOL_EXPORT -#ifdef _WINDOWS - extern template class std::allocator; - extern template class std::basic_string; -#endif #else #define AGENT_LIB_API AGENT_SYMBOL_IMPORT #endif diff --git a/src/mtconnect/version.cpp b/src/mtconnect/version.cpp index 08c094100..6c6a3b667 100644 --- a/src/mtconnect/version.cpp +++ b/src/mtconnect/version.cpp @@ -35,9 +35,3 @@ void PrintMTConnectAgentVersion() printf("%s - built on " __TIMESTAMP__ "\n", GetAgentVersion().c_str()); } -#ifdef AGENT_BUILD_SHARED_LIB -#ifdef _WINDOWS - template class std::allocator; - template class std::basic_string; -#endif -#endif From 66c1427a8ad2656a9806f32fec2089ce7c9ddd7a Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Wed, 4 Jan 2023 17:24:05 -0800 Subject: [PATCH 25/50] added windows validation --- conanfile.py | 16 +- simulator/nist.cfg | 60 +++++ simulator/nist.xml | 569 +++++++++++++++++++++++++++++++++++++++++++++ simulator/out.xml | 551 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1191 insertions(+), 5 deletions(-) create mode 100755 simulator/nist.cfg create mode 100644 simulator/nist.xml create mode 100644 simulator/out.xml diff --git a/conanfile.py b/conanfile.py index 3e22ba617..7098583a2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -63,20 +63,26 @@ class MTConnectAgentConan(ConanFile): # else: # git.clone("https://github.com/mtconnect/cppagent") -# def validate(self): -# if is_msvc(self) and self.options.shared and not is_msvc_static_runtime(self): -# raise ConanInvalidConfiguration("Shared can only be built with DLL runtime.") + def validate(self): + if self.settings.os == 'Windows' and self.options.shared and + str(self.settings.compiler.runtime).startswith('MT'): + raise ConanInvalidConfiguration("Shared can only be built with DLL runtime.") def configure(self): self.windows_xp = self.settings.os == 'Windows' and self.settings.compiler.toolset and \ self.settings.compiler.toolset in ('v141_xp', 'v140_xp') if self.settings.os == 'Windows': - if not self.options.shared: + if self.options.shared: + if self.settings.build_type and self.settings.build_type == 'Debug': + self.settings.compiler.runtime = 'MDd' + else: + self.settings.compiler.runtime = 'MD' + else: if self.settings.build_type and self.settings.build_type == 'Debug': self.settings.compiler.runtime = 'MTd' else: self.settings.compiler.runtime = 'MT' - + if not self.settings.compiler.version: self.settings.compiler.version = '16' diff --git a/simulator/nist.cfg b/simulator/nist.cfg new file mode 100755 index 000000000..3c8450b74 --- /dev/null +++ b/simulator/nist.cfg @@ -0,0 +1,60 @@ +Devices = nist.xml +AllowPut = true +ReconnectInterval = 1000 +BufferSize = 17 +SchemaVersion = 1.7 +MonitorConfigFiles = true +Pretty = true +# MinimumConfigReloadAge = 30 + +TlsPrivateKey = ../test/resources/user.key +TlsCertificateChain = ../test/resources/user.crt +TlsCertificatePassword = mtconnect +TlsDHKey = ../test/resources/dh2048.pem + +Adapters { + # Log file has all machines with device name prefixed + GFAgie01 { + Host = 127.0.0.1 + Port = 7878 + } + + #Mazak01 { + # Url = mqtt://localhost:1883/ + # Topics = "#" + #} +} + +PythonPath = "modules:other_modules" +PythonModules = my_transforms, other_stuff + +Files { + schemas { + Path = ../schemas + Location = /schemas/ + } + styles { + Path = ../styles + Location = /styles/ + } + Favicon { + Path = ../styles/favicon.ico + Location = /favicon.ico + } +} + +StreamsNamespaces { + x { + Urn = urn:nist.gov:NistStreams:1.3 + } +} + +StreamsStyle { + Location = /styles/Streams.xsl +} + +# Logger Configuration +logger_config +{ + logging_level = info +} diff --git a/simulator/nist.xml b/simulator/nist.xml new file mode 100644 index 000000000..e03ff6508 --- /dev/null +++ b/simulator/nist.xml @@ -0,0 +1,569 @@ + + + +
+ + + Agie Mikron HPM600U - GF Agie Charmilles HPM600U + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mazak Integrex 100-IV + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mazak QuickTurn - Mazak QuickTurn Nexus 300 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sload + + + + + + + + + + + S2load + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hurco VMX 24 #1 + + + + + + + + + + + + spindle_speed + + + SspeedOvr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hurco VMX 24 #2 + + + + + + + + + + + + spindle_speed + + + SspeedOvr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hurco VMX 24 #3 + + + + + + + + + + + + spindle_speed + + + SspeedOvr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hurco VMX 24 #4 + + + + + + + + + + + + spindle_speed + + + SspeedOvr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hurco VMX 64 + + + + + + + + + + + + spindle_speed + + + SspeedOvr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/simulator/out.xml b/simulator/out.xml new file mode 100644 index 000000000..427520473 --- /dev/null +++ b/simulator/out.xml @@ -0,0 +1,551 @@ + + + +
+ + + + + AVAILABLE + ARMED + UNAVAILABLE + UNAVAILABLE + + + Key non-functional + + + + + -0.0001 + + + + + 0 + + + + + 6.39211 + + + + + -26.3065 + + + + + 23.19091 + + + + + 99.25 + 100.75 + + + + + + + + + + + + + + -11.4562500000 -7.3124000000 21.2179700000 + + + READY + AUTOMATIC + TNC:\BRIAN\FACE BOTTOM.H + 0 + NORMAL + + + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + UNAVAILABLE + + + UNAVAILABLE + + + + + UNAVAILABLE + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + UNAVAILABLE + + + UNAVAILABLE + + + + + UNAVAILABLE + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + UNAVAILABLE + + + UNAVAILABLE + + + + + UNAVAILABLE + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + UNAVAILABLE + + + UNAVAILABLE + + + + + UNAVAILABLE + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + UNAVAILABLE + + + UNAVAILABLE + + + + + UNAVAILABLE + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + + + UNAVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + 0 + 0 + 90 + + + + + + + + 0 + 0 + 0 + 2852 + 47 + 270 + + + 100 + + + + + + + + + + 0 + 0 + 37 + + + + + + + + + -4.61264 + 28 + 1.507067 + + + + + + + + 6.933057 + 7 + 3.0099 + + + + + + + + -1.8542 + 3 + 0 + + + + + + + + + + + + + ARMED + + + + + + + + + + + + + + + + + ON + + + + + + + + + + + + + 8328015 + 41700838 + 4253246 + 67.29623 + + + 1006 + 16 + 0 + C + ACTIVE + AUTOMATIC + + + + 1 + 0 + 1 + 0 + 25 + 100 + + + + + + + + + + + + + + + + AVAILABLE + UNAVAILABLE + UNAVAILABLE + + + + + 0 + 0 + 180 + + + + + + + + 0 + 0 + 51 + + + + + + + + + 750 + 1 + 40 + + + + + + + + + 15.35684 + 44 + 0 + + + + + + + + -216.6747 + 1 + 0 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + ON + + + + + + + + + + + + + 2706723 + 14110123 + 1824843 + 0 + + + ACTIVE + AUTOMATIC + + + 100 + 9 + 0 + A + 31 + + 9 + 0 + 25 + 80 + 9 + 0 + + + ILLEGAL NUMBER INPUT + + + + + + + + + + + + + + + + + From 4a7c38642d356617240e0dd85ebc4ee10bb57c2a Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Wed, 4 Jan 2023 19:04:30 -0800 Subject: [PATCH 26/50] refactored to use new hook manager --- agent_lib/CMakeLists.txt | 1 + src/mtconnect/agent.cpp | 12 +-- src/mtconnect/agent.hpp | 21 ++--- src/mtconnect/configuration/agent_config.cpp | 7 +- src/mtconnect/configuration/agent_config.hpp | 12 +-- src/mtconnect/configuration/hook_manager.hpp | 82 +++++++++++++++++++ .../source/adapter/shdr/connector.cpp | 20 ++--- test/agent_adapter_test.cpp | 1 - test/agent_test.cpp | 8 +- test/asset_buffer_test.cpp | 2 - test/asset_test.cpp | 4 +- test/connector_test.cpp | 9 +- test/file_asset_test.cpp | 4 +- test/http_server_test.cpp | 2 +- test/test_utilities.hpp | 6 +- test/tls_http_server_test.cpp | 2 +- 16 files changed, 131 insertions(+), 62 deletions(-) create mode 100644 src/mtconnect/configuration/hook_manager.hpp diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index 2f4b98dcb..b0b6bb353 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -47,6 +47,7 @@ set(AGENT_SOURCES "${SOURCE_DIR}/configuration/agent_config.hpp" "${SOURCE_DIR}/configuration/async_context.hpp" "${SOURCE_DIR}/configuration/config_options.hpp" + "${SOURCE_DIR}/configuration/hook_manager.hpp" "${SOURCE_DIR}/configuration/parser.hpp" "${SOURCE_DIR}/configuration/service.hpp" diff --git a/src/mtconnect/agent.cpp b/src/mtconnect/agent.cpp index 9c492b064..988f6467c 100644 --- a/src/mtconnect/agent.cpp +++ b/src/mtconnect/agent.cpp @@ -115,8 +115,7 @@ namespace mtconnect { { NAMED_SCOPE("Agent::initialize"); - for (auto &hook : m_preInitializeHooks) - hook(*this); + m_beforeInitializeHooks.exec(*this); m_pipelineContext = context; m_loopback = @@ -146,8 +145,7 @@ namespace mtconnect { m_initialized = true; - for (auto &hook : m_postInitializeHooks) - hook(*this); + m_afterInitializeHooks.exec(*this); } void Agent::initialDataItemObservations() @@ -186,8 +184,7 @@ namespace mtconnect { NAMED_SCOPE("Agent::start"); try { - for (auto &hook : m_preStartHooks) - hook(*this); + m_beforeStartHooks.exec(*this); for (auto sink : m_sinks) sink->start(); @@ -215,8 +212,7 @@ namespace mtconnect { { NAMED_SCOPE("Agent::stop"); - for (auto &hook : m_preStopHooks) - hook(*this); + m_beforeStopHooks.exec(*this); // Stop all adapter threads... LOG(info) << "Shutting down sources"; diff --git a/src/mtconnect/agent.hpp b/src/mtconnect/agent.hpp index 5899360cb..48c93ac3e 100644 --- a/src/mtconnect/agent.hpp +++ b/src/mtconnect/agent.hpp @@ -40,6 +40,7 @@ #include "mtconnect/buffer/checkpoint.hpp" #include "mtconnect/buffer/circular_buffer.hpp" #include "mtconnect/config.hpp" +#include "mtconnect/configuration/hook_manager.hpp" #include "mtconnect/configuration/service.hpp" #include "mtconnect/device_model/agent_device.hpp" #include "mtconnect/device_model/device.hpp" @@ -89,14 +90,10 @@ namespace mtconnect { ~Agent(); // Hooks - void addPreInitializeHook(Hook &&hook) { m_preInitializeHooks.push_back(std::move(hook)); } - void addPreInitializeHook(Hook &hook) { m_preInitializeHooks.push_back(hook); } - void addPostInitializeHook(Hook &&hook) { m_postInitializeHooks.push_back(std::move(hook)); } - void addPostInitializeHook(Hook &hook) { m_postInitializeHooks.push_back(hook); } - void addPreStartHook(Hook &&hook) { m_preStartHooks.push_back(std::move(hook)); } - void addPreStartHook(Hook &hook) { m_preStartHooks.push_back(hook); } - void addPreStopHook(Hook &&hook) { m_preStopHooks.push_back(std::move(hook)); } - void addPreStopHook(Hook &hook) { m_preStopHooks.push_back(hook); } + auto &beforeInitializeHooks() { return m_beforeInitializeHooks; } + auto &afterInitializeHooks() { return m_afterInitializeHooks; } + auto &beforeStartHooks() { return m_beforeStartHooks; } + auto &beforeStopHooks() { return m_beforeStopHooks; } // Initialize models and pipeline void initialize(pipeline::PipelineContextPtr context); @@ -323,10 +320,10 @@ namespace mtconnect { bool m_pretty; // Agent hooks - HookList m_preInitializeHooks; - HookList m_postInitializeHooks; - HookList m_preStartHooks; - HookList m_preStopHooks; + configuration::HookManager m_beforeInitializeHooks; + configuration::HookManager m_afterInitializeHooks; + configuration::HookManager m_beforeStartHooks; + configuration::HookManager m_beforeStopHooks; }; class AGENT_LIB_API AgentPipelineContract : public pipeline::PipelineContract diff --git a/src/mtconnect/configuration/agent_config.cpp b/src/mtconnect/configuration/agent_config.cpp index e7a1ac815..0f71305d9 100644 --- a/src/mtconnect/configuration/agent_config.cpp +++ b/src/mtconnect/configuration/agent_config.cpp @@ -307,6 +307,7 @@ namespace mtconnect::configuration { LOG(warning) << "Monitor thread has detected change in configuration files."; LOG(warning) << ".... Restarting agent: " << m_configFile; + m_beforeStopHooks.exec(*this); m_agent->stop(); m_context->pause( @@ -321,6 +322,7 @@ namespace mtconnect::configuration { boost::optional(m_configFile.string()), false); options.insert(make_pair("config-file"s, value)); initialize(options); + m_beforeStartHooks.exec(*this); m_agent->start(); if (m_monitorFiles) @@ -383,6 +385,7 @@ namespace mtconnect::configuration { } m_context->setThreadCount(m_workerThreadCount); + m_beforeStartHooks.exec(*this); m_agent->start(); m_context->start(); } @@ -390,6 +393,7 @@ namespace mtconnect::configuration { void AgentConfiguration::stop() { LOG(info) << "Agent stopping"; + m_beforeStopHooks.exec(*this); m_monitorTimer.cancel(); m_restart = false; if (m_agent) @@ -720,8 +724,7 @@ namespace mtconnect::configuration { // Make the Agent m_agent = make_unique(getAsyncContext(), m_devicesFile, options); - for (auto &hook : m_afterAgentHooks) - hook(*this); + m_afterAgentHooks.exec(*this); // Make the PipelineContext m_pipelineContext = std::make_shared(); diff --git a/src/mtconnect/configuration/agent_config.hpp b/src/mtconnect/configuration/agent_config.hpp index d8262b1de..e726a4595 100644 --- a/src/mtconnect/configuration/agent_config.hpp +++ b/src/mtconnect/configuration/agent_config.hpp @@ -28,6 +28,7 @@ #include #include "async_context.hpp" +#include "hook_manager.hpp" #include "mtconnect/agent.hpp" #include "mtconnect/config.hpp" #include "mtconnect/sink/rest_sink/file_cache.hpp" @@ -65,9 +66,6 @@ namespace mtconnect { class AGENT_LIB_API AgentConfiguration : public MTConnectService { public: - using Hook = std::function; - using HookList = std::list; - using InitializationFn = void(const boost::property_tree::ptree &, AgentConfiguration &); using InitializationFunction = boost::function; @@ -77,7 +75,9 @@ namespace mtconnect { virtual ~AgentConfiguration(); // Hooks - void addAfterAgentHook(Hook &&hook) { m_afterAgentHooks.push_back(std::move(hook)); } + auto &afterAgentHooks() { return m_afterAgentHooks; } + auto &beforeStartHooks() { return m_beforeStartHooks; } + auto &beforeStopHooks() { return m_beforeStopHooks; } // For MTConnectService void stop() override; @@ -184,7 +184,9 @@ namespace mtconnect { std::unique_ptr m_python; #endif - HookList m_afterAgentHooks; + HookManager m_afterAgentHooks; + HookManager m_beforeStartHooks; + HookManager m_beforeStopHooks; }; } // namespace configuration } // namespace mtconnect diff --git a/src/mtconnect/configuration/hook_manager.hpp b/src/mtconnect/configuration/hook_manager.hpp new file mode 100644 index 000000000..7f073ff84 --- /dev/null +++ b/src/mtconnect/configuration/hook_manager.hpp @@ -0,0 +1,82 @@ +// +// Copyright Copyright 2009-2022, AMT – The Association For Manufacturing Technology (“AMT”) +// All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#pragma once + +#include +#include +#include + +#include "mtconnect/config.hpp" + +namespace mtconnect::configuration { + template + class AGENT_LIB_API HookManager + { + public: + using Hook = std::function; + using HookEntry = std::pair, Hook>; + using HookList = std::list; + + HookManager() {} + ~HookManager() {} + + // Add hooks without name, cannot be removed + void add(Hook &hook) { m_hooks.emplace_back(std::make_pair(std::nullopt, hook)); } + void add(Hook &&hook) { m_hooks.emplace_back(std::make_pair(std::nullopt, std::move(hook))); } + void addFirst(Hook &hook) { m_hooks.emplace_front(std::make_pair(std::nullopt, hook)); } + void addFirst(Hook &&hook) + { + m_hooks.emplace_front(std::make_pair(std::nullopt, std::move(hook))); + } + + // Add by name + void add(std::string &name, Hook &hook) + { + m_hooks.emplace_back(std::make_pair(std::nullopt, hook)); + } + void add(std::string &name, Hook &&hook) + { + m_hooks.emplace_back(std::make_pair(std::nullopt, std::move(hook))); + } + void addFirst(std::string &name, Hook &hook) + { + m_hooks.emplace_front(std::make_pair(std::nullopt, hook)); + } + void addFirst(std::string &name, Hook &&hook) + { + m_hooks.emplace_front(std::make_pair(std::nullopt, std::move(hook))); + } + + // Remove by name + bool remove(const std::string &name) + { + auto v = m_hooks.remove_if([&name](const auto &v) { return v.first && *v.first == name; }); + return v > 0; + } + + // Execute hooks9i + void exec(T &obj) const + { + for (const auto &h : m_hooks) + h.second(obj); + } + + protected: + HookList m_hooks; + }; +} // namespace mtconnect::configuration diff --git a/src/mtconnect/source/adapter/shdr/connector.cpp b/src/mtconnect/source/adapter/shdr/connector.cpp index 64dc4e75f..bb144eb16 100644 --- a/src/mtconnect/source/adapter/shdr/connector.cpp +++ b/src/mtconnect/source/adapter/shdr/connector.cpp @@ -129,7 +129,8 @@ namespace mtconnect::source::adapter::shdr { // Using a smart pointer to ensure connection is deleted if exception thrown LOG(debug) << "Connecting to data source: " << m_server << " on port: " << m_port; - asio::async_connect(m_socket, m_results.begin(), m_results.end(), + asio::async_connect( + m_socket, m_results.begin(), m_results.end(), [this](const boost::system::error_code &ec, ip::tcp::resolver::iterator it) { asio::dispatch(m_strand, boost::bind(&Connector::connected, this, ec, it)); }); @@ -235,10 +236,9 @@ namespace mtconnect::source::adapter::shdr { } }); - asio::async_read_until(m_socket, m_incoming, '\n', - [this](sys::error_code ec, size_t len) { + asio::async_read_until(m_socket, m_incoming, '\n', [this](sys::error_code ec, size_t len) { asio::dispatch(m_strand, boost::bind(&Connector::reader, this, ec, len)); - }); + }); } } @@ -376,10 +376,9 @@ namespace mtconnect::source::adapter::shdr { << "Sending " << command; ostream os(&m_outgoing); os << "* " << command << "\n"; - asio::async_write(m_socket, m_outgoing, - [this](sys::error_code ec, size_t length) { - asio::dispatch(m_strand, boost::bind(&Connector::writer, this, ec, length)); - }); + asio::async_write(m_socket, m_outgoing, [this](sys::error_code ec, size_t length) { + asio::dispatch(m_strand, boost::bind(&Connector::writer, this, ec, length)); + }); } } @@ -423,10 +422,9 @@ namespace mtconnect::source::adapter::shdr { setReceiveTimeout(); m_heartbeatTimer.expires_from_now(m_heartbeatFrequency); - m_heartbeatTimer.async_wait( - [this](boost::system::error_code ec) { + m_heartbeatTimer.async_wait([this](boost::system::error_code ec) { asio::dispatch(m_strand, boost::bind(&Connector::heartbeat, this, ec)); - }); + }); } else { diff --git a/test/agent_adapter_test.cpp b/test/agent_adapter_test.cpp index ae7336fa0..7ffdf82b8 100644 --- a/test/agent_adapter_test.cpp +++ b/test/agent_adapter_test.cpp @@ -59,7 +59,6 @@ int main(int argc, char *argv[]) return RUN_ALL_TESTS(); } - struct MockPipelineContract : public PipelineContract { MockPipelineContract(DevicePtr &device) : m_device(device) {} diff --git a/test/agent_test.cpp b/test/agent_test.cpp index 1b85a65e0..5733b6b82 100644 --- a/test/agent_test.cpp +++ b/test/agent_test.cpp @@ -2882,7 +2882,7 @@ TEST_F(AgentTest, pre_start_hook_should_be_called) bool called = false; Agent::Hook lambda = [&](Agent &agent) { called = true; }; AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { - helper.getAgent()->addPreStartHook(lambda); + helper.getAgent()->beforeStartHooks().add(lambda); }; m_agentTestHelper->setAgentCreateHook(helperHook); auto agent = m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); @@ -2898,7 +2898,7 @@ TEST_F(AgentTest, pre_initialize_hooks_should_be_called) bool called = false; Agent::Hook lambda = [&](Agent &agent) { called = true; }; AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { - helper.getAgent()->addPreInitializeHook(lambda); + helper.getAgent()->beforeInitializeHooks().add(lambda); }; m_agentTestHelper->setAgentCreateHook(helperHook); m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); @@ -2911,7 +2911,7 @@ TEST_F(AgentTest, post_initialize_hooks_should_be_called) bool called = false; Agent::Hook lambda = [&](Agent &agent) { called = true; }; AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { - helper.getAgent()->addPostInitializeHook(lambda); + helper.getAgent()->afterInitializeHooks().add(lambda); }; m_agentTestHelper->setAgentCreateHook(helperHook); m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); @@ -2924,7 +2924,7 @@ TEST_F(AgentTest, pre_stop_hook_should_be_called) bool called = false; Agent::Hook lambda = [&](Agent &agent) { called = true; }; AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { - helper.getAgent()->addPreStopHook(lambda); + helper.getAgent()->beforeStopHooks().add(lambda); }; m_agentTestHelper->setAgentCreateHook(helperHook); auto agent = m_agentTestHelper->createAgent("/samples/test_config.xml", 8, 4, "2.0", 4, true); diff --git a/test/asset_buffer_test.cpp b/test/asset_buffer_test.cpp index f0334f1b5..54d5c4076 100644 --- a/test/asset_buffer_test.cpp +++ b/test/asset_buffer_test.cpp @@ -42,7 +42,6 @@ using namespace mtconnect; using namespace mtconnect::entity; using namespace mtconnect::asset; - // main int main(int argc, char *argv[]) { @@ -50,7 +49,6 @@ int main(int argc, char *argv[]) return RUN_ALL_TESTS(); } - class AssetBufferTest : public testing::Test { protected: diff --git a/test/asset_test.cpp b/test/asset_test.cpp index a2a91f460..82d3aebf9 100644 --- a/test/asset_test.cpp +++ b/test/asset_test.cpp @@ -76,7 +76,7 @@ TEST_F(AssetTest, TestExtendedAsset) auto entity = parser.parse(Asset::getRoot(), doc, "1.7", errors); ASSERT_EQ(0, errors.size()); - auto asset = dynamic_cast(entity.get()); + auto asset = dynamic_cast(entity.get()); ASSERT_NE(nullptr, asset); entity::XmlPrinter printer; @@ -104,6 +104,6 @@ TEST_F(AssetTest, asset_should_parse_and_load_if_asset_id_is_missing_from_xml) auto entity = parser.parse(Asset::getRoot(), doc, "1.7", errors); ASSERT_EQ(0, errors.size()); - auto asset = dynamic_cast(entity.get()); + auto asset = dynamic_cast(entity.get()); ASSERT_NE(nullptr, asset); } diff --git a/test/connector_test.cpp b/test/connector_test.cpp index 70c09ff8d..d44fc62df 100644 --- a/test/connector_test.cpp +++ b/test/connector_test.cpp @@ -76,9 +76,7 @@ class TestConnector : public Connector void connecting() override {} void disconnected() override { m_disconnected = true; } - void connected() override { - m_disconnected = false; - } + void connected() override { m_disconnected = false; } bool heartbeats() { return m_heartbeats; } void startHeartbeats(std::string &aString) { Connector::startHeartbeats(aString); } @@ -203,10 +201,7 @@ TEST_F(ConnectorTest, Connection) m_connector->start(m_port); - runUntil(5s, [this]() -> bool - { - return m_connected && m_connector->isConnected(); - }); + runUntil(5s, [this]() -> bool { return m_connected && m_connector->isConnected(); }); EXPECT_FALSE(m_connector->m_disconnected); auto line = read(1s); diff --git a/test/file_asset_test.cpp b/test/file_asset_test.cpp index c4ee12878..5a8c0aba9 100644 --- a/test/file_asset_test.cpp +++ b/test/file_asset_test.cpp @@ -86,7 +86,7 @@ TEST_F(FileAssetTest, TestMinmalArchetype) auto entity = parser.parse(Asset::getRoot(), doc, "1.7", errors); ASSERT_EQ(0, errors.size()); - auto asset = dynamic_cast(entity.get()); + auto asset = dynamic_cast(entity.get()); ASSERT_NE(nullptr, asset); ASSERT_EQ("F1", asset->getAssetId()); @@ -144,7 +144,7 @@ TEST_F(FileAssetTest, TestMinmalFile) auto entity = parser.parse(Asset::getRoot(), doc, "1.7", errors); ASSERT_EQ(0, errors.size()); - auto asset = dynamic_cast(entity.get()); + auto asset = dynamic_cast(entity.get()); ASSERT_NE(nullptr, asset); EXPECT_EQ("F1", asset->getAssetId()); diff --git a/test/http_server_test.cpp b/test/http_server_test.cpp index f9bfb335c..9c64f9c35 100644 --- a/test/http_server_test.cpp +++ b/test/http_server_test.cpp @@ -45,7 +45,7 @@ namespace http = boost::beast::http; using tcp = boost::asio::ip::tcp; // main -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp index 88a066b8d..c3259fdbd 100644 --- a/test/test_utilities.hpp +++ b/test/test_utilities.hpp @@ -21,13 +21,10 @@ #include // Here -#include "mtconnect/config.hpp" -#include "mtconnect/utilities.hpp" - #include +#include #include #include -#include #include #include @@ -36,6 +33,7 @@ #include #include "mtconnect/config.hpp" +#include "mtconnect/utilities.hpp" // Retrieve a sample file, open it, and return it as a string inline std::string getFile(std::string file) diff --git a/test/tls_http_server_test.cpp b/test/tls_http_server_test.cpp index a2e146ce7..393a0eae2 100644 --- a/test/tls_http_server_test.cpp +++ b/test/tls_http_server_test.cpp @@ -47,7 +47,7 @@ namespace ssl = boost::asio::ssl; using tcp = boost::asio::ip::tcp; // main -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); From d663eb2c2b20721f46483eb62630431eb31e476e Mon Sep 17 00:00:00 2001 From: William Sobel Date: Thu, 17 Nov 2022 06:41:25 -0800 Subject: [PATCH 27/50] Version 2.0.0.12 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a7c9581b..d9ab6cd29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ # The version number. set(AGENT_VERSION_MAJOR 2) -set(AGENT_VERSION_MINOR 0) +set(AGENT_VERSION_MINOR 1) set(AGENT_VERSION_PATCH 0) -set(AGENT_VERSION_BUILD 13) +set(AGENT_VERSION_BUILD 2) set(AGENT_VERSION_RC "_RC1") # This minimum version is to support Visual Studio 2017 and C++ feature checking and FetchContent From 591fa2d9a488e45e73f4bfc7752790ab46aae0f2 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Tue, 20 Dec 2022 16:13:04 -0800 Subject: [PATCH 28/50] Start clean ssessions with broker --- src/mtconnect/mqtt/mqtt_client_impl.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mtconnect/mqtt/mqtt_client_impl.hpp b/src/mtconnect/mqtt/mqtt_client_impl.hpp index a57c926b7..1d207b1b9 100644 --- a/src/mtconnect/mqtt/mqtt_client_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_client_impl.hpp @@ -266,6 +266,7 @@ namespace mtconnect { if (m_handler && m_handler->m_connecting) m_handler->m_connecting(shared_from_this()); + derived().getClient()->set_clean_session(true); derived().getClient()->async_connect([this](mqtt::error_code ec) { if (ec) { From 60ec094051d0cf3d6250986dc57194a5f54f9b30 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 5 Jan 2023 15:25:08 -0800 Subject: [PATCH 29/50] Added asset relationship to device model --- samples/configuration.xml | 1 + .../configuration/relationships.cpp | 16 +++++- test/relationship_test.cpp | 53 +++++++++++++++---- 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/samples/configuration.xml b/samples/configuration.xml index dcba0e73d..27189e796 100644 --- a/samples/configuration.xml +++ b/samples/configuration.xml @@ -39,6 +39,7 @@ + diff --git a/src/mtconnect/device_model/configuration/relationships.cpp b/src/mtconnect/device_model/configuration/relationships.cpp index c98445f5a..1d8915b74 100644 --- a/src/mtconnect/device_model/configuration/relationships.cpp +++ b/src/mtconnect/device_model/configuration/relationships.cpp @@ -39,18 +39,30 @@ namespace mtconnect { Requirement("deviceUuidRef", true), Requirement("role", ControlledVocab {"SYSTEM", "AUXILIARY"}, false), Requirement("href", false), - Requirement("xlink:type", false), + Requirement("xlink:type", false) }); auto componentRelationship = make_shared(*relationship); componentRelationship->addRequirements(Requirements {Requirement("idRef", true)}); + auto assetRelationship = make_shared(*relationship); + + assetRelationship->addRequirements(Requirements { + Requirement("assetIdRef", true), + Requirement("assetType", true), + Requirement("href", false), + Requirement("xlink:type", false) + }); + relationships = make_shared( Requirements {Requirement("ComponentRelationship", ENTITY, componentRelationship, 0, Requirement::Infinite), Requirement("DeviceRelationship", ENTITY, deviceRelationship, 0, - Requirement::Infinite)}); + Requirement::Infinite), + Requirement("AssetRelationship", ENTITY, assetRelationship, 0, + Requirement::Infinite) + }); relationships->registerMatchers(); diff --git a/test/relationship_test.cpp b/test/relationship_test.cpp index 683953e4d..d99331661 100644 --- a/test/relationship_test.cpp +++ b/test/relationship_test.cpp @@ -71,24 +71,26 @@ class RelationshipTest : public testing::Test TEST_F(RelationshipTest, ParseDeviceAndComponentRelationships) { ASSERT_NE(nullptr, m_component); - + const auto &clc = m_component->get("Configuration"); ASSERT_TRUE(clc); - + auto rels = clc->getList("Relationships"); - - ASSERT_EQ(2, rels->size()); - + + ASSERT_EQ(3, rels->size()); + auto it = rels->begin(); - + + EXPECT_EQ("ComponentRelationship", (*it)->getName()); EXPECT_EQ("ref1", (*it)->get("id")); EXPECT_EQ("Power", (*it)->get("name")); EXPECT_EQ("PEER", (*it)->get("type")); EXPECT_EQ("CRITICAL", (*it)->get("criticality")); EXPECT_EQ("power", (*it)->get("idRef")); - + it++; - + + EXPECT_EQ("DeviceRelationship", (*it)->getName()); EXPECT_EQ("ref2", (*it)->get("id")); EXPECT_EQ("coffee", (*it)->get("name")); EXPECT_EQ("PARENT", (*it)->get("type")); @@ -96,6 +98,17 @@ TEST_F(RelationshipTest, ParseDeviceAndComponentRelationships) EXPECT_EQ("AUXILIARY", (*it)->get("role")); EXPECT_EQ("http://127.0.0.1:2000/coffee", (*it)->get("href")); EXPECT_EQ("bfccbfb0-5111-0138-6cd5-0c85909298d9", (*it)->get("deviceUuidRef")); + + it++; + + EXPECT_EQ("AssetRelationship", (*it)->getName()); + EXPECT_EQ("ref3", (*it)->get("id")); + EXPECT_EQ("asset", (*it)->get("name")); + EXPECT_EQ("CuttingTool", (*it)->get("assetType")); + EXPECT_EQ("PEER", (*it)->get("type")); + EXPECT_EQ("NON_CRITICAL", (*it)->get("criticality")); + EXPECT_EQ("http://127.0.0.1:2000/asset/f7de7350-6f7a-013b-ca4c-4e7f553bbb76", (*it)->get("href")); + EXPECT_EQ("f7de7350-6f7a-013b-ca4c-4e7f553bbb76", (*it)->get("assetIdRef")); } #define CONFIGURATION_PATH "//m:Rotary[@id='c']/m:Configuration" @@ -107,7 +120,7 @@ TEST_F(RelationshipTest, XmlPrinting) PARSE_XML_RESPONSE("/probe"); ASSERT_XML_PATH_COUNT(doc, RELATIONSHIPS_PATH, 1); - ASSERT_XML_PATH_COUNT(doc, RELATIONSHIPS_PATH "/*", 2); + ASSERT_XML_PATH_COUNT(doc, RELATIONSHIPS_PATH "/*", 3); ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:ComponentRelationship@id", "ref1"); ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:ComponentRelationship@name", "Power"); @@ -126,6 +139,15 @@ TEST_F(RelationshipTest, XmlPrinting) "http://127.0.0.1:2000/coffee"); ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:DeviceRelationship@deviceUuidRef", "bfccbfb0-5111-0138-6cd5-0c85909298d9"); + + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@id", "ref3"); + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@name", "asset"); + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@type", "PEER"); + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@assetType", "CuttingTool"); + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@criticality", + "NON_CRITICAL"); + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@assetIdRef", "f7de7350-6f7a-013b-ca4c-4e7f553bbb76"); + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@href", "http://127.0.0.1:2000/asset/f7de7350-6f7a-013b-ca4c-4e7f553bbb76"); } } @@ -141,7 +163,7 @@ TEST_F(RelationshipTest, JsonPrinting) auto relationships = rotary.at("/Configuration/Relationships"_json_pointer); ASSERT_TRUE(relationships.is_array()); - ASSERT_EQ(2_S, relationships.size()); + ASSERT_EQ(3_S, relationships.size()); auto crel = relationships.at(0); auto cfields = crel.at("/ComponentRelationship"_json_pointer); @@ -160,5 +182,16 @@ TEST_F(RelationshipTest, JsonPrinting) EXPECT_EQ("AUXILIARY", dfields["role"]); EXPECT_EQ("http://127.0.0.1:2000/coffee", dfields["href"]); EXPECT_EQ("bfccbfb0-5111-0138-6cd5-0c85909298d9", dfields["deviceUuidRef"]); + + auto arel = relationships.at(2); + auto afields = arel.at("/AssetRelationship"_json_pointer); + EXPECT_EQ("ref3", afields["id"]); + EXPECT_EQ("asset", afields["name"]); + EXPECT_EQ("PEER", afields["type"]); + EXPECT_EQ("CuttingTool", afields["assetType"]); + EXPECT_EQ("NON_CRITICAL", afields["criticality"]); + EXPECT_EQ("http://127.0.0.1:2000/asset/f7de7350-6f7a-013b-ca4c-4e7f553bbb76", afields["href"]); + EXPECT_EQ("f7de7350-6f7a-013b-ca4c-4e7f553bbb76", afields["assetIdRef"]); + } } From 629b2c680d1522dd3f4610cff6d277f2bc2d2b02 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Wed, 11 Jan 2023 12:37:55 -0800 Subject: [PATCH 30/50] merged in changes for asset relationship --- conanfile.py | 2 +- .../configuration/relationships.cpp | 22 +++++--------- src/mtconnect/entity/data_set.hpp | 2 +- test/relationship_test.cpp | 30 ++++++++++--------- 4 files changed, 26 insertions(+), 30 deletions(-) diff --git a/conanfile.py b/conanfile.py index 7098583a2..9436ae667 100644 --- a/conanfile.py +++ b/conanfile.py @@ -64,7 +64,7 @@ class MTConnectAgentConan(ConanFile): # git.clone("https://github.com/mtconnect/cppagent") def validate(self): - if self.settings.os == 'Windows' and self.options.shared and + if self.settings.os == 'Windows' and self.options.shared and \ str(self.settings.compiler.runtime).startswith('MT'): raise ConanInvalidConfiguration("Shared can only be built with DLL runtime.") diff --git a/src/mtconnect/device_model/configuration/relationships.cpp b/src/mtconnect/device_model/configuration/relationships.cpp index 1d8915b74..bf993f03b 100644 --- a/src/mtconnect/device_model/configuration/relationships.cpp +++ b/src/mtconnect/device_model/configuration/relationships.cpp @@ -35,12 +35,10 @@ namespace mtconnect { auto deviceRelationship = make_shared(*relationship); - deviceRelationship->addRequirements(Requirements { - Requirement("deviceUuidRef", true), - Requirement("role", ControlledVocab {"SYSTEM", "AUXILIARY"}, false), - Requirement("href", false), - Requirement("xlink:type", false) - }); + deviceRelationship->addRequirements( + Requirements {Requirement("deviceUuidRef", true), + Requirement("role", ControlledVocab {"SYSTEM", "AUXILIARY"}, false), + Requirement("href", false), Requirement("xlink:type", false)}); auto componentRelationship = make_shared(*relationship); @@ -48,12 +46,9 @@ namespace mtconnect { auto assetRelationship = make_shared(*relationship); - assetRelationship->addRequirements(Requirements { - Requirement("assetIdRef", true), - Requirement("assetType", true), - Requirement("href", false), - Requirement("xlink:type", false) - }); + assetRelationship->addRequirements( + Requirements {Requirement("assetIdRef", true), Requirement("assetType", true), + Requirement("href", false), Requirement("xlink:type", false)}); relationships = make_shared( Requirements {Requirement("ComponentRelationship", ENTITY, componentRelationship, 0, @@ -61,8 +56,7 @@ namespace mtconnect { Requirement("DeviceRelationship", ENTITY, deviceRelationship, 0, Requirement::Infinite), Requirement("AssetRelationship", ENTITY, assetRelationship, 0, - Requirement::Infinite) - }); + Requirement::Infinite)}); relationships->registerMatchers(); diff --git a/src/mtconnect/entity/data_set.hpp b/src/mtconnect/entity/data_set.hpp index 8bfb7b68b..b92bfe9e1 100644 --- a/src/mtconnect/entity/data_set.hpp +++ b/src/mtconnect/entity/data_set.hpp @@ -105,7 +105,7 @@ namespace mtconnect::entity { if (v == end()) return std::nullopt; else - return get(v->m_value); + return std::get(v->m_value); } inline bool DataSetValueSame::operator()(const DataSet &v) diff --git a/test/relationship_test.cpp b/test/relationship_test.cpp index d99331661..86d330d7f 100644 --- a/test/relationship_test.cpp +++ b/test/relationship_test.cpp @@ -71,25 +71,25 @@ class RelationshipTest : public testing::Test TEST_F(RelationshipTest, ParseDeviceAndComponentRelationships) { ASSERT_NE(nullptr, m_component); - + const auto &clc = m_component->get("Configuration"); ASSERT_TRUE(clc); - + auto rels = clc->getList("Relationships"); - + ASSERT_EQ(3, rels->size()); - + auto it = rels->begin(); - + EXPECT_EQ("ComponentRelationship", (*it)->getName()); EXPECT_EQ("ref1", (*it)->get("id")); EXPECT_EQ("Power", (*it)->get("name")); EXPECT_EQ("PEER", (*it)->get("type")); EXPECT_EQ("CRITICAL", (*it)->get("criticality")); EXPECT_EQ("power", (*it)->get("idRef")); - + it++; - + EXPECT_EQ("DeviceRelationship", (*it)->getName()); EXPECT_EQ("ref2", (*it)->get("id")); EXPECT_EQ("coffee", (*it)->get("name")); @@ -98,7 +98,7 @@ TEST_F(RelationshipTest, ParseDeviceAndComponentRelationships) EXPECT_EQ("AUXILIARY", (*it)->get("role")); EXPECT_EQ("http://127.0.0.1:2000/coffee", (*it)->get("href")); EXPECT_EQ("bfccbfb0-5111-0138-6cd5-0c85909298d9", (*it)->get("deviceUuidRef")); - + it++; EXPECT_EQ("AssetRelationship", (*it)->getName()); @@ -107,7 +107,8 @@ TEST_F(RelationshipTest, ParseDeviceAndComponentRelationships) EXPECT_EQ("CuttingTool", (*it)->get("assetType")); EXPECT_EQ("PEER", (*it)->get("type")); EXPECT_EQ("NON_CRITICAL", (*it)->get("criticality")); - EXPECT_EQ("http://127.0.0.1:2000/asset/f7de7350-6f7a-013b-ca4c-4e7f553bbb76", (*it)->get("href")); + EXPECT_EQ("http://127.0.0.1:2000/asset/f7de7350-6f7a-013b-ca4c-4e7f553bbb76", + (*it)->get("href")); EXPECT_EQ("f7de7350-6f7a-013b-ca4c-4e7f553bbb76", (*it)->get("assetIdRef")); } @@ -139,15 +140,17 @@ TEST_F(RelationshipTest, XmlPrinting) "http://127.0.0.1:2000/coffee"); ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:DeviceRelationship@deviceUuidRef", "bfccbfb0-5111-0138-6cd5-0c85909298d9"); - + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@id", "ref3"); ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@name", "asset"); ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@type", "PEER"); ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@assetType", "CuttingTool"); ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@criticality", "NON_CRITICAL"); - ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@assetIdRef", "f7de7350-6f7a-013b-ca4c-4e7f553bbb76"); - ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@href", "http://127.0.0.1:2000/asset/f7de7350-6f7a-013b-ca4c-4e7f553bbb76"); + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@assetIdRef", + "f7de7350-6f7a-013b-ca4c-4e7f553bbb76"); + ASSERT_XML_PATH_EQUAL(doc, RELATIONSHIPS_PATH "/m:AssetRelationship@href", + "http://127.0.0.1:2000/asset/f7de7350-6f7a-013b-ca4c-4e7f553bbb76"); } } @@ -182,7 +185,7 @@ TEST_F(RelationshipTest, JsonPrinting) EXPECT_EQ("AUXILIARY", dfields["role"]); EXPECT_EQ("http://127.0.0.1:2000/coffee", dfields["href"]); EXPECT_EQ("bfccbfb0-5111-0138-6cd5-0c85909298d9", dfields["deviceUuidRef"]); - + auto arel = relationships.at(2); auto afields = arel.at("/AssetRelationship"_json_pointer); EXPECT_EQ("ref3", afields["id"]); @@ -192,6 +195,5 @@ TEST_F(RelationshipTest, JsonPrinting) EXPECT_EQ("NON_CRITICAL", afields["criticality"]); EXPECT_EQ("http://127.0.0.1:2000/asset/f7de7350-6f7a-013b-ca4c-4e7f553bbb76", afields["href"]); EXPECT_EQ("f7de7350-6f7a-013b-ca4c-4e7f553bbb76", afields["assetIdRef"]); - } } From 9698b6589268b99d2569f645e39577a50bddc244 Mon Sep 17 00:00:00 2001 From: William Sobel Date: Fri, 13 Jan 2023 20:34:43 -0800 Subject: [PATCH 31/50] Added winver to conan package --- conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conanfile.py b/conanfile.py index 9436ae667..35429af86 100644 --- a/conanfile.py +++ b/conanfile.py @@ -161,6 +161,8 @@ def package_info(self): self.user_info.SHARED = 'ON' self.cpp_info.defines.append("SHARED_AGENT_LIB=1") if self.settings.os == 'Windows': + self.cpp_info.defines.append("WINVER=0x0600") + self.cpp_info.defines.append("_WIN32_WINNT=0x0600") self.cpp_info.defines.append("BOOST_ALL_DYN_LINK") def package(self): From 9ae9ac9bdc350a13075a1c9ac8288a144db6eed3 Mon Sep 17 00:00:00 2001 From: William Sobel Date: Fri, 13 Jan 2023 21:37:12 -0800 Subject: [PATCH 32/50] Ported changed to windows --- src/mtconnect/configuration/hook_manager.hpp | 2 +- src/mtconnect/entity/requirement.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mtconnect/configuration/hook_manager.hpp b/src/mtconnect/configuration/hook_manager.hpp index 7f073ff84..608f208a0 100644 --- a/src/mtconnect/configuration/hook_manager.hpp +++ b/src/mtconnect/configuration/hook_manager.hpp @@ -25,7 +25,7 @@ namespace mtconnect::configuration { template - class AGENT_LIB_API HookManager + class HookManager { public: using Hook = std::function; diff --git a/src/mtconnect/entity/requirement.hpp b/src/mtconnect/entity/requirement.hpp index ccf29351c..7f42c2d14 100644 --- a/src/mtconnect/entity/requirement.hpp +++ b/src/mtconnect/entity/requirement.hpp @@ -76,7 +76,7 @@ namespace mtconnect { using Pattern = std::optional; using VocabSet = std::optional>; - bool ConvertValueToType(Value &value, ValueType type, bool table = false); + bool AGENT_LIB_API ConvertValueToType(Value &value, ValueType type, bool table = false); class AGENT_LIB_API EntityError : public std::logic_error { From dcc799fca2cb0431b260013c23c0a8f8f0cf85fe Mon Sep 17 00:00:00 2001 From: William Sobel Date: Fri, 13 Jan 2023 23:14:55 -0800 Subject: [PATCH 33/50] add dlls to installation of shared package --- agent/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agent/CMakeLists.txt b/agent/CMakeLists.txt index e5800c8a6..82f5405e1 100644 --- a/agent/CMakeLists.txt +++ b/agent/CMakeLists.txt @@ -47,4 +47,6 @@ if(SHARED_AGENT_LIB AND MSVC) set(CMAKE_INSTALL_DEBUG_LIBRARIES ON) include(InstallRequiredSystemLibraries) install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION bin COMPONENT Libraries) + install(DIRECTORY "${PROJECT_BINARY_DIR}/bin/" DESTINATION bin COMPONENT Libraries + FILES_MATCHING PATTERN "*.dll") endif() From 5b56084bf520442ed9e27aaf94b7a600f499dfec Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Sat, 14 Jan 2023 19:36:03 -0800 Subject: [PATCH 34/50] added winver as a setting --- conanfile.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/conanfile.py b/conanfile.py index 35429af86..99dbaaebd 100644 --- a/conanfile.py +++ b/conanfile.py @@ -16,7 +16,7 @@ class MTConnectAgentConan(ConanFile): settings = "os", "compiler", "arch", "build_type", "arch_build" options = { "run_tests": [True, False], "build_tests": [True, False], "without_ruby": [True, False], "without_ipv6": [True, False], "with_ruby": [True, False], - "development" : [True, False], "shared": [True, False] } + "development" : [True, False], "shared": [True, False], "winver": "ANY" } description = "MTConnect reference C++ agent copyright Association for Manufacturing Technology" requires = ["boost/1.79.0@#3249d9bd2b863a9489767bf9c8a05b4b", @@ -35,6 +35,7 @@ class MTConnectAgentConan(ConanFile): "with_ruby": True, "development": False, "shared": False, + "winver": "0x600", "boost:shared": False, "boost:without_python": True, @@ -72,6 +73,10 @@ def configure(self): self.windows_xp = self.settings.os == 'Windows' and self.settings.compiler.toolset and \ self.settings.compiler.toolset in ('v141_xp', 'v140_xp') if self.settings.os == 'Windows': + if self.windows_xp: + self.options.build_tests = False + self.options.winver == '0x501' + if self.options.shared: if self.settings.build_type and self.settings.build_type == 'Debug': self.settings.compiler.runtime = 'MDd' @@ -91,8 +96,6 @@ def configure(self): self.settings.compiler.cppstd = 17 - if self.windows_xp: - self.options.build_tests = False if not self.options.build_tests: self.options.run_tests = False @@ -129,9 +132,9 @@ def build(self): cmake.definitions['WITH_RUBY'] = 'ON' else: cmake.definitions['WITH_RUBY'] = 'OFF' - - if self.windows_xp: - cmake.definitions['WINVER'] = '0x0501' + + if self.settings.os == 'Windows': + cmake.definitions['WINVER'] = self.options.winver if self.options.shared: cmake.definitions['SHARED_AGENT_LIB'] = 'ON' @@ -160,10 +163,11 @@ def package_info(self): if self.options.shared: self.user_info.SHARED = 'ON' self.cpp_info.defines.append("SHARED_AGENT_LIB=1") - if self.settings.os == 'Windows': - self.cpp_info.defines.append("WINVER=0x0600") - self.cpp_info.defines.append("_WIN32_WINNT=0x0600") - self.cpp_info.defines.append("BOOST_ALL_DYN_LINK") + self.cpp_info.defines.append("BOOST_ALL_DYN_LINK") + + if self.settings.os == 'Windows': + self.cpp_info.defines.append("WINVER=" + self.options.winver) + self.cpp_info.defines.append("_WIN32_WINNT=" + self.options..winver) def package(self): self.copy("*", src=os.path.join(self.build_folder, "bin"), dst="bin", keep_path=False) From 8baed8e65be070db7ff370491b101284e8434577 Mon Sep 17 00:00:00 2001 From: William Sobel Date: Sun, 15 Jan 2023 20:18:22 -0800 Subject: [PATCH 35/50] Some changes for xp port --- conan/profiles/vsxp | 10 ++++++++-- conanfile.py | 8 ++------ src/mtconnect/asset/asset.hpp | 2 +- src/mtconnect/config.hpp | 4 ++++ src/mtconnect/configuration/agent_config.cpp | 7 ++++--- src/mtconnect/device_model/component.cpp | 19 ++++++++++--------- .../device_model/data_item/constraints.hpp | 13 +++++++------ .../device_model/data_item/definition.hpp | 14 +++++++------- .../device_model/data_item/filter.hpp | 6 +++--- .../device_model/data_item/relationships.hpp | 4 ++-- src/mtconnect/entity/factory.hpp | 3 ++- src/mtconnect/entity/requirement.hpp | 8 ++++---- 12 files changed, 54 insertions(+), 44 deletions(-) diff --git a/conan/profiles/vsxp b/conan/profiles/vsxp index 3f4897b2e..d61bbc81e 100644 --- a/conan/profiles/vsxp +++ b/conan/profiles/vsxp @@ -3,9 +3,15 @@ include(default) [settings] compiler=Visual Studio arch=x86 -arch_build=x86 compiler.toolset=v141_xp compiler.runtime=MT +[options] +winver=0x0501 +with_ruby=False +date:header_only=True + [env] -WINVER=0x0501 \ No newline at end of file +WINVER=0x0501 +CFLAGS=/DWINVER=0x0501 /D_WIN32_WINNT=0x0501 /DNTDDI_VERSION=0x05010300 +CXXFLAGS=/DWINVER=0x0501 /D_WIN32_WINNT=0x0501 /DNTDDI_VERSION=0x05010300 diff --git a/conanfile.py b/conanfile.py index 99dbaaebd..7ee2f3acd 100644 --- a/conanfile.py +++ b/conanfile.py @@ -15,7 +15,7 @@ class MTConnectAgentConan(ConanFile): license = "Apache License 2.0" settings = "os", "compiler", "arch", "build_type", "arch_build" options = { "run_tests": [True, False], "build_tests": [True, False], - "without_ruby": [True, False], "without_ipv6": [True, False], "with_ruby": [True, False], + "without_ipv6": [True, False], "with_ruby": [True, False], "development" : [True, False], "shared": [True, False], "winver": "ANY" } description = "MTConnect reference C++ agent copyright Association for Manufacturing Technology" @@ -30,7 +30,6 @@ class MTConnectAgentConan(ConanFile): default_options = { "run_tests": True, "build_tests": True, - "without_ruby": False, "without_ipv6": False, "with_ruby": True, "development": False, @@ -100,9 +99,6 @@ def configure(self): if not self.options.build_tests: self.options.run_tests = False - if not self.options.without_ruby: - self.options.with_ruby = True - if not self.options.shared and self.settings.os == "Macos": self.options["boost"].visibility = "hidden" @@ -167,7 +163,7 @@ def package_info(self): if self.settings.os == 'Windows': self.cpp_info.defines.append("WINVER=" + self.options.winver) - self.cpp_info.defines.append("_WIN32_WINNT=" + self.options..winver) + self.cpp_info.defines.append("_WIN32_WINNT=" + self.options.winver) def package(self): self.copy("*", src=os.path.join(self.build_folder, "bin"), dst="bin", keep_path=False) diff --git a/src/mtconnect/asset/asset.hpp b/src/mtconnect/asset/asset.hpp index ce71319fa..57e4abae6 100644 --- a/src/mtconnect/asset/asset.hpp +++ b/src/mtconnect/asset/asset.hpp @@ -56,7 +56,7 @@ namespace mtconnect { if (std::holds_alternative(r)) m_removed = std::get(r); else - entity::ConvertValueToType(r, entity::BOOL); + entity::ConvertValueToType(r, entity::ValueType::BOOL); } m_properties.insert_or_assign(key, r); diff --git a/src/mtconnect/config.hpp b/src/mtconnect/config.hpp index b5a22be29..c5fa269a6 100644 --- a/src/mtconnect/config.hpp +++ b/src/mtconnect/config.hpp @@ -17,6 +17,10 @@ // limitations under the License. // +#pragma once + +#include + #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif diff --git a/src/mtconnect/configuration/agent_config.cpp b/src/mtconnect/configuration/agent_config.cpp index ea850ccc8..f677924ae 100644 --- a/src/mtconnect/configuration/agent_config.cpp +++ b/src/mtconnect/configuration/agent_config.cpp @@ -15,6 +15,8 @@ // limitations under the License. // +#include "mtconnect/config.hpp" + #include "agent_config.hpp" #include @@ -802,7 +804,7 @@ namespace mtconnect::configuration { {{configuration::Url, string()}, {configuration::Device, string()}}); auto qname = entity::QName(block.first); - auto [factory, name] = qname.getPair(); + auto [factory, name] = qname.getPair(); auto deviceName = GetOption(adapterOptions, configuration::Device).value_or(name); device = m_agent->getDeviceByName(deviceName); @@ -855,9 +857,8 @@ namespace mtconnect::configuration { } // Override if protocol if not specified - string protocol; AddDefaultedOptions(block.second, adapterOptions, {{configuration::Protocol, "shdr"s}}); - protocol = *GetOption(adapterOptions, configuration::Protocol); + auto protocol = *GetOption(adapterOptions, configuration::Protocol); if (factory.empty()) factory = protocol; diff --git a/src/mtconnect/device_model/component.cpp b/src/mtconnect/device_model/component.cpp index 1c9b6a139..4cb2815d0 100644 --- a/src/mtconnect/device_model/component.cpp +++ b/src/mtconnect/device_model/component.cpp @@ -106,14 +106,14 @@ namespace mtconnect { {"id", true}, {"name", false}, {"nativeName", false}, - {"sampleRate", DOUBLE, false}, - {"sampleInterval", DOUBLE, false}, + {"sampleRate", ValueType::DOUBLE, false}, + {"sampleInterval", ValueType::DOUBLE, false}, {"uuid", false}, - {"Description", ENTITY, description, false}, - {"DataItems", ENTITY_LIST, dataItems, false}, - {"Compositions", ENTITY_LIST, compositions, false}, - {"References", ENTITY_LIST, references, false}, - {"Configuration", ENTITY, configuration, false}}, + {"Description", ValueType::ENTITY, description, false}, + {"DataItems", ValueType::ENTITY_LIST, dataItems, false}, + {"Compositions", ValueType::ENTITY_LIST, compositions, false}, + {"References", ValueType::ENTITY_LIST, references, false}, + {"Configuration", ValueType::ENTITY, configuration, false}}, [](const std::string &name, Properties &props) -> EntityPtr { auto ptr = make_shared(name, props); ptr->initialize(); @@ -122,10 +122,11 @@ namespace mtconnect { factory->setOrder( {"Description", "Configuration", "DataItems", "Compositions", "References"}); auto component = make_shared( - Requirements {{"Component", ENTITY, factory, 1, Requirement::Infinite}}); + Requirements {{"Component", ValueType::ENTITY, factory, 1, Requirement::Infinite}}); component->registerFactory(regex(".+"), factory); component->registerMatchers(); - factory->addRequirements(Requirements {{"Components", ENTITY_LIST, component, false}}); + factory->addRequirements( + Requirements {{"Components", ValueType::ENTITY_LIST, component, false}}); } return factory; } diff --git a/src/mtconnect/device_model/data_item/constraints.hpp b/src/mtconnect/device_model/data_item/constraints.hpp index 2c8f328bd..bacd14855 100644 --- a/src/mtconnect/device_model/data_item/constraints.hpp +++ b/src/mtconnect/device_model/data_item/constraints.hpp @@ -34,16 +34,17 @@ namespace mtconnect { static FactoryPtr factory; if (!factory) { - auto limit = std::make_shared(Requirements {{"VALUE", DOUBLE, true}}); + auto limit = + std::make_shared(Requirements {{"VALUE", ValueType::DOUBLE, true}}); auto value = std::make_shared(Requirements {{"VALUE", true}}); auto filter = Filter::getFactory()->factoryFor("Filter")->deepCopy(); filter->getRequirement("type")->setMultiplicity(0, 1); factory = std::make_shared( - Requirements {{"Minimum", ENTITY, limit, 0, 1}, - {"Maximum", ENTITY, limit, 0, 1}, - {"Nominal", ENTITY, limit, 0, 1}, - {"Value", ENTITY, value, 0, Requirement::Infinite}, - {"Filter", ENTITY, filter, 0, Requirement::Infinite}}); + Requirements {{"Minimum", ValueType::ENTITY, limit, 0, 1}, + {"Maximum", ValueType::ENTITY, limit, 0, 1}, + {"Nominal", ValueType::ENTITY, limit, 0, 1}, + {"Value", ValueType::ENTITY, value, 0, Requirement::Infinite}, + {"Filter", ValueType::ENTITY, filter, 0, Requirement::Infinite}}); } return factory; } diff --git a/src/mtconnect/device_model/data_item/definition.hpp b/src/mtconnect/device_model/data_item/definition.hpp index 50cded529..3ae563b29 100644 --- a/src/mtconnect/device_model/data_item/definition.hpp +++ b/src/mtconnect/device_model/data_item/definition.hpp @@ -56,8 +56,8 @@ namespace mtconnect { {"subType", false}, {"units", false}}); - auto cells = make_shared( - Requirements {{"CellDefinition", ENTITY, cell, 1, Requirement::Infinite}}); + auto cells = make_shared(Requirements { + {"CellDefinition", ValueType::ENTITY, cell, 1, Requirement::Infinite}}); cells->setFunction([](const std::string &name, Properties &props) -> EntityPtr { auto ptr = make_shared(name, props); return dynamic_pointer_cast(ptr); @@ -70,19 +70,19 @@ namespace mtconnect { {"type", false}, {"subType", false}, {"units", false}, - {"CellDefinitions", ENTITY_LIST, cells, false}}); + {"CellDefinitions", ValueType::ENTITY_LIST, cells, false}}); entry->setOrder({"Description", "CellDefinitions"}); entry->setFunction([](const std::string &name, Properties &props) -> EntityPtr { auto ptr = make_shared(name, props); return dynamic_pointer_cast(ptr); }); - auto entries = make_shared( - Requirements {{"EntryDefinition", ENTITY, entry, 1, Requirement::Infinite}}); + auto entries = make_shared(Requirements { + {"EntryDefinition", ValueType::ENTITY, entry, 1, Requirement::Infinite}}); definition = make_shared( Requirements {{"Description", false}, - {"EntryDefinitions", ENTITY_LIST, entries, false}, - {"CellDefinitions", ENTITY_LIST, cells, false}}); + {"EntryDefinitions", ValueType::ENTITY_LIST, entries, false}, + {"CellDefinitions", ValueType::ENTITY_LIST, cells, false}}); definition->setOrder({"Description", "EntryDefinitions", "CellDefinitions"}); } diff --git a/src/mtconnect/device_model/data_item/filter.hpp b/src/mtconnect/device_model/data_item/filter.hpp index 50d93720c..87cb0b2d5 100644 --- a/src/mtconnect/device_model/data_item/filter.hpp +++ b/src/mtconnect/device_model/data_item/filter.hpp @@ -31,10 +31,10 @@ namespace mtconnect { { using namespace mtconnect::entity; using namespace std; - static auto filter = make_shared(Requirements { - {"type", ControlledVocab {"PERIOD", "MINIMUM_DELTA"}}, {"VALUE", DOUBLE, true}}); + static auto filter = make_shared(Requirements {{"type", ControlledVocab {"PERIOD", "MINIMUM_DELTA"}}, + {"VALUE", ValueType::DOUBLE, true}}); static auto filters = make_shared( - Requirements {{"Filter", ENTITY, filter, 1, Requirement::Infinite}}); + Requirements {{"Filter", ValueType::ENTITY, filter, 1, Requirement::Infinite}}); return filters; } }; diff --git a/src/mtconnect/device_model/data_item/relationships.hpp b/src/mtconnect/device_model/data_item/relationships.hpp index e78e10ad0..538e0cc4b 100644 --- a/src/mtconnect/device_model/data_item/relationships.hpp +++ b/src/mtconnect/device_model/data_item/relationships.hpp @@ -90,8 +90,8 @@ namespace mtconnect { auto di = Relationship::getDataItemFactory(); auto spec = Relationship::getSpecificationFactory(); relationships = make_shared( - Requirements {{"SpecificationRelationship", ENTITY, spec, 0, Requirement::Infinite}, - {"DataItemRelationship", ENTITY, di, 0, Requirement::Infinite}}); + Requirements {{"SpecificationRelationship", ValueType::ENTITY, spec, 0, Requirement::Infinite}, + {"DataItemRelationship", ValueType::ENTITY, di, 0, Requirement::Infinite}}); relationships->setMinListSize(1); relationships->setFunction([](const std::string &name, Properties &props) -> EntityPtr { return std::make_shared(name, props); diff --git a/src/mtconnect/entity/factory.hpp b/src/mtconnect/entity/factory.hpp index bff6bb132..449a39cc9 100644 --- a/src/mtconnect/entity/factory.hpp +++ b/src/mtconnect/entity/factory.hpp @@ -238,7 +238,8 @@ namespace mtconnect { { m_properties.emplace(r.getName()); auto factory = r.getFactory(); - if (factory && (r.getType() == ENTITY || r.getType() == ENTITY_LIST)) + if (factory && + (r.getType() == ValueType::ENTITY || r.getType() == ValueType::ENTITY_LIST)) { registerFactory(r.getName(), factory); if (r.getUpperMultiplicity() > 1) diff --git a/src/mtconnect/entity/requirement.hpp b/src/mtconnect/entity/requirement.hpp index 7f42c2d14..7f37ceb8d 100644 --- a/src/mtconnect/entity/requirement.hpp +++ b/src/mtconnect/entity/requirement.hpp @@ -50,7 +50,7 @@ namespace mtconnect { using Value = std::variant; - enum ValueType : int16_t + enum class ValueType : int16_t { EMPTY = 0x0, ENTITY = 0x1, @@ -169,7 +169,7 @@ namespace mtconnect { Requirement(const std::string &name, ValueType type, bool required = true) : m_name(name), m_upperMultiplicity(1), m_lowerMultiplicity(required ? 1 : 0), m_type(type) {} - Requirement(const std::string &name, bool required, ValueType type = STRING) + Requirement(const std::string &name, bool required, ValueType type = ValueType::STRING) : m_name(name), m_upperMultiplicity(1), m_lowerMultiplicity(required ? 1 : 0), m_type(type) {} Requirement(const std::string &name, ValueType type, int lower, int upper) @@ -188,7 +188,7 @@ namespace mtconnect { : m_name(name), m_upperMultiplicity(1), m_lowerMultiplicity(required ? 1 : 0), - m_type(STRING) + m_type(ValueType::STRING) { m_vocabulary.emplace(); for (auto &s : vocab) @@ -198,7 +198,7 @@ namespace mtconnect { : m_name(name), m_upperMultiplicity(1), m_lowerMultiplicity(required ? 1 : 0), - m_type(STRING), + m_type(ValueType::STRING), m_pattern(pattern) {} From cd10cc9adc1a9139c7f12400ab7382e4e4d2b980 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Sun, 15 Jan 2023 20:50:03 -0800 Subject: [PATCH 36/50] Reverted back value types, causes issues when using in variant. --- src/mtconnect/asset/asset.hpp | 2 +- src/mtconnect/configuration/agent_config.cpp | 6 +++--- src/mtconnect/device_model/component.cpp | 19 +++++++++---------- .../device_model/data_item/constraints.hpp | 13 ++++++------- .../device_model/data_item/definition.hpp | 14 +++++++------- .../device_model/data_item/filter.hpp | 6 +++--- .../device_model/data_item/relationships.hpp | 4 ++-- src/mtconnect/entity/factory.hpp | 3 +-- src/mtconnect/entity/requirement.hpp | 8 ++++---- src/mtconnect/sink/rest_sink/parameter.hpp | 2 +- src/mtconnect/utilities.hpp | 6 +++--- src/mtconnect/version.cpp | 1 - 12 files changed, 40 insertions(+), 44 deletions(-) diff --git a/src/mtconnect/asset/asset.hpp b/src/mtconnect/asset/asset.hpp index 57e4abae6..ce71319fa 100644 --- a/src/mtconnect/asset/asset.hpp +++ b/src/mtconnect/asset/asset.hpp @@ -56,7 +56,7 @@ namespace mtconnect { if (std::holds_alternative(r)) m_removed = std::get(r); else - entity::ConvertValueToType(r, entity::ValueType::BOOL); + entity::ConvertValueToType(r, entity::BOOL); } m_properties.insert_or_assign(key, r); diff --git a/src/mtconnect/configuration/agent_config.cpp b/src/mtconnect/configuration/agent_config.cpp index f677924ae..2b86e51e4 100644 --- a/src/mtconnect/configuration/agent_config.cpp +++ b/src/mtconnect/configuration/agent_config.cpp @@ -15,8 +15,6 @@ // limitations under the License. // -#include "mtconnect/config.hpp" - #include "agent_config.hpp" #include @@ -34,6 +32,8 @@ #include #include +#include "mtconnect/config.hpp" + #ifdef __APPLE__ #include #endif @@ -804,7 +804,7 @@ namespace mtconnect::configuration { {{configuration::Url, string()}, {configuration::Device, string()}}); auto qname = entity::QName(block.first); - auto [factory, name] = qname.getPair(); + auto [factory, name] = qname.getPair(); auto deviceName = GetOption(adapterOptions, configuration::Device).value_or(name); device = m_agent->getDeviceByName(deviceName); diff --git a/src/mtconnect/device_model/component.cpp b/src/mtconnect/device_model/component.cpp index 4cb2815d0..1c9b6a139 100644 --- a/src/mtconnect/device_model/component.cpp +++ b/src/mtconnect/device_model/component.cpp @@ -106,14 +106,14 @@ namespace mtconnect { {"id", true}, {"name", false}, {"nativeName", false}, - {"sampleRate", ValueType::DOUBLE, false}, - {"sampleInterval", ValueType::DOUBLE, false}, + {"sampleRate", DOUBLE, false}, + {"sampleInterval", DOUBLE, false}, {"uuid", false}, - {"Description", ValueType::ENTITY, description, false}, - {"DataItems", ValueType::ENTITY_LIST, dataItems, false}, - {"Compositions", ValueType::ENTITY_LIST, compositions, false}, - {"References", ValueType::ENTITY_LIST, references, false}, - {"Configuration", ValueType::ENTITY, configuration, false}}, + {"Description", ENTITY, description, false}, + {"DataItems", ENTITY_LIST, dataItems, false}, + {"Compositions", ENTITY_LIST, compositions, false}, + {"References", ENTITY_LIST, references, false}, + {"Configuration", ENTITY, configuration, false}}, [](const std::string &name, Properties &props) -> EntityPtr { auto ptr = make_shared(name, props); ptr->initialize(); @@ -122,11 +122,10 @@ namespace mtconnect { factory->setOrder( {"Description", "Configuration", "DataItems", "Compositions", "References"}); auto component = make_shared( - Requirements {{"Component", ValueType::ENTITY, factory, 1, Requirement::Infinite}}); + Requirements {{"Component", ENTITY, factory, 1, Requirement::Infinite}}); component->registerFactory(regex(".+"), factory); component->registerMatchers(); - factory->addRequirements( - Requirements {{"Components", ValueType::ENTITY_LIST, component, false}}); + factory->addRequirements(Requirements {{"Components", ENTITY_LIST, component, false}}); } return factory; } diff --git a/src/mtconnect/device_model/data_item/constraints.hpp b/src/mtconnect/device_model/data_item/constraints.hpp index bacd14855..2c8f328bd 100644 --- a/src/mtconnect/device_model/data_item/constraints.hpp +++ b/src/mtconnect/device_model/data_item/constraints.hpp @@ -34,17 +34,16 @@ namespace mtconnect { static FactoryPtr factory; if (!factory) { - auto limit = - std::make_shared(Requirements {{"VALUE", ValueType::DOUBLE, true}}); + auto limit = std::make_shared(Requirements {{"VALUE", DOUBLE, true}}); auto value = std::make_shared(Requirements {{"VALUE", true}}); auto filter = Filter::getFactory()->factoryFor("Filter")->deepCopy(); filter->getRequirement("type")->setMultiplicity(0, 1); factory = std::make_shared( - Requirements {{"Minimum", ValueType::ENTITY, limit, 0, 1}, - {"Maximum", ValueType::ENTITY, limit, 0, 1}, - {"Nominal", ValueType::ENTITY, limit, 0, 1}, - {"Value", ValueType::ENTITY, value, 0, Requirement::Infinite}, - {"Filter", ValueType::ENTITY, filter, 0, Requirement::Infinite}}); + Requirements {{"Minimum", ENTITY, limit, 0, 1}, + {"Maximum", ENTITY, limit, 0, 1}, + {"Nominal", ENTITY, limit, 0, 1}, + {"Value", ENTITY, value, 0, Requirement::Infinite}, + {"Filter", ENTITY, filter, 0, Requirement::Infinite}}); } return factory; } diff --git a/src/mtconnect/device_model/data_item/definition.hpp b/src/mtconnect/device_model/data_item/definition.hpp index 3ae563b29..50cded529 100644 --- a/src/mtconnect/device_model/data_item/definition.hpp +++ b/src/mtconnect/device_model/data_item/definition.hpp @@ -56,8 +56,8 @@ namespace mtconnect { {"subType", false}, {"units", false}}); - auto cells = make_shared(Requirements { - {"CellDefinition", ValueType::ENTITY, cell, 1, Requirement::Infinite}}); + auto cells = make_shared( + Requirements {{"CellDefinition", ENTITY, cell, 1, Requirement::Infinite}}); cells->setFunction([](const std::string &name, Properties &props) -> EntityPtr { auto ptr = make_shared(name, props); return dynamic_pointer_cast(ptr); @@ -70,19 +70,19 @@ namespace mtconnect { {"type", false}, {"subType", false}, {"units", false}, - {"CellDefinitions", ValueType::ENTITY_LIST, cells, false}}); + {"CellDefinitions", ENTITY_LIST, cells, false}}); entry->setOrder({"Description", "CellDefinitions"}); entry->setFunction([](const std::string &name, Properties &props) -> EntityPtr { auto ptr = make_shared(name, props); return dynamic_pointer_cast(ptr); }); - auto entries = make_shared(Requirements { - {"EntryDefinition", ValueType::ENTITY, entry, 1, Requirement::Infinite}}); + auto entries = make_shared( + Requirements {{"EntryDefinition", ENTITY, entry, 1, Requirement::Infinite}}); definition = make_shared( Requirements {{"Description", false}, - {"EntryDefinitions", ValueType::ENTITY_LIST, entries, false}, - {"CellDefinitions", ValueType::ENTITY_LIST, cells, false}}); + {"EntryDefinitions", ENTITY_LIST, entries, false}, + {"CellDefinitions", ENTITY_LIST, cells, false}}); definition->setOrder({"Description", "EntryDefinitions", "CellDefinitions"}); } diff --git a/src/mtconnect/device_model/data_item/filter.hpp b/src/mtconnect/device_model/data_item/filter.hpp index 87cb0b2d5..50d93720c 100644 --- a/src/mtconnect/device_model/data_item/filter.hpp +++ b/src/mtconnect/device_model/data_item/filter.hpp @@ -31,10 +31,10 @@ namespace mtconnect { { using namespace mtconnect::entity; using namespace std; - static auto filter = make_shared(Requirements {{"type", ControlledVocab {"PERIOD", "MINIMUM_DELTA"}}, - {"VALUE", ValueType::DOUBLE, true}}); + static auto filter = make_shared(Requirements { + {"type", ControlledVocab {"PERIOD", "MINIMUM_DELTA"}}, {"VALUE", DOUBLE, true}}); static auto filters = make_shared( - Requirements {{"Filter", ValueType::ENTITY, filter, 1, Requirement::Infinite}}); + Requirements {{"Filter", ENTITY, filter, 1, Requirement::Infinite}}); return filters; } }; diff --git a/src/mtconnect/device_model/data_item/relationships.hpp b/src/mtconnect/device_model/data_item/relationships.hpp index 538e0cc4b..e78e10ad0 100644 --- a/src/mtconnect/device_model/data_item/relationships.hpp +++ b/src/mtconnect/device_model/data_item/relationships.hpp @@ -90,8 +90,8 @@ namespace mtconnect { auto di = Relationship::getDataItemFactory(); auto spec = Relationship::getSpecificationFactory(); relationships = make_shared( - Requirements {{"SpecificationRelationship", ValueType::ENTITY, spec, 0, Requirement::Infinite}, - {"DataItemRelationship", ValueType::ENTITY, di, 0, Requirement::Infinite}}); + Requirements {{"SpecificationRelationship", ENTITY, spec, 0, Requirement::Infinite}, + {"DataItemRelationship", ENTITY, di, 0, Requirement::Infinite}}); relationships->setMinListSize(1); relationships->setFunction([](const std::string &name, Properties &props) -> EntityPtr { return std::make_shared(name, props); diff --git a/src/mtconnect/entity/factory.hpp b/src/mtconnect/entity/factory.hpp index 449a39cc9..bff6bb132 100644 --- a/src/mtconnect/entity/factory.hpp +++ b/src/mtconnect/entity/factory.hpp @@ -238,8 +238,7 @@ namespace mtconnect { { m_properties.emplace(r.getName()); auto factory = r.getFactory(); - if (factory && - (r.getType() == ValueType::ENTITY || r.getType() == ValueType::ENTITY_LIST)) + if (factory && (r.getType() == ENTITY || r.getType() == ENTITY_LIST)) { registerFactory(r.getName(), factory); if (r.getUpperMultiplicity() > 1) diff --git a/src/mtconnect/entity/requirement.hpp b/src/mtconnect/entity/requirement.hpp index 7f37ceb8d..77336aeda 100644 --- a/src/mtconnect/entity/requirement.hpp +++ b/src/mtconnect/entity/requirement.hpp @@ -50,7 +50,7 @@ namespace mtconnect { using Value = std::variant; - enum class ValueType : int16_t + enum ValueType : std::uint16_t { EMPTY = 0x0, ENTITY = 0x1, @@ -169,7 +169,7 @@ namespace mtconnect { Requirement(const std::string &name, ValueType type, bool required = true) : m_name(name), m_upperMultiplicity(1), m_lowerMultiplicity(required ? 1 : 0), m_type(type) {} - Requirement(const std::string &name, bool required, ValueType type = ValueType::STRING) + Requirement(const std::string &name, bool required, ValueType type = STRING) : m_name(name), m_upperMultiplicity(1), m_lowerMultiplicity(required ? 1 : 0), m_type(type) {} Requirement(const std::string &name, ValueType type, int lower, int upper) @@ -188,7 +188,7 @@ namespace mtconnect { : m_name(name), m_upperMultiplicity(1), m_lowerMultiplicity(required ? 1 : 0), - m_type(ValueType::STRING) + m_type(STRING) { m_vocabulary.emplace(); for (auto &s : vocab) @@ -198,7 +198,7 @@ namespace mtconnect { : m_name(name), m_upperMultiplicity(1), m_lowerMultiplicity(required ? 1 : 0), - m_type(ValueType::STRING), + m_type(STRING), m_pattern(pattern) {} diff --git a/src/mtconnect/sink/rest_sink/parameter.hpp b/src/mtconnect/sink/rest_sink/parameter.hpp index ebe4040af..6113aa560 100644 --- a/src/mtconnect/sink/rest_sink/parameter.hpp +++ b/src/mtconnect/sink/rest_sink/parameter.hpp @@ -30,7 +30,7 @@ namespace mtconnect::sink::rest_sink { using std::logic_error::logic_error; }; - enum ParameterType + enum ParameterType : uint8_t { NONE = 0, STRING = 1, diff --git a/src/mtconnect/utilities.hpp b/src/mtconnect/utilities.hpp index bb9314137..d213785a9 100644 --- a/src/mtconnect/utilities.hpp +++ b/src/mtconnect/utilities.hpp @@ -22,11 +22,11 @@ #include #include -#include -#include "mtconnect/config.hpp" - #include #include +#include + +#include "mtconnect/config.hpp" //####### CONSTANTS ####### diff --git a/src/mtconnect/version.cpp b/src/mtconnect/version.cpp index 6c6a3b667..b27f769f2 100644 --- a/src/mtconnect/version.cpp +++ b/src/mtconnect/version.cpp @@ -34,4 +34,3 @@ void PrintMTConnectAgentVersion() { printf("%s - built on " __TIMESTAMP__ "\n", GetAgentVersion().c_str()); } - From c40ce68969433b7b045613efff147ba9aced6c5b Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Mon, 23 Jan 2023 16:06:54 +0100 Subject: [PATCH 37/50] refactored to the timstamped entity to the timestamp extractor --- src/mtconnect/pipeline/shdr_token_mapper.hpp | 6 ++++++ src/mtconnect/pipeline/timestamp_extractor.hpp | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mtconnect/pipeline/shdr_token_mapper.hpp b/src/mtconnect/pipeline/shdr_token_mapper.hpp index 595061527..b842c8732 100644 --- a/src/mtconnect/pipeline/shdr_token_mapper.hpp +++ b/src/mtconnect/pipeline/shdr_token_mapper.hpp @@ -31,6 +31,12 @@ namespace mtconnect { namespace pipeline { using namespace entity; + class AGENT_LIB_API Observations : public Timestamped + { + public: + using Timestamped::Timestamped; + }; + class AGENT_LIB_API ShdrTokenMapper : public Transform { public: diff --git a/src/mtconnect/pipeline/timestamp_extractor.hpp b/src/mtconnect/pipeline/timestamp_extractor.hpp index e378a873a..406b59007 100644 --- a/src/mtconnect/pipeline/timestamp_extractor.hpp +++ b/src/mtconnect/pipeline/timestamp_extractor.hpp @@ -49,12 +49,6 @@ namespace mtconnect { using Timestamped::Timestamped; }; - class AGENT_LIB_API Observations : public Timestamped - { - public: - using Timestamped::Timestamped; - }; - class AGENT_LIB_API ExtractTimestamp : public Transform { public: From 6e69cbde7307bd5b4e07009dc4e9d00f02a5b47c Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 26 Jan 2023 10:54:38 +0100 Subject: [PATCH 38/50] Formatted code w/ clangformat --- src/mtconnect/mqtt/mqtt_authorization.hpp | 18 +-- src/mtconnect/mqtt/mqtt_client_impl.hpp | 4 +- src/mtconnect/mqtt/mqtt_server_impl.hpp | 4 +- src/mtconnect/pipeline/shdr_token_mapper.hpp | 2 +- test/mqtt_isolated_test.cpp | 153 +++++++++---------- 5 files changed, 89 insertions(+), 92 deletions(-) diff --git a/src/mtconnect/mqtt/mqtt_authorization.hpp b/src/mtconnect/mqtt/mqtt_authorization.hpp index 35576c766..c616b3e65 100644 --- a/src/mtconnect/mqtt/mqtt_authorization.hpp +++ b/src/mtconnect/mqtt/mqtt_authorization.hpp @@ -42,7 +42,7 @@ namespace mtconnect { Both }; - void MqttTopicPermission(const std::string &topic, const std::string& clientId) + void MqttTopicPermission(const std::string& topic, const std::string& clientId) { m_topic = topic; m_clientId = clientId; @@ -51,7 +51,7 @@ namespace mtconnect { } void MqttTopicPermission(const std::string& topic, const std::string& clientId, - AuthorizationType type) + AuthorizationType type) { m_topic = topic; m_clientId = clientId; @@ -60,7 +60,7 @@ namespace mtconnect { } void MqttTopicPermission(const std::string& topic, const std::string& clientId, - AuthorizationType type, TopicMode mode) + AuthorizationType type, TopicMode mode) { m_topic = topic; m_clientId = clientId; @@ -78,7 +78,7 @@ namespace mtconnect { class MqttAuthorization : public std::enable_shared_from_this { public: - MqttAuthorization(const ConfigOptions &options) : m_options(options) + MqttAuthorization(const ConfigOptions& options) : m_options(options) { m_clientId = GetOption(options, configuration::MqttClientId); m_username = GetOption(options, configuration::MqttUserName); @@ -86,16 +86,16 @@ namespace mtconnect { } virtual ~MqttAuthorization() = default; - - bool checkCredentials() - { + + bool checkCredentials() + { if (!m_username && !m_password) { LOG(error) << "MQTT USERNAME_OR_PASSWORD are Not Available"; return false; } - return true; + return true; } protected: @@ -104,5 +104,5 @@ namespace mtconnect { std::string m_clientId; ConfigOptions m_options; }; - } // namespace MqttAuthorization + } // namespace mqtt_client } // namespace mtconnect diff --git a/src/mtconnect/mqtt/mqtt_client_impl.hpp b/src/mtconnect/mqtt/mqtt_client_impl.hpp index fb225f157..64a3a99a5 100644 --- a/src/mtconnect/mqtt/mqtt_client_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_client_impl.hpp @@ -134,7 +134,7 @@ namespace mtconnect { else { LOG(debug) << "No connect handler, setting connected"; - m_connected = true; + m_connected = true; } } else @@ -425,7 +425,7 @@ namespace mtconnect { if (cacert) { m_client->get_ssl_context().load_verify_file(*cacert); - } + } } return m_client; diff --git a/src/mtconnect/mqtt/mqtt_server_impl.hpp b/src/mtconnect/mqtt/mqtt_server_impl.hpp index 8106ade75..01afabd4e 100644 --- a/src/mtconnect/mqtt/mqtt_server_impl.hpp +++ b/src/mtconnect/mqtt/mqtt_server_impl.hpp @@ -302,7 +302,7 @@ namespace mtconnect { boost::asio::ssl::context::single_dh_use); if (HasOption(m_options, configuration::TlsCertificateChain) && - HasOption(m_options, configuration::TlsPrivateKey) && + HasOption(m_options, configuration::TlsPrivateKey) && HasOption(m_options, configuration::TlsDHKey)) { LOG(info) << "Server: Initializing TLS support"; @@ -317,7 +317,7 @@ namespace mtconnect { auto serverPrivateKey = GetOption(m_options, configuration::TlsPrivateKey); auto serverCert = GetOption(m_options, configuration::TlsCertificateChain); auto serverDHKey = GetOption(m_options, configuration::TlsDHKey); - + ctx.use_certificate_chain_file(*serverCert); ctx.use_private_key_file(*serverPrivateKey, boost::asio::ssl::context::pem); ctx.use_tmp_dh_file(*serverDHKey); diff --git a/src/mtconnect/pipeline/shdr_token_mapper.hpp b/src/mtconnect/pipeline/shdr_token_mapper.hpp index b842c8732..579c58a29 100644 --- a/src/mtconnect/pipeline/shdr_token_mapper.hpp +++ b/src/mtconnect/pipeline/shdr_token_mapper.hpp @@ -36,7 +36,7 @@ namespace mtconnect { public: using Timestamped::Timestamped; }; - + class AGENT_LIB_API ShdrTokenMapper : public Transform { public: diff --git a/test/mqtt_isolated_test.cpp b/test/mqtt_isolated_test.cpp index e1715e03b..733caa008 100644 --- a/test/mqtt_isolated_test.cpp +++ b/test/mqtt_isolated_test.cpp @@ -66,10 +66,9 @@ class MqttIsolatedUnitTest : public testing::Test } void TearDown() override - { + { if (m_client) { - m_client->stop(); while (m_agentTestHelper->m_ioContext.run_one_for(10ms)) ; @@ -82,13 +81,13 @@ class MqttIsolatedUnitTest : public testing::Test m_agentTestHelper->m_ioContext.run_for(500ms); m_server.reset(); } - + m_agentTestHelper.reset(); m_jsonPrinter.reset(); } void createServer(const ConfigOptions &options) - { + { bool withTlsOption = IsOptionSet(options, configuration::MqttTls); if (withTlsOption) @@ -140,7 +139,7 @@ class MqttIsolatedUnitTest : public testing::Test void createClient(const ConfigOptions &options, unique_ptr &&handler) { - bool withTlsOption = IsOptionSet(options, configuration::MqttTls); + bool withTlsOption = IsOptionSet(options, configuration::MqttTls); ConfigOptions opts(options); @@ -159,7 +158,7 @@ class MqttIsolatedUnitTest : public testing::Test } bool startClient() - { + { bool started = m_client && m_client->start(); if (started) { @@ -176,16 +175,12 @@ class MqttIsolatedUnitTest : public testing::Test uint16_t m_port {0}; }; - TEST_F(MqttIsolatedUnitTest, mqtt_client_should_connect_to_broker) { - ConfigOptions options{{ServerIp, "127.0.0.1"s}, - {MqttPort, 0}, - {MqttTls, false}, - {AutoAvailable, false}, - {MqttCaCert, MqttClientCACert}, - {RealTime, false}}; - + ConfigOptions options { + {ServerIp, "127.0.0.1"s}, {MqttPort, 0}, {MqttTls, false}, {AutoAvailable, false}, + {MqttCaCert, MqttClientCACert}, {RealTime, false}}; + createServer(options); startServer(); @@ -222,75 +217,77 @@ TEST_F(MqttIsolatedUnitTest, mqtt_tcp_client_should_receive_loopback_publication client->set_clean_session(true); client->set_keep_alive_sec(30); - client->set_connack_handler( - [&client, &pid_sub1](bool sp, mqtt::connect_return_code connack_return_code) { - std::cout << "Connack handler called" << std::endl; - std::cout << "Session Present: " << std::boolalpha << sp << std::endl; - std::cout << "Connack Return Code: " << connack_return_code << std::endl; - if (connack_return_code == mqtt::connect_return_code::accepted) - { - pid_sub1 = client->acquire_unique_packet_id(); - - client->async_subscribe(pid_sub1, "mqtt_tcp_client_cpp/topic1", MQTT_NS::qos::at_most_once, - //[optional] checking async_subscribe completion code - [](MQTT_NS::error_code ec) { - EXPECT_FALSE(ec); - std::cout << "async_tcp_subscribe callback: " << ec.message() - << std::endl; - }); - } - return true; - }); - client->set_close_handler([] { std::cout << "closed" << std::endl; }); - - client->set_suback_handler([&client, &pid_sub1](std::uint16_t packet_id, - std::vector results) { - std::cout << "suback received. packet_id: " << packet_id << std::endl; - for (auto const &e : results) + client->set_connack_handler([&client, &pid_sub1](bool sp, + mqtt::connect_return_code connack_return_code) { + std::cout << "Connack handler called" << std::endl; + std::cout << "Session Present: " << std::boolalpha << sp << std::endl; + std::cout << "Connack Return Code: " << connack_return_code << std::endl; + if (connack_return_code == mqtt::connect_return_code::accepted) { - std::cout << "subscribe result: " << e << std::endl; - } + pid_sub1 = client->acquire_unique_packet_id(); - if (packet_id == pid_sub1) - { - client->async_publish("mqtt_tcp_client_cpp/topic1", "test1", MQTT_NS::qos::at_most_once, - //[optional] checking async_publish completion code - [](MQTT_NS::error_code ec) { - EXPECT_FALSE(ec); - - std::cout << "async_tcp_publish callback: " << ec.message() << std::endl; - EXPECT_EQ(ec.message(), "Success"); - }); - return true; + client->async_subscribe(pid_sub1, "mqtt_tcp_client_cpp/topic1", MQTT_NS::qos::at_most_once, + //[optional] checking async_subscribe completion code + [](MQTT_NS::error_code ec) { + EXPECT_FALSE(ec); + std::cout << "async_tcp_subscribe callback: " << ec.message() + << std::endl; + }); } - return true; }); + client->set_close_handler([] { std::cout << "closed" << std::endl; }); + + client->set_suback_handler( + [&client, &pid_sub1](std::uint16_t packet_id, std::vector results) { + std::cout << "suback received. packet_id: " << packet_id << std::endl; + for (auto const &e : results) + { + std::cout << "subscribe result: " << e << std::endl; + } + + if (packet_id == pid_sub1) + { + client->async_publish("mqtt_tcp_client_cpp/topic1", "test1", MQTT_NS::qos::at_most_once, + //[optional] checking async_publish completion code + [](MQTT_NS::error_code ec) { + EXPECT_FALSE(ec); + + std::cout << "async_tcp_publish callback: " << ec.message() + << std::endl; + EXPECT_EQ(ec.message(), "Success"); + }); + return true; + } + + return true; + }); client->set_close_handler([] { std::cout << "closed" << std::endl; }); - client->set_suback_handler([&client, &pid_sub1](std::uint16_t packet_id, - std::vector results) { - std::cout << "suback received. packet_id: " << packet_id << std::endl; - for (auto const &e : results) - { - std::cout << "subscribe result: " << e << std::endl; - } + client->set_suback_handler( + [&client, &pid_sub1](std::uint16_t packet_id, std::vector results) { + std::cout << "suback received. packet_id: " << packet_id << std::endl; + for (auto const &e : results) + { + std::cout << "subscribe result: " << e << std::endl; + } - if (packet_id == pid_sub1) - { - client->async_publish("mqtt_tcp_client_cpp/topic1", "test1", MQTT_NS::qos::at_most_once, - //[optional] checking async_publish completion code - [packet_id](MQTT_NS::error_code ec) { - EXPECT_FALSE(ec); - - std::cout << "async_tcp_publish callback: " << ec.message() << std::endl; - ASSERT_TRUE(packet_id); - }); - } + if (packet_id == pid_sub1) + { + client->async_publish("mqtt_tcp_client_cpp/topic1", "test1", MQTT_NS::qos::at_most_once, + //[optional] checking async_publish completion code + [packet_id](MQTT_NS::error_code ec) { + EXPECT_FALSE(ec); - return true; - }); + std::cout << "async_tcp_publish callback: " << ec.message() + << std::endl; + ASSERT_TRUE(packet_id); + }); + } + + return true; + }); bool received = false; client->set_publish_handler([&client, &received](mqtt::optional packet_id, @@ -320,9 +317,9 @@ TEST_F(MqttIsolatedUnitTest, mqtt_tcp_client_should_receive_loopback_publication } TEST_F(MqttIsolatedUnitTest, mqtt_tls_client_should_receive_loopback_publication) -{ +{ GTEST_SKIP(); - + ConfigOptions options {{ServerIp, "127.0.0.1"s}, {MqttPort, 0}, {MqttTls, true}, @@ -330,7 +327,7 @@ TEST_F(MqttIsolatedUnitTest, mqtt_tls_client_should_receive_loopback_publication {TlsCertificateChain, ServerCertFile}, {TlsPrivateKey, ServerKeyFile}, {TlsDHKey, ServerDhFile}, - {TlsVerifyClientCertificate,true}, + {TlsVerifyClientCertificate, true}, {TlsClientCAs, MqttClientCACert}, {MqttCaCert, MqttClientCACert}, {MqttCert, MqttClientCert}, @@ -477,8 +474,8 @@ TEST_F(MqttIsolatedUnitTest, should_connect_using_tls) /*{TlsVerifyClientCertificate, true}, {TlsClientCAs, ClientCA},*/ {MqttCaCert, MqttClientCACert}, - /* {MqttCert, MqttClientCert}, - {MqttPrivateKey, MqttClientKey},*/ + /* {MqttCert, MqttClientCert}, + {MqttPrivateKey, MqttClientKey},*/ {RealTime, false}}; createServer(options); From a56c263f38713711d33105ae97c7a03cabd8874a Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 26 Jan 2023 11:14:25 +0100 Subject: [PATCH 39/50] Added shared matrix build --- appveyor.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d3492868d..ad974dd88 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,9 +13,8 @@ image: environment: matrix: - - WITH_RUBY: True - -# - WITH_RUBY: False + - SHARED: True + - SHARED: False configuration: - Release @@ -50,7 +49,7 @@ before_build: pip install conan conan export conan/mqtt_cpp conan export conan/mruby - conan install . -if build --build=missing -pr conan/profiles/vs32 -o run_tests=False -o with_ruby=%WITH_RUBY% + conan install . -if build --build=missing -pr conan/profiles/vs32 -o run_tests=False -o shared=%SHARED% - sh: |- export PATH=$HOME/venv3.10/bin:$PATH if [[ $APPVEYOR_BUILD_WORKER_IMAGE = "Ubuntu2004" ]] @@ -66,7 +65,7 @@ before_build: pip install conan conan export conan/mqtt_cpp conan export conan/mruby - conan install . -if build --build=missing -pr $CONAN_PROFILE -o run_tests=False -o with_ruby=$WITH_RUBY + conan install . -if build --build=missing -pr $CONAN_PROFILE -o run_tests=False -o shared=$SHARED build: verbosity: minimal From 0b54ee345276cf68259ada436d41faec0ead5626 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 26 Jan 2023 14:46:39 +0100 Subject: [PATCH 40/50] Updated linux compiler for appveyor to gcc 11 --- appveyor.yml | 2 ++ conan/profiles/gcc-appveyor | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ad974dd88..ac3712521 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -54,6 +54,8 @@ before_build: export PATH=$HOME/venv3.10/bin:$PATH if [[ $APPVEYOR_BUILD_WORKER_IMAGE = "Ubuntu2004" ]] then + apt update + apt install build-essential cmake gcc-11 g++-11 export CONAN_PROFILE=conan/profiles/gcc-appveyor elif [[ $APPVEYOR_BUILD_WORKER_IMAGE = "macOS" ]] then diff --git a/conan/profiles/gcc-appveyor b/conan/profiles/gcc-appveyor index a80246886..9891ae03b 100644 --- a/conan/profiles/gcc-appveyor +++ b/conan/profiles/gcc-appveyor @@ -2,8 +2,8 @@ include(default) [settings] compiler.libcxx=libstdc++11 -compiler.version=9 +compiler.version=11 [env] -CC=/usr/bin/gcc-9 -CXX=/usr/bin/g++-9 +CC=/usr/bin/gcc-11 +CXX=/usr/bin/g++-11 From 1c1bbe20358ea516f69a943fbc5a8309827c4191 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 26 Jan 2023 14:48:52 +0100 Subject: [PATCH 41/50] sudo for apt install --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ac3712521..3213876d8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -54,8 +54,8 @@ before_build: export PATH=$HOME/venv3.10/bin:$PATH if [[ $APPVEYOR_BUILD_WORKER_IMAGE = "Ubuntu2004" ]] then - apt update - apt install build-essential cmake gcc-11 g++-11 + sudo apt update + sudo apt install build-essential cmake gcc-11 g++-11 export CONAN_PROFILE=conan/profiles/gcc-appveyor elif [[ $APPVEYOR_BUILD_WORKER_IMAGE = "macOS" ]] then From 34aa6864a4e8e14b009bd13980a759e44b6afa21 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 26 Jan 2023 14:54:40 +0100 Subject: [PATCH 42/50] Added -y for install and python3 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3213876d8..90f382ffc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -55,7 +55,7 @@ before_build: if [[ $APPVEYOR_BUILD_WORKER_IMAGE = "Ubuntu2004" ]] then sudo apt update - sudo apt install build-essential cmake gcc-11 g++-11 + sudo apt install -y build-essential cmake gcc-11 g++-11 python3 export CONAN_PROFILE=conan/profiles/gcc-appveyor elif [[ $APPVEYOR_BUILD_WORKER_IMAGE = "macOS" ]] then From f2c5c17f512eb93f6c6957415ce4f848d1107aaa Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 26 Jan 2023 19:35:40 +0100 Subject: [PATCH 43/50] Added shared profiles for VC builds --- appveyor.yml | 7 ++++--- conan/profiles/vs32shared | 9 +++++++++ conan/profiles/vs64shared | 9 +++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 conan/profiles/vs32shared create mode 100644 conan/profiles/vs64shared diff --git a/appveyor.yml b/appveyor.yml index 90f382ffc..8e8714859 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,8 +7,8 @@ branches: image: - - Ubuntu2004 - Visual Studio 2019 + - Ubuntu2004 - macOS environment: @@ -42,14 +42,15 @@ init: before_build: - cmd: |- set PATH=C:\Python39-x64\;C:\Python39-x64\Scripts;C:\Ruby30\bin;%PATH% - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" set if not exist C:\conan mkdir C:\conan + if %SHARED%==True set CONAN_PROFILE=conan/profiles/vs64shared else set CONAN_PROFILE=conan/profiles/vs64 set CONAN_USER_HOME=C:\conan pip install conan conan export conan/mqtt_cpp conan export conan/mruby - conan install . -if build --build=missing -pr conan/profiles/vs32 -o run_tests=False -o shared=%SHARED% + conan install . -if build --build=missing -pr %CONAN_PROFILE% -o run_tests=False -o shared=%SHARED% - sh: |- export PATH=$HOME/venv3.10/bin:$PATH if [[ $APPVEYOR_BUILD_WORKER_IMAGE = "Ubuntu2004" ]] diff --git a/conan/profiles/vs32shared b/conan/profiles/vs32shared new file mode 100644 index 000000000..99bc71fbf --- /dev/null +++ b/conan/profiles/vs32shared @@ -0,0 +1,9 @@ +include(default) + +[settings] +compiler=Visual Studio +arch=x86 +arch_build=x86 +compiler.runtime=MD + +[env] \ No newline at end of file diff --git a/conan/profiles/vs64shared b/conan/profiles/vs64shared new file mode 100644 index 000000000..ee58ac80d --- /dev/null +++ b/conan/profiles/vs64shared @@ -0,0 +1,9 @@ +include(default) + +[settings] +compiler=Visual Studio +arch=x86_64 +arch_build=x86_64 +compiler.runtime=MD + +[env] \ No newline at end of file From 207b7443d96789ba8017a8d3db4566f0a6f7e3c9 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 26 Jan 2023 19:39:09 +0100 Subject: [PATCH 44/50] Debug appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8e8714859..55bda8e06 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,10 +43,10 @@ before_build: - cmd: |- set PATH=C:\Python39-x64\;C:\Python39-x64\Scripts;C:\Ruby30\bin;%PATH% "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - set if not exist C:\conan mkdir C:\conan if %SHARED%==True set CONAN_PROFILE=conan/profiles/vs64shared else set CONAN_PROFILE=conan/profiles/vs64 set CONAN_USER_HOME=C:\conan + set pip install conan conan export conan/mqtt_cpp conan export conan/mruby From d6e3f6c41668c5c83230715693a2f3c3fcddc0b7 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 26 Jan 2023 19:41:51 +0100 Subject: [PATCH 45/50] Debug appveyor for windows --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 55bda8e06..5168603c0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -44,7 +44,7 @@ before_build: set PATH=C:\Python39-x64\;C:\Python39-x64\Scripts;C:\Ruby30\bin;%PATH% "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" if not exist C:\conan mkdir C:\conan - if %SHARED%==True set CONAN_PROFILE=conan/profiles/vs64shared else set CONAN_PROFILE=conan/profiles/vs64 + if %SHARED%==True (set CONAN_PROFILE=conan/profiles/vs64shared) else (set CONAN_PROFILE=conan/profiles/vs64) set CONAN_USER_HOME=C:\conan set pip install conan From 15bc7b63504e256a18d6bdf7ade1bd1856377a6d Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 27 Jan 2023 17:03:14 +0100 Subject: [PATCH 46/50] bind server ip for agent to 127.0.0.1 --- test/agent_test_helper.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/agent_test_helper.hpp b/test/agent_test_helper.hpp index 4a3beeec6..c667453ec 100644 --- a/test/agent_test_helper.hpp +++ b/test/agent_test_helper.hpp @@ -196,6 +196,7 @@ class AgentTestHelper options.emplace(configuration::SchemaVersion, version); options.emplace(configuration::Pretty, true); options.emplace(configuration::Port, 0); + options.emplace(configuration::ServerIp, std::string("127.0.0.1")); options.emplace(configuration::JsonVersion, 1); m_agent = std::make_unique(m_ioContext, PROJECT_ROOT_DIR + file, options); From ac1fab25c6427dea5dd8250c02cc03831c1d111a Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 27 Jan 2023 17:25:14 +0100 Subject: [PATCH 47/50] Added run_for to let agent fully stop --- test/agent_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/agent_test.cpp b/test/agent_test.cpp index 5733b6b82..6eac49f83 100644 --- a/test/agent_test.cpp +++ b/test/agent_test.cpp @@ -2891,6 +2891,8 @@ TEST_F(AgentTest, pre_start_hook_should_be_called) agent->start(); ASSERT_TRUE(called); agent->stop(); + + m_agentTestHelper->m_ioContext.run_for(100ms); } TEST_F(AgentTest, pre_initialize_hooks_should_be_called) @@ -2934,4 +2936,6 @@ TEST_F(AgentTest, pre_stop_hook_should_be_called) ASSERT_FALSE(called); agent->stop(); ASSERT_TRUE(called); + + m_agentTestHelper->m_ioContext.run_for(100ms); } From c8653c5359fad8ba92d65c00622e2aa137c9498f Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 27 Jan 2023 17:36:13 +0100 Subject: [PATCH 48/50] Build macos first --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5168603c0..cf05ebc35 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,9 +7,9 @@ branches: image: + - macOS - Visual Studio 2019 - Ubuntu2004 - - macOS environment: matrix: From eec2353625af6a79df4f573e98e4a35f8e26a060 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 27 Jan 2023 18:16:32 +0100 Subject: [PATCH 49/50] Made called static --- test/agent_test.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/agent_test.cpp b/test/agent_test.cpp index 6eac49f83..5b8371c49 100644 --- a/test/agent_test.cpp +++ b/test/agent_test.cpp @@ -2891,8 +2891,6 @@ TEST_F(AgentTest, pre_start_hook_should_be_called) agent->start(); ASSERT_TRUE(called); agent->stop(); - - m_agentTestHelper->m_ioContext.run_for(100ms); } TEST_F(AgentTest, pre_initialize_hooks_should_be_called) @@ -2923,9 +2921,9 @@ TEST_F(AgentTest, post_initialize_hooks_should_be_called) TEST_F(AgentTest, pre_stop_hook_should_be_called) { - bool called = false; + static bool called = false; Agent::Hook lambda = [&](Agent &agent) { called = true; }; - AgentTestHelper::Hook helperHook = [&](AgentTestHelper &helper) { + AgentTestHelper::Hook helperHook = [&lambda](AgentTestHelper &helper) { helper.getAgent()->beforeStopHooks().add(lambda); }; m_agentTestHelper->setAgentCreateHook(helperHook); @@ -2936,6 +2934,4 @@ TEST_F(AgentTest, pre_stop_hook_should_be_called) ASSERT_FALSE(called); agent->stop(); ASSERT_TRUE(called); - - m_agentTestHelper->m_ioContext.run_for(100ms); } From 5fc64a01e13df5b88f10799594684580b7e94379 Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Fri, 27 Jan 2023 20:05:11 +0100 Subject: [PATCH 50/50] Fixed streaming sample race with service destruction. --- src/mtconnect/agent.cpp | 19 ++++++++++- src/mtconnect/agent.hpp | 2 ++ src/mtconnect/sink/rest_sink/rest_service.cpp | 32 ++++++++++++++----- src/mtconnect/sink/sink.hpp | 4 ++- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/mtconnect/agent.cpp b/src/mtconnect/agent.cpp index 988f6467c..88fa39cca 100644 --- a/src/mtconnect/agent.cpp +++ b/src/mtconnect/agent.cpp @@ -182,6 +182,13 @@ namespace mtconnect { void Agent::start() { NAMED_SCOPE("Agent::start"); + + if (m_started) + { + LOG(warning) << "Agent already started."; + return; + } + try { m_beforeStartHooks.exec(*this); @@ -206,12 +213,20 @@ namespace mtconnect { LOG(fatal) << "Cannot start server: " << e.what(); std::exit(1); } + + m_started = true; } void Agent::stop() { NAMED_SCOPE("Agent::stop"); - + + if (!m_started) + { + LOG(warning) << "Agent already stopped."; + return; + } + m_beforeStopHooks.exec(*this); // Stop all adapter threads... @@ -233,6 +248,8 @@ namespace mtconnect { } LOG(info) << "Shutting down completed"; + + m_started = false; } // --------------------------------------- diff --git a/src/mtconnect/agent.hpp b/src/mtconnect/agent.hpp index 983fbcad6..08c70303c 100644 --- a/src/mtconnect/agent.hpp +++ b/src/mtconnect/agent.hpp @@ -258,6 +258,8 @@ namespace mtconnect { boost::asio::io_context::strand m_strand; std::shared_ptr m_loopback; + + bool m_started { false }; // Asset Management std::unique_ptr m_assetStorage; diff --git a/src/mtconnect/sink/rest_sink/rest_service.cpp b/src/mtconnect/sink/rest_sink/rest_service.cpp index 7154aed3d..5f1297888 100644 --- a/src/mtconnect/sink/rest_sink/rest_service.cpp +++ b/src/mtconnect/sink/rest_sink/rest_service.cpp @@ -728,6 +728,7 @@ namespace mtconnect { m_timer(strand.context()) {} + std::weak_ptr m_service; rest_sink::SessionPtr m_session; ofstream m_log; SequenceNumber_t m_sequence {0}; @@ -767,7 +768,8 @@ namespace mtconnect { asyncResponse->m_count = count; asyncResponse->m_printer = printer; asyncResponse->m_heartbeat = std::chrono::milliseconds(heartbeatIn); - + asyncResponse->m_service = getptr(); + checkPath(asyncResponse->m_printer, path, dev, asyncResponse->m_filter); if (m_logStreamData) @@ -829,10 +831,16 @@ namespace mtconnect { using boost::placeholders::_1; using boost::placeholders::_2; - if (!m_server->isRunning()) + auto service = asyncResponse->m_service.lock(); + + if (!service || !m_server || !m_server->isRunning()) { - asyncResponse->m_session->fail(boost::beast::http::status::internal_server_error, - "Agent shutting down, aborting stream"); + LOG(warning) << "Trying to send chunk when service has stopped"; + if (service) + { + asyncResponse->m_session->fail(boost::beast::http::status::internal_server_error, + "Agent shutting down, aborting stream"); + } return; } @@ -938,7 +946,8 @@ namespace mtconnect { AsyncCurrentResponse(rest_sink::SessionPtr session, asio::io_context &context) : m_session(session), m_timer(context) {} - + + std::weak_ptr m_service; rest_sink::SessionPtr m_session; chrono::milliseconds m_interval; const Printer *m_printer {nullptr}; @@ -966,6 +975,7 @@ namespace mtconnect { } asyncResponse->m_interval = chrono::milliseconds {interval}; asyncResponse->m_printer = printer; + asyncResponse->m_service = getptr(); asyncResponse->m_session->beginStreaming( printer->mimeType(), boost::asio::bind_executor(m_strand, [this, asyncResponse]() { @@ -978,10 +988,16 @@ namespace mtconnect { { using boost::placeholders::_1; - if (!m_server->isRunning()) + auto service = asyncResponse->m_service.lock(); + + if (!service || !m_server || !m_server->isRunning()) { - asyncResponse->m_session->fail(boost::beast::http::status::internal_server_error, - "Agent shutting down, aborting stream"); + LOG(warning) << "Trying to send chunk when service has stopped"; + if (service) + { + asyncResponse->m_session->fail(boost::beast::http::status::internal_server_error, + "Agent shutting down, aborting stream"); + } return; } diff --git a/src/mtconnect/sink/sink.hpp b/src/mtconnect/sink/sink.hpp index ea4a39ff4..d7599b356 100644 --- a/src/mtconnect/sink/sink.hpp +++ b/src/mtconnect/sink/sink.hpp @@ -80,7 +80,7 @@ namespace mtconnect { const std::string &name, boost::asio::io_context &io, SinkContractPtr &&contract, const ConfigOptions &options, const boost::property_tree::ptree &block)>; - class AGENT_LIB_API Sink + class AGENT_LIB_API Sink : public std::enable_shared_from_this { public: Sink(const std::string &name, SinkContractPtr &&contract) @@ -88,6 +88,8 @@ namespace mtconnect { {} virtual ~Sink() = default; + SinkPtr getptr() const { return const_cast(this)->shared_from_this(); } + virtual void start() = 0; virtual void stop() = 0;