• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

LightweightDatabaseCommon.cpp

Go to the documentation of this file.
00001 #include "TableSerializer.h"
00002 #include "LightweightDatabaseCommon.h"
00003 #include "BitStream.h"
00004 #include "StringCompressor.h"
00005 
00006 void DatabaseFilter::Serialize(RakNet::BitStream *out)
00007 {
00008         stringCompressor->EncodeString(columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, out);
00009         out->Write((unsigned char)columnType);
00010         out->Write((unsigned char)operation);
00011         if (operation!=DataStructures::Table::QF_IS_EMPTY && operation!=DataStructures::Table::QF_NOT_EMPTY)
00012         {
00013                 RakAssert(cellValue.isEmpty==false);
00014                 TableSerializer::SerializeCell(out, &cellValue, columnType);
00015         }
00016 }
00017 bool DatabaseFilter::Deserialize(RakNet::BitStream *in)
00018 {
00019         unsigned char temp;
00020         stringCompressor->DecodeString(columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, in);
00021         in->Read(temp);
00022         columnType=(DataStructures::Table::ColumnType)temp;
00023         if (in->Read(temp)==false)
00024                 return false;
00025         operation=(DataStructures::Table::FilterQueryType)temp;
00026         if (operation!=DataStructures::Table::QF_IS_EMPTY && operation!=DataStructures::Table::QF_NOT_EMPTY)
00027         {
00028                 return TableSerializer::DeserializeCell(in, &cellValue, columnType);
00029         }
00030         return true;
00031 }
00032 void DatabaseCellUpdate::Serialize(RakNet::BitStream *out)
00033 {
00034         stringCompressor->EncodeString(columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, out);
00035         out->Write((unsigned char)columnType);
00036         TableSerializer::SerializeCell(out, &cellValue, columnType);
00037 }
00038 bool DatabaseCellUpdate::Deserialize(RakNet::BitStream *in)
00039 {
00040         unsigned char temp;
00041         stringCompressor->DecodeString(columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, in);
00042         in->Read(temp);
00043         columnType=(DataStructures::Table::ColumnType)temp;
00044         return TableSerializer::DeserializeCell(in, &cellValue, columnType);
00045 }

Generated on Thu Sep 30 2010 01:27:24 for RakNet by  doxygen 1.7.1