Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/synchronizeable.cc @ 6037

Last change on this file since 6037 was 5997, checked in by patrick, 19 years ago

merged the network branche a second time because there where some more changes in the code: svn merge -r5991:HEAD branches/network trunk

File size: 2.0 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11
12### File Specific:
13   main-programmer: Silvan Nellen
14   co-programmer: Benjamin Wuest
15*/
16
17#include "synchronizeable.h"
18#include "netdefs.h"
19
20
21/**
22 *  default constructor
23 */
24Synchronizeable::Synchronizeable()
25{
26
27  //owner = ?;
28  //hostID = ?;
29  //state = ?;
30
31}
32
33/**
34 *  default constructor
35 */
36Synchronizeable::Synchronizeable(const char* name)
37{
38  this->setName(name);
39}
40
41
42/**
43 *  default destructor deletes all unneded stuff
44 */
45Synchronizeable::~Synchronizeable()
46{}
47
48/**
49 *  write data to NetworkStream
50 */
51void Synchronizeable::writeBytes(const byte* data, int length)
52{}
53
54/**
55 *  read data from NetworkStream
56 */
57int Synchronizeable::readBytes(byte* data)
58{}
59
60
61void Synchronizeable::writeDebug() const
62{}
63
64
65void Synchronizeable::readDebug() const
66{}
67
68
69
70
71
72/**
73 * Sets the server flag to a given value
74 * @param isServer: the boolean value which the server flag is to set to
75 */
76void Synchronizeable::setIsServer(bool isServer)
77{
78  if( isServer )
79    this->state = this->state | STATE_SERVER;
80  else
81    this->state = this->state & (~STATE_SERVER);
82}
83
84/**
85 * Sets the outofsync flag to a given value
86 * @param outOfSync: the boolean value which the outofsync flag is to set to
87 */
88void Synchronizeable::setIsOutOfSync(bool outOfSync)
89{
90  if( outOfSync )
91    this->state = this->state | STATE_OUTOFSYNC;
92  else
93    this->state = this->state & (~STATE_OUTOFSYNC);
94}
95
96/**
97 * Determines if the server flag is set
98 * @return true, if the server flag is true, false else
99 */
100bool Synchronizeable::isServer()
101{
102  return this->state & STATE_SERVER == STATE_SERVER;
103}
104
105/**
106 * Determines if the outofsync flag is set
107 * @return true, if the outofsync flag is true, false else
108 */
109bool Synchronizeable::isOutOfSync()
110{
111  return this->state & STATE_OUTOFSYNC == STATE_OUTOFSYNC;
112}
Note: See TracBrowser for help on using the repository browser.