CGMES_3_0_0
Loading...
Searching...
No Matches
CIMWriter Class Reference

Class for writing CIM RDF/XML files. More...

#include <CIMWriter.hpp>

Static Public Member Functions

static void writeFile (const std::string &path, const std::vector< BaseClass * > &objList)
 Write the CIM data to a RDF/XML file.
static void writeFile (const std::string &path, const std::vector< BaseClass * > &objList, const CGMESProfile &profile, const std::string &modelId, const std::map< std::string, CGMESProfile > &classProfileMap)
 Write the CIM data corresponding to one profile to a RDF file.
static std::map< CGMESProfile, std::string > writeFiles (const std::string &pathStem, const std::vector< BaseClass * > &objList, const std::string &modelIdStem, const std::map< std::string, CGMESProfile > &classProfileMap)
 Write the CIM data to RDF/XML files separated by profiles.
static void writeCim (std::ostream &rdf, const std::vector< BaseClass * > &objList)
 Write the CIM data to a stream (e.g. a file stream).
static bool writeCim (std::ostream &rdf, const std::vector< BaseClass * > &objList, const CGMESProfile &profile, const std::string &modelId, const std::map< std::string, CGMESProfile > &classProfileMap)
 Write CIM objects as RDF/XML data to a stream.
static bool isClassMatchingProfile (const BaseClass *obj, const CGMESProfile &profile)
 Check if this profile is a possible profile for this CIM object.
static CGMESProfile getClassProfile (const BaseClass *obj)
 Get the main profile of this CIM object.
static std::map< std::string, CGMESProfile > getClassProfileMap (const std::vector< BaseClass * > &objList)
 Get the main profiles for a list of CIM objects.
static CGMESProfile getAttributeProfile (const BaseClass *obj, const std::string &attr, const CGMESProfile &classProfile)
 Get the profile for this attribute of the CIM object.

Detailed Description

Class for writing CIM RDF/XML files.

Member Function Documentation

◆ getAttributeProfile()

CGMESProfile CIMWriter::getAttributeProfile ( const BaseClass * obj,
const std::string & attr,
const CGMESProfile & classProfile )
static

Get the profile for this attribute of the CIM object.

This function searches for the profile of an attribute for the CIM type of an object. If the main profile of the type is a possible profile of the attribute it should be choosen. Otherwise, the first profile in the list of possible profiles ordered by profile number.

Parameters
objCIM object to get the CIM type from
attrAttribute to check
classProfileMain profile of the CIM type
Returns
Attribute profile

◆ getClassProfile()

CGMESProfile CIMWriter::getClassProfile ( const BaseClass * obj)
static

Get the main profile of this CIM object.

This function searches for the main profile of the CIM type of an object. If the type contains attributes for different profiles not all data of the object could be written into one file. To write the data to as few as possible files the main profile should be that with most of the attributes. But some types contain a lot of rarely used special attributes, i.e. attributes for a special profile (e.g. TopologyNode has many attributes for TopologyBoundary, but the main profile should be Topology). That's why attributes that only belong to one profile are skipped in the search algorithm.

Parameters
objCIM object to get the CIM type from
Returns
Main profile

◆ getClassProfileMap()

std::map< std::string, CGMESProfile > CIMWriter::getClassProfileMap ( const std::vector< BaseClass * > & objList)
static

Get the main profiles for a list of CIM objects.

This function searches for the main profile of each CIM type in the object list (see getClassProfile for details).

The result could be used as parameter for the write functions: writeFiles and writeCim. But it is also possible to optimize the mapping manually for some CIM types before calling the write function.

Parameters
objListList of CIM objects
Returns
Mapping of CIM type to profile

◆ isClassMatchingProfile()

bool CIMWriter::isClassMatchingProfile ( const BaseClass * obj,
const CGMESProfile & profile )
static

Check if this profile is a possible profile for this CIM object.

This function checks if the CIM type of an object contains data for a profile. The profile could be the main profile of the type, or the type contains attributes for this profile.

Parameters
objCIM object to get the CIM type from
profileProfile to check
Returns
True/False

◆ writeCim() [1/2]

void CIMWriter::writeCim ( std::ostream & rdf,
const std::vector< BaseClass * > & objList )
static

Write the CIM data to a stream (e.g. a file stream).

All CIM objects are written to just one stream, regardless of profiles.

Parameters
rdfOutput stream
objListList of CIM objects to write

◆ writeCim() [2/2]

bool CIMWriter::writeCim ( std::ostream & rdf,
const std::vector< BaseClass * > & objList,
const CGMESProfile & profile,
const std::string & modelId,
const std::map< std::string, CGMESProfile > & classProfileMap )
static

Write CIM objects as RDF/XML data to a stream.

This function writes RDF/XML data corresponding to one profile into a stream (e.g. a file stream).

Parameters
rdfOutput stream
objListList of CIM objects to write
profileOnly data for this profile should be written
modelIdModel ID to write into the model description
classProfileMapMapping of CIM type to profile
Returns
Success: at least one object ist written to the stream

◆ writeFile() [1/2]

void CIMWriter::writeFile ( const std::string & path,
const std::vector< BaseClass * > & objList )
static

Write the CIM data to a RDF/XML file.

All CIM objects are written to just one file, regardless of profiles.

Parameters
pathPath of the file to write
objListList of CIM objects to write

◆ writeFile() [2/2]

void CIMWriter::writeFile ( const std::string & path,
const std::vector< BaseClass * > & objList,
const CGMESProfile & profile,
const std::string & modelId,
const std::map< std::string, CGMESProfile > & classProfileMap )
static

Write the CIM data corresponding to one profile to a RDF file.

If no profile is specified, all objects are written, regardless of profiles. In this case, modelId and classProfileMap are not required.

Parameters
pathPath of file to write
objListList of CIM objects to write
profileOnly data for this profile should be written (if specified)
modelIdModel ID to write into the model description
classProfileMapMapping of CIM type to profile

◆ writeFiles()

std::map< CGMESProfile, std::string > CIMWriter::writeFiles ( const std::string & pathStem,
const std::vector< BaseClass * > & objList,
const std::string & modelIdStem,
const std::map< std::string, CGMESProfile > & classProfileMap )
static

Write the CIM data to RDF/XML files separated by profiles.

Each CIM object will be written to its corresponding profile file depending on classProfileMap. But some objects to more than one file if some attribute profiles are not the same as the class profile.

Parameters
pathStemStem of the output files, resulting files: <pathStem>_<profileName>.xml
objListList of CIM objects to write
modelIdStemStem of the model IDs, resulting IDs: <modelIdStem>_<profileName>
classProfileMapMapping of CIM type to profile
Returns
Written files: Mapping of profile to file

The documentation for this class was generated from the following files: