Commit 1beb34ea authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Clipboard: make a few getter functions const

parent 6cf64bc8
......@@ -23,7 +23,7 @@ Objects* Clipboard::get(std::string name, std::string type) {
return m_data[name + type];
}
double Clipboard::get_persistent(std::string name) {
double Clipboard::get_persistent(std::string name) const {
try {
return m_persistent_data.at(name);
} catch(std::out_of_range&) {
......@@ -31,7 +31,7 @@ double Clipboard::get_persistent(std::string name) {
}
}
bool Clipboard::event_defined() {
bool Clipboard::event_defined() const {
return (m_event != nullptr);
}
......@@ -44,14 +44,14 @@ void Clipboard::put_event(std::shared_ptr<Event> event) {
}
}
std::shared_ptr<Event> Clipboard::get_event() {
std::shared_ptr<Event> Clipboard::get_event() const {
if(!m_event) {
throw InvalidDataError("Event not defined. Add Metronome module or Event reader defining the event");
}
return m_event;
}
bool Clipboard::has_persistent(std::string name) {
bool Clipboard::has_persistent(std::string name) const {
return m_persistent_data.find(name) != m_persistent_data.end();
}
......@@ -69,7 +69,7 @@ void Clipboard::clear() {
m_event.reset();
}
std::vector<std::string> Clipboard::listCollections() {
std::vector<std::string> Clipboard::listCollections() const {
std::vector<std::string> collections;
for(auto& dataset : m_data) {
collections.push_back(dataset.first);
......
......@@ -69,7 +69,7 @@ namespace corryvreckan {
* @brief Check whether an event has been defined
* @return true if an event has been defined, false otherwise
*/
bool event_defined();
bool event_defined() const;
/**
* @brief Store the event object
......@@ -83,7 +83,7 @@ namespace corryvreckan {
* @returnShared pointer to the event
* @throws MissingDataError in case no event is available.
*/
std::shared_ptr<Event> get_event();
std::shared_ptr<Event> get_event() const;
/**
* @brief Store or update variable on the persistent clipboard storage
......@@ -98,14 +98,14 @@ namespace corryvreckan {
* @return Stored value from the persistent clipboard storage
* @throws MissingDataError in case the key is not found.
*/
double get_persistent(std::string name);
double get_persistent(std::string name) const;
/**
* @brief Check if variable exists on the persistent clipboard storage
* @param name Name of the variable
* @return True if value exists, false if it does not exist.
*/
bool has_persistent(std::string name);
bool has_persistent(std::string name) const;
/**
* @brief Clear the event storage of the clipboard
......@@ -116,7 +116,7 @@ namespace corryvreckan {
* @brief Get a list of currently held collections on the clipboard event storage
* @return Vector of collections names currently stored on the clipboard
*/
std::vector<std::string> listCollections();
std::vector<std::string> listCollections() const;
private:
typedef std::map<std::string, Objects*> ClipboardData;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment