Ran the auto-generator on all our Streamable stuff in Narya. Tidied up the
results. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4395 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
package com.threerings.crowd.chat.data {
|
||||
|
||||
import com.threerings.util.ClassUtil;
|
||||
import com.threerings.util.Long;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
@@ -43,6 +44,9 @@ public /*abstract*/ class ChatMessage
|
||||
* registered with an auxiliary source in the ChatDirector. */
|
||||
public var localtype :String;
|
||||
|
||||
/** The client time that this message was created. */
|
||||
public var timestamp :Long;
|
||||
|
||||
public function ChatMessage (msg :String = null, bundle :String = null)
|
||||
{
|
||||
this.message = msg;
|
||||
@@ -70,14 +74,14 @@ public /*abstract*/ class ChatMessage
|
||||
" [message=" + message + ", bundle=" + bundle + "]";
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
// from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
message = (ins.readField(String) as String);
|
||||
bundle = (ins.readField(String) as String);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
// from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeField(message);
|
||||
|
||||
@@ -32,31 +32,35 @@ public class SystemMessage extends ChatMessage
|
||||
{
|
||||
/** Attention level constant to indicate that this message is merely
|
||||
* providing the user with information. */
|
||||
public static const INFO :int = 0;
|
||||
public static const INFO :int = 0;
|
||||
|
||||
/** Attention level constant to indicate that this message is the
|
||||
* result of a user action. */
|
||||
public static const FEEDBACK :int = 1;
|
||||
public static const FEEDBACK :int = 1;
|
||||
|
||||
/** Attention level constant to indicate that some action is required. */
|
||||
public static const ATTENTION :int = 2;
|
||||
|
||||
//----
|
||||
|
||||
/** The attention level of this message. */
|
||||
public var attentionLevel :int;
|
||||
|
||||
public function SystemMessage (
|
||||
msg :String = null, bundle :String = null, attLevel :int = 0)
|
||||
msg :String = null, bundle :String = null, attLevel :int = 0)
|
||||
{
|
||||
super(msg, bundle);
|
||||
this.attentionLevel = attLevel;
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
attentionLevel = ins.readByte();
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
|
||||
@@ -37,6 +37,29 @@ public class UserMessage extends ChatMessage
|
||||
/** The mode of the message. @see ChatCodes.DEFAULT_MODE */
|
||||
public var mode :int;
|
||||
|
||||
/**
|
||||
* Constructs a user message for a player originated tell (which has no
|
||||
* bundle and is in the default mode).
|
||||
*/
|
||||
public function UserMessage (speaker :Name = null, bundle :String = null,
|
||||
message :String = null, mode :int = 0)
|
||||
{
|
||||
super(message, bundle);
|
||||
this.speaker = speaker;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name to display for the speaker. Some types of messages
|
||||
* may wish to not use the canonical name for the speaker and should thus
|
||||
* override this function.
|
||||
*/
|
||||
public function getSpeakerDisplayName () :Name
|
||||
{
|
||||
return speaker;
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
@@ -44,6 +67,7 @@ public class UserMessage extends ChatMessage
|
||||
mode = ins.readByte();
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
|
||||
@@ -23,8 +23,8 @@ public class UserSystemMessage extends SystemMessage
|
||||
* Construct a UserSystemMessage.
|
||||
*/
|
||||
public function UserSystemMessage (
|
||||
sender :Name = null, message :String = null, bundle :String = null,
|
||||
attLevel :int = 0)
|
||||
sender :Name = null, message :String = null, bundle :String = null,
|
||||
attLevel :int = 0)
|
||||
{
|
||||
super(message, bundle, attLevel);
|
||||
this.speaker = sender;
|
||||
@@ -36,6 +36,7 @@ public class UserSystemMessage extends SystemMessage
|
||||
speaker = (ins.readObject() as Name);
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
|
||||
@@ -21,16 +21,18 @@
|
||||
|
||||
package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.util.Cloneable;
|
||||
import com.threerings.util.Integer;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
import com.threerings.presents.dobj.DSet_Entry;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
/**
|
||||
* The occupant info object contains all of the information about an
|
||||
* occupant of a place that should be shared with other occupants of the
|
||||
@@ -47,8 +49,8 @@ import com.threerings.io.ObjectOutputStream;
|
||||
* responsible for adding the code to clone those attributes when a clone
|
||||
* is requested.
|
||||
*/
|
||||
public class OccupantInfo
|
||||
implements DSet_Entry
|
||||
public class OccupantInfo extends SimpleStreamableObject
|
||||
implements DSet_Entry, Cloneable
|
||||
{
|
||||
/** Constant value for {@link #status}. */
|
||||
public static const ACTIVE :int = 0;
|
||||
@@ -71,32 +73,52 @@ public class OccupantInfo
|
||||
/** The status of this occupant. */
|
||||
public var status :int = ACTIVE;
|
||||
|
||||
/** A blank constructor used for unserialization. */
|
||||
public function OccupantInfo (body :BodyObject = null)
|
||||
{
|
||||
if (body != null) {
|
||||
bodyOid = body.getOid();
|
||||
username = body.getVisibleName();
|
||||
status = body.status;
|
||||
}
|
||||
}
|
||||
|
||||
/** Access to the body object id as an int. */
|
||||
public function getBodyOid () :int
|
||||
{
|
||||
return bodyOid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a cloned copy of this instance.
|
||||
*/
|
||||
public function clone () :Object
|
||||
{
|
||||
throw new Error("Clone not implemented. Implement if you need it.");
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return bodyOid;
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeObject(new Integer(bodyOid));
|
||||
out.writeObject(username);
|
||||
out.writeByte(status);
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
bodyOid = (ins.readField(Integer) as Integer).value;
|
||||
username = (ins.readObject() as Name);
|
||||
status = ins.readByte();
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeObject(new Integer(bodyOid));
|
||||
out.writeObject(username);
|
||||
out.writeByte(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,12 @@
|
||||
|
||||
package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.util.ClassUtil;
|
||||
import com.threerings.util.StringBuilder;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
import com.threerings.crowd.client.PlaceController;
|
||||
|
||||
@@ -40,9 +43,24 @@ import com.threerings.crowd.client.PlaceController;
|
||||
* #getControllerClass} and {@link #getManagerClassName}, returning the
|
||||
* appropriate place controller and manager class for that place.
|
||||
*/
|
||||
public /*abstract*/ class PlaceConfig
|
||||
implements Streamable
|
||||
public /*abstract*/ class PlaceConfig extends SimpleStreamableObject
|
||||
{
|
||||
public function PlaceConfig ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class that should be used to create a controller for this
|
||||
* place. The controller class must derive from {@link PlaceController}.
|
||||
*
|
||||
* @deprecated Override {@link #createController} directly.
|
||||
*/
|
||||
public function getControllerClass () :Class
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the controller that should be used for this place.
|
||||
*/
|
||||
@@ -61,17 +79,17 @@ public /*abstract*/ class PlaceConfig
|
||||
* (DashO Pro, for example) to remove the server code from the client,
|
||||
* knowing that it is never used.
|
||||
*/
|
||||
// public function getManagerClassName () :String;
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
public function getManagerClassName () :String
|
||||
{
|
||||
// nothing needed
|
||||
return null; // not used
|
||||
}
|
||||
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
// documentation inherited
|
||||
override protected function toStringBuilder (buf :StringBuilder) :void
|
||||
{
|
||||
// nothing needed
|
||||
buf.append("type=").append(ClassUtil.shortClassName(this));
|
||||
buf.append(", ");
|
||||
super.toStringBuilder(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,14 +23,13 @@ package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
/**
|
||||
* Defines access control tokens that convey certain privileges to users
|
||||
* (see {@link BodyObject#checkAccess}).
|
||||
*/
|
||||
public class TokenRing
|
||||
implements Streamable
|
||||
public class TokenRing extends SimpleStreamableObject
|
||||
{
|
||||
/** Indicates that this user is an administrator and can do things
|
||||
* like broadcast, shutdown the server and whatnot. */
|
||||
@@ -44,31 +43,6 @@ public class TokenRing
|
||||
_tokens = tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this token ring contains the specified token.
|
||||
*/
|
||||
public function holdsToken (token :int) :Boolean
|
||||
{
|
||||
return (_tokens & token) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for checking whether this ring holds the
|
||||
* {@link #ADMIN} token.
|
||||
*/
|
||||
public function isAdmin () :Boolean
|
||||
{
|
||||
return holdsToken(ADMIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bitmask that stores the various tokens.
|
||||
*/
|
||||
public function getTokens () :int
|
||||
{
|
||||
return _tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified token to this ring.
|
||||
*/
|
||||
@@ -82,6 +56,31 @@ public class TokenRing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bitmask that stores the various tokens.
|
||||
*/
|
||||
public function getTokens () :int
|
||||
{
|
||||
return _tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for checking whether this ring holds the
|
||||
* {@link #ADMIN} token.
|
||||
*/
|
||||
public function isAdmin () :Boolean
|
||||
{
|
||||
return holdsToken(ADMIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this token ring contains the specified token.
|
||||
*/
|
||||
public function holdsToken (token :int) :Boolean
|
||||
{
|
||||
return (_tokens & token) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the specified token from this ring.
|
||||
*/
|
||||
@@ -90,16 +89,18 @@ public class TokenRing
|
||||
_tokens &= ~token;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
out.writeInt(_tokens);
|
||||
super.readObject(ins);
|
||||
_tokens = ins.readInt();
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
_tokens = ins.readInt();
|
||||
super.writeObject(out);
|
||||
out.writeInt(_tokens);
|
||||
}
|
||||
|
||||
/** The tokens contained in this ring (composed together bitwise). */
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.crowd.peer.data {
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
import com.threerings.presents.peer.data.ClientInfo;
|
||||
|
||||
/**
|
||||
* Extends the standard {@link ClientInfo} with Crowd bits.
|
||||
*/
|
||||
public class CrowdClientInfo extends ClientInfo
|
||||
{
|
||||
/** The client's visible name, which is used for chatting. */
|
||||
public var visibleName :Name;
|
||||
|
||||
public function CrowdClientInfo ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
override public function getKey () :Object
|
||||
{
|
||||
return visibleName;
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
visibleName = (ins.readObject() as Name);
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeObject(visibleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.io {
|
||||
|
||||
import com.threerings.util.StringBuilder;
|
||||
|
||||
/**
|
||||
* A simple serializable object implements the {@link Streamable}
|
||||
* interface and provides a default {@link #toString} implementation which
|
||||
* outputs all public members.
|
||||
*/
|
||||
public class SimpleStreamableObject implements Streamable
|
||||
{
|
||||
// from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
// nothing by default
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
// nothing by default
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a string representation of this instance.
|
||||
*/
|
||||
public function toString () :String
|
||||
{
|
||||
var buf :StringBuilder = new StringBuilder("[");
|
||||
toStringBuilder(buf);
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the toString-ification of all public members. Derived
|
||||
* classes can override and include non-public members if desired.
|
||||
*/
|
||||
protected function toStringBuilder (buf :StringBuilder): void
|
||||
{
|
||||
// TODO: StringUtil.fieldsToString(buf, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// $Id: ConMgrStats.java 4324 2006-08-15 00:12:42Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.data {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
import com.threerings.util.Cloneable;
|
||||
import com.threerings.util.Long;
|
||||
|
||||
/**
|
||||
* Used to track and report stats on the connection manager.
|
||||
*/
|
||||
public class ConMgrStats extends SimpleStreamableObject
|
||||
implements Cloneable
|
||||
{
|
||||
/** The size of the queue of waiting to auth sockets. This is a snapshot at
|
||||
* the time the stats are requested. */
|
||||
public var authQueueSize :int;
|
||||
|
||||
/** The size of the queue of waiting to die sockets. This is a snapshot at
|
||||
* the time the stats are requested. */
|
||||
public var deathQueueSize :int;
|
||||
|
||||
/** The outgoing queue size. This is a snapshot at the time the stats are
|
||||
* requested. */
|
||||
public var outQueueSize :int;
|
||||
|
||||
/** The overflow queue size. This is a snapshot at the time the stats are
|
||||
* requested. */
|
||||
public var overQueueSize :int;
|
||||
|
||||
/** The number of connection events since the server started up. */
|
||||
public var connects :int;
|
||||
|
||||
/** The number of disconnection events since the server started up. */
|
||||
public var disconnects :int;
|
||||
|
||||
/** The number of bytes read since the server started up. */
|
||||
public var bytesIn :Long;
|
||||
|
||||
/** The number of bytes written since the server started up. */
|
||||
public var bytesOut :Long;
|
||||
|
||||
/** The number of messages read since the server started up. */
|
||||
public var msgsIn :int;
|
||||
|
||||
/** The number of messages written since the server started up. */
|
||||
public var msgsOut :int;
|
||||
|
||||
public function ConMgrStats ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
// from Object
|
||||
public function clone () :Object
|
||||
{
|
||||
throw new Error("Clone not implemented. Implement if you need it.");
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
authQueueSize = ins.readInt();
|
||||
deathQueueSize = ins.readInt();
|
||||
outQueueSize = ins.readInt();
|
||||
overQueueSize = ins.readInt();
|
||||
connects = ins.readInt();
|
||||
disconnects = ins.readInt();
|
||||
bytesIn = new Long(ins.readInt(), ins.readInt());
|
||||
bytesOut = new Long(ins.readInt(), ins.readInt());
|
||||
msgsIn = ins.readInt();
|
||||
msgsOut = ins.readInt();
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeInt(authQueueSize);
|
||||
out.writeInt(deathQueueSize);
|
||||
out.writeInt(outQueueSize);
|
||||
out.writeInt(overQueueSize);
|
||||
out.writeInt(connects);
|
||||
out.writeInt(disconnects);
|
||||
out.writeInt(bytesIn == null ? 0 : bytesIn.low);
|
||||
out.writeInt(bytesIn == null ? 0 : bytesIn.high);
|
||||
out.writeInt(bytesOut == null ? 0 : bytesOut.low);
|
||||
out.writeInt(bytesOut == null ? 0 : bytesOut.high);
|
||||
out.writeInt(msgsIn);
|
||||
out.writeInt(msgsOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.peer.data {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
import com.threerings.presents.dobj.DSet_Entry;
|
||||
|
||||
/**
|
||||
* Contains information on a particular client.
|
||||
*/
|
||||
public class ClientInfo extends SimpleStreamableObject
|
||||
implements DSet_Entry
|
||||
{
|
||||
/** The username used by this client to authenticate. */
|
||||
public var username :Name;
|
||||
|
||||
public function ClientInfo ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSet.Entry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
username = (ins.readObject() as Name);
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeObject(username);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user