//******************************************************************************************************
// MetadataRecordGeneralFlags.cs - Gbtc
//
// Copyright © 2012, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://www.opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 02/20/2007 - Pinal C. Patel
// Generated original version of code based on DatAWare system specifications by Brian B. Fox, GSF.
// 04/20/2009 - Pinal C. Patel
// Converted to C#.
// 09/15/2009 - Stephen C. Wills
// Added new header and license agreement.
// 10/11/2010 - Mihir Brahmbhatt
// Updated header and license agreement.
// 12/14/2012 - Starlynn Danyelle Gilliam
// Modified Header.
//
//******************************************************************************************************
namespace GSF.Historian.Files
{
#region [ Enumerations ]
///
/// Indicates the type of data being archived for a .
///
public enum DataType
{
///
/// Data value is analog in nature.
///
Analog,
///
/// Data value is digital in nature.
///
Digital,
///
/// Data value is calculated based on an equation upon retrieval.
///
Composed,
///
/// Data value is a constant and no real-time time-series data is received.
///
Constant
}
#endregion
///
/// Defines general boolean settings for a .
///
///
public class MetadataRecordGeneralFlags
{
#region [ Members ]
// Constants
private const Bits DataTypeMask = Bits.Bit00 | Bits.Bit01 | Bits.Bit02;
private const Bits EnabledMask = Bits.Bit03;
private const Bits UsedMask = Bits.Bit04;
private const Bits AlarmEnabledMask = Bits.Bit05;
private const Bits NotifyByEmailMask = Bits.Bit06;
private const Bits NotifyByPagerMask = Bits.Bit07;
private const Bits NotifyByPhoneMask = Bits.Bit08;
private const Bits LogToFileMask = Bits.Bit09;
private const Bits SpareMask = Bits.Bit10;
private const Bits ChangedMask = Bits.Bit11;
private const Bits StepCheckMask = Bits.Bit12;
// Fields
private int m_value;
#endregion
#region [ Properties ]
///
/// Gets or sets the of archived data for the .
///
public DataType DataType
{
get
{
return (DataType)m_value.GetMaskedValue(DataTypeMask);
}
set
{
m_value = m_value.SetMaskedValue(DataTypeMask, (int)value);
}
}
///
/// Gets or sets a boolean value that indicates whether the is currently enabled for archival of new data.
///
public bool Enabled
{
get
{
return m_value.CheckBits(EnabledMask);
}
set
{
m_value = value ? m_value.SetBits(EnabledMask) : m_value.ClearBits(EnabledMask);
}
}
///
/// Gets or sets a boolean value that indicates whether the is being used (need to be verify).
///
public bool Used
{
get
{
return m_value.CheckBits(UsedMask);
}
set
{
m_value = value ? m_value.SetBits(UsedMask) : m_value.ClearBits(UsedMask);
}
}
///
/// Gets or sets a boolean value that indicates whether alarm notifications are enabled for the .
///
public bool AlarmEnabled
{
get
{
return m_value.CheckBits(AlarmEnabledMask);
}
set
{
m_value = value ? m_value.SetBits(AlarmEnabledMask) : m_value.ClearBits(AlarmEnabledMask);
}
}
///
/// Gets or sets a boolean value that indicates whether email alarm notifications are to be sent for the .
///
public bool AlarmByEmail
{
get
{
return m_value.CheckBits(NotifyByEmailMask);
}
set
{
m_value = value ? m_value.SetBits(NotifyByEmailMask) : m_value.ClearBits(NotifyByEmailMask);
}
}
///
/// Gets or sets a boolean value that indicates whether text alarm notifications are to be sent for the .
///
public bool AlarmByPager
{
get
{
return m_value.CheckBits(NotifyByPagerMask);
}
set
{
m_value = value ? m_value.SetBits(NotifyByPagerMask) : m_value.ClearBits(NotifyByPagerMask);
}
}
///
/// Gets or sets a boolean value that indicates whether voice alarm notifications are to be sent for the .
///
public bool AlarmByPhone
{
get
{
return m_value.CheckBits(NotifyByPhoneMask);
}
set
{
m_value = value ? m_value.SetBits(NotifyByPhoneMask) : m_value.ClearBits(NotifyByPhoneMask);
}
}
///
/// Gets or sets a boolean value that indicates whether alarm notifications for the are to be logged to a text file.
///
public bool AlarmToFile
{
get
{
return m_value.CheckBits(LogToFileMask);
}
set
{
m_value = value ? m_value.SetBits(LogToFileMask) : m_value.ClearBits(LogToFileMask);
}
}
///
/// Gets or sets a boolean value that indicates whether the has been modified.
///
public bool Changed
{
get
{
return m_value.CheckBits(ChangedMask);
}
set
{
m_value = value ? m_value.SetBits(ChangedMask) : m_value.ClearBits(ChangedMask);
}
}
///
/// Gets or sets a boolean value that indicates whether a "step change" operation is to be performed on incoming time-series data for the .
///
public bool StepCheck
{
get
{
return m_value.CheckBits(StepCheckMask);
}
set
{
m_value = value ? m_value.SetBits(StepCheckMask) : m_value.ClearBits(StepCheckMask);
}
}
///
/// Gets or sets the 32-bit integer value used for defining general boolean settings for a .
///
public int Value
{
get
{
return m_value;
}
set
{
m_value = value;
}
}
#endregion
}
}