Back to index

nux  3.0.0
NSerializer.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00019  *
00020  */
00021 
00022 
00023 #include "NuxCore.h"
00024 
00025 namespace nux
00026 {
00027 
00028 // template<typename T>
00029 // void NSerializer::SerializeBuffer(T* buffer, unsigned long long Length, unsigned long long ElementSize)
00030 // {
00031 //     for(unsigned long long i = 0; i < Length; i++)
00032 //     {
00033 //         unsigned char* bytebuffer = (unsigned char*)(&buffer[i]);
00034 //         Serialize(bytebuffer, ElementSize);
00035 //     }
00036 // }
00037 
00038 // NSerializer& operator << (NSerializer& Sr, NString& s)
00039 // {
00040 //     Sr.SerializeBuffer<TCHAR>(NUX_CONST_CAST(TCHAR*, s.GetTCharPtr()), s.Size()+1, sizeof(TCHAR));
00041 //     return Sr;
00042 // }
00043 //
00044 // NSerializer& operator << (NSerializer& Sr, std::string& s)
00045 // {
00046 //     Sr.SerializeBuffer<TCHAR>(NUX_CONST_CAST(char*, s.c_str()), s.size()+1, sizeof(char));
00047 //     return Sr;
00048 // }
00049 
00050   void NSerializer::Serialize (char   &data)
00051   {
00052     SerializeFinal (&data, sizeof (char)   );
00053   }
00054 
00055   void NSerializer::Serialize (wchar_t  &data)
00056   {
00057     SerializeFinal (&data, sizeof (wchar_t)   );
00058   }
00059 
00060   void NSerializer::Serialize (bool   &data)
00061   {
00062     SerializeFinal (&data, sizeof (bool)    );
00063   }
00064 
00065   void NSerializer::Serialize (unsigned char     &data)
00066   {
00067     SerializeFinal (&data, sizeof (unsigned char)      );
00068   }
00069 
00070   void NSerializer::Serialize (unsigned short    &data)
00071   {
00072     SerializeFinal (&data, sizeof (unsigned short)     );
00073   }
00074   void NSerializer::Serialize (short    &data)
00075   {
00076     SerializeFinal (&data, sizeof (short)     );
00077   }
00078   void NSerializer::Serialize (unsigned int &data)
00079   {
00080     SerializeFinal (&data, sizeof (unsigned int)  );
00081   }
00082   void NSerializer::Serialize (int  &data)
00083   {
00084     SerializeFinal (&data, sizeof (int)   );
00085   }
00086   void NSerializer::Serialize (long   &data)
00087   {
00088     SerializeFinal (&data, sizeof (long)    );
00089   }
00090   void NSerializer::Serialize (unsigned long  &data)
00091   {
00092     SerializeFinal (&data, sizeof (unsigned long)   );
00093   }
00094   void NSerializer::Serialize (float  &data)
00095   {
00096     SerializeFinal (&data, sizeof (float)   );
00097   }
00098   void NSerializer::Serialize (double &data)
00099   {
00100     SerializeFinal (&data, sizeof (double)  );
00101   }
00102   void NSerializer::Serialize (unsigned long long    &data)
00103   {
00104     SerializeFinal (&data, sizeof (unsigned long long)     );
00105   }
00106   void NSerializer::Serialize (long long    &data)
00107   {
00108     SerializeFinal (&data, sizeof (long long)     );
00109   }
00110 
00111   void NSerializer::Serialize (wchar_t  *buffer, unsigned int len, unsigned int stride)
00112   {
00113     SerializeFinal (buffer, len * stride);
00114   }
00115   void NSerializer::Serialize (bool   *buffer, unsigned int len, unsigned int stride)
00116   {
00117     SerializeFinal (buffer, len * stride);
00118   }
00119   void NSerializer::Serialize (char   *buffer, unsigned int len, unsigned int stride)
00120   {
00121     SerializeFinal (buffer, len * stride);
00122   }
00123   void NSerializer::Serialize (unsigned char     *buffer, unsigned int len, unsigned int stride)
00124   {
00125     SerializeFinal (buffer, len * stride);
00126   }
00127   void NSerializer::Serialize (unsigned short    *buffer, unsigned int len, unsigned int stride)
00128   {
00129     SerializeFinal (buffer, len * stride);
00130   }
00131   void NSerializer::Serialize (short    *buffer, unsigned int len, unsigned int stride)
00132   {
00133     SerializeFinal (buffer, len * stride);
00134   }
00135   void NSerializer::Serialize (unsigned int *buffer, unsigned int len, unsigned int stride)
00136   {
00137     SerializeFinal (buffer, len * stride);
00138   }
00139   void NSerializer::Serialize (int  *buffer, unsigned int len, unsigned int stride)
00140   {
00141     SerializeFinal (buffer, len * stride);
00142   }
00143   void NSerializer::Serialize (long   *buffer, unsigned int len, unsigned int stride)
00144   {
00145     SerializeFinal (buffer, len * stride);
00146   }
00147   void NSerializer::Serialize (unsigned long  *buffer, unsigned int len, unsigned int stride)
00148   {
00149     SerializeFinal (buffer, len * stride);
00150   }
00151   void NSerializer::Serialize (float  *buffer, unsigned int len, unsigned int stride)
00152   {
00153     SerializeFinal (buffer, len * stride);
00154   }
00155   void NSerializer::Serialize (double *buffer, unsigned int len, unsigned int stride)
00156   {
00157     SerializeFinal (buffer, len * stride);
00158   }
00159   void NSerializer::Serialize (unsigned long long    *buffer, unsigned int len, unsigned int stride)
00160   {
00161     SerializeFinal (buffer, len * stride);
00162   }
00163   void NSerializer::Serialize (long long    *buffer, unsigned int len, unsigned int stride)
00164   {
00165     SerializeFinal (buffer, len * stride);
00166   }
00167 
00168 }