singrdk/base/Kernel/Singularity.Security/AccessMode.sg

45 lines
1.1 KiB
Plaintext
Raw Normal View History

2008-03-05 09:52:00 -05:00
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Singularity.Security
{
using System;
/// <summary>
/// Represents an access mode (permission)
/// </summary>
public class AccessMode
{
private static uint next = 0;
private static object sync = new object();
private string! mode;
private uint num;
public AccessMode(string! mode)
{
this.mode = mode;
lock (sync)
this.num = next++;
}
public string! Val { get { return mode; } }
public uint Num { get { return num; } }
public override int GetHashCode()
{
return mode.GetHashCode();
}
public override bool Equals(object o)
{
AccessMode other = o as AccessMode;
if (other != null){
return this.mode.Equals(other.mode);
}
return false;
}
}
}