Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::lang::fom Namespace Reference

Classes

struct  Document
 One document that was read, and the nodes in it that declare something. More...
struct  MappingDocument
 A mapping file and where it was read from, so a refusal can name the file that asked for something the FOM does not have. More...
struct  DocumentTypeSet
 A type set and the path it was built from. One caller resolves a single FOM file by path. More...
struct  Declaration
 One declaring node and the document it came from, so a refusal can name the file. More...
struct  Declarations
 Everything that declares one type. The complete definition owns the type and decides its package; every other declaration adds its members to it. HLA 4 calls this the union over the collective set of modules, and uses the same two words for the two roles. More...
class  FomDocuments
 Reads every document, indexes what each one declares, then builds the types. A type is built on first reference, from every declaration of it rather than only the first, which is what lets a file beside the FOM add members to it. More...

Functions

bool startsWith (const std::string &str, const std::string subStr) noexcept
 True if str begins with subStr.
bool isNumber (const std::string &s)
 True if s is not empty and holds digits only.
std::optional< std::uint64_t > 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 > splitString (std::string_view input, std::string_view delimiters)
 Splits input on any of the delimiters. Empty pieces are kept.
std::string toLower (const std::string &original)
 A copy of original with every ASCII upper case letter lowered.
std::string 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 findStringIgnoreCase (const std::string &strHaystack, const std::string &strNeedle)
 True if strNeedle appears anywhere in strHaystack, ignoring case.
std::string 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 formatSemantics (std::string str)
 Semantics text as a description: newlines become spaces and quotes become apostrophes.
bool isTrue (std::string_view str, std::string_view attribute)
 Reads true or false, ignoring case. An empty string is false; anything else throws.
void 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 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 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 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 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 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 collectConstructorArgs (std::vector< Arg > &list, const ClassType &type)
 The static read-write properties of a class, parents first: these are its constructor arguments.
void 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 > prependArgs (const std::vector< Arg > &currentArgs, const std::vector< Arg > &argsToPrepend)
 argsToPrepend followed by currentArgs.
std::optional< TransportMode > 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 > 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 > getEventTransportMode (const std::string &hlaTransport)
 The same for an event.

Variables

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

Class Documentation

◆ sen::lang::fom::Document

struct sen::lang::fom::Document

One document that was read, and the nodes in it that declare something.

Class Members
path path
xml_document xml
xml_node objectModel
string name modelIdentification/name, used to resolve dependency references
string package the directory name in lower case
bool isExtension {} from the extensions input: adds members, never owns a type
bool built {} guards ensureBuilt's recursion
vector< Document * > dependencies
vector< Document * > mappingImports documents a mapping pulled in
vector< xml_node > classNodes
vector< xml_node > interactionNodes
CustomTypeRegistry registry The types this document owns. They become its type set, so this decides which generated file each type lands in.
vector< ConstTypeHandle<> > storage

◆ sen::lang::fom::MappingDocument

struct sen::lang::fom::MappingDocument

A mapping file and where it was read from, so a refusal can name the file that asked for something the FOM does not have.

Class Members
path path
xml_document xml

◆ sen::lang::fom::DocumentTypeSet

struct sen::lang::fom::DocumentTypeSet

A type set and the path it was built from. One caller resolves a single FOM file by path.

Class Members
path path
unique_ptr< TypeSet > typeSet

◆ sen::lang::fom::Declaration

struct sen::lang::fom::Declaration

One declaring node and the document it came from, so a refusal can name the file.

Class Members
xml_node node
Document * document {}

◆ sen::lang::fom::Declarations

struct sen::lang::fom::Declarations

Everything that declares one type. The complete definition owns the type and decides its package; every other declaration adds its members to it. HLA 4 calls this the union over the collective set of modules, and uses the same two words for the two roles.

Class Members
vector< Declaration > all in the order the documents were read
Document * owner {} null when only extensions declare the type
bool ownerIsComplete {false} the owner's declaration carries semantics

Function Documentation

◆ startsWith()

bool sen::lang::fom::startsWith ( const std::string & str,
const std::string subStr )
nodiscardnoexcept

True if str begins with subStr.

◆ isNumber()

bool sen::lang::fom::isNumber ( const std::string & s)
nodiscard

True if s is not empty and holds digits only.

◆ parseUnsigned()

std::optional< std::uint64_t > sen::lang::fom::parseUnsigned ( std::string_view text)
nodiscard

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.

◆ splitString()

std::vector< std::string_view > sen::lang::fom::splitString ( std::string_view input,
std::string_view delimiters )
nodiscard

Splits input on any of the delimiters. Empty pieces are kept.

◆ toLower()

std::string sen::lang::fom::toLower ( const std::string & original)
nodiscard

A copy of original with every ASCII upper case letter lowered.

◆ toLowerCamelCase()

std::string sen::lang::fom::toLowerCamelCase ( const std::string & original)
nodiscard

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.

◆ findStringIgnoreCase()

bool sen::lang::fom::findStringIgnoreCase ( const std::string & strHaystack,
const std::string & strNeedle )
nodiscard

True if strNeedle appears anywhere in strHaystack, ignoring case.

◆ toSenPropertyName()

std::string sen::lang::fom::toSenPropertyName ( const std::string & original)
nodiscard

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.

◆ formatSemantics()

std::string sen::lang::fom::formatSemantics ( std::string str)
nodiscard

Semantics text as a description: newlines become spaces and quotes become apostrophes.

◆ isTrue()

bool sen::lang::fom::isTrue ( std::string_view str,
std::string_view attribute )
nodiscard

Reads true or false, ignoring case. An empty string is false; anything else throws.

◆ collectClassesNodes()

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.

◆ collectInteractionNodes()

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.

◆ computeInteractionPath()

std::string sen::lang::fom::computeInteractionPath ( const pugi::xpath_node & interactionNode)
nodiscard

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.

◆ interactionClassPath()

std::string sen::lang::fom::interactionClassPath ( pugi::xml_node node)
nodiscard

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.

◆ objectClassPath()

std::string sen::lang::fom::objectClassPath ( pugi::xml_node node)
nodiscard

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.

◆ computeClassPath()

std::string sen::lang::fom::computeClassPath ( const ClassType * parent,
const std::string & child,
const ClassType * root )
nodiscard

The path of a class in the FOM hierarchy, up to but not including root.

◆ collectConstructorArgs() [1/2]

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.

◆ collectConstructorArgs() [2/2]

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.

◆ prependArgs()

std::vector< Arg > sen::lang::fom::prependArgs ( const std::vector< Arg > & currentArgs,
const std::vector< Arg > & argsToPrepend )
nodiscard

argsToPrepend followed by currentArgs.

◆ getTransportMode()

std::optional< TransportMode > sen::lang::fom::getTransportMode ( const std::string & hlaTransport)
nodiscard

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.

◆ getMethodTransportMode()

std::optional< TransportMode > sen::lang::fom::getMethodTransportMode ( const std::string & hlaTransport)
nodiscard

The same for a method: best effort is unicast there, because a call goes to one object.

◆ getEventTransportMode()

std::optional< TransportMode > sen::lang::fom::getEventTransportMode ( const std::string & hlaTransport)
nodiscard

The same for an event.

Variable Documentation

◆ maxStaticVectorSize

std::size_t sen::lang::fom::maxStaticVectorSize = 1024 * 1024
constexpr

The largest maximum a bounded sequence is given. Above this an array becomes unbounded.