Introduction Manual Class Reference Header Reference

zoidcom_replicator_numeric.h

Go to the documentation of this file.
00001 /****************************************
00002 * zoidcom_replicator_numeric.h
00003 * pointer-to-numerics replicators
00004 *
00005 * This file is part of the "Zoidcom Automated Networking System" application library.
00006 * Copyright (C)2002-2007 by Joerg Rueppel. See documentation for copyright and licensing details.
00007 *****************************************/
00008 
00009 #ifndef _ZOIDREPLICATORNUMERIC_H_
00010 #define _ZOIDREPLICATORNUMERIC_H_
00011 
00015 #include "zoidcom.h"
00016 #include "zoidcom_replicator_value.h"
00017 #include "zoidcom_typehelper.h"
00018 
00019 /****************************************************
00020 *         (numeric replicator setup class)
00021 *****************************************************/
00022 
00025 class ZCOM_API ZCom_RSetupNumeric : public ZCom_ReplicatorSetup
00026 {
00027 public:
00029   ZCOM_TAPI ZCom_RSetupNumeric(zU8 _rbits, zU8 _flags, zU8 _rules, zU8 _intercept_id = 0,
00030                               zS16 _mindelay = -1, zS16 _maxdelay = -1)
00031                               : ZCom_ReplicatorSetup(_flags, _rules, _intercept_id,
00032                                                      _mindelay, _maxdelay)
00033                     { m_relevant_bits = _rbits; }
00034 
00035   ZCOM_TAPI virtual ZCom_ReplicatorSetup* Duplicate();
00036 
00038   ZCOM_TAPI inline zU8 getRelevantBits() const { return m_relevant_bits; }
00039 
00047   ZCOM_TAPI inline void setRelevantBits(zU8 _bits) { m_relevant_bits = _bits; }
00048 protected:
00051   zU8       m_relevant_bits;
00052 };
00053 
00054 
00060 template <typename T, int SIZE>
00061 class ZCOM_API ZCom_Replicate_Numeric : public ZCom_ReplicatorBasic
00062 {
00063   // make T a non-pointer
00064   typedef typename ZCom_TypeHelper<T>::value_type TYPE;
00065 protected:
00066   ZCom_ReplicatorValue<T, SIZE> m_value;
00067 public:
00069   ZCOM_TAPI ZCom_Replicate_Numeric(TYPE *_data, ZCom_RSetupNumeric *_setup);
00071   ZCOM_TAPI ZCom_Replicate_Numeric(TYPE *_data, zU8 _rbits, zU8 _flags, zU8 _rules, zU8 _intercept_id = 0, zS16 _mindelay = -1, zS16 _maxdelay = -1);
00072   ZCOM_TAPI ~ZCom_Replicate_Numeric();
00073   ZCOM_TAPI bool checkState();
00074   ZCOM_TAPI void packData(ZCom_BitStream* _stream);
00075   ZCOM_TAPI void unpackData(ZCom_BitStream* _stream, bool _store, zU32 _estimated_time_sent);
00076   ZCOM_TAPI void Process(eZCom_NodeRole _localrole, zU32 _simulation_time_passed) {};
00077 
00081   ZCOM_TAPI void* peekData();
00082   ZCOM_TAPI void  clearPeekData();
00083 
00087   ZCOM_TAPI zU8   getSize() const { return SIZE; }
00088 
00093   ZCOM_TAPI TYPE  getValue(zU8 _idx) { assert(_idx < SIZE); return m_value.getData()[_idx]; }
00094 
00098   ZCOM_TAPI TYPE* getValue() { return m_value.getData(); }
00099 
00104   ZCOM_TAPI void  setValue(zU8 _idx, TYPE _val) { assert(_idx < SIZE); m_value.getData()[_idx] = _val; }
00105 
00109   ZCOM_TAPI void  setValue(TYPE* _val) { m_value.setData(_val); }
00110 
00111 };
00112 
00113 
00114 #endif

This file is part of the documentation for Zoidcom. Documentation copyright © 2004-2008 by Jörg Rüppel. Generated on Sat Aug 16 15:26:49 2008 for Zoidcom by doxygen 1.4.6-NO