Page MenuHomePhorge

SystemImpl.hpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

SystemImpl.hpp

/*******************************************************************************
*
* File: SystemImpl.hpp
*
* Contents: Declaration of a basic implementation of the System interface.
*
* Copyright 2017
*
* Author: David Juhasz (david.juhasz@tuwien.ac.at)
*
******************************************************************************/
#ifndef ROSA_LIB_CORE_SYSTEMIMPL_HPP // NOLINT
#define ROSA_LIB_CORE_SYSTEMIMPL_HPP
#include "rosa/core/System.hpp"
#include <mutex>
#include <unordered_set>
namespace rosa {
class SystemImpl : public System {
public:
SystemImpl(const std::string &Name) noexcept;
~SystemImpl(void);
private:
// Container for keeping reference of registered Units.
std::unordered_set<Unit *> Units;
// Used to provide mutual exclusion when modifying Units.
std::mutex RegisterMutex;
protected:
// Registers the given Unit instance to the System.
// PRE: !isUnitRegistered(U)
// POST: isUnitRegistered(U)
void registerUnit(Unit &U) noexcept override;
// Unregisters and destroys the given Unit.
// PRE: isUnitRegistered(U)
// POST: !isUnitRegistered(U) && 'U is destroyed'
void destroyUnit(Unit &U) noexcept override;
// Returns if the given Unit is registered in the System.
bool isUnitRegistered(const Unit &U) const noexcept override;
public:
// Returns the number of live Units, that have been constructed and not
// destroyed yet.
size_t numberOfLiveUnits(void) const noexcept override;
// Returns if the System has no live Units.
bool empty(void) const noexcept override;
};
} // End namespace rosa
#endif // ROSA_LIB_CORE_SYSTEMIMPL_HPP

File Metadata

Mime Type
text/x-c++
Expires
Sun, Mar 1, 5:57 PM (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
287509
Default Alt Text
SystemImpl.hpp (1 KB)

Event Timeline