diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-13 02:20:15 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-13 02:20:15 (GMT) |
commit | c443aaa23e079d8ab94942bfefa65b940c1acd01 (patch) | |
tree | beab36f1446339fe1b157c349c0808e4f5106982 /src/uscxml/plugins | |
parent | a116aeb2cf5a84fa03f9814c3884561149029267 (diff) | |
download | uscxml-c443aaa23e079d8ab94942bfefa65b940c1acd01.zip uscxml-c443aaa23e079d8ab94942bfefa65b940c1acd01.tar.gz uscxml-c443aaa23e079d8ab94942bfefa65b940c1acd01.tar.bz2 |
Fixed bugs intriduced by PIMPL
Diffstat (limited to 'src/uscxml/plugins')
14 files changed, 28 insertions, 26 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index 5ab9b3e..1aa181e 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -23,8 +23,8 @@ V8DataModel::V8DataModel() { // _contexts.push_back(v8::Context::New()); } -DataModelImpl* V8DataModel::create(Interpreter* interpreter) { - V8DataModel* dm = new V8DataModel(); +boost::shared_ptr<DataModelImpl> V8DataModel::create(Interpreter* interpreter) { + boost::shared_ptr<V8DataModel> dm = boost::shared_ptr<V8DataModel>(new V8DataModel()); dm->_interpreter = interpreter; v8::Locker locker; v8::HandleScope scope; @@ -38,8 +38,8 @@ DataModelImpl* V8DataModel::create(Interpreter* interpreter) { // some free functions v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); - global->Set(v8::String::New("In"), v8::FunctionTemplate::New(jsIn, v8::External::New(reinterpret_cast<void*>(dm))), v8::ReadOnly); - global->Set(v8::String::New("print"), v8::FunctionTemplate::New(jsPrint, v8::External::New(reinterpret_cast<void*>(dm))), v8::ReadOnly); + global->Set(v8::String::New("In"), v8::FunctionTemplate::New(jsIn, v8::External::New(reinterpret_cast<void*>(dm.get()))), v8::ReadOnly); + global->Set(v8::String::New("print"), v8::FunctionTemplate::New(jsPrint, v8::External::New(reinterpret_cast<void*>(dm.get()))), v8::ReadOnly); v8::Persistent<v8::Context> context = v8::Context::New(0, global); v8::Context::Scope contextScope(context); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h index e5c1bc8..7e7bb8d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h @@ -21,7 +21,7 @@ class V8DataModel : public DataModelImpl { public: V8DataModel(); virtual ~V8DataModel(); - virtual DataModelImpl* create(Interpreter* interpreter); + virtual boost::shared_ptr<DataModelImpl> create(Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index 3e20867..5a33080 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -20,8 +20,8 @@ bool connect(pluma::Host& host) { SWIDataModel::SWIDataModel() { } -DataModelImpl* SWIDataModel::create(Interpreter* interpreter) { - SWIDataModel* dm = new SWIDataModel(); +boost::shared_ptr<DataModelImpl> SWIDataModel::create(Interpreter* interpreter) { + boost::shared_ptr<SWIDataModel> dm = boost::shared_ptr<SWIDataModel>(new SWIDataModel()); dm->_interpreter = interpreter; const char* swiPath = SWI_LIBRARY_PATH; dm->_plEngine = new PlEngine((char*)swiPath); diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h index f5f5247..1d5a454 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h @@ -15,7 +15,7 @@ class SWIDataModel : public DataModelImpl { public: SWIDataModel(); virtual ~SWIDataModel(); - virtual DataModelImpl* create(Interpreter* interpreter); + virtual boost::shared_ptr<DataModelImpl> create(Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp index 94156c0..08fc1f3 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp @@ -22,8 +22,8 @@ OSGInvoker::OSGInvoker() { OSGInvoker::~OSGInvoker() { }; -InvokerImpl* OSGInvoker::create(Interpreter* interpreter) { - OSGInvoker* invoker = new OSGInvoker(); +boost::shared_ptr<IOProcessorImpl> OSGInvoker::create(Interpreter* interpreter) { + boost::shared_ptr<OSGInvoker> invoker = boost::shared_ptr<OSGInvoker> (new OSGInvoker()); invoker->_interpreter = interpreter; return invoker; } diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h index 933ee4a..29f950f 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h @@ -20,7 +20,7 @@ class OSGInvoker : public InvokerImpl, public Arabica::DOM::Events::EventListene public: OSGInvoker(); virtual ~OSGInvoker(); - virtual InvokerImpl* create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp index eaf5eba..65eed78 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp @@ -21,8 +21,8 @@ HeartbeatInvoker::HeartbeatInvoker() { HeartbeatInvoker::~HeartbeatInvoker() { }; -InvokerImpl* HeartbeatInvoker::create(Interpreter* interpreter) { - HeartbeatInvoker* invoker = new HeartbeatInvoker(); +boost::shared_ptr<IOProcessorImpl> HeartbeatInvoker::create(Interpreter* interpreter) { + boost::shared_ptr<HeartbeatInvoker> invoker = boost::shared_ptr<HeartbeatInvoker>(new HeartbeatInvoker()); invoker->_interpreter = interpreter; return invoker; } diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h index 8a90011..bbea7d6 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h @@ -13,7 +13,7 @@ class HeartbeatInvoker : public InvokerImpl { public: HeartbeatInvoker(); virtual ~HeartbeatInvoker(); - virtual InvokerImpl* create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index c90ef4d..85f2963 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -23,8 +23,8 @@ USCXMLInvoker::~USCXMLInvoker() { delete _invokedInterpreter; }; -InvokerImpl* USCXMLInvoker::create(Interpreter* interpreter) { - USCXMLInvoker* invoker = new USCXMLInvoker(); +boost::shared_ptr<IOProcessorImpl> USCXMLInvoker::create(Interpreter* interpreter) { + boost::shared_ptr<USCXMLInvoker> invoker = boost::shared_ptr<USCXMLInvoker>(new USCXMLInvoker()); invoker->_parentInterpreter = interpreter; return invoker; } @@ -55,8 +55,10 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) { if (dataModel) { } - _invokedInterpreter->setInvoker(boost::static_pointer_cast<InvokerImpl>(shared_from_this())); - _invokedInterpreter->start(); + if (_invokedInterpreter) { + _invokedInterpreter->setInvoker(boost::static_pointer_cast<InvokerImpl>(shared_from_this())); + _invokedInterpreter->start(); + } } }
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h index b1579a2..95de9b2 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h @@ -16,7 +16,7 @@ class USCXMLInvoker : public InvokerImpl, public boost::enable_shared_from_this< public: USCXMLInvoker(); virtual ~USCXMLInvoker(); - virtual InvokerImpl* create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; names.insert("uscxml"); diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp index 3ddc14a..2957078 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp @@ -28,8 +28,8 @@ UmundoInvoker::~UmundoInvoker() { } }; -InvokerImpl* UmundoInvoker::create(Interpreter* interpreter) { - UmundoInvoker* invoker = new UmundoInvoker(); +boost::shared_ptr<IOProcessorImpl> UmundoInvoker::create(Interpreter* interpreter) { + boost::shared_ptr<UmundoInvoker> invoker = boost::shared_ptr<UmundoInvoker>(new UmundoInvoker()); invoker->_interpreter = interpreter; return invoker; } diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h index 1aa37f2..c5f9656 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h @@ -20,7 +20,7 @@ class UmundoInvoker : public InvokerImpl, public umundo::TypedReceiver, public u public: UmundoInvoker(); virtual ~UmundoInvoker(); - virtual InvokerImpl* create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp index 1607e3e..2b6273c 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp +++ b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp @@ -46,8 +46,8 @@ EventIOProcessor::~EventIOProcessor() { httpServer->unregisterProcessor(this); } -IOProcessorImpl* EventIOProcessor::create(Interpreter* interpreter) { - EventIOProcessor* io = new EventIOProcessor(); +boost::shared_ptr<IOProcessorImpl> EventIOProcessor::create(Interpreter* interpreter) { + boost::shared_ptr<EventIOProcessor> io = boost::shared_ptr<EventIOProcessor>(new EventIOProcessor()); io->_interpreter = interpreter; io->_dns = evdns_base_new(io->_asyncQueue._eventLoop, 1); @@ -56,7 +56,7 @@ IOProcessorImpl* EventIOProcessor::create(Interpreter* interpreter) { // register at http server EventIOServer* httpServer = EventIOServer::getInstance(); - httpServer->registerProcessor(io); + httpServer->registerProcessor(io.get()); io->start(); return io; diff --git a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h index d3557f4..c90bf79 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h +++ b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h @@ -28,7 +28,7 @@ public: EventIOProcessor(); virtual ~EventIOProcessor(); - virtual IOProcessorImpl* create(uscxml::Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; |