Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation2/src/libraries/network/FunctionCallManager.cc @ 6518

Last change on this file since 6518 was 6388, checked in by rgrieder, 15 years ago

Found some end of line leftover spaces.

  • Property svn:eol-style set to native
File size: 6.7 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 {
[6387]33
[2937]34std::map<uint32_t, packet::FunctionCalls*> FunctionCallManager::clientMap_;
35
[2949]36// Static calls
37
38void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID)
[6388]39{
40  if(clientMap_.find(clientID)==clientMap_.end())
[2937]41  {
[6388]42    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
43    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
44  }
[6073]45  FunctionCallManager::clientMap_[clientID]->addCallStatic(functionID);
[2937]46}
[2949]47void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1)
[6388]48{
49  if(clientMap_.find(clientID)==clientMap_.end())
[2949]50  {
[6388]51    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
52    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
53  }
[2949]54  FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1);
55}
56void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2)
[6388]57{
58  if(clientMap_.find(clientID)==clientMap_.end())
[2949]59  {
[6388]60    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
61    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
62  }
[2949]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)
[6388]66{
67  if(clientMap_.find(clientID)==clientMap_.end())
[2949]68  {
[6388]69    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
70    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
71  }
[2949]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)
[6388]75{
76  if(clientMap_.find(clientID)==clientMap_.end())
[2949]77  {
[6388]78    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
79    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
80  }
[2949]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)
[6388]84{
85  if(clientMap_.find(clientID)==clientMap_.end())
[2949]86  {
[6388]87    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
88    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
89  }
[2949]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)
[6388]97{
98  if(clientMap_.find(clientID)==clientMap_.end())
[2937]99  {
[6388]100    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
101    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
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)
[6388]106{
107  if(clientMap_.find(clientID)==clientMap_.end())
[2949]108  {
[6388]109    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
110    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
111  }
[2949]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)
[6388]115{
116  if(clientMap_.find(clientID)==clientMap_.end())
[2949]117  {
[6388]118    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
119    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
120  }
[2949]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)
[6388]124{
125  if(clientMap_.find(clientID)==clientMap_.end())
[2949]126  {
[6388]127    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
128    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
129  }
[2949]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)
[6388]133{
134  if(clientMap_.find(clientID)==clientMap_.end())
[2949]135  {
[6388]136    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
137    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
138  }
[2949]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)
[6388]142{
143  if(clientMap_.find(clientID)==clientMap_.end())
[2949]144  {
[6388]145    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
146    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
147  }
[2949]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.