Exemplo n.º 1
0
 public RefToReplicatedObject( IReplicated targetobject )
 {
     islocal = true;
     this.targetobject = targetobject;
     Type targettype = targetobject.GetType();
     reference = replicatedobjectreferencecontroller.GetInstance().GetReference( targettype, targetobject );
 }
Exemplo n.º 2
0
 public RefToReplicatedObject( IReplicated targetobject )
 {
     islocal = true;
     this.targetobject = targetobject;
     Type targettype = targetobject.GetType();
     reference = replicatedobjectreferencecontroller.GetInstance().GetReference( targettype, targetobject );
 }
Exemplo n.º 3
0
 public int GetNextReference( IReferenceConsumer requester, Type targettype, IReplicated targetobject )
 {
     HashableWeakReference targetobjectweakreference = new HashableWeakReference( targetobject );
     if( referencebyobject.Contains( targetobjectweakreference ) )
     {
         return (int)referencebyobject[ targetobjectweakreference ];
     }
     
     if( ismaster )
     {
         int nextreference = _GetNextReferenceForType( targettype );
     
         objectbyreference.Add( nextreference, targetobjectweakreference );
         referencebyobject.Add( targetobjectweakreference, nextreference );                
         return nextreference;
     }
     else
     {
         return null;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Compares the value.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(IReplicated other)
 {
     return((int)(this.Version.Own - other.Version.Own));
 }
Exemplo n.º 5
0
 public void Write(IReplicated item, ReplicatedVersion since)
 {
     item.Write(this, since);
 }
Exemplo n.º 6
0
        public int GetNextReference( IReferenceConsumer requester, Type targettype, IReplicated targetobject )
        {
            HashableWeakReference targetobjectweakreference = new HashableWeakReference( targetobject );
            if( referencebyobject.Contains( targetobjectweakreference ) )
            {
                return (int)referencebyobject[ targetobjectweakreference ];
            }

            if( ismaster )
            {
                int nextreference = _GetNextReferenceForType( targettype );

                objectbyreference.Add( nextreference, targetobjectweakreference );
                referencebyobject.Add( targetobjectweakreference, nextreference );
                return nextreference;
            }
            else
            {
                return null;
            }
        }