Giter Site home page Giter Site logo

Create a Enum RPC message about grpc-labview HOT 9 CLOSED

ni avatar ni commented on July 22, 2024
Create a Enum RPC message

from grpc-labview.

Comments (9)

a-clucker avatar a-clucker commented on July 22, 2024

This ticket would greatly aid us in being able to use proto for lower-level data, e.g. bit fields. This is a key item keeping us from more fully adopting proto/grpc-labview as an IDL for interfaces between LabVIEW and other supported languages (py, C++, etc). This came up on the volta project (private repo in NI org), but we've encountered other examples of wanting this use case.

Also, minor note of value from Chris in 20, rings vs enums:

We should create proper rings for them in LabVIEW. Enums can be sparse and have repeated values so we will have to create rings to support all possible enums.

Edit: FYI to @eyesonvis

from grpc-labview.

drjdpowell avatar drjdpowell commented on July 22, 2024

I think you should allow the user to choose either a ring or an enum. Although an enum is not always possible, it is much better than a ring.

from grpc-labview.

eyesonvis avatar eyesonvis commented on July 22, 2024

Neither rings nor enums will fulfill all the desired use cases, so we're going to need to decide which benefits are more important.

Rings allow sparse values and localization.

Enums provide better diagram readability (e.g., on Case Structure frames). As type definitions, they will update all instances when the item list changes.

Neither rings nor enums will allow multiple names for the same numeric value.

In my opinion, enums are supposed to be logically independent of their numeric backing value, and so users should have a function that does a look up when they need to get a number for an enum value. Similarly, users can have a corresponding ring for places where localization is required, and a function that looks up the corresponding enum value so that the rings are only UI/API elements, and their numeric value is never used in code.

from grpc-labview.

Rohith-Grandhi avatar Rohith-Grandhi commented on July 22, 2024

Listing down some of Enum features as defined in Proto3 and if they can be supported with LabVIEW Ring or Enum

Enum features as defined in proto 3 LabVIEW Ring LabVIEW Enum
must contain a constant that maps to Zero as its value Yes Yes
use enum type declared in one message as the type of a field in a different message Yes Yes
Enum value must be in the range of 32-bit integer Yes No
Non sequential values No (can workaround?) No (can workaround?)
Aliases - Same value to different enum constants No No
Reserved Values - The proto buff compiler will complain if any future users try to use the identifiers specified as Reserved No No

from grpc-labview.

eyesonvis avatar eyesonvis commented on July 22, 2024

We're planning to implement this feature using LabVIEW Enums. This means that users will have to call a look-up function to get the numeric value for an enum item.

from grpc-labview.

drjdpowell avatar drjdpowell commented on July 22, 2024

This means that users will have to call a look-up function get the numeric value for an enum item.

Sorry, what does this mean? LabVIEW Enums are already numbers, so what is this look-up?

from grpc-labview.

eyesonvis avatar eyesonvis commented on July 22, 2024

The proto buf might say:
A=0;
B=0;
C=1;
D=20;

But the LabVIEW enum will be 0, 1, 2, 3. We'll provide a VI that takes the (typedef) enum type and returns the Int32 value.

from grpc-labview.

drjdpowell avatar drjdpowell commented on July 22, 2024

Ah, so it would only be if teh User actually needed the numeric value that they would need to use this look up.

from grpc-labview.

Rohith-Grandhi avatar Rohith-Grandhi commented on July 22, 2024

Support for Enum type is now present in Version 1.0.0.2 release

from grpc-labview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.