summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs136
1 files changed, 65 insertions, 71 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index b56f251..47f427b 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/Ivy.cs
@@ -1,17 +1,8 @@
-/// <summary> a software bus package
+/// François-Régis Colin
+/// http://www.tls.cena.fr/products/ivy/
/// *
-/// </summary>
-/// <author> François-Régis Colin
-/// </author>
-/// <author> <a href="http://www.tls.cena.fr/products/ivy/">http://www.tls.cena.fr/products/ivy/</a>
+/// (C) CENA
/// *
-/// <pre>
-/// Ivy bus = new Ivy("Dummy agent","ready");
-/// bus.bindMsg("(.*)",new IvyMessageHandler(myMessageListener));
-/// bus.start(null);
-/// </pre>
-///
-/// </author>
namespace IvyBus
{
using System;
@@ -22,6 +13,8 @@ namespace IvyBus
using System.Threading;
using System.Configuration;
+ /// <summary> The Main bus Class
+ /// </summary>
public class Ivy
{
/* Event handler */
@@ -34,10 +27,20 @@ namespace IvyBus
/* Event */
+ /// <summary>fires when a new client connect to the bus</summary>
+ /// <param name='appcb'>A callback handling the notification of connexions and
+ /// disconnections, may be null
+ ///
+ /// </param>
public event ClientConnectedHandler clientConnected;
+ /// <summary>fires when a client discconnect from the bus</summary>
public event ClientDisconnectedHandler clientDisconnected;
+ /// <summary>fires when a client receive a direct message from another client</summary>
public event DirectMessageHandler directMessageReceived;
+ /// <summary>fires when somebody ask for killing every client on the bus</summary>
public event DieHandler dieReceived;
+
+ /// <summary>IvyClients accesses the list of the connected clients</summary>
public Hashtable IvyClients
{
get
@@ -54,6 +57,7 @@ namespace IvyBus
}
}
+ /// <summary>ClientNames accesses the name list of the connected clients</summary>
private String ClientNames
{
get
@@ -70,6 +74,8 @@ namespace IvyBus
}
}
+ /// <summary>AppName the application name</summary>
+
public String AppName
{
get
@@ -79,21 +85,14 @@ namespace IvyBus
}
- /// <summary> the name of the application on the bus
- /// </summary>
+ /// the name of the application on the bus
internal String appName;
- /// <summary> the protocol version number
- /// </summary>
+ /// the protocol version number
internal const int PROCOCOLVERSION = 3;
- /// <summary> the port for the UDP rendez vous, if none is supplied
- /// </summary>
+ /// the port for the UDP rendez vous, if none is supplied
internal const int DEFAULT_PORT = 2010;
- /// <summary> the domain for the UDP rendez vous
- /// </summary>
+ /// the domain for the UDP rendez vous
internal static readonly String DEFAULT_DOMAIN = "127.255.255.255:" + DEFAULT_PORT;
- /// <summary> the library version, useful for development purposes only, when java is
- /// invoked with -DIVY_DEBUG
- /// </summary>
internal const String libVersion = "1.0.0";
private bool debug;
@@ -110,18 +109,26 @@ namespace IvyBus
internal String ready_message = null;
/// <summary> Readies the structures for the software bus connexion.
- /// *
- /// All the dirty work is done un the start() method
/// </summary>
- /// <seealso cref=" #start
- /// "/>
- /// <param name="name">The name of your Ivy agent on the software bus
- /// </param>
- /// <param name="message">The hellow message you will send once ready
+ /// <example> This sample shows how to start working with Ivy.
+ /// <code>
+ /// Ivy bus = new Ivy("Dummy agent","ready");
+ /// bus.bindMsg("(.*)",new Ivy.MessageHandler(myMessageListener));
+ /// bus.start(null);
+ /// </code>
+ /// How to send & receive:
+ /// the Ivy agent A performs <c>b.bindMsg("^Hello (*)",cb);</c>
+ /// the Ivy agent B performs <c>b2.sendMsg("Hello world");</c>
+ /// a thread in A will run the callback cb with its second argument set
+ /// to a array of String, with one single element, "world"
+ /// </example>
+ /// <remarks>
+ /// the real work begin in the start() method
+ /// </remarks>
+ /// <seealso cref=" Ivy.start"/>
+ /// <param name='name'>The name of your Ivy agent on the software bus
/// </param>
- /// <param name="appcb">A callback handling the notification of connexions and
- /// disconnections, may be null
- ///
+ /// <param name='message'>The hellow message you will send once ready
/// </param>
public Ivy(String name, String message)
{
@@ -136,13 +143,13 @@ namespace IvyBus
}
/// <summary> connects the Ivy bus to a domain or list of domains.
- /// *
- /// <li>One thread (IvyWatcher) for each traffic rendezvous (either UDP broadcast or TCPMulticast)
- /// <li>One thread (serverThread/Ivy) to accept incoming connexions on server socket
- /// <li>a thread for each IvyClient when the connexion has been done
- /// *
/// </summary>
- /// <param name="domainbus">a domain of the form 10.0.0:1234, it is similar to the
+ /// <remarks>
+ /// One thread (IvyWatcher) for each traffic rendezvous (either UDP broadcast or TCP Multicast).
+ /// One thread (serverThread/Ivy) to accept incoming connexions on server socket.
+ /// a thread for each IvyClient when the connexion has been done.
+ /// </remarks>
+ /// <param name='domainbus'>a domain of the form 10.0.0:1234, it is similar to the
/// netmask without the trailing .255. This will determine the meeting point
/// of the different applications. Right now, this is done with an UDP
/// broadcast. Beware of routing problems ! You can also use a comma
@@ -253,12 +260,15 @@ namespace IvyBus
}
- /// <summary> Performs a pattern matching according to everyone's regexps, and sends
- /// the results to the relevant ivy agents.
- /// <p><em>There is one thread for each client connected, we could also
- /// create another thread each time we send a message.</em>
+ /// <summary> Send a message to someone on the bus
/// </summary>
- /// <param name="message">A String which will be compared to the regular
+ /// <remarks>
+ /// Performs a pattern matching according to everyone's regexps, and sends
+ /// the results to the relevant ivy agents.
+ /// There is one thread for each client connected, we could also
+ /// create another thread each time we send a message.
+ /// </remarks>
+ /// <param name='message'>A message which will be compared to the regular
/// expressions of the different clients
/// </param>
/// <returns>the number of messages actually sent
@@ -280,20 +290,16 @@ namespace IvyBus
}
/// <summary> Subscribes to a regular expression.
- /// *
+ /// </summary>
+ /// <remarks>
/// The callback will be executed with
/// the saved parameters of the regexp as arguments when a message will sent
- /// by another agent. A program <em>doesn't</em> receive its own messages.
- /// <p>Example:
- /// <br>the Ivy agent A performs <pre>b.bindMsg("^Hello (*)",cb);</pre>
- /// <br>the Ivy agent B performs <pre>b2.sendMsg("Hello world");</pre>
- /// <br>a thread in A will uun the callback cb with its second argument set
- /// to a array of String, with one single element, "world"
- /// </summary>
- /// <param name="regexp">a perl regular expression, groups are done with parenthesis
+ /// by another agent. A program doesn't receive its own messages.
+ /// </remarks>
+ ///
+ /// <param name='regexp'>a regular expression, groups are done with parenthesis
/// </param>
- /// <param name="callback">any objects implementing the IvyMessageListener
- /// interface, on the AWT/Swing framework
+ /// <param name='callback'>any objects implementing the Ivy.MessageListener
/// </param>
/// <returns>the id of the regular expression
///
@@ -316,9 +322,8 @@ namespace IvyBus
}
/// <summary> unsubscribes a regular expression
- /// *
/// </summary>
- /// <param name="id">the id of the regular expression, returned when it was bound
+ /// <param name='id'>the id of the regular expression, returned when it was bound
///
/// </param>
public void unBindMsg(int id)
@@ -337,12 +342,11 @@ namespace IvyBus
}
/// <summary> unsubscribes a regular expression
- /// *
/// </summary>
/// <returns>a boolean, true if the regexp existed, false otherwise or
/// whenever an exception occured during unbinding
/// </returns>
- /// <param name="String">the string for the regular expression
+ /// <param name='re'>the string for the regular expression
///
/// </param>
public bool unBindMsg(String re)
@@ -399,15 +403,9 @@ namespace IvyBus
}
-
- /// <summary> gives the names of IvyClient(s)
- /// </summary>
-
/// <summary> gives a list of IvyClient(s) with the name given in parameter
- /// *
/// </summary>
- /// <param name="name">The name of the Ivy agent you're looking for
- ///
+ /// <param name='name'>The name of the Ivy agent you're looking for
/// </param>
public ArrayList getIvyClientsByName(String name)
{
@@ -495,8 +493,7 @@ namespace IvyBus
}
- /// <summary> checks the "validity" of a regular expression.
- /// </summary>
+ /// checks the "validity" of a regular expression.
internal bool CheckRegexp(String exp)
{
bool regexp_ok = true;
@@ -630,7 +627,4 @@ namespace IvyBus
}
}
}
- // class Ivy
-
- /* EOF */
} \ No newline at end of file