Sen API
Sen Libraries
Loading...
Searching...
No Matches
fom_common.h File Reference
#include "sen/core/meta/callable.h"
#include "sen/core/meta/class_type.h"
#include "sen/core/meta/type.h"
#include "pugixml.hpp"
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  sen
namespace  sen::lang
namespace  sen::lang::fom

Functions

bool sen::lang::fom::startsWith (const std::string &str, const std::string subStr) noexcept
 True if str begins with subStr.
bool sen::lang::fom::isNumber (const std::string &s)
 True if s is not empty and holds digits only.
std::optional< std::uint64_t > sen::lang::fom::parseUnsigned (std::string_view text)
 Reads a decimal unsigned value, or nothing if the text is not one or does not fit in 64 bits. Surrounding whitespace and a leading + are ignored; any other trailing character is a failure, so a half-numeric value is not read as its numeric prefix.
std::vector< std::string_view > sen::lang::fom::splitString (std::string_view input, std::string_view delimiters)
 Splits input on any of the delimiters. Empty pieces are kept.
std::string sen::lang::fom::toLower (const std::string &original)
 A copy of original with every ASCII upper case letter lowered.
std::string sen::lang::fom::toLowerCamelCase (const std::string &original)
 An HLA name as a sen member name: words split on _ and -, lower camel case, and a Val suffix where the result would be a C++ keyword.
bool sen::lang::fom::findStringIgnoreCase (const std::string &strHaystack, const std::string &strNeedle)
 True if strNeedle appears anywhere in strHaystack, ignoring case.
std::string sen::lang::fom::toSenPropertyName (const std::string &original)
 An HLA attribute name as a sen property name. Five names belong to the Object class, so an attribute that would take one of them gets NonSen appended.
std::string sen::lang::fom::formatSemantics (std::string str)
 Semantics text as a description: newlines become spaces and quotes become apostrophes.
bool sen::lang::fom::isTrue (std::string_view str, std::string_view attribute)
 Reads true or false, ignoring case. An empty string is false; anything else throws.
void sen::lang::fom::collectClassesNodes (pugi::xml_node node, std::vector< pugi::xml_node > &result)
 Collects the object class nodes that declare a class, descending through nested ones. A node declares one if it carries semantics or an attribute; an extension carries no semantics.
void sen::lang::fom::collectInteractionNodes (pugi::xml_node node, std::vector< pugi::xml_node > &result)
 The same for interaction classes, on semantics or at least one parameter.
std::string sen::lang::fom::computeInteractionPath (const pugi::xpath_node &interactionNode)
 The path of an interaction's PARENT, without the interaction root, which is what walking up the hierarchy needs. Empty for an interaction directly under the root. For the interaction's own path, which is its identity, use interactionClassPath.
std::string sen::lang::fom::interactionClassPath (pugi::xml_node node)
 The nested path of an interaction class node, without the interaction root, joined with dots. An interaction is identified by its path, so two sharing a leaf name in different branches stay apart, and one named by two modules is recognized as one interaction.
std::string sen::lang::fom::objectClassPath (pugi::xml_node node)
 The nested path of an object class node, without the HLA root, joined with dots. A class is identified by its path, so two classes sharing a leaf name in different branches stay apart.
std::string sen::lang::fom::computeClassPath (const ClassType *parent, const std::string &child, const ClassType *root)
 The path of a class in the FOM hierarchy, up to but not including root.
void sen::lang::fom::collectConstructorArgs (std::vector< Arg > &list, const ClassType &type)
 The static read-write properties of a class, parents first: these are its constructor arguments.
void sen::lang::fom::collectConstructorArgs (std::vector< Arg > &list, const ClassSpec &spec)
 The same from a spec that has not been made into a type yet.
std::vector< Arg > sen::lang::fom::prependArgs (const std::vector< Arg > &currentArgs, const std::vector< Arg > &argsToPrepend)
 argsToPrepend followed by currentArgs.
std::optional< TransportMode > sen::lang::fom::getTransportMode (const std::string &hlaTransport)
 The transport mode for a property, from the FOM transportation. Nothing for a value the DIF does not define: the caller knows the file and the member, so it writes the message.
std::optional< TransportMode > sen::lang::fom::getMethodTransportMode (const std::string &hlaTransport)
 The same for a method: best effort is unicast there, because a call goes to one object.
std::optional< TransportMode > sen::lang::fom::getEventTransportMode (const std::string &hlaTransport)
 The same for an event.

Variables

constexpr std::size_t sen::lang::fom::maxStaticVectorSize = 1024 * 1024
 The largest maximum a bounded sequence is given. Above this an array becomes unbounded.