Introduction Manual Class Reference Header Reference

zoidcom_replicator_interpolate.h

Go to the documentation of this file.
00001 /****************************************
00002 * zoidcom_replicator_interpolate.h
00003 * interpolating 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 _ZOIDREPLICATORINTERPOLATE_H_
00010 #define _ZOIDREPLICATORINTERPOLATE_H_
00011 
00015 #include "zoidcom.h"
00016 #include "zoidcom_replicator_value.h"
00017 
00018 /****************************************************
00019 *            (interpolator setup class)
00020 *****************************************************/
00021 
00024 template <typename T>
00025 class ZCOM_API ZCom_RSetupInterpolate : public ZCom_RSetupNumeric
00026 {
00027 public:
00029   ZCOM_TAPI ZCom_RSetupInterpolate(zU8 _rbits, zU8 _flags, zU8 _rules, T _ipoltreshold,
00030                                   zU8 _intercept_id = 0, zS16 _mindelay=-1, zS16 _maxdelay=-1,
00031                                   zFloat _ipolfac=0.4f)
00032   : ZCom_RSetupNumeric(_rbits, _flags, _rules, _intercept_id,
00033                                 _mindelay, _maxdelay)
00034   {
00035     ipol_factor = _ipolfac;
00036     ipol_treshold = _ipoltreshold;
00037   }
00038 
00039   ZCOM_TAPI virtual ZCom_ReplicatorSetup* Duplicate();
00040 
00047   zFloat ipol_factor;
00048 
00055   T      ipol_treshold;
00056 };
00057 
00058 /****************************************************
00059 * (interpolator template)
00060 *****************************************************/
00061 
00064 template <typename T, int SIZE>
00065 class ZCOM_API ZCom_Interpolate : public ZCom_ReplicatorBasic
00066 {
00067   typedef typename ZCom_TypeHelper<T>::value_type TYPE;
00068 private:
00070   ZCom_ReplicatorValue<T, SIZE> m_value;
00071   TYPE                          m_received_val[SIZE];
00072 public:
00074   ZCOM_TAPI ZCom_Interpolate(TYPE *_data, ZCom_RSetupInterpolate<TYPE> *_setup);
00076   ZCOM_TAPI ZCom_Interpolate(TYPE *_data, zU8 _bits, zU8 _flags, zU8 _rules, TYPE _treshold, TYPE *_dst=NULL, zU8 _intercept_id = 0, zS16 _mindelay=-1, zS16 _maxdelay=-1, zFloat _ipolfac=0.4f);
00077 
00078   ZCOM_TAPI ~ZCom_Interpolate();
00079   ZCOM_TAPI bool checkState();
00080   ZCOM_TAPI void packData(ZCom_BitStream *_stream);
00081   ZCOM_TAPI void unpackData(ZCom_BitStream *_stream, bool _store, zU32 _estimated_time_sent);
00082   ZCOM_TAPI void Process(eZCom_NodeRole _localrole, zU32 _simulation_time_passed);
00083 
00087   ZCOM_TAPI void* peekData();
00088   ZCOM_TAPI void  clearPeekData();
00089 
00094   ZCOM_TAPI TYPE  getValue(zU8 _idx) { assert(_idx < SIZE); return m_value.getData()[_idx]; }
00095 
00100   ZCOM_TAPI void  setValue(zU8 _idx, TYPE _val) { assert(_idx < SIZE); m_value.getData()[_idx] = _val; }
00101 
00105   ZCOM_TAPI void  setValue(TYPE* _val) { m_value.setData(_val); }
00106 
00110   ZCOM_TAPI zU8   getSize() const { return SIZE; }
00111 
00117   ZCOM_TAPI TYPE  getRecVal(zU8 _idx) const { assert(_idx < SIZE); return m_received_val[_idx]; }
00118 
00124   ZCOM_TAPI TYPE* getRecValPtr(zU8 _idx) { assert(_idx < SIZE); return &m_received_val[_idx]; }
00125 
00130   ZCOM_TAPI void setRecVal(zU8 _idx, TYPE _val) { assert(_idx < SIZE); m_received_val[_idx] = _val; }
00131 };
00132 
00133 #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