[9906] | 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 | */ |
---|
| 26 | SynchronizeableClassID::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 | */ |
---|
| 36 | SynchronizeableClassID::~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 | */ |
---|
| 46 | int SynchronizeableClassID::writeToBuf( byte * buf, int maxLength ) |
---|
| 47 | { |
---|
[9908] | 48 | int res = Converter::intToByteArray( vPtrIn->getClassID().id(), buf, maxLength ); |
---|
[9906] | 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 | */ |
---|
| 62 | int SynchronizeableClassID::readFromBuf( byte * buf, int maxLength ) |
---|
| 63 | { |
---|
| 64 | return INTSIZE; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | /** |
---|
| 69 | * print out variable value |
---|
| 70 | */ |
---|
| 71 | void SynchronizeableClassID::debug( ) |
---|
| 72 | { |
---|
| 73 | printf( "SYNCHRONIZEABLE_VAR: %s IN: %d\n", name.c_str(), vPtrIn->getClassID().id() ); |
---|
| 74 | } |
---|
| 75 | |
---|