| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- /*
- * EmsAppImpl.cpp
- *
- * Created on: 2020年9月11日
- * Author: vsbes
- */
-
- #include "EmsAppImpl.h"
-
- #include <stddef.h>
- #include <iterator>
-
- #include "../../common/GUID.cpp"
- #include "../../models/sys/System.h"
-
- EmsCoreI* EmsAppImpl::pCore = NULL;
-
- System EmsAppImpl::sys;
-
- int EmsAppImpl::run_priority = 100;
- int EmsAppImpl::protect_priority = 100;
-
- EmsAppImpl::EmsAppImpl()
- {
- // TODO Auto-generated constructor stub
- initLogger();
- }
-
- EmsAppImpl::~EmsAppImpl()
- {
- // TODO Auto-generated destructor stub
- }
-
- HRESULT EmsAppImpl::queryInterface(const IID& iid, void** ppv)
- {
- if (iid == IID_IEmsApp)
- {
- *ppv = static_cast<EmsAppI*>(this);
- }
- else if (iid == IID_IUnknown)
- {
- *ppv = static_cast<IUnknown*>(this);
- }
- else
- {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- reinterpret_cast<IUnknown*>(*ppv)->addRef();
- return S_OK;
- }
-
- ULONG EmsAppImpl::addRef()
- {
- return ++m_cRef;;
- }
-
- ULONG EmsAppImpl::release()
- {
- if (--m_cRef == 0)
- {
- delete this;
- return 0;
- }
- return m_cRef;
- }
-
- ULONG EmsAppImpl::getVersion()
- {
- return VERSION;
- }
-
- HRESULT EmsAppImpl::init()
- {
- return sys.init();
- }
-
- HRESULT EmsAppImpl::applyDataBase(DataBase*& pstart, unsigned int& size)
- {
- size = sys.getDataBaseSize();
- if (size == 0)
- {
- pstart = NULL;
- }
- else
- {
- pstart = &(*sys.getDataBase());
- }
-
- return S_OK;
- }
-
- HRESULT EmsAppImpl::registerCoreHandle(EmsCoreI* handle, int t_run_priority, int t_protect_priority)
- {
- pCore = handle;
- run_priority = t_run_priority;
- protect_priority = t_protect_priority;
- return S_OK;
- }
-
- HRESULT EmsAppImpl::run()
- {
- sys.other();
-
- return S_OK;
- }
-
- #ifdef __cplusplus
- extern "C" IUnknown* CreateInstance()
- {
- IUnknown *pI = static_cast<EmsAppI*>(new EmsAppImpl());
- pI->addRef();
- return pI;
- }
- #endif
|