Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/network/FunctionCallManager.cc @ 6104

Last change on this file since 6104 was 6073, checked in by rgrieder, 15 years ago

Found more tabs in the trunk.

  • Property svn:eol-style set to native
File size: 6.8 KB
RevLine 
[2937]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "FunctionCallManager.h"
30#include "packet/FunctionCalls.h"
31
32namespace orxonox {
33   
34std::map<uint32_t, packet::FunctionCalls*> FunctionCallManager::clientMap_;
35
[2949]36// Static calls
37
38void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID)
[2945]39{ 
[2937]40  if(clientMap_.find(clientID)==clientMap_.end()) 
41  {
[2945]42    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
43    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
[2937]44  } 
[6073]45  FunctionCallManager::clientMap_[clientID]->addCallStatic(functionID);
[2937]46}
[2949]47void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1)
48{ 
49  if(clientMap_.find(clientID)==clientMap_.end()) 
50  {
51    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
52    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
53  } 
54  FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1);
55}
56void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2)
57{ 
58  if(clientMap_.find(clientID)==clientMap_.end()) 
59  {
60    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
61    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
62  } 
63  FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1, &mt2);
64}
65void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3)
66{ 
67  if(clientMap_.find(clientID)==clientMap_.end()) 
68  {
69    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
70    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
71  } 
72  FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1, &mt2, &mt3);
73}
74void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)
75{ 
76  if(clientMap_.find(clientID)==clientMap_.end()) 
77  {
78    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
79    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
80  } 
81  FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1, &mt2, &mt3, &mt4);
82}
83void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)
84{ 
85  if(clientMap_.find(clientID)==clientMap_.end()) 
86  {
87    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
88    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
89  } 
90  FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1, &mt2, &mt3, &mt4, &mt5);
91}
[2937]92
[2949]93
94// MemberCalls
95
96void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID)
[2937]97{ 
98  if(clientMap_.find(clientID)==clientMap_.end()) 
99  {
[2945]100    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
101    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
[2937]102  } 
[2949]103  FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID);
[2937]104}
[2949]105void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1)
106{ 
107  if(clientMap_.find(clientID)==clientMap_.end()) 
108  {
109    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
110    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
111  } 
112  FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1);
113}
114void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2)
115{ 
116  if(clientMap_.find(clientID)==clientMap_.end()) 
117  {
118    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
119    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
120  } 
121  FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1, &mt2);
122}
123void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3)
124{ 
125  if(clientMap_.find(clientID)==clientMap_.end()) 
126  {
127    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
128    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
129  } 
130  FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3);
131}
132void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)
133{ 
134  if(clientMap_.find(clientID)==clientMap_.end()) 
135  {
136    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
137    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
138  } 
139  FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3, &mt4);
140}
141void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)
142{ 
143  if(clientMap_.find(clientID)==clientMap_.end()) 
144  {
145    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
146    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
147  } 
148  FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3, &mt4, &mt5);
149}
[2937]150
[2949]151// Send calls
152
[2937]153void FunctionCallManager::sendCalls()
154{
155  std::map<uint32_t, packet::FunctionCalls*>::iterator it;
[2945]156  for (it = FunctionCallManager::clientMap_.begin(); it != FunctionCallManager::clientMap_.end(); it++ )
[2944]157  {
[2945]158    assert(!FunctionCallManager::clientMap_.empty());
[2937]159    it->second->send();
[2944]160  }
[2945]161  FunctionCallManager::clientMap_.clear();
[2937]162}
163
164
165} //namespace orxonox
Note: See TracBrowser for help on using the repository browser.