PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
gsdml.cpp File Reference

Implements GSDML parsing and PROFINET I/O slot configuration. More...

#include "profinet/gsdml.h"
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <algorithm>
#include <map>
#include <sstream>
#include <stdexcept>
+ Include dependency graph for gsdml.cpp:

Go to the source code of this file.

Namespaces

namespace  profinet
 
namespace  profinet::gsdml
 

Functions

GSDMLDevice profinet::gsdml::ParseGsdmlString (const std::string &xml)
 Parse GSDML content already held in memory.
 
GSDMLDevice profinet::gsdml::ParseGsdml (const std::string &path)
 Parse a GSDML file into a GSDMLDevice.
 

Detailed Description

Implements GSDML parsing and PROFINET I/O slot configuration.

Implements the functionality declared in gsdml.h for parsing Generic Station Description Markup Language (GSDML) files and translating the device configuration into the PROFINET I/O structures used by the controller.

The implementation covers:

  • Parsing GSDML XML documents using libxml2 and XPath.
  • Namespace-independent XML element lookup.
  • Parsing GSDML integer and slot specifications.
  • Resolving ExternalTextList TextId references to human-readable names.
  • Parsing device identity, vendor, and device information.
  • Parsing Device Access Point (DAP) modules and system-defined submodules.
  • Parsing DAP virtual submodules and their process-data definitions.
  • Parsing pluggable modules and virtual submodules.
  • Parsing globally defined submodules referenced by modules.
  • Parsing UseableModules and PredefinedPnioModules slot assignments.
  • Resolving module and submodule references during I/O slot construction.
  • Validating module and submodule placement against GSDML restrictions.
  • Determining input/output process-data lengths from GSDML DataItems.
  • Configuring IOCR data and IOCS participation for each I/O slot.
  • Building default and explicitly assigned PROFINET I/O slot configurations.

XML resources are managed using RAII wrappers for libxml2 document and XPath objects. Parsing is designed to tolerate different GSDML namespace versions by matching XML elements using their local names.

Definition in file gsdml.cpp.

Variable Documentation

◆ ctx

xmlXPathContextPtr ctx = nullptr

Definition at line 67 of file gsdml.cpp.

Referenced by profinet::gsdml::ParseGsdmlString().

◆ doc

xmlDocPtr doc = nullptr

Definition at line 55 of file gsdml.cpp.

◆ obj