Template Class Workspace

Inheritance Relationships

Base Type

Class Documentation

template<EWorkspaceType TypeT>
class Workspace : public multisensor_calibration::AbstractWorkspace

Base workspace class, templated by the type of workspace.

Template Parameters:

TypeT – Type of workspace.

Public Functions

Workspace() = delete

Default constructor (deleted)

Workspace(const std::string &iWsPath, const rclcpp::Logger &iLogger)

Initialization constructor. This will initialize the workspace object with given variables. It will, however, not load the workspace.

Parameters:
  • iWsPath[in] Absolute path to workspace.

  • iLogger[in] Logger object of node. Needed for information logging

Workspace(const Workspace &rhs)

Copy constructor.

Workspace(Workspace &&rhs)

Move constructor.

virtual ~Workspace()

Destructor.

Workspace &operator=(const Workspace &rhs)

Copy assignment operator.

Workspace &operator=(Workspace &&rhs)

Move assignment operator.

virtual bool createBackup() const override

Create a backup of the workspace.

Returns:

True, if successful. False, otherwise.

virtual fs::path getPath() const override

Returns absolute path to workspace.

bool initialize()

Method to initialize non-existing workspace.

This will create the directory and copy the given settings file template from resource into the created directory.

Returns:

Returns true if successful. False, otherwise.

bool isValid() const

Check if workspace object is valid.

This will check if the directory exists and if it holds a corresponding type of workspace. Latter is being checked based on the key inside the settings.ini file.

virtual bool load(const bool forceMkWs = false, const bool forceOverwrite = false) override

Load workspace. This will if check if workspace and settings file exist. If not, it will initialize an empty workspace and ask the user to adjust the settings file. Finally, the settings file is loaded into oSettingsObj,.

Parameters:
  • forceMkWs[in] If true, this will immediately create the workspace if does not exist. If false (default), the user is notified that the workspace does not exist and is asked if it is do be created.

  • forceOverwrite[in] If true, a new settings file is copied into the directory, even if a previous settings file already exists. If false (default), the already existing setting file (if available) is used.

Returns:

True, if successful. In this case, the returned settings object is valid. If false, the user has aborted or an error has occurred.

virtual QSettings *settingsPtr() override

Return pointer to workspace settings.

Note

This might return a nullptr, if the workspace object has not yet been initialized by Workspace::load().

Public Static Functions

static bool isValid(const fs::path &iDirectory)

Check if workspace at given path is valid.

This will check if the directory exists and if it holds a corresponding type of workspace. Latter is being checked based on the key inside the settings.ini file.

Protected Attributes

fs::path wsPath_

Absolute path to workspace.

std::shared_ptr<QSettings> pSettings_

Pointer to object settings.

rclcpp::Logger logger_

Logger object of node.

std::string settingsTplFileName_

Name of settings template file.

std::vector<std::string> requiredFilesForBackup_

List file that have to exist in directory for backup to be done.