Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/synchronizeable_var/synchronizeable_classid.cc @ 9906

Last change on this file since 9906 was 9906, checked in by rennerc, 18 years ago

Return of the Network :D

File size: 1.8 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->getLeafClassID().id(), buf, maxLength );
49  printf( "%s has id %d\n", vPtrIn->getClassName().c_str(), vPtrIn->getLeafClassID().id() );
50
51  assert( res == INTSIZE );
52
53  return res;
54}
55
56/**
57 * read var data from byte buffer. actually this function does nothing but
58 * return INTSIZE
59 * @param buf pointer to read from
60 * @param maxLength readFromBuf will not read more than maxLength bytes
61 * @return number bytes read
62 */
63int SynchronizeableClassID::readFromBuf( byte * buf, int maxLength )
64{
65  return INTSIZE;
66}
67
68
69/**
70 * print out variable value
71 */
72void SynchronizeableClassID::debug( )
73{
74  printf( "SYNCHRONIZEABLE_VAR: %s IN: %d\n", name.c_str(), vPtrIn->getClassID().id() );
75}
76
Note: See TracBrowser for help on using the repository browser.