Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# The version number.
set(AGENT_VERSION_MAJOR 2)
set(AGENT_VERSION_MINOR 6)
set(AGENT_VERSION_MINOR 7)
set(AGENT_VERSION_PATCH 0)
set(AGENT_VERSION_BUILD 7)
set(AGENT_VERSION_RC "")
set(AGENT_VERSION_BUILD 1)
set(AGENT_VERSION_RC "RC1")

# This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent
cmake_minimum_required(VERSION 3.23 FATAL_ERROR)
Expand Down
8 changes: 8 additions & 0 deletions agent_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ set(AGENT_SOURCES
"${SOURCE_DIR}/asset/component_configuration_parameters.hpp"
"${SOURCE_DIR}/asset/physical_asset.hpp"
"${SOURCE_DIR}/asset/fixture.hpp"
"${SOURCE_DIR}/asset/part.hpp"
"${SOURCE_DIR}/asset/process.hpp"
"${SOURCE_DIR}/asset/pallet.hpp"
"${SOURCE_DIR}/asset/target.hpp"
"${SOURCE_DIR}/asset/task.hpp"

# src/asset SOURCE_FILES_ONLY

Expand All @@ -39,7 +43,11 @@ set(AGENT_SOURCES
"${SOURCE_DIR}/asset/component_configuration_parameters.cpp"
"${SOURCE_DIR}/asset/physical_asset.cpp"
"${SOURCE_DIR}/asset/fixture.cpp"
"${SOURCE_DIR}/asset/part.cpp"
"${SOURCE_DIR}/asset/process.cpp"
"${SOURCE_DIR}/asset/pallet.cpp"
"${SOURCE_DIR}/asset/target.cpp"
"${SOURCE_DIR}/asset/task.cpp"

# src/buffer HEADER_FILES_ONLY

Expand Down
9 changes: 9 additions & 0 deletions src/mtconnect/agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@
#include "mtconnect/asset/file_asset.hpp"
#include "mtconnect/asset/fixture.hpp"
#include "mtconnect/asset/pallet.hpp"
#include "mtconnect/asset/part.hpp"
#include "mtconnect/asset/process.hpp"
#include "mtconnect/asset/qif_document.hpp"
#include "mtconnect/asset/raw_material.hpp"
#include "mtconnect/asset/task.hpp"
#include "mtconnect/configuration/config_options.hpp"
#include "mtconnect/device_model/agent_device.hpp"
#include "mtconnect/entity/xml_parser.hpp"
Expand Down Expand Up @@ -102,6 +105,12 @@ namespace mtconnect {
ComponentConfigurationParameters::registerAsset();
Pallet::registerAsset();
Fixture::registerAsset();
Process::registerAsset();
ProcessArchetype::registerAsset();
Part::registerAsset();
PartArchetype::registerAsset();
Task::registerAsset();
TaskArchetype::registerAsset();

m_assetStorage = make_unique<AssetBuffer>(
GetOption<int>(options, mtconnect::configuration::MaxAssets).value_or(1024));
Expand Down
14 changes: 9 additions & 5 deletions src/mtconnect/asset/asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,27 @@
// limitations under the License.
//

#include "mtconnect/asset/asset.hpp"
#include "asset.hpp"

#include <map>
#include <utility>

#include "mtconnect/device_model/configuration/configuration.hpp"

using namespace std;

namespace mtconnect {
using namespace entity;
namespace asset {
FactoryPtr Asset::getFactory()
{
using namespace device_model::configuration;
static auto asset = make_shared<Factory>(
Requirements({Requirement("assetId", false), Requirement("deviceUuid", false),
Requirement("timestamp", ValueType::TIMESTAMP, false),
Requirement("hash", false),
Requirement("removed", ValueType::BOOL, false)}),
Requirements(
{Requirement("assetId", false), Requirement("deviceUuid", false),
Requirement("timestamp", ValueType::TIMESTAMP, false), Requirement("hash", false),
Requirement("Configuration", ValueType::ENTITY, Configuration::getFactory(), false),
Requirement("removed", ValueType::BOOL, false)}),
[](const std::string &name, Properties &props) -> EntityPtr {
return make_shared<Asset>(name, props);
});
Expand Down
108 changes: 108 additions & 0 deletions src/mtconnect/asset/part.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
//
// Copyright Copyright 2009-2025, 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.
//

#include "part.hpp"

using namespace std;

namespace mtconnect {
using namespace entity;
namespace asset {
FactoryPtr PartArchetype::getFactory()
{
static FactoryPtr factory;
if (!factory)
{
auto ext = make_shared<Factory>();
ext->registerFactory(regex(".+"), ext);
ext->setAny(true);
ext->setList(true);

auto customer = make_shared<Factory>(Requirements {
{"customerId", true},
{"name", false},
{"Address", false},
{"Description", false},
});

auto customers = make_shared<Factory>(Requirements {
{"Customer", ValueType::ENTITY, customer, 1, entity::Requirement::Infinite}});

factory = make_shared<Factory>(*Asset::getFactory());
factory->addRequirements({
{"revision", true},
{"family", false},
{"drawing", false},
{"Customers", ValueType::ENTITY_LIST, customers, false},
});
factory->registerFactory(regex(".+"), ext);
factory->setAny(true);
}
return factory;
}

void PartArchetype::registerAsset()
{
static bool once {true};
if (once)
{
Asset::registerAssetType("PartArchetype", getFactory());
once = false;
}
}

FactoryPtr Part::getFactory()
{
static FactoryPtr factory;
if (!factory)
{
auto ext = make_shared<Factory>();
ext->registerFactory(regex(".+"), ext);
ext->setAny(true);
ext->setList(true);

auto identifier = make_shared<Factory>(
Requirements {{"type", ControlledVocab {"UNIQUE_IDENTIFIER", "GROUP_IDENTIFIER"}, true},
{"stepIdRef", false},
{"timestamp", ValueType::TIMESTAMP, true},
{"VALUE", true}});

auto identifiers = make_shared<Factory>(Requirements {
{"Identifier", ValueType::ENTITY, identifier, 1, entity::Requirement::Infinite}});

factory = make_shared<Factory>(*Asset::getFactory());
factory->addRequirements({{"revision", true},
{"family", false},
{"drawing", false},
{"PartIdentifiers", ValueType::ENTITY_LIST, identifiers, false}});
factory->registerFactory(regex(".+"), ext);
factory->setAny(true);
}
return factory;
}

void Part::registerAsset()
{
static bool once {true};
if (once)
{
Asset::registerAssetType("Part", getFactory());
once = false;
}
}
} // namespace asset
} // namespace mtconnect
44 changes: 44 additions & 0 deletions src/mtconnect/asset/part.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright Copyright 2009-2025, 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 <map>
#include <utility>
#include <vector>

#include "asset.hpp"
#include "mtconnect/entity/factory.hpp"
#include "mtconnect/utilities.hpp"

namespace mtconnect::asset {
/// @brief Manufacturing process archetype asset
class AGENT_LIB_API PartArchetype : public Asset
{
public:
static entity::FactoryPtr getFactory();
static void registerAsset();
};

/// @brief Manufacturing process asset
class AGENT_LIB_API Part : public Asset
{
public:
static entity::FactoryPtr getFactory();
static void registerAsset();
};
} // namespace mtconnect::asset
113 changes: 113 additions & 0 deletions src/mtconnect/asset/process.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//
// Copyright Copyright 2009-2025, 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.
//

#include "process.hpp"

#include "target.hpp"

using namespace std;

namespace mtconnect {
using namespace entity;
namespace asset {
FactoryPtr ProcessArchetype::getFactory()
{
static FactoryPtr factory;
if (!factory)
{
auto activity =
make_shared<Factory>(Requirements {{"sequence", ValueType::INTEGER, false},
{"activityId", true},
{"precedence", ValueType::INTEGER, false},
{"optional", ValueType::BOOL, false},
{"Description", false}});

auto activityGroup = make_shared<Factory>(Requirements {
{"activityGroupId", true},
{"name", false},
{"Activity", ValueType::ENTITY, activity, 1, entity::Requirement::Infinite},
});

auto activityGroups = make_shared<Factory>(Requirements {
{"ActivityGroup", ValueType::ENTITY, activityGroup, 1, entity::Requirement::Infinite}});

auto processStep = make_shared<Factory>(
Requirements {{{"stepId", true},
{"optional", ValueType::BOOL, false},
{"sequence", ValueType::INTEGER, false},
{"Description", false},
{"StartTime", ValueType::TIMESTAMP, false},
{"Duration", ValueType::DOUBLE, false},
{"Targets", ValueType::ENTITY_LIST, Target::getTargetsFactory(), false},
{"ActivityGroups", ValueType::ENTITY_LIST, activityGroups, false}}});
processStep->setOrder(
{"Description", "StartTime", "Duration", "Targets", "ActivityGroups"});

auto routing = make_shared<Factory>(Requirements {
{"precedence", ValueType::INTEGER, true},
{"routingId", true},
{"ProcessStep", ValueType::ENTITY, processStep, 1, entity::Requirement::Infinite},
});

auto routings = make_shared<Factory>(Requirements {
{"Routing", ValueType::ENTITY, routing, 1, entity::Requirement::Infinite}});

factory = make_shared<Factory>(*Asset::getFactory());
factory->addRequirements({
{"revision", true},
{"Targets", ValueType::ENTITY_LIST, Target::getTargetsFactory(), false},
{"Routings", ValueType::ENTITY_LIST, routings, true},
});
factory->setOrder({"Configuration", "Routings", "Targets"});
}
return factory;
}

void ProcessArchetype::registerAsset()
{
static bool once {true};
if (once)
{
Asset::registerAssetType("ProcessArchetype", getFactory());
once = false;
}
}

FactoryPtr Process::getFactory()
{
static FactoryPtr factory;
if (!factory)
{
factory = ProcessArchetype::getFactory()->deepCopy();
auto routings = factory->getRequirement("Routings");
auto routing = routings->getFactory()->getRequirement("Routing");
routing->setMultiplicity(1, 1);
}
return factory;
}

void Process::registerAsset()
{
static bool once {true};
if (once)
{
Asset::registerAssetType("Process", getFactory());
once = false;
}
}
} // namespace asset
} // namespace mtconnect
Loading