remotemono
RMonoAPIBase_Impl.h
1 /*
2  Copyright 2020 David "Alemarius Nexus" Lerch
3 
4  This file is part of RemoteMono.
5 
6  RemoteMono is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  RemoteMono is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with RemoteMono. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #pragma once
21 
22 #include "../config.h"
23 
24 #include "RMonoAPIBase_Def.h"
25 
26 #include "RMonoAPIDispatcher_Def.h"
27 
28 
29 
30 namespace remotemono
31 {
32 
33 
34 RMonoAPIBase::RMonoAPIBase(blackbone::Process& process)
35  : apid(new RMonoAPIDispatcher), process(process), worker(nullptr)
36 {
37 }
38 
39 
40 RMonoAPIBase::~RMonoAPIBase()
41 {
42  delete apid;
43 }
44 
45 
46 typename RMonoAPIBase::HandleBackendIterator RMonoAPIBase::registerMonoHandleBackend(RMonoHandleBackendBase* backend)
47 {
48  registeredHandles.push_back(backend);
49  HandleBackendIterator it = registeredHandles.end();
50  it--;
51  return it;
52 }
53 
54 
55 void RMonoAPIBase::unregisterMonoHandleBackend(HandleBackendIterator backendIt)
56 {
57  registeredHandles.erase(backendIt);
58 }
59 
60 
62 {
63  return registeredHandles.size();
64 }
65 
66 
68 {
69  return apid;
70 }
71 
72 
73 blackbone::Process& RMonoAPIBase::getProcess()
74 {
75  return process;
76 }
77 
78 
79 blackbone::ThreadPtr RMonoAPIBase::getWorkerThread()
80 {
81  return worker;
82 }
83 
84 
85 }
remotemono::RMonoAPIBase::getAPIDispatcher
RMonoAPIDispatcher * getAPIDispatcher()
Definition: RMonoAPIBase_Impl.h:67
remotemono::RMonoAPIDispatcher
Definition: RMonoAPIDispatcher_Def.h:78
remotemono::RMonoAPIBase::getRegisteredHandleCount
size_t getRegisteredHandleCount() const
Definition: RMonoAPIBase_Impl.h:61
remotemono::RMonoAPIBase::getWorkerThread
blackbone::ThreadPtr getWorkerThread()
Definition: RMonoAPIBase_Impl.h:79
remotemono::RMonoAPIBase::registerMonoHandleBackend
HandleBackendIterator registerMonoHandleBackend(RMonoHandleBackendBase *backend)
Definition: RMonoAPIBase_Impl.h:46
remotemono::RMonoAPIBase::getProcess
blackbone::Process & getProcess()
Definition: RMonoAPIBase_Impl.h:73
remotemono::RMonoHandleBackendBase
Definition: RMonoHandle_Def.h:40
remotemono::RMonoAPIBase::unregisterMonoHandleBackend
void unregisterMonoHandleBackend(HandleBackendIterator backendIt)
Definition: RMonoAPIBase_Impl.h:55