Česky
Kamil Dudka

TriloBot Simulator (C++, Qt4, Flex, Readline, Boost)

File detail

Name:Downloadcore.h [Download]
Location: rob08 > src
Size:2.1 KB
Last modification:2022-09-09 13:06

Source code

/*
 * Copyright (C) 2008 Kamil Dudka <xdudka00@stud.fit.vutbr.cz>
 *
 * This file is part of rob08
 *
 * rob08 is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * rob08 is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with rob08.  If not, see <http://www.gnu.org/licenses/>.
 */
 
#ifndef CORE_H
#define CORE_H
 
#include "config.h"
#include "scanner.h"
#include "term.h"
 
#ifndef BUILDING_DOX
#   include <string>
#endif
 
class IEnviroment;
class Trilobot;
 
/// core callback interface (core is passive)
class IListener: public IErrorSensitive {
    public:
        virtual ~IListener() { }
 
        /**
         * dispatch request
         * @return False value shoot down whole simulator. Do not return false
         * on recoverable errors as IErrorSensitive::hasError method is the way
         * to go in such cases.
         */
        virtual bool dispatch(const Token &) = 0;
};
 
class ICanExportImport
{
	public:
		virtual void Export( std::ostream& output ) =0;
		virtual void Import( std::istream& input ) =0;
 
		virtual ~ICanExportImport() {}
};
 
/// Observer for robot and his components to do
/// export simulator state
class IExporter
{
	public:
		/// Make simulator export
		virtual void MakeExport() =0;
 
		virtual ~IExporter() {}
};
 
/// core interface
class ICore : public IListener, public ICanExportImport
{
	public:
		virtual IEnviroment& GetEnviroment() =0;
		virtual Trilobot& GetTrilobot() =0;
 
		virtual ~ICore() {}
};
 
/// static-only factory
class CoreFactory {
    public:
        /*
         * return on heap allocated core object
         * @attention IWriter object is not deleted by this module.
         */
        static ICore* createCore(IWriter *);
    private:
        CoreFactory();
};
 
#endif /* CORE_H */