VR-Engage  2.3
Loading...
Searching...
No Matches
vreStatePropertiesUtil.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreStatePropertiesUtil.h
7//! \ingroup vreUtil
8//! \brief Utility functions for VR-Engage runtime state properties
9//!
10//! This file provides shared helpers for reading or updating the structured
11//! role-occupancy state properties published by VR-Engage simulation objects.
12
13#pragma once
14
15#include "vreUtil/export.h"
16
17#include <string>
18#include <vector>
19
20class DtPropertyInterface;
21class DtString;
22
23namespace makVre
24{
25//! \brief State property carrying direct role assignments.
26constexpr const char DtRolesStatePropertyName[] = "Roles";
27
28//! \brief Human-only state property carrying the currently engaged embarked role/slot name.
29constexpr const char DtEngagedEmbarkedStationStatePropertyName[] = "EngagedEmbarkedStation";
30
31//! \brief One station entry from the published "Roles" state property.
33{
34 //! \brief Station identifier stored in the entry.
35 std::string myStationId;
36
37 //! \brief Entity-role name stored in the entry.
38 std::string myRoleName;
39
40 //! \brief True when the station entry represents an embarked role assignment.
41 bool myIsEmbarked = false;
42};
43
44//! \brief Checks whether a property is a list of role-station structures.
45//! \param property The property to inspect.
46//! \return True when the property is a role-station list, false otherwise.
47UTIL_DLL bool statePropertyIsRoleStationList(const DtPropertyInterface* property);
48
49//! \brief Counts the number of station entries in a role-station list.
50//! \param property The property to inspect.
51//! \return Number of entries with non-empty station identifiers.
52UTIL_DLL int statePropertyRoleStationCount(const DtPropertyInterface* property);
53
54//! \brief Determines whether a role-station list contains any station entries.
55//! \param property The property to inspect.
56//! \return True if at least one station entry is present.
57UTIL_DLL bool statePropertyHasRoleStations(const DtPropertyInterface* property);
58
59//! \brief Determines whether a role-station list contains a specific station.
60//! \param property The property to inspect.
61//! \param stationId The station identifier to search for.
62//! \return True if a matching station entry is present.
63UTIL_DLL bool statePropertyContainsRoleStation(const DtPropertyInterface* property, const DtString& stationId);
64
65//! \brief Appends all role-station entries from a property to an output vector.
66//! \param property The property to inspect.
67//! \param valuesOut Output vector that receives the station entries.
69 const DtPropertyInterface* property, std::vector<DtStatePropertyRoleStationItem>& valuesOut);
70
71//! \brief Appends all station identifiers from a role-station list to an output vector.
72//! \param property The property to inspect.
73//! \param valuesOut Output vector that receives the station identifiers.
75 const DtPropertyInterface* property, std::vector<std::string>& valuesOut);
76
77//! \brief Builds a brace-delimited station-id string from a role-station list.
78//! \param property The property to inspect.
79//! \return String in the form "{station1}{station2}" containing each non-empty station identifier.
80UTIL_DLL std::string braceDelimitedStatePropertyRoleStationIds(const DtPropertyInterface* property);
81
82//! \brief Adds or updates a station entry in a role-station list.
83//! \param property The mutable property to update.
84//! \param value The station entry to add or update.
85//! \return True if the station entry is present after the call, false otherwise.
87 DtPropertyInterface* property, const DtStatePropertyRoleStationItem& value);
88
89//! \brief Removes a station entry from a role-station list.
90//! \param property The mutable property to update.
91//! \param stationId The station identifier to remove.
92//! \return True if a station entry was removed, false otherwise.
93UTIL_DLL bool removeStatePropertyRoleStationItem(DtPropertyInterface* property, const DtString& stationId);
94} // namespace makVre
Defines export macros for the VREngage Utility library.
#define UTIL_DLL
Export/import macro for non-Windows platforms.
Definition export.h:39
!
Definition glsVreMessageUtil.h:50
UTIL_DLL bool statePropertyHasRoleStations(const DtPropertyInterface *property)
Determines whether a role-station list contains any station entries.
UTIL_DLL bool statePropertyIsRoleStationList(const DtPropertyInterface *property)
Checks whether a property is a list of role-station structures.
UTIL_DLL bool addStatePropertyRoleStationItem(DtPropertyInterface *property, const DtStatePropertyRoleStationItem &value)
Adds or updates a station entry in a role-station list.
UTIL_DLL std::string braceDelimitedStatePropertyRoleStationIds(const DtPropertyInterface *property)
Builds a brace-delimited station-id string from a role-station list.
UTIL_DLL void appendStatePropertyRoleStationItems(const DtPropertyInterface *property, std::vector< DtStatePropertyRoleStationItem > &valuesOut)
Appends all role-station entries from a property to an output vector.
constexpr const char DtRolesStatePropertyName[]
State property carrying direct role assignments.
Definition vreStatePropertiesUtil.h:26
UTIL_DLL bool statePropertyContainsRoleStation(const DtPropertyInterface *property, const DtString &stationId)
Determines whether a role-station list contains a specific station.
UTIL_DLL int statePropertyRoleStationCount(const DtPropertyInterface *property)
Counts the number of station entries in a role-station list.
UTIL_DLL void appendStatePropertyRoleStationIds(const DtPropertyInterface *property, std::vector< std::string > &valuesOut)
Appends all station identifiers from a role-station list to an output vector.
constexpr const char DtEngagedEmbarkedStationStatePropertyName[]
Human-only state property carrying the currently engaged embarked role/slot name.
Definition vreStatePropertiesUtil.h:29
UTIL_DLL bool removeStatePropertyRoleStationItem(DtPropertyInterface *property, const DtString &stationId)
Removes a station entry from a role-station list.
One station entry from the published "Roles" state property.
Definition vreStatePropertiesUtil.h:33
bool myIsEmbarked
True when the station entry represents an embarked role assignment.
Definition vreStatePropertiesUtil.h:41
std::string myStationId
Station identifier stored in the entry.
Definition vreStatePropertiesUtil.h:35
std::string myRoleName
Entity-role name stored in the entry.
Definition vreStatePropertiesUtil.h:38