Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/netp6/src/network/synchronisable/SynchronisableSpecialisations.cc @ 4192

Last change on this file since 4192 was 3302, checked in by scheusso, 15 years ago

changed some debug output
removed some uneccessary "multi"threading
some enhancements in Connection

  • Property svn:eol-style set to native
File size: 4.4 KB
Line 
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 *      Dumeni Manatschal, (C) 2007
24 *      Oliver Scheuss, (C) 2007
25 *   Co-authors:
26 *      ...
27 *
28 */
29
30#include <string>
31#include "util/Math.h"
32#include "Synchronisable.h"
33#include "SynchronisableVariable.h"
34
35// ================ template spezialisation
36 
37 
38namespace orxonox{
39 
40  template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
41  {
42    SynchronisableVariableBase* sv;
43    if (bidirectional)
44      sv = new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb);
45    else
46      sv = new SynchronisableVariable<const std::string>(variable, mode, cb);
47    syncList.push_back(sv);
48    stringList.push_back(sv);
49  }
50 
51  template <> void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
52  {
53    registerVariable(variable.r, mode, cb, bidirectional);
54    registerVariable(variable.g, mode, cb, bidirectional);
55    registerVariable(variable.b, mode, cb, bidirectional);
56    registerVariable(variable.a, mode, cb, bidirectional);
57  }
58  template <> void Synchronisable::registerVariable( ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
59  {
60    return Synchronisable::registerVariable( (const ColourValue&)variable, mode, cb, bidirectional);
61  }
62
63  template <> void Synchronisable::registerVariable( const Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
64  {
65    registerVariable(variable.x, mode, cb, bidirectional);
66    registerVariable(variable.y, mode, cb, bidirectional);
67  }
68 
69  template <> void Synchronisable::registerVariable( const Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
70  {
71    registerVariable(variable.x, mode, cb, bidirectional);
72    registerVariable(variable.y, mode, cb, bidirectional);
73    registerVariable(variable.z, mode, cb, bidirectional);
74  }
75  template <> void Synchronisable::registerVariable( Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
76  {
77    registerVariable( (const Vector3&)variable, mode, cb, bidirectional);
78  }
79
80  template <> void Synchronisable::registerVariable( const Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
81  {
82    registerVariable(variable.x, mode, cb, bidirectional);
83    registerVariable(variable.y, mode, cb, bidirectional);
84    registerVariable(variable.z, mode, cb, bidirectional);
85    registerVariable(variable.w, mode, cb, bidirectional);
86  }
87  template <> void Synchronisable::registerVariable( Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
88  {
89    registerVariable( (const Vector4&)variable, mode, cb, bidirectional);
90  }
91 
92  template <> void Synchronisable::registerVariable( mbool& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
93  {
94    registerVariable(variable.getMemory(), mode, cb, bidirectional);
95  }
96 
97  template <> void Synchronisable::registerVariable( const Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
98  {
99    registerVariable(variable.x, mode, cb, bidirectional);
100    registerVariable(variable.y, mode, cb, bidirectional);
101    registerVariable(variable.z, mode, cb, bidirectional);
102    registerVariable(variable.w, mode, cb, bidirectional);
103  }
104  template <> void Synchronisable::registerVariable( Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
105  {
106    registerVariable( (const Quaternion&)variable, mode, cb, bidirectional);
107  }
108
109 
110
111} //namespace
Note: See TracBrowser for help on using the repository browser.