Esempio n. 1
0
		/// <summary> Create a copy of the message. If offset and length are used (to refer to another buffer), the copy will
		/// contain only the subset offset and length point to, copying the subset into the new copy.
		/// </summary>
		/// <param name="">copy_buffer
		/// </param>
		/// <returns>
		/// </returns>
		public virtual Message copy(bool copy_buffer,MemoryManager memManaager)
		{
            Message retval = null;
            if (memManaager != null)
            {
                ObjectProvider provider = memManaager.GetProvider(typeof(Message));
                if(provider != null)
                    retval = (Message)provider.RentAnObject();
            }
            else
                retval = new Message();

			retval.dest_addr = dest_addr;
			retval.dest_addrs = dest_addrs;
			retval.src_addr = src_addr;
			retval.prio = prio;
			retval.isUserMsg = isUserMsg;
            retval.isProfilable = IsProfilable;
            retval.ProfileId = profileid;
            retval.psTime = psTime;
            retval.tnspTime = tnspTime;
            retval.traceMsg = traceMsg;
            retval.RequestId = reqId;
            retval.handledAsynchronously = handledAsynchronously;
            retval.responseExpected = responseExpected;

			if (copy_buffer && buf != null)
			{
				retval.setBuffer(buf, offset, length);
			}
            
            if (headers != null)
            {
                retval.headers = (Hashtable)headers.Clone();
                
            }
            retval.Payload = this.Payload;
			return retval;
		}
Esempio n. 2
0
 public virtual Message copy(MemoryManager memManager)
 {
     return copy(true, memManager);
 }
 /// <summary>
 /// Serializes an object into the specified stream.
 /// </summary>
 /// <param name="stream">specified stream</param>
 /// <param name="graph">object</param>
 static public void Serialize(Stream stream, object graph, string cacheContext, bool closeStream,MemoryManager objManager)
 {
     CompactBinaryWriter writer = new CompactBinaryWriter(stream);
     writer.Context.MemManager = objManager;
     Serialize(writer, graph, cacheContext);
     writer.Dispose(closeStream);
 }
 /// <summary>
 /// Deserializes an object from the specified stream.
 /// </summary>
 /// <param name="stream">specified stream</param>
 /// <returns>deserialized object</returns>
 static public object Deserialize(Stream stream, string cacheContext, bool closeStream,MemoryManager memManager)
 {
     object obj;
     CompactBinaryReader reader = new CompactBinaryReader(stream);
     reader.Context.MemManager = memManager;
     obj = Deserialize(reader, cacheContext, false);
     reader.Dispose(closeStream);
     return obj;
 }
 /// <summary>
 /// Creates instance of <see cref="ActualType"/>. Calls the default constructor and returns
 /// the object. There must be a default constructor even though it is private.
 /// </summary>
 /// <returns></returns>
 public virtual object GetInstance(MemoryManager objManager)
 {
     object obj = null;
     if (objManager != null)
     {
         ObjectProvider provider = objManager.GetProvider(ActualType);
         if (provider != null)
         {
             obj = provider.RentAnObject();
         }
     }
     return obj;
 }