Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/synchronizeable_var/synchronizeable_classid.cc @ 10529

Last change on this file since 10529 was 10114, checked in by patrick, 18 years ago

merged network back to trunk

File size: 1.7 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   ### File Specific:
12   main-programmer: Christoph Renner
13   co-programmer: ...
14*/
15
16
17#include "synchronizeable_classid.h"
18#include "converter.h"
19
20#include <cassert>
21
22/**
23 * standard constructor
24 * @todo this constructor is not jet implemented - do it
25*/
26SynchronizeableClassID::SynchronizeableClassID( BaseObject * ptrIn, std::string name, int permission, int priority) : SynchronizeableVar( ptrIn, ptrIn, name, INTSIZE, permission, priority )
27{
28  this->vPtrIn = ptrIn;
29  this->vPtrOut = ptrIn;
30}
31
32
33/**
34 * standard deconstructor
35*/
36SynchronizeableClassID::~SynchronizeableClassID ()
37{
38}
39
40/**
41 * write var data to byte buffer
42 * @param buf pointer to write to
43 * @param maxLength writeToBuf will not write more than maxLength bytes
44 * @return number bytes written
45 */
46int SynchronizeableClassID::writeToBuf( byte * buf, int maxLength )
47{
48  int res = Converter::intToByteArray( vPtrIn->getClassID().id(), buf, maxLength );
49
50  assert( res == INTSIZE );
51
52  return res;
53}
54
55/**
56 * read var data from byte buffer. actually this function does nothing but
57 * return INTSIZE
58 * @param buf pointer to read from
59 * @param maxLength readFromBuf will not read more than maxLength bytes
60 * @return number bytes read
61 */
62int SynchronizeableClassID::readFromBuf( byte * buf, int maxLength )
63{
64  return INTSIZE;
65}
66
67
68/**
69 * print out variable value
70 */
71void SynchronizeableClassID::debug( )
72{
73  printf( "SYNCHRONIZEABLE_VAR: %s IN: %d\n", name.c_str(), vPtrIn->getClassID().id() );
74}
75
Note: See TracBrowser for help on using the repository browser.