Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

cabal_line.h

00001 /*
00002    Cabal - cabal_line
00003    Line (set of connection towards an host).
00004 
00005    $Id: cabal_line.h,v 1.4 2004/04/05 21:54:18 jonnymind Exp $
00006 ---------------------------------------------
00007    Begin      : gio mar 25 2004 $TIME$
00008    Author     : Giancarlo Niccolai <gc@niccolai.ws>, (C) 2004
00009 
00010    Last modified because:
00011 
00012 */
00013 
00014 /**************************************************************************
00015 *   This program is free software; you can redistribute it and/or modify  *
00016 *   it under the terms of the GNU Library General Public License as       *
00017 *   published by the Free Software Foundation; either version 2.1 of the  *
00018 *   License, or (at your option) any later version.                       *
00019 ***************************************************************************/
00020 
00021 #ifndef CABAL_LINE_H
00022 #define CABAL_LINE_H
00023 
00024 #include <map>
00025 #include <string>
00026 #include <cabal_os.h>
00027 #include <cabal_waiter.h>
00028 #include <cassert>
00029 
00030 namespace Cabal 
00031 {
00032 
00033 class Connection;
00034 
00036 typedef std::map<std::string, Connection *> ConMap;
00037 
00039 typedef struct {
00040    short int bytes;
00041    MSECS timeOfDay;
00042 } SendEntry;
00043 
00045 typedef std::list< SendEntry > SentList;
00046 
00093 class Line: public Waiter
00094 {
00095    
00096    Connection **m_conArray;
00097    ConMap *m_conMap;
00098    int m_aSize;
00099    
00100 public:
00112    Line( const long band, int arraySize );
00113    
00122    Line( const long band );
00123 
00129    ~Line(); 
00130    
00131 
00146    Connection *set( const int conId, Connection *con );
00147    
00158    Connection *get( const int conId ) const;
00159    
00160    
00176    Connection *set( const std::string &conName, Connection *con );
00177    
00178    
00188    Connection *get( const std::string &conName ) const;
00189    
00197    Connection *set( const char *conName, Connection *con )
00198    {
00199       std::string cs(conName);
00200       return set( cs, con );
00201    }
00202    
00210    Connection *get( const char *conName ) const
00211    {
00212       std::string cs(conName);
00213       return get( cs );
00214    }
00215    
00219    void remove( Connection *con );
00220    
00222    void bandwidth( const long int bw ) { m_bandwidth = bw; }
00224    double bandwidth() const { return m_bandwidth; }
00225 };
00226 
00227 }
00228 
00229 #endif
00230 
00231 /* end of cabal_line */

Generated on Sat Apr 10 17:41:48 2004 for Cabal by doxygen 1.3.5