UniSet  2.8.0
ProxyManager.h
1 /*
2  * Copyright (c) 2015 Pavel Vainerman.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, version 2.1.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Lesser Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 // --------------------------------------------------------------------------
20 // --------------------------------------------------------------------------
21 #ifndef ProxyManager_H_
22 #define ProxyManager_H_
23 //---------------------------------------------------------------------------
24 #include <unordered_map>
25 #include <memory>
26 #include "UniSetObject.h"
27 
28 //----------------------------------------------------------------------------
29 namespace uniset
30 {
31  //----------------------------------------------------------------------------
32  class PassiveObject;
33  //----------------------------------------------------------------------------
34 
44  class ProxyManager:
45  public UniSetObject
46  {
47 
48  public:
50  ~ProxyManager();
51 
52  void attachObject( PassiveObject* po, uniset::ObjectId id );
53  void detachObject( uniset::ObjectId id );
54 
55  std::shared_ptr<UInterface> uin;
56 
57  protected:
58  ProxyManager();
59  virtual void processingMessage( const uniset::VoidMessage* msg ) override;
60  virtual void allMessage( const uniset::VoidMessage* msg );
61 
62  virtual bool activateObject() override;
63  virtual bool deactivateObject() override;
64 
65  private:
66  typedef std::unordered_map<uniset::ObjectId, PassiveObject*> PObjectMap;
67  PObjectMap omap;
68  };
69  // -------------------------------------------------------------------------
70 } // end of uniset namespace
71 //----------------------------------------------------------------------------------------
72 #endif // ProxyManager
73 //----------------------------------------------------------------------------------------
Definition: ProxyManager.h:44
Definition: PassiveObject.h:41
Definition: CommonEventLoop.h:14
Definition: UniSetObject.h:73
Definition: MessageType.h:90
virtual void processingMessage(const uniset::VoidMessage *msg) override
Definition: ProxyManager.cc:135
virtual bool deactivateObject() override
Деактивация объекта (переопределяется для необходимых действий при завершении работы)
Definition: ProxyManager.cc:118
long ObjectId
Definition: UniSetTypes_i.idl:30
virtual bool activateObject() override
Активизация объекта (переопределяется для необходимых действий после активизации)
Definition: ProxyManager.cc:68