Exemplo n.º 1
0
        // Add this DistributedObject to the repository.
        public void AddObject(IDistributedObject obj)
        {
            DistributedObjectId doId = obj.DistributedObjectId;

            // Store in the dictionary of objects
            mObjectIds[doId] = obj;
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Returns the object referenced by the doId or null if not found on this state server.
        /// </summary>
        /// <param name="doId"></param>
        /// <returns></returns>
        public IDistributedObject GetObject(DistributedObjectId doId)
        {
            IDistributedObject obj = null;

            mObjectIds.TryGetValue(doId, out obj);
            return(obj);
        }
Exemplo n.º 3
0
 public void DeleteObjectMessage(bool broadcastMessage, DistributedObjectId distributedObjectId, List <object> data)
 {
     mBroadcast           = broadcastMessage;
     mDistributedObjectId = distributedObjectId;
     mData        = data;
     mMessageType = MessageType.Delete;
 }
Exemplo n.º 4
0
 public void CreateObjectMessage(bool broadcastMessage, bool storeInRam, DistributedObjectId distributedObjectId, List <object> data)
 {
     mBroadcast           = broadcastMessage;
     mStoreInRam          = storeInRam;
     mDistributedObjectId = distributedObjectId;
     mData        = data;
     mMessageType = MessageType.Create;
 }
Exemplo n.º 5
0
 //The first argument in List<object>data will contain all the serializable data we want
 //Eg: Data = new List<object> ( float x, float y, float z, float x, float y, float z, float w );
 public void UpdateObjectMessage(bool broadcastMessage, bool storeInRam, DistributedObjectId distributedObjectId, int callback, List <object> data)
 {
     mBroadcast           = broadcastMessage;
     mStoreInRam          = storeInRam;
     mDistributedObjectId = distributedObjectId;
     mCallback            = callback;
     mData        = data;
     mMessageType = MessageType.Update;
 }
Exemplo n.º 6
0
 public Message(SerializationInfo info, StreamingContext ctxt) : this()
 {
     mBroadcast           = info.GetBoolean("broadcast");
     mStoreInRam          = info.GetBoolean("storeInRam");
     mDistributedObjectId = (DistributedObjectId)info.GetValue("objectId", typeof(DistributedObjectId));//info.GetUInt32("objectId");
     mCallback            = info.GetInt32("callback");
     mData        = (List <object>)info.GetValue("data", typeof(List <object>));
     mMessageType = (MessageType)info.GetValue("messageType", typeof(MessageType));
     mId          = info.GetInt32("id");
 }
Exemplo n.º 7
0
        // Remove this DistributedObject from the repository.
        public virtual void RemoveObject(IDistributedObject obj)
        {
            // Remove from object id dict
            DistributedObjectId doId = obj.DistributedObjectId;

            if (!mObjectIds.Remove(doId))
            {
                Console.WriteLine("Warning!!! We don't have this object!");
                return;
            }
        }
Exemplo n.º 8
0
 // Returns true if this state server currently is maintaining this object in memory.
 public bool ContainsObject(DistributedObjectId doId)
 {
     return(mObjectIds.ContainsKey(doId));
 }
Exemplo n.º 9
0
 public DistributedObject(DistributedObjectId doId)
 {
     mDistributedObjectId = doId;
     RegisterMessageActions();
 }