Veda/PackFloat_FixedPoint.h

Go to the documentation of this file.
00001 /*! \file 
00002     \author victorien ferry & www.m4nkind.com
00003     \brief This file applies the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 , read file COPYING.
00004 */
00005 #ifndef COM_M4NKIND_PackFloat_FixedPoint_H
00006 #define COM_M4NKIND_PackFloat_FixedPoint_H
00007 
00008 #include "PackFloat.h"
00009 
00010 /*!
00011     \class  PackFloat_FixedPoint
00012     \ingroup    BaseSerializableClass
00013     \brief   Base type managing a float, but serialized like a PackLong.
00014             You provide a const number at construction that fixes a number
00015             of bit after the point. For example, 1 bit after the point will
00016             make possible: 0.0f , 0.5f, 1.0f, 1.5f,... 2 bits after the point
00017             will manage: 0.0f,0.25f,0.5f,0.75f,1.0f,1.25f,...
00018 */
00019 
00020 class PackFloat_FixedPoint : public PackFloat
00021 {
00022 /*==================================================================
00023                                 PUBLIC
00024 ==================================================================*/
00025 public:
00026     /*!
00027         \brief  Constructor by default number of bit after the point is 6: (_ValueToMultiplyFromIntToFloat=1/64.0)
00028     */
00029     PackFloat_FixedPoint();
00030     /*!
00031         \brief  Constructor. 
00032         \param _ValueToMultiplyFromIntToFloat fixes how many bit are used after the point.
00033     */
00034     PackFloat_FixedPoint(const float _ValueToMultiplyFromIntToFloat );
00035     /*!
00036         \brief  Constructor To initialize PackFloat as a multi dimentional vector. 
00037         \param _DimensionEnum on of the 3 VectorDimension enum.
00038         \param _ValueToMultiplyFromIntToFloat fixes how many bit are used after the point.
00039     */
00040     PackFloat_FixedPoint( VectorDimension _DimensionEnum,const float _ValueToMultiplyFromIntToFloat );
00041 
00042 #ifdef _ENGINE_EDITABLE_
00043     /*!
00044         \brief  Destructor. 
00045     */
00046     virtual ~PackFloat_FixedPoint(void);
00047 #endif
00048     /*!
00049         \brief  Read the object description from a byte chunk. Could crash if chunk not valid.
00050         \param  _pDescriptionChunk the objet description chunk. 
00051         \return the end of the chunk written, possibly unlocated. Don't use this if you don't need it.
00052     */
00053     virtual  const unsigned char * Serialize_In( const unsigned char * _pDescriptionChunk);
00054 
00055 #ifdef _ENGINE_EDITABLE_
00056     /*!
00057         \brief  get the size of the whole byte chunk that will be written by Serialize_Out().
00058         \return byte size of the serialisation to do.(1,2,3, or4)
00059     */
00060     virtual unsigned int  GetSerializedDescriptionSize(void);
00061 #endif
00062 #ifdef _ENGINE_EDITABLE_
00063     /*!
00064         \brief  write the Current object definition to a Chunk using private packed types, recursively.
00065         \param  _pDescriptionChunkToFill the chunk where to write the objet description chunk. 
00066         \return the end of the chunk written, possibly unlocated. Don't use this if you don't need it.
00067     */
00068     virtual unsigned char * Serialize_Out(unsigned char * _pDescriptionChunkToFill);
00069 #endif
00070 #ifdef _ENGINE_EDITABLE_
00071     /*!
00072         \brief  Each BaseType's inherited classes must explicit an ID for their
00073                 class, or let use one of the super class at least through this virtual method.
00074                 This is needed by GUIs to detect the types of each sub-members, and shape
00075                 an interface for each Object according to their member list.
00076         \return a const character string, that must be unique and unchanged for all serializable base type.
00077     */
00078     virtual const char *GetClassID() const { return "PackFloat::PackFloat_FixedPoint"; };
00079 #endif
00080 
00081 /*==================================================================
00082                                 PROTECTED
00083 ==================================================================*/
00084 protected:
00085     //! the value that give the ratio for serialization:
00086     float   m_ValueToMultiplyFromIntToFloat;
00087 };
00088 
00089 
00090 // end of file:
00091 #endif

      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/