- Main Page
- Related Pages
- Classes
- Files

# memiter.h

    00001 //
    00002 // memiter.h
    00003 //
    00004 // derived from memasmg.cc
    00005 // Copyright (C) 1996 Limit Point Systems, Inc.
    00006 //
    00007 // Author: Curtis Janssen <cljanss@limitpt.com>
    00008 // Maintainer: LPS
    00009 //
    00010 // This file is part of the SC Toolkit.
    00011 //
    00012 // The SC Toolkit is free software; you can redistribute it and/or modify
    00013 // it under the terms of the GNU Library General Public License as published by
    00014 // the Free Software Foundation; either version 2, or (at your option)
    00015 // any later version.
    00016 //
    00017 // The SC Toolkit is distributed in the hope that it will be useful,
    00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00020 // GNU Library General Public License for more details.
    00021 //
    00022 // You should have received a copy of the GNU Library General Public License
    00023 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
    00024 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00025 //
    00026 // The U.S. Government is granted a limited license as per AL 91-7.
    00027 //
    00028
    00029 #ifdef __GNUC__
    00030 #pragma interface
    00031 #endif
    00032
    00033 #ifndef _util_group_memiter_h
    00034 #define _util_group_memiter_h
    00035
    00036 #include <util/group/memory.h>
    00037
    00038 namespace sc {
    00039
    00040 class MemoryIter {
    00041   private:
    00042     distsize_t *offsets_;
    00043     int n_;
    00044
    00045     void *data_;
    00046
    00047     char *current_data_;
    00048     int current_size_;
    00049     int current_offset_;
    00050     int node_;
    00051
    00052     int ready_;
    00053
    00054     distsize_t offset_;
    00055     int size_;
    00056   public:
    00057     MemoryIter(void *data, distsize_t *offsets, int n);
    00058
    00059     // iteration control
    00060     void begin(distsize_t offset, int size);
    00061     int ready() { return ready_; }
    00062     void next();
    00063
    00064     // info about the current piece of data
    00065     void *data() { return (void*) current_data_; }
    00066     int node() { return node_; }
    00067     int offset() { return current_offset_; }
    00068     int size() { return current_size_; }
    00069
    00070     // returns true if all data is local to node
    00071     int local(distsize_t offset, int size, int node);
    00072 };
    00073
    00074 }
    00075
    00076 #endif
    00077
    00078 // Local Variables:
    00079 // mode: c++
    00080 // c-file-style: "CLJ"
    00081 // End: