| 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: Patrick Boenzli |
|---|
| 13 | co-programmer: |
|---|
| 14 | */ |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | /* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module |
|---|
| 18 | For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput |
|---|
| 19 | */ |
|---|
| 20 | #define DEBUG_MODULE_NETWORK |
|---|
| 21 | |
|---|
| 22 | #include "simple_sync.h" |
|---|
| 23 | |
|---|
| 24 | #include "class_id.h" |
|---|
| 25 | #include "fast_factory.h" |
|---|
| 26 | #include "lib/util/loading/factory.h" |
|---|
| 27 | |
|---|
| 28 | #include "debug.h" |
|---|
| 29 | |
|---|
| 30 | CREATE_FACTORY(SimpleSync, CL_SIMPLE_SYNC); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | /** |
|---|
| 34 | * default constructor |
|---|
| 35 | */ |
|---|
| 36 | SimpleSync::SimpleSync( std::string name ) |
|---|
| 37 | { |
|---|
| 38 | setName( name ); |
|---|
| 39 | this->setClassID( CL_SIMPLE_SYNC, "SimpleSync" ); |
|---|
| 40 | in = 0; |
|---|
| 41 | out = 1; |
|---|
| 42 | syncStr = "hallo test test"; |
|---|
| 43 | id = this->registerVarId( new SynchronizeableInt( &in, &out, "var", PERMISSION_ALL ) ); |
|---|
| 44 | registerVar( new SynchronizeableString( &syncStr, &syncStr, "syncStr" ) ); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | /** |
|---|
| 49 | * default destructor deletes all unneded stuff |
|---|
| 50 | */ |
|---|
| 51 | SimpleSync::~SimpleSync() |
|---|
| 52 | { |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | void SimpleSync::debug( ) |
|---|
| 56 | { |
|---|
| 57 | printf("IN: %d OUT: %d\n", in, out); |
|---|
| 58 | printf("str: %s\n", syncStr.c_str()); |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | SimpleSync::SimpleSync( const TiXmlElement * root ) |
|---|
| 62 | { |
|---|
| 63 | setName( "" ); |
|---|
| 64 | this->setClassID( CL_SIMPLE_SYNC, "SimpleSync" ); |
|---|
| 65 | in = 0; |
|---|
| 66 | out = 1; |
|---|
| 67 | syncStr = "hallo test test"; |
|---|
| 68 | id = this->registerVarId( new SynchronizeableInt( &in, &out, "var", PERMISSION_ALL ) ); |
|---|
| 69 | registerVar( new SynchronizeableString( &syncStr, &syncStr, "syncStr" ) ); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | |
|---|