ChimeraTK-DeviceAccess  03.18.00
Utilities.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 #pragma once
4 
5 #include "DeviceInfoMap.h"
6 #include "Exception.h"
7 
8 #include <list>
9 #include <map>
10 
11 namespace ChimeraTK {
12 
17  std::string getDMapFilePath();
18 
26  void setDMapFilePath(std::string dmapFilePath);
27 
32  std::string backendType;
33  std::string address;
34  std::map<std::string, std::string> parameters;
35  };
36 
40  struct Sdm {
41  double sdmVersion{0.1};
42  std::string host;
43  std::string interface;
44  std::string instance;
45  std::string protocol;
46  std::list<std::string> parameters;
47  };
48 
49  namespace Utilities {
50 
53  DeviceDescriptor parseDeviceDesciptor(std::string cddString);
54 
58  bool isDeviceDescriptor(std::string theString);
59 
61  Sdm parseSdm(const std::string& sdmString);
62 
65  Sdm parseDeviceString(const std::string& deviceString);
66 
70  bool isSdm(const std::string& theString);
71 
74  size_t countOccurence(std::string theString, char delimiter);
75 
78  DeviceInfoMap::DeviceInfo aliasLookUp(const std::string& aliasName, const std::string& dmapFilePath);
79 
82  std::vector<std::string> getAliasList();
83 
86  void printStackTrace();
87 
88  } // namespace Utilities
89 
90 } /* namespace ChimeraTK */
ChimeraTK::Sdm::host
std::string host
Definition: Utilities.h:42
ChimeraTK::Sdm::interface
std::string interface
Definition: Utilities.h:43
ChimeraTK::Utilities::parseDeviceDesciptor
DeviceDescriptor parseDeviceDesciptor(std::string cddString)
Parse a ChimeraTK device descriptor (CDD) and return the information in the DeviceDescriptor struct.
Definition: Utilities.cpp:47
ChimeraTK::Sdm::sdmVersion
double sdmVersion
Definition: Utilities.h:41
ChimeraTK::Utilities::countOccurence
size_t countOccurence(std::string theString, char delimiter)
Check if the given string only contains alphanumeric characters.
Definition: Utilities.cpp:21
ChimeraTK::Utilities::getAliasList
std::vector< std::string > getAliasList()
Returns the list of device aliases from the DMap file set using BackendFactory::setDMapFilePath.
Definition: Utilities.cpp:295
ChimeraTK::Sdm::instance
std::string instance
Definition: Utilities.h:44
ChimeraTK::Sdm
This structure holds the information of an SDM.
Definition: Utilities.h:40
ChimeraTK::DeviceDescriptor
This structure holds the information of an ChimeraTK device descriptor.
Definition: Utilities.h:31
ChimeraTK::DeviceDescriptor::parameters
std::map< std::string, std::string > parameters
Definition: Utilities.h:34
ChimeraTK::DeviceDescriptor::backendType
std::string backendType
Definition: Utilities.h:32
ChimeraTK::Utilities::parseDeviceString
Sdm parseDeviceString(const std::string &deviceString)
Parse an old-style device string (either path to device node or map file name for dummies)
Definition: Utilities.cpp:260
ChimeraTK::DeviceDescriptor::address
std::string address
Definition: Utilities.h:33
ChimeraTK::Utilities::isSdm
bool isSdm(const std::string &theString)
Check wehter the given string seems to be an SDM.
Definition: Utilities.cpp:28
ChimeraTK::Utilities::parseSdm
Sdm parseSdm(const std::string &sdmString)
Parse an SDM URI and return the device information in the Sdm struct.
Definition: Utilities.cpp:189
ChimeraTK::DeviceInfoMap::DeviceInfo
Stores information about one device.
Definition: DeviceInfoMap.h:30
ChimeraTK::Sdm::parameters
std::list< std::string > parameters
Definition: Utilities.h:46
ChimeraTK::Utilities::isDeviceDescriptor
bool isDeviceDescriptor(std::string theString)
Check whether the given string seems to be a CDD.
Definition: Utilities.cpp:37
ChimeraTK::getDMapFilePath
std::string getDMapFilePath()
Returns the dmap file name which the library currently uses for looking up device(alias) names.
Definition: Utilities.cpp:321
ChimeraTK::Utilities::aliasLookUp
DeviceInfoMap::DeviceInfo aliasLookUp(const std::string &aliasName, const std::string &dmapFilePath)
Search for an alias in a given DMap file and return the DeviceInfo entry.
Definition: Utilities.cpp:286
DeviceInfoMap.h
ChimeraTK::Sdm::protocol
std::string protocol
Definition: Utilities.h:45
Exception.h
ChimeraTK::setDMapFilePath
void setDMapFilePath(std::string dmapFilePath)
Set the location of the dmap file.
Definition: Utilities.cpp:327
ChimeraTK
Definition: DummyBackend.h:16
ChimeraTK::Utilities::printStackTrace
void printStackTrace()
Print a call stack trace (but continue executing the process normally).
Definition: Utilities.cpp:333