Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/network/synchronisable/SynchronisableSpecialisations.cc @ 5673

Last change on this file since 5673 was 3304, checked in by rgrieder, 15 years ago

Merged netp6 branch back to the trunk.

  • Property svn:eol-style set to native
File size: 4.4 KB
RevLine 
[2246]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
[3084]30#include <string>
[3214]31#include "util/Math.h"
32#include "Synchronisable.h"
33#include "SynchronisableVariable.h"
[2246]34
35// ================ template spezialisation
36 
37 
38namespace orxonox{
39 
[3084]40  template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
41  {
[3304]42    SynchronisableVariableBase* sv;
[3084]43    if (bidirectional)
[3304]44      sv = new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb);
[3084]45    else
[3304]46      sv = new SynchronisableVariable<const std::string>(variable, mode, cb);
47    syncList.push_back(sv);
48    stringList.push_back(sv);
[3084]49  }
50 
[2246]51  template <> void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
52  {
[2309]53    registerVariable(variable.r, mode, cb, bidirectional);
54    registerVariable(variable.g, mode, cb, bidirectional);
55    registerVariable(variable.b, mode, cb, bidirectional);
[2246]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  {
[2309]65    registerVariable(variable.x, mode, cb, bidirectional);
[2246]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  {
[2309]71    registerVariable(variable.x, mode, cb, bidirectional);
72    registerVariable(variable.y, mode, cb, bidirectional);
[2246]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  {
[2309]82    registerVariable(variable.x, mode, cb, bidirectional);
83    registerVariable(variable.y, mode, cb, bidirectional);
84    registerVariable(variable.z, mode, cb, bidirectional);
[2246]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  {
[2309]99    registerVariable(variable.x, mode, cb, bidirectional);
100    registerVariable(variable.y, mode, cb, bidirectional);
[2246]101    registerVariable(variable.z, mode, cb, bidirectional);
[2309]102    registerVariable(variable.w, mode, cb, bidirectional);
[2246]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
[2355]111} //namespace
Note: See TracBrowser for help on using the repository browser.