#ifndef __JLANG__JACCESSIBLE__ #define __JLANG__JACCESSIBLE__ #include "JLang/JThrow.hh" /** * \author mdejong */ namespace JLANG {} namespace JPP { using namespace JLANG; } namespace JLANG { /** * Interface for named access of a device. */ class JAccessible : public JThrow { protected: /** * Default constructor. */ JAccessible() {} public: /** * Virtual destructor. */ virtual ~JAccessible() {} /** * Check is device is open. * * \return true if open; else false */ virtual bool is_open() const = 0; /** * Open device. * * \param file_name file name */ virtual void open(const char* file_name) = 0; /** * Close device. */ virtual void close() = 0; }; /** * Interface for null access. */ class JNullAccess : public virtual JAccessible { public: /** * Check is device is open. * * \return true */ virtual bool is_open() const override { return true; } /** * Open device. * * \param file_name file name */ virtual void open(const char* file_name) override {} /** * Close device. */ virtual void close() override {} }; } #endif