GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — mexcppclass/include/mexcppclass/pointermodule.hpp at master · rymut/mexcppclass Expand file tree/ Copy pathpointermodule.hppMore file actions 66 lines (53 loc) · 1.54 KB / Copy pathpointermodule.hppFile metadata and controls66 lines (53 loc) · 1.54 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 /// Copyright (C) 2017 by Boguslaw Rymut /// /// This file is distributed under the Apache 2.0 License /// See LICENSE for details. #ifndef MEXCPPCLASS_POINTERMODULE_HPP_ #define MEXCPPCLASS_POINTERMODULE_HPP_ #include <mex.h> #include <memory> #include <vector> #include <string> #include "mexcppclass/persistentdatainterface.hpp" #include "mexcppclass/nonpersistentdatainterface.hpp" #include "mexcppclass/moduleinterface.hpp" namespace mexcppclass { template <typename T> class PointerModule : public ModuleInterface { public: PointerModule(const std::string &name, T *object) : name_(name) { this->object_.reset(object); } virtual ~PointerModule() { } virtual size_t MethodCount() const { return 0; } virtual size_t Method(const size_t &method, const size_t &length, char *name) const { return 0; } virtual void Call(const char *method, NonpersistentDataInterface *args, PersistentDataInterface *mgr) { // no method are suported } virtual const char * Name() const { return this->name_.c_str(); } T *Pointer() const { return this->object_.get(); } private: typename std::unique_ptr<T> object_; const std::string &name_; }; template <typename T> void DestroyPointerModuleInterface(ModuleInterface *object) { typename PointerModule<T> *pointer = dynamic_cast<typename PointerModule<T>*>(object); if (pointer != nullptr) { delete pointer; } } } // namespace mexcppclass #endif // MEXCPPCLASS_POINTERMODULE_HPP_ |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |