- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# window.hh

Go to the documentation of this file.

    00001 // window.hh: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 The Vaucanson Group.
    00006 //
    00007 // This program is free software; you can redistribute it and/or
    00008 // modify it under the terms of the GNU General Public License
    00009 // as published by the Free Software Foundation; either version 2
    00010 // of the License, or (at your option) any later version.
    00011 //
    00012 // The complete GNU General Public Licence Notice can be found as the
    00013 // `COPYING' file in the root directory.
    00014 //
    00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
    00016 //
    00017 #ifndef VCSN_MISC_WINDOW_HH
    00018 # define VCSN_MISC_WINDOW_HH
    00019
    00031 # include <iostream>
    00032 # include <string>
    00033
    00034 namespace vcsn {
    00035   namespace misc {
    00036
    00059     template <class InputIterator, class Letter>
    00060     struct Window
    00061     {
    00062         typedef InputIterator                           iterator_t;
    00063         typedef Letter                                  letter_t;
    00064         typedef typename std::basic_string<letter_t>    string_t;
    00065         typedef unsigned int                            length_t;
    00066
    00080         Window (const iterator_t& stream,
    00081                 const iterator_t& eof,
    00082                 letter_t eol,
    00083                 length_t length);
    00084
    00086         bool            eof () const;
    00088         bool            eol () const;
    00089
    00095         void            shift (unsigned int n);
    00097         void            shift ();
    00098
    00100
    00101         void            moveto (length_t offset);
    00102         void            moveto (iterator_t position);
    00104
    00106         length_t        size () const;
    00107
    00109         letter_t        operator[] (length_t i) const;
    00110
    00112         std::ostream&   print (std::ostream& ostr) const;
    00113
    00115
    00116
    00117         iterator_t      begin () const;
    00119         iterator_t      stream () const;
    00121         iterator_t      end () const;
    00123         size_t          offset () const;
    00125         letter_t        eol_value () const;
    00127         length_t        length () const;
    00129         string_t        window () const;
    00131       protected:
    00132         void            compute_size ();
    00133
    00134         iterator_t      begin_;
    00135         iterator_t      stream_;
    00136         iterator_t      end_;
    00137         letter_t        eol_;
    00138         length_t        length_;
    00139         length_t        size_;
    00140     };
    00141
    00142     template <class InputIterator, class Letter>
    00143     std::ostream&
    00144     operator<< (std::ostream& ostr, const Window<InputIterator, Letter>& w);
    00145
    00148   } // misc
    00149 } // vcsn
    00150
    00151 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00152 #  include <vaucanson/misc/window.hxx>
    00153 # endif // VCSN_USE_INTERFACE_ONLY
    00154
    00155 #endif // ! VCSN_MISC_WINDOW_HH