Merge pull request #3740 from Unity-Technologies/gc-options-command-line
[mono.git] / mcs / class / referencesource / System.Workflow.Runtime / EventQueueState.cs
1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.     All rights    reserved.
3 //------------------------------------------------------------
4 using System;
5 using System.Collections;
6 using System.Collections.Generic;
7 using System.Text;
8 using System.Diagnostics;
9 using System.Globalization;
10 using System.Workflow.ComponentModel;
11 using System.Runtime.Serialization;
12
13 namespace System.Workflow.Runtime
14 {
15     [Serializable]
16     internal sealed class EventQueueState
17     {
18         Queue deliveredMessages;
19         List<ActivityExecutorDelegateInfo<QueueEventArgs>> synchronousListeners;
20         List<ActivityExecutorDelegateInfo<QueueEventArgs>> asynchronousListeners;
21         bool enabled = true;
22         bool transactional = true;
23
24         [NonSerialized]
25         internal IComparable queueName;
26
27         [NonSerialized]
28         bool dirty = false; // dirty flag set to true until a transaction completes
29
30         internal EventQueueState()
31         {
32             this.deliveredMessages = new Queue();
33             this.synchronousListeners = new List<ActivityExecutorDelegateInfo<QueueEventArgs>>();
34             this.asynchronousListeners = new List<ActivityExecutorDelegateInfo<QueueEventArgs>>();
35         }
36
37         internal Queue Messages
38         {
39             get { return this.deliveredMessages; }
40         }
41         internal List<ActivityExecutorDelegateInfo<QueueEventArgs>> AsynchronousListeners
42         {
43             get { return this.asynchronousListeners; }
44         }
45         internal List<ActivityExecutorDelegateInfo<QueueEventArgs>> SynchronousListeners
46         {
47             get { return this.synchronousListeners; }
48         }
49         internal bool Enabled
50         {
51             get { return this.enabled; }
52             set { this.enabled = value; }
53         }
54         internal bool Transactional
55         {
56             get { return this.transactional; }
57             set { this.transactional = value; }
58         }
59
60         internal bool Dirty
61         {
62             get { return this.dirty; }
63             set { this.dirty = value; }
64         }
65
66         internal void CopyFrom(EventQueueState copyFromState)
67         {
68             this.deliveredMessages = new Queue(copyFromState.Messages);
69
70             // don't copy Subscribers since this gets fixed 
71             // up at access time based on these tracking context ints
72             this.asynchronousListeners.AddRange(copyFromState.AsynchronousListeners.ToArray());
73             this.synchronousListeners.AddRange(copyFromState.SynchronousListeners.ToArray());
74
75             this.enabled = copyFromState.Enabled;
76             this.transactional = copyFromState.Transactional;
77             this.dirty = false;
78         }
79     }
80
81 }