Click or drag to resize
OSIsoft, LLC

AFEnumerationSet Class

The AFEnumerationSet represents a user-defined set of named constant values. It is also used to represent a PI Digital State Set.

Inheritance Hierarchy
SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.AssetAFEnumerationSet

Namespace:  OSIsoft.AF.Asset
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.6.195
Syntax
[SerializableAttribute]
public sealed class AFEnumerationSet : AFObject, 
	IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFEnumerationSet>, 
	IList<AFEnumerationValue>, ICollection<AFEnumerationValue>, IEnumerable<AFEnumerationValue>, 
	IEnumerable, IList, ICollection

The AFEnumerationSet type exposes the following members.

Constructors
  NameDescription
Public methodAFEnumerationSet
Initializes a new instance of the class with default values.
Public methodAFEnumerationSet(String)
Initializes a new instance of the class with the specified name.
Top
Properties
  NameDescription
Public propertyCheckOutInfo
This read-only property returns the checked out status information for the object.
Public propertyCount
Gets the number of items actually contained in the collection.
Public propertyDatabase
This read-only property returns the AFDatabase where this object is defined.
Public propertyDescription
Read/write property that provides a more detailed description of the object.
Public propertyID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public propertyIdentity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public propertyIsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public propertyIsDirty
This read-only property indicates whether the object has been modified since the last save to the PI AF Server.
Public propertyIsNew
This read-only property indicates whether the object is new and has never been saved to the PI AF Server.
Public propertyItemGuid
Gets the item with the specified id.
Public propertyItemInt32
Gets or sets the item at the specified index.
Public propertyItemString
Returns the specified object from the collection by name.
Public propertyName
Read/write property that identifies the name of the object.
Public propertyPIServer
Returns a reference to the PIServer associated with this AFEnumerationSet or if it is not associated with one.
Public propertyPISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public propertySecurity
This read-only property returns the AFSecurity information for the object.
Public propertyStatic memberSystemStateSet
The standard system enumeration set.
Public propertyUniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Top
Methods
  NameDescription
Public methodAdd(AFEnumerationValue)
The Add method adds the specified AFEnumerationValue to the AFEnumerationSet.
Public methodAdd(String, Int32)
The Add method creates a new AFEnumerationValue and adds it to the collection with the specified name and value.
Public methodCode exampleApplyChanges
This method applies the changes to the object and makes those changes available to other objects for the current user.
Public methodAreEquivalent
This method compares two AFEnumerationSet objects for equivalence.
Public methodCode exampleCheckIn
This method checks in (commits) all the changes to the object by saving the information to persistent storage.
Public methodCheckOut
This method locks the object so that its configuration can be modified.
Public methodStatic memberCheckOutEnumerationSets
Check out the objects with the specified unique identifiers at the specified query date.
Public methodClear
Removes all items from the collection.
Public methodCompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public methodCompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodContains(Guid)
This method determines whether the collection contains a specific item referenced by id.
Public methodContains(Int32)
This method determines whether the collection contains a specific item value.
Public methodContains(String)
This method determines whether the collection contains a specific item referenced by name.
Public methodContains(AFEnumerationValue)
This method determines whether the collection contains a specific item.
Public methodCopyTo
Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array.
Public methodStatic memberDeleteEnumerationSets
Delete the objects with the specified unique identifiers.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public methodEquals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodStatic memberFindEnumerationSet
Retrieves the AFEnumerationSet object with the specified unique identifier.
Public methodStatic memberFindEnumerationSets(PISystem, Guid)
Performs a search within the PISystem to retrieve a collection of AFEnumerationSet objects with the specified list of unique identifiers.
Public methodStatic memberFindEnumerationSets(AFDatabase, String, AFSearchField, AFSortField, AFSortOrder, Int32)
Performs a non-paged text search within the AFDatabase to retrieve a collection of AFEnumerationSet objects which have a field that match the specified query string.
Public methodStatic memberGetBySystemStateCode
Gets the specified AFEnumerationValue from the SystemStateSet collection by its AFSystemStateCode.
Public methodGetByValue
Gets the specified AFEnumerationValue from the collection by its value.
Public methodGetEnumerator
Returns an enumerator that iterates through the collection.
Public methodGetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public methodGetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public methodGetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public methodGetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public methodGetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf
Searches for the specified object and returns the zero-based index of the first occurrence within the entire collection.
Public methodStatic memberLoadEnumerationSets(IListAFEnumerationSet)
Loads the specified list AFEnumerationSet objects.
Public methodStatic memberLoadEnumerationSets(PISystem, Guid)
Loads the AFEnumerationSet objects with the specified unique identifiers.
Public methodPersist
This method returns the persistence string for the object.
(Overrides AFObjectPersist.)
Public methodRefresh
Refreshes the client with any changes that have been made to the object since loaded.
Public methodRemove(Guid)
Removes the item with the specified id from the collection.
Public methodRemove(Int32)
The Remove method removes the item from the collection by its value.
Public methodRemove(String)
The Remove method removes the item from the collection by name.
Public methodRemove(AFEnumerationValue)
Removes the first occurrence of a specific object from the collection.
Public methodRemoveAt
Removes the item at the specified index of the collection.
Public methodSort
Sorts the items in the entire collection using the default comparer.
Public methodSort(IComparerAFEnumerationValue)
Sorts the items in the entire collection using the specified comparer.
Public methodSort(Int32, Int32, IComparerAFEnumerationValue)
Sorts the items in a range of items in the collection using the specified comparer.
Public methodToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public methodUndoCheckOut
This method discards all the changes to the object and all sub-objects since the last call to CheckOut. Any changes since the check out will be lost.
Top
Events
  NameDescription
Public eventCode exampleChanged
Event is raised when the object or one of its sub-objects is changed.
Top
Extension Methods
  NameDescription
Public Extension MethodAggregateAFEnumerationValue
Performs all requested aggregates on the specified items.
(Defined by AFAggregate.)
Public Extension MethodAggregateAsyncAFEnumerationValue
Performs all requested aggregates on the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension MethodBinnedSummaryAFEnumerationValue, TBin
Generates a summary broken down by the specified bins for items matching the search criteria.
(Defined by AFAggregate.)
Public Extension MethodBinnedSummaryAsyncAFEnumerationValue, TBin
Generates a summary broken down by the specified bins for items matching the search criteria asynchronously.
(Defined by AFAggregate.)
Public Extension MethodCode exampleChunkedByAFEnumerationValue
This extension method breaks up search results into chunks to make it easier to page through and process IEnumerableT collections in chunks.
(Defined by AFSDKExtension.)
Public Extension MethodFrequencyDistributionAFEnumerationValue
Generates a frequency distribution for the specified items.
(Defined by AFAggregate.)
Public Extension MethodFrequencyDistributionAsyncAFEnumerationValue
Generates a frequency distribution for the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension MethodGroupedSummaryAFEnumerationValue
Generates a summary broken down by group for the specified items.
(Defined by AFAggregate.)
Public Extension MethodGroupedSummaryAsyncAFEnumerationValue
Generates a histogram for the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension MethodHistogramAFEnumerationValue, TBin
Generates a histogram for the specified items with the specified weighting.
(Defined by AFAggregate.)
Public Extension MethodHistogramAsyncAFEnumerationValue, TBin
Generates a histogram for the specified items with the specified weighting asynchronously.
(Defined by AFAggregate.)
Public Extension MethodSummaryAFEnumerationValue(String, AFSummaryTypes)Overloaded.
Summarizes the specified items.
(Defined by AFAggregate.)
Public Extension MethodSummaryAFEnumerationValue(String, AFSummaryTypes, String)Overloaded.
Summarizes the specified items with the specified weighting.
(Defined by AFAggregate.)
Public Extension MethodSummaryAsyncAFEnumerationValue(String, AFSummaryTypes, CancellationToken)Overloaded.
Summarizes the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension MethodSummaryAsyncAFEnumerationValue(String, AFSummaryTypes, String, CancellationToken)Overloaded.
Summarizes the specified items with the specified weighting asynchronously.
(Defined by AFAggregate.)
Top
Remarks
The collection of available enumeration sets is maintained by the AFDatabase and PIServer. The SystemStateSet property returns the standard system enumeration set.
Examples
// This example demonstrates how to create an enumeration 
// value type and add it as the type of an attribute,
// as well as setting a value with it.

// Get the Database
PISystems myPISystems = new PISystems();
AFDatabase myDB = myPISystems.DefaultPISystem.Databases.DefaultDatabase;

// Create the Enumeration Set
AFEnumerationSet myEnumerationSet = myDB.EnumerationSets.Add("Speed");
myEnumerationSet.Description = "Motor Speeds";

// Add the Enumeration Values
myEnumerationSet.Add("Stop", 0);
myEnumerationSet.Add("Slow", 1);
myEnumerationSet.Add("Medium", 5);
myEnumerationSet.Add("Fast", 10);

// Display the Name and Description of the EnumerationSet
Console.WriteLine("Name of EnumerationSet = {0}", myEnumerationSet.Name);
Console.WriteLine("Description = {0}", myEnumerationSet.Description);

// Display each value in the EnumerationSet
foreach (AFEnumerationValue eVal in myEnumerationSet)
{
    Console.WriteLine("Name in set = {0}", eVal.Name);
    Console.WriteLine("Value in set = {0}", eVal.Value);
}

// Create an Element
AFElement myElement = myDB.Elements.Add("MyElement");

// Create an Attribute
AFAttribute myAttribute = myElement.Attributes.Add("MyAttribute");

// Set the EnumerationSet for an Attibute
myAttribute.TypeQualifier = myEnumerationSet;
myAttribute.SetValue(myEnumerationSet["Stop"], null);
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5, 2.4
See Also
Enabling Operational Intelligence