diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-12-20 21:34:09 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-12-20 21:34:09 (GMT) |
commit | 498f6f80e9ca01236ca1491596875ab7eb4cd8c3 (patch) | |
tree | e627ae19475bb93a98dfa50db1950f6e3403f569 /src/uscxml/plugins/datamodel/prolog | |
parent | d779abe6ff76a78f92d229fcf1f006f5cf1f9295 (diff) | |
download | uscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.zip uscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.tar.gz uscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.tar.bz2 |
Refactoring finished
Support datamodels, invokers and ioprocessors as plugins
Comply to HTTP1.1 by sending host header field
Started prolog datamodel
Diffstat (limited to 'src/uscxml/plugins/datamodel/prolog')
-rw-r--r-- | src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp | 103 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h | 66 |
2 files changed, 169 insertions, 0 deletions
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp new file mode 100644 index 0000000..77f0b66 --- /dev/null +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -0,0 +1,103 @@ +#include "uscxml/Common.h" +#include "SWIDataModel.h" +#include "uscxml/Message.h" +#include <glog/logging.h> + +#ifdef BUILD_AS_PLUGINS +#include <Pluma/Connector.hpp> +#endif + +namespace uscxml { + +#ifdef BUILD_AS_PLUGINS +PLUMA_CONNECTOR +bool connect(pluma::Host& host) { + host.add( new SWIDataModelProvider() ); + return true; +} +#endif + +SWIDataModel::SWIDataModel() { +} + +DataModel* SWIDataModel::create(Interpreter* interpreter) { + SWIDataModel* dm = new SWIDataModel(); + dm->_interpreter = interpreter; + const char* swiPath = SWI_LIBRARY_PATH; + dm->_plEngine = new PlEngine((char*)swiPath); + return dm; +} + +void SWIDataModel::registerIOProcessor(const std::string& name, IOProcessor* ioprocessor) { + std::cout << "SWIDataModel::registerIOProcessor" << std::endl; +} + +void SWIDataModel::setSessionId(const std::string& sessionId) { + std::cout << "SWIDataModel::setSessionId" << std::endl; + _sessionId = sessionId; +} + +void SWIDataModel::setName(const std::string& name) { + std::cout << "SWIDataModel::setName" << std::endl; + _name = name; +} + +SWIDataModel::~SWIDataModel() { +} + +void SWIDataModel::pushContext() { + std::cout << "SWIDataModel::pushContext" << std::endl; +} + +void SWIDataModel::popContext() { + std::cout << "SWIDataModel::popContext" << std::endl; +} + +void SWIDataModel::initialize() { + std::cout << "SWIDataModel::initialize" << std::endl; +} + +void SWIDataModel::setEvent(const Event& event) { + std::cout << "SWIDataModel::setEvent" << std::endl; + _event = event; +} + +Data SWIDataModel::getStringAsData(const std::string& content) { + std::cout << "SWIDataModel::getStringAsData" << std::endl; + Data data; + return data; +} + +bool SWIDataModel::validate(const std::string& location, const std::string& schema) { + std::cout << "SWIDataModel::validate" << std::endl; + return true; +} + +uint32_t SWIDataModel::getLength(const std::string& expr) { + std::cout << "SWIDataModel::getLength" << std::endl; + return 0; +} + +void SWIDataModel::eval(const std::string& expr) { + std::cout << "SWIDataModel::eval" << std::endl; +} + +bool SWIDataModel::evalAsBool(const std::string& expr) { + std::cout << "SWIDataModel::evalAsBool" << std::endl; + return true; +} + +std::string SWIDataModel::evalAsString(const std::string& expr) { + std::cout << "SWIDataModel::evalAsString" << std::endl; + return std::string(""); +} + +void SWIDataModel::assign(const std::string& location, const Data& data) { + std::cout << "SWIDataModel::assign" << std::endl; +} + +void SWIDataModel::assign(const std::string& location, const std::string& expr) { + std::cout << "SWIDataModel::assign" << std::endl; +} + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h new file mode 100644 index 0000000..16dee3c --- /dev/null +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h @@ -0,0 +1,66 @@ +#ifndef SWIDATAMODEL_H_KN8TWG0V +#define SWIDATAMODEL_H_KN8TWG0V + +#include "uscxml/Interpreter.h" +#include <list> +#include <SWI-cpp.h> + +#ifdef BUILD_AS_PLUGINS +#include "uscxml/plugins/Plugins.h" +#endif + +namespace uscxml { + +class SWIDataModel : public DataModel { +public: + SWIDataModel(); + virtual ~SWIDataModel(); + virtual DataModel* create(Interpreter* interpreter); + + virtual std::set<std::string> getNames() { + std::set<std::string> names; + names.insert("prolog"); + return names; + } + + virtual void initialize(); + virtual void setSessionId(const std::string& sessionId); + virtual void setName(const std::string& name); + virtual void setEvent(const Event& event); + + virtual void registerIOProcessor(const std::string& name, IOProcessor* ioprocessor); + + virtual bool validate(const std::string& location, const std::string& schema); + + virtual uint32_t getLength(const std::string& expr); + virtual void pushContext(); + virtual void popContext(); + + virtual void eval(const std::string& expr); + virtual void assign(const std::string& location, const std::string& expr); + virtual void assign(const std::string& location, const Data& data); + + virtual Data getStringAsData(const std::string& content); + + virtual std::string evalAsString(const std::string& expr); + virtual bool evalAsBool(const std::string& expr); + + +protected: + Interpreter* _interpreter; + + std::string _sessionId; + std::string _name; + + Event _event; + PlEngine* _plEngine; + +}; + +#ifdef BUILD_AS_PLUGINS +PLUMA_INHERIT_PROVIDER(SWIDataModel, DataModel); +#endif + +} + +#endif /* end of include guard: SWIDATAMODEL_H_KN8TWG0V */ |