summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsc2000-12-04 13:23:22 +0000
committersc2000-12-04 13:23:22 +0000
commit2455534347596bd4ccf415c9cdf6d2e42a98fb72 (patch)
tree09379b262ce739bfa86cf9c7610c83b471b89ffc
parentee21a6940d4a8edb758187352ae717bbe7b1b825 (diff)
downloadivy-league-2455534347596bd4ccf415c9cdf6d2e42a98fb72.zip
ivy-league-2455534347596bd4ccf415c9cdf6d2e42a98fb72.tar.gz
ivy-league-2455534347596bd4ccf415c9cdf6d2e42a98fb72.tar.bz2
ivy-league-2455534347596bd4ccf415c9cdf6d2e42a98fb72.tar.xz
IvlFilDes -> IvlFd
-rw-r--r--comm/Channel.cc58
-rw-r--r--comm/Channel.h34
-rw-r--r--comm/Datagram.cc18
-rw-r--r--comm/Datagram.h12
-rw-r--r--comm/Scheduler.cc22
-rw-r--r--comm/Scheduler.h19
6 files changed, 78 insertions, 85 deletions
diff --git a/comm/Channel.cc b/comm/Channel.cc
index f396a40..98bc97c 100644
--- a/comm/Channel.cc
+++ b/comm/Channel.cc
@@ -1,17 +1,17 @@
/*
- * The Unix Channel
+ * Ivy League
*
- * by Michel Beaudouin-Lafon
+ * File descriptors, channels
*
- * Copyright 1990-1997
+ * Copyright 1990-2000
* Laboratoire de Recherche en Informatique (LRI)
+ * Centre d'Etudes de la Navigation Aerienne (CENA)
*
- * File descriptors, channels
+ * original code by Michel Beaudouin-Lafon,
+ * heavily modified by Stephane Chatty and Stephane Sire
*
* $Id$
- * $CurLog$
- * Smart(ies) removed by Stephane Sire
- * Removed ReadHandler and WriteHandler
+ *
*/
#ifdef __GNUG__
@@ -37,7 +37,7 @@ static int Inited = 0;
/*?nodoc?*/
void
-IvlFilDes :: Use (int fd)
+IvlFd :: Use (int fd)
{
if (fd < 0)
return;
@@ -52,7 +52,7 @@ IvlFilDes :: Use (int fd)
/*?nodoc?*/
void
-IvlFilDes :: Unuse (int fd)
+IvlFd :: Unuse (int fd)
{
if (fd < 0)
return;
@@ -62,20 +62,20 @@ IvlFilDes :: Unuse (int fd)
/*?nodoc?*/
char*
-IvlFilDes :: StrRepr (char* buf)
+IvlFd :: StrRepr (char* buf)
{
sprintf (buf, "%d", Fd);
return buf;
}
-/*?class IvlFilDes
+/*?class IvlFd
This class implements objects representing Unix file descriptors.
-When the associated file descriptor is -1, the \typ{IvlFilDes} is said to be closed,
+When the associated file descriptor is -1, the \typ{IvlFd} is said to be closed,
else it is said to be opened.
Because several objects of this class can refer to the same file descriptor,
the destructor closes the file descriptor only if it is the last object referring to this file descriptor.
This is implemented with the help of a reference count, the overloading of \fun{operator =}
-and the definition of the constructor \fun{IvlFilDes(const IvlFilDes\&)}.
+and the definition of the constructor \fun{IvlFd(const IvlFd\&)}.
All member functions described here are inline for maximum efficiency.
?*/
@@ -84,38 +84,32 @@ All member functions described here are inline for maximum efficiency.
/*?
Construct a closed file descriptor.
?*/
-IvlFilDes :: IvlFilDes ()
+IvlFd :: IvlFd ()
{ }
/*?
Construct an open file descriptor for the Unix file descriptor \var{fd}.
-In particular, this makes it possible to pass an integer where a \typ{IvlFilDes} is normally expected.
+In particular, this makes it possible to pass an integer where a \typ{IvlFd} is normally expected.
This is most useful when using Unix file descriptors.
?*/
-IvlFilDes :: IvlFilDes (int fd)
+IvlFd :: IvlFd (int fd)
{ }
/*?
-This conversion operator makes it possible to pass a \typ{IvlFilDes} argument where
-an integer is expected. This is most useful for system calls.
+This conversion operator makes it possible to pass a \typ{IvlFd} argument where
+an integer file descriptor is expected. This is most useful for system calls.
?*/
int
-IvlFilDes :: operator int ()
+IvlFd :: operator int ()
{ }
-/*?
-Return the Unix file descriptor, or -1 if it is closed.
-?*/
-int
-IvlFilDes :: FilDes ()
-{ }
/*?
Open the object on file descriptor \var{fd}.
If it was already opened, it is closed first.
?*/
void
-IvlFilDes :: Open (int fd)
+IvlFd :: Open (int fd)
{ }
/*?
@@ -124,14 +118,14 @@ only if it was the last reference to it.
\fun{Close} is automatically called by the destructor.
?*/
void
-IvlFilDes :: Close ()
+IvlFd :: Close ()
{ }
/*?
Return true if the object is opened, false else.
?*/
bool
-IvlFilDes :: Opened ()
+IvlFd :: Opened ()
{ }
/*?
@@ -140,7 +134,7 @@ This is the Unix \fun{read} system call.
For efficiency, this function does not test whether the file descriptor is opened.
?*/
int
-IvlFilDes :: Read (byte* b, int n)
+IvlFd :: Read (byte* b, int n)
{ }
/*?
@@ -149,13 +143,13 @@ This is the Unix \fun{write} system call.
For efficiency, this function does not test whether the file descriptor is opened.
?*/
int
-IvlFilDes :: Write (byte* b, int n)
+IvlFd :: Write (byte* b, int n)
{ }
#endif /* DOC */
/*?class IvlChannel
-A \typ{IvlChannel} is basically a file descriptor, with more strict semantics than a \typ{IvlFilDes}.
+A \typ{IvlChannel} is basically a file descriptor, with more strict semantics than a \typ{IvlFd}.
A channel is immutable: once initialized, it cannot change its file descriptor.
It has a mode, of type \typ{^{IOMODE}}, with possible values
\var{IONone}, \var{IORead}, \var{IOWrite}, \var{IOReadWrite},
@@ -327,7 +321,7 @@ IvlChannel :: Read (byte* b, int n)
{ }
/*?
-The Unix \fun{read} and \fun{write} system calls, as in class \typ{IvlFilDes}.
+The Unix \fun{read} and \fun{write} system calls, as in class \typ{IvlFd}.
?*/
int
IvlChannel :: Write (byte* b, int n)
diff --git a/comm/Channel.h b/comm/Channel.h
index 1a9bd64..01a395f 100644
--- a/comm/Channel.h
+++ b/comm/Channel.h
@@ -1,20 +1,17 @@
/*
- * The Unix Channel
+ * Ivy League
*
- * by Michel Beaudouin-Lafon
+ * File descriptors, channels
*
- * Copyright 1990-1997
+ * Copyright 1990-2000
* Laboratoire de Recherche en Informatique (LRI)
+ * Centre d'Etudes de la Navigation Aerienne (CENA)
*
- * File descriptors, channels
+ * original code by Michel Beaudouin-Lafon,
+ * heavily modified by Stephane Chatty and Stephane Sire
*
* $Id$
- * $CurLog$
- * Removed virtual IvlChannel::Copy ()
- * Removed virutal IvlChannel::HandleSelect ()
- * Smart(ies) removed by Stephane Sire
- * Removed ReadHandler and WriteHandler
- * NFILE -> 64, en attendant mieux
+ *
*/
#ifndef Channel_H_
@@ -44,7 +41,7 @@ enum IOMODE { IONone = 0, IORead = 1, IOWrite = 2,
extern char* StrReprBuf;
-class IvlFilDes {
+class IvlFd {
private:
static void Use (int);
static void Unuse (int);
@@ -52,14 +49,13 @@ static void Unuse (int);
protected:
int Fd;
public:
-inline IvlFilDes () : Fd (-1) { }
-inline IvlFilDes (const IvlFilDes& fd) { Use (Fd = fd.Fd); }
-inline IvlFilDes (int fd) { Use (Fd = fd); }
-inline ~IvlFilDes () { Unuse (Fd); }
+inline IvlFd () : Fd (-1) { }
+inline IvlFd (const IvlFd& fd) { Use (Fd = fd.Fd); }
+inline IvlFd (int fd) { Use (Fd = fd); }
+inline ~IvlFd () { Unuse (Fd); }
inline operator int () const { return Fd; }
-inline IvlFilDes& operator = (const IvlFilDes& fd) { Unuse (Fd); Fd = fd.Fd; Use (Fd); return *this; }
-inline int FilDes () { return Fd; }
+inline IvlFd& operator = (const IvlFd& fd) { Unuse (Fd); Fd = fd.Fd; Use (Fd); return *this; }
inline void Open (int fd) { Unuse (Fd); Use (Fd = fd); }
inline void Close () { Unuse (Fd); Fd = -1; }
inline bool Opened () { return bool (Fd >= 0); }
@@ -78,7 +74,7 @@ inline int Write (byte* b, int n) { return write (Fd, (const char*) b, n); }
class IvlChannel : public IvlIOS {
friend class IvlBaseScheduler;
protected:
- IvlFilDes Fd;
+ IvlFd Fd;
IOMODE Mode;
IvlBaseScheduler* Mpx;
@@ -104,7 +100,7 @@ inline void SetMode (IOMODE io) { Mode = io; }
virtual void HandleWrite ();
virtual void HandleRead ();
-inline int FilDes () const { return Fd; }
+inline int GetFd () const { return Fd; }
inline int Read (byte* b, int n) { return read (Fd, (char*) b, n); }
inline int Write (const byte* b, int n) { return write (Fd, (const char*) b, n); }
inline operator int () { return Fd; }
diff --git a/comm/Datagram.cc b/comm/Datagram.cc
index 66c40df..e2bad89 100644
--- a/comm/Datagram.cc
+++ b/comm/Datagram.cc
@@ -1,17 +1,21 @@
/*
- * The Unix Channel
+ * Ivy League
*
- * by Michel Beaudouin-Lafon
+ * Datagrams
+ * File descriptors, channels
*
- * Copyright 1990-1997
+ * Copyright 1990-2000
* Laboratoire de Recherche en Informatique (LRI)
+ * Centre d'Etudes de la Navigation Aerienne (CENA)
*
- * Datagrams
+ * original code by Michel Beaudouin-Lafon,
+ * modified by Stephane Chatty
*
* $Id$
- * $CurLog$
+ *
*/
+
#include "Datagram.h"
#include "MsgBuffer.h"
#include <stdlib.h>
@@ -92,7 +96,7 @@ If the datagram is connected, you must use \fun{Write} instead.
int
IvlDatagram :: Send (byte* buf, int len, IvlAddress& to)
{
- return sendto (FilDes (), (char*) buf, len, 0, to.GetSockAddr (), to.Length ());
+ return sendto (GetFd (), (char*) buf, len, 0, to.GetSockAddr (), to.Length ());
}
/*?
@@ -126,7 +130,7 @@ IvlDatagram :: Reply (byte* buf, int len)
{
if (! FAddr)
return -1;
- return sendto (FilDes (), (char*) buf, len, 0, FAddr->GetSockAddr (), FAddr->Length ());
+ return sendto (GetFd (), (char*) buf, len, 0, FAddr->GetSockAddr (), FAddr->Length ());
}
/*?nextdoc?*/
diff --git a/comm/Datagram.h b/comm/Datagram.h
index e9ffd1e..60c0ac4 100644
--- a/comm/Datagram.h
+++ b/comm/Datagram.h
@@ -1,15 +1,17 @@
/*
- * The Unix Channel
+ * Ivy League
*
- * by Michel Beaudouin-Lafon
+ * Datagrams
*
- * Copyright 1990-1997
+ * Copyright 1990-2000
* Laboratoire de Recherche en Informatique (LRI)
+ * Centre d'Etudes de la Navigation Aerienne (CENA)
*
- * Datagrams
+ * original code by Michel Beaudouin-Lafon,
+ * modified by Stephane Chatty
*
* $Id$
- * $CurLog$
+ *
*/
#ifndef Datagram_H_
diff --git a/comm/Scheduler.cc b/comm/Scheduler.cc
index 075c461..9140abe 100644
--- a/comm/Scheduler.cc
+++ b/comm/Scheduler.cc
@@ -1,21 +1,17 @@
/*
- * The Unix Channel
+ * Ivy League
*
- * by Michel Beaudouin-Lafon
+ * Channel sets, or multiplexers, or schedulers
*
- * Copyright 1990-1997
+ * Copyright 1990-2000
* Laboratoire de Recherche en Informatique (LRI)
+ * Centre d'Etudes de la Navigation Aerienne (CENA)
*
- * Channel sets, or multiplexers
+ * original code by Michel Beaudouin-Lafon,
+ * heavily modified by Stephane Chatty and Stephane Sire
*
* $Id$
- * $CurLog$
- * Amelioration de la gestion des timers dans Scan
- * Amelioration de la gestion des timers dans LoopScan
- * Modification du mecanisme d'ajout d'un Channel
- * Remplacement du HandleSelect par un systeme de Hook
- * Integration avec IvlBaseMultiplexer
- * Meilleures verifications de NFILE, en attendant mieux
+ *
*/
#include "Scheduler.h"
@@ -89,7 +85,7 @@ differences. See the class \typ{IvlScheduler} for a ``pure \uch''
implementation of multiplexers.
Note that the functions that take an integer file descriptor as
-argument can be passed a \typ{FILDES} or a \typ{IvlChannel} because
+argument can be passed a \typ{IvlFd} or a \typ{IvlChannel} because
the corresponding conversion operators are defined.
The way to Add/Remove a channel from a multiplexer is to call
@@ -152,7 +148,7 @@ working on it at a time.
bool
IvlBaseScheduler :: Add (IvlChannel* chan)
{
- int fd = chan->FilDes ();
+ int fd = chan->GetFd ();
if (fd < 0 || fd >= NFILE)
return false;
IvlChannel* ochan = Channels [fd];
diff --git a/comm/Scheduler.h b/comm/Scheduler.h
index b6eec4d..d465006 100644
--- a/comm/Scheduler.h
+++ b/comm/Scheduler.h
@@ -1,19 +1,20 @@
/*
- * The Unix Channel
+ * Ivy League
*
- * by Michel Beaudouin-Lafon
+ * Channel sets, or multiplexers, or schedulers
*
- * Copyright 1990-1993
+ * Copyright 1990-2000
* Laboratoire de Recherche en Informatique (LRI)
+ * Centre d'Etudes de la Navigation Aerienne (CENA)
*
- * Channel sets, or multiplexers
+ * original code by Michel Beaudouin-Lafon,
+ * heavily modified by Stephane Chatty and Stephane Sire
*
* $Id$
- * $CurLog$
- * Smart(ies) removed by Stephane Sire
- * added Hooks
+ *
*/
+
#ifndef IvlScheduler_H_
#define IvlScheduler_H_
@@ -25,8 +26,8 @@
extern char* StrReprBuf;
// This class defines channel sets for multiplexing i/o
-// Because of the coercion defined for FILDES -> int,
-// most arguments of type ints can be FILDES, IvlChannel, ...
+// Because of the coercion defined for IvlFd -> int,
+// most arguments of type ints can be IvlFd, IvlChannel, ...
// An array of pointers to channels is kept in the object;
// The masks for reading/writing are kept consistent with the IOMode of
// the channels, as long as it is not changed by a direct access to the channel