Palabos  Version 1.0
atomicBlockSerializer2D.h
Go to the documentation of this file.
00001 /* This file is part of the Palabos library.
00002  *
00003  * Copyright (C) 2011 FlowKit Sarl
00004  * Avenue de Chailly 23
00005  * 1012 Lausanne, Switzerland
00006  * E-mail contact: contact@flowkit.com
00007  *
00008  * The most recent release of Palabos can be downloaded at 
00009  * <http://www.palabos.org/>
00010  *
00011  * The library Palabos is free software: you can redistribute it and/or
00012  * modify it under the terms of the GNU Affero General Public License as
00013  * published by the Free Software Foundation, either version 3 of the
00014  * License, or (at your option) any later version.
00015  *
00016  * The library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Affero General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Affero General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00028 #ifndef ATOMIC_BLOCK_SERIALIZER_2D_H
00029 #define ATOMIC_BLOCK_SERIALIZER_2D_H
00030 
00031 #include "core/globalDefs.h"
00032 #include "core/util.h"
00033 #include "atomicBlock/atomicBlock2D.h"
00034 #include "core/serializer.h"
00035 
00036 namespace plb {
00037 
00038 class AtomicBlockSerializer2D : public DataSerializer {
00039 public:
00040     AtomicBlockSerializer2D(AtomicBlock2D const& block_,
00041                             IndexOrdering::OrderingT ordering_);
00042     AtomicBlockSerializer2D(AtomicBlock2D const& block_,
00043                             Box2D domain_,
00044                             IndexOrdering::OrderingT ordering_);
00045     virtual AtomicBlockSerializer2D* clone() const;
00046     virtual pluint getSize() const;
00047     virtual const char* getNextDataBuffer(pluint& bufferSize) const;
00048     virtual bool isEmpty() const;
00049 private:
00050     AtomicBlock2D const& block;
00051     IndexOrdering::OrderingT ordering;
00052     Box2D domain;
00053     mutable std::vector<char> buffer;
00054     mutable plint iX, iY;
00055 };
00056 
00057 class AtomicBlockUnSerializer2D : public DataUnSerializer {
00058 public:
00059     AtomicBlockUnSerializer2D(AtomicBlock2D& block_,
00060                               IndexOrdering::OrderingT ordering_);
00061     AtomicBlockUnSerializer2D(AtomicBlock2D& block_,
00062                               Box2D domain_,
00063                               IndexOrdering::OrderingT ordering_);
00064     virtual AtomicBlockUnSerializer2D* clone() const;
00065     virtual pluint getSize() const;
00066     virtual char* getNextDataBuffer(pluint& bufferSize);
00067     virtual void commitData();
00068     virtual bool isFull() const;
00069 private:
00070     AtomicBlock2D& block;
00071     IndexOrdering::OrderingT ordering;
00072     Box2D domain;
00073     mutable std::vector<char> buffer;
00074     mutable plint iX, iY;
00075 };
00076 
00077 }  //  namespace plb
00078 
00079 #endif  // ATOMIC_BLOCK_SERIALIZER_2D_H