# cee::ug::StateInfo

class `StateInfo`

  Simple class containing metadata info for a state.

  A state info contains:

  - State id
  - State name
  - State reference type. Frequency, time step or load case or other.
  - State reference value.

  Default state id is -1 which indicates an invalid id.

  Metadata for a model is accessed from the data source directory.

  Example

  Example on getting the state id for the last state using the metadata directory.

      std::vector<cee::ug::StateInfo> stateInfos = source->directory()->stateInfos();
      if (stateInfos.size() > 0)
      {
          int lastStateId = stateInfos[stateInfos.size() - 1].id();
      }

  See the complete source code at: UnstructGrid: Load Model from File and Set Up Model Specification

  See also

  DataSourceDirectory and DataState

  Public Types

  enum `ReferenceType`

    List of state reference types.

    Values:

    enumerator `TIME`

      Time.

    enumerator `FREQUENCY`

      Frequency.

    enumerator `LOADCASE`

      Load case.

    enumerator `OTHER`

      Any other reference type.

  Public Functions

  `StateInfo`()

    Constructs an empty object.

    Default id is -1 (invalid)

  `StateInfo`(int stateId, const Str &stateName, ReferenceType refType, double stateRefVal)

    Constructs a new object with the given state id, state name, reference type and state reference value.

  `StateInfo`(int stateId, const Str &stateName, double stateRefVal)

    Constructs a new object with the given state id, state name and state reference value.

  `StateInfo`(const StateInfo &other)

    Constructs a new StateInfo that is a copy of other.

  StateInfo &`operator=`(const StateInfo &rhs)

    Assigns rhs to this state info and returns a reference to this state info.

  bool `operator==`(const StateInfo &rhs) const

    Returns true if the object is equal to rhs.

  bool `operator!=`(const StateInfo &rhs) const

    Returns true if the object is not equal to rhs.

  int `id`() const

    Returns the state id.

    Returns -1 if this state info object is invalid.

  Str `name`() const

    Returns the state name.

  double `referenceValue`() const

    Returns the state reference value.

  ReferenceType `referenceType`() const

    Returns the state reference type (time, frequency, load case, none)

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...