feisty meow concerns codebase  2.140
span_manager.h
Go to the documentation of this file.
1 #ifndef SPAN_MANAGER_CLASS
2 #define SPAN_MANAGER_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : span_manager *
7 * Author : Chris Koeritz *
8 * *
9 *******************************************************************************
10 * Copyright (c) 1990-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
17 
18 #include <structures/bit_vector.h>
19 
20 namespace sockets {
21 
23 
32 {
33 public:
34  span_manager(int number_of_items);
35  // keeps track of "number_of_items" worth of whatever the unit is.
36 
37  span_manager(const span_manager &to_copy);
38 
39  ~span_manager();
40 
41  span_manager &operator =(const span_manager &to_copy);
42 
43  void reset(int number_of_items);
45 
46  bool update(const basis::int_array &new_spans);
48 
51  int received_sequence() const;
53 
56  int missing_sequence() const;
58 
60  void make_received_list(basis::int_array &spans, int max_spans = -1) const;
62 
68  void make_missing_list(basis::int_array &spans, int max_spans = -1) const;
70 
71  const structures::bit_vector &vector() const;
75 
78 
81 
82 private:
83  structures::bit_vector *_implementation;
84 
85  basis::astring funky_print(const basis::int_array &to_spew, int rec_seq) const;
87 };
88 
89 } //namespace.
90 
91 #endif
92 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
A simple object that wraps a templated array of ints.
Definition: array.h:275
Manages lists of numbers representing the completion of some activity.
Definition: span_manager.h:32
bool update(const basis::int_array &new_spans)
updates the span information.
int received_sequence() const
returns the highest chunk number at which all chunks are ready.
const structures::bit_vector & vector() const
observes the held bit_vector that represents the spans.
void make_missing_list(basis::int_array &spans, int max_spans=-1) const
creates a list representing the spans that are not ready yet.
void make_received_list(basis::int_array &spans, int max_spans=-1) const
Creates a list for the received spans that are ready.
span_manager(int number_of_items)
span_manager & operator=(const span_manager &to_copy)
basis::astring print_received_list() const
prints out the span list for received blocks into a string.
basis::astring print_missing_list() const
prints out the span list for missing blocks into a string.
void reset(int number_of_items)
sets up the span manager with a new configuration.
int missing_sequence() const
returns the number of the chunk where the first item is missing.
An array of bits with operations for manipulating and querying individual bits.
Definition: bit_vector.h:26
Provides access to the operating system's socket methods.
Definition: base_address.h:26