Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(AGENT_VERSION_MAJOR 2)
set(AGENT_VERSION_MINOR 7)
set(AGENT_VERSION_PATCH 0)
set(AGENT_VERSION_BUILD 12)
set(AGENT_VERSION_BUILD 13)
set(AGENT_VERSION_RC "")

# This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent
Expand Down
2 changes: 1 addition & 1 deletion agent/cppagent.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
8 changes: 7 additions & 1 deletion src/mtconnect/agent.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -124,6 +124,12 @@ namespace mtconnect {
m_printers["xml"] = make_unique<printer::XmlPrinter>(m_pretty, m_validation);
m_printers["json"] = make_unique<printer::JsonPrinter>(jsonVersion, m_pretty, m_validation);

if (!m_schemaVersion)
{
m_xmlParser->parseFile(m_deviceXmlPath, dynamic_cast<printer::XmlPrinter *>(m_printers["xml"].get()));
m_schemaVersion = m_xmlParser->getSchemaVersion();
}

if (m_schemaVersion)
{
m_intSchemaVersion = IntSchemaVersion(*m_schemaVersion);
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/agent.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/asset.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/asset.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/asset_buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/asset_storage.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/component_configuration_parameters.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/component_configuration_parameters.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/cutting_tool.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/cutting_tool.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/file_asset.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/file_asset.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/fixture.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/fixture.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/pallet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/pallet.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/part.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/part.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/physical_asset.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/physical_asset.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/process.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/process.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/qif_document.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/qif_document.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/raw_material.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/raw_material.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/target.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/target.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/task.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/asset/task.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/buffer/checkpoint.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/buffer/checkpoint.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/buffer/circular_buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/config.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

//
// Copyright Copyright 2009-2025, AMT � The Association For Manufacturing Technology (�AMT�)
// Copyright 2009-2026, AMT � The Association For Manufacturing Technology (�AMT�)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
21 changes: 19 additions & 2 deletions src/mtconnect/configuration/agent_config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -53,6 +53,7 @@
#include <stdio.h>
#include <sys/stat.h>
#include <vector>
#include <format>

#include "mtconnect/agent.hpp"
#include "mtconnect/configuration/config_options.hpp"
Expand Down Expand Up @@ -809,6 +810,10 @@ namespace mtconnect::configuration {
throw;
}

// Expand $VAR and ${VAR} references from sibling config values and the
// environment before any options are read.
expandConfigVariables(config);

if (m_logChannels.empty())
{
configureLogger(config);
Expand Down Expand Up @@ -970,7 +975,19 @@ namespace mtconnect::configuration {
// Make the PipelineContext
m_pipelineContext = std::make_shared<pipeline::PipelineContext>();
m_pipelineContext->m_contract = m_agent->makePipelineContract();

if (!HasOption(options, configuration::SchemaVersion))
{
if (m_agent->getSchemaVersion())
{
options[configuration::SchemaVersion] = *m_agent->getSchemaVersion();
}
else
{
options[configuration::SchemaVersion] = std::format("{}.{}", std::to_string(AGENT_VERSION_MAJOR),
std::to_string(AGENT_VERSION_MINOR));

}
Comment on lines +986 to +989
}
loadSinks(config, options);

m_agent->initialize(m_pipelineContext);
Expand Down
12 changes: 9 additions & 3 deletions src/mtconnect/configuration/agent_config.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -272,6 +272,14 @@ namespace mtconnect {
///@param path the path to set for the config file directory
void setConfigPath(const std::filesystem::path &path) { m_configPath = path; }

/// @brief Expand `$VAR` and `${VAR}` references in the config tree.
///
/// Each value is resolved against sibling config values that precede it and,
/// failing that, against environment variables. Unresolved references are left
/// in place. Called by loadConfig() before any options are parsed.
/// @param config the parsed configuration tree to expand in place
void expandConfigVariables(boost::property_tree::ptree &config);

protected:
DevicePtr getDefaultDevice();
void loadAdapters(const ptree &tree, const ConfigOptions &options);
Expand Down Expand Up @@ -349,8 +357,6 @@ namespace mtconnect {
}
}

void expandConfigVariables(boost::property_tree::ptree &);

protected:
using text_sink = boost::log::sinks::synchronous_sink<boost::log::sinks::text_file_backend>;
using console_sink =
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/configuration/async_context.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/configuration/config_options.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/configuration/hook_manager.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/configuration/parser.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/configuration/parser.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/configuration/service.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/mtconnect/configuration/service.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Copyright 2009-2025, AMT – The Association For Manufacturing Technology (“AMT”)
// Copyright 2009-2026, AMT – The Association For Manufacturing Technology (“AMT”)
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading
Loading