Eugen Graf Posted January 6, 2009 Report Share Posted January 6, 2009 Is it possible? I need it to work with other programming languages over TCP/IP. I mean C++ don't really know how a LVOOP Class is flattened (to a binary string), so I want to convert it to a binary data string (Cast). Thank you, Eugen Quote Link to comment
Francois Normandin Posted January 6, 2009 Report Share Posted January 6, 2009 QUOTE (Eugen Graf @ Jan 5 2009, 05:25 PM) Is it possible? I need it to work with other programming languages over TCP/IP. I mean C++ don't really know how a LVOOP Class is flattened (to a binary string), so I want to convert it to a binary data string (Cast).Thank you, Eugen You can have a Public Method to read the LVClass Data and output a cluster of your choice. Quote Link to comment
Eugen Graf Posted January 6, 2009 Author Report Share Posted January 6, 2009 So I have to define a cluster in the class data cluster and create a member VI to access this cluster. Good solution, thank you. Quote Link to comment
Francois Normandin Posted January 6, 2009 Report Share Posted January 6, 2009 QUOTE (Eugen Graf @ Jan 5 2009, 06:34 PM) So I have to define a cluster in the class data cluster and create a member VI to access this cluster.Good solution, thank you. That's a solution. But since LVClass is already a cluster, you could simply unbundle it and make a bundle of your liking in a "UnBundle/Bundle method" (instead of accessor). Both will work... I just don't know which one would be preferable from a theoretical standpoint. I guess using a cluster inside the class data cluster makes it easily upgradable as the accessor would automatically adjust to typedef of your class data. Otherwise, you need to modify the method if you add or remove data from class data. <thinking out loud> If you want the output cluster to stay the same even when adding stuff to your class data, then use a Unbundle/Bundle approach. </thinking out loud> Here is what I mean by this. I looks more work but if you use this cluster with a C++ program, you might want to keep a tight control on your typedef. http://lavag.org/old_files/monthly_01_2009/post-10515-1231202703.png' target="_blank"> Quote Link to comment
Eugen Graf Posted January 6, 2009 Author Report Share Posted January 6, 2009 Of course I want LV resizes the cluster (and adapts the member access VI) automaticaly if I add/remove class members. Quote Link to comment
crelf Posted January 6, 2009 Report Share Posted January 6, 2009 Everyone that's replied so far in this thread is right, but here's a little clarificaiton: you're not converting a class to a cluster, you're returning the data of an object as a cluster (it's an important distinction). Also, one of the great powers of OOP is encapsulation - you're protecting your object data from public access, and exposing all of the data of an object to the public is usually considered bad form - unless you really have a reason to do it. Quote Link to comment
nhollenback Posted January 6, 2009 Report Share Posted January 6, 2009 QUOTE (Eugen Graf @ Jan 5 2009, 03:25 PM) Is it possible? I need it to work with other programming languages over TCP/IP. I mean C++ don't really know how a LVOOP Class is flattened (to a binary string), so I want to convert it to a binary data string (Cast).Thank you, Eugen Perhaps the new feature in 8.6 that allows you to write an object to xml is what you need.. http://forums.lavag.org/What-s-new-for-Lab...-86-t11549.html Quote Link to comment
Eugen Graf Posted January 7, 2009 Author Report Share Posted January 7, 2009 QUOTE (nhollenback @ Jan 6 2009, 02:30 AM) Perhaps the new feature in 8.6 that allows you to write an object to xml is what you need..http://forums.lavag.org/What-s-new-for-Lab...-86-t11549.html Wow, very nice :thumbup: Quote Link to comment
PaulL Posted January 7, 2009 Report Share Posted January 7, 2009 We have been applying the convert-object-to-XML functionality quite successfully. This allows us to: 1) send LabVIEW objects over the network. (This requires that the class definitions are accessible in the applications on the communicating computers. One can accomplish this by putting the class definitions in a networked code repository, for example.) (Note that we can also use Flatten To String and Unflatten To String instead of XML just to send the object data. In either case no parser is necessary, just a type-cast! Quite clean and easy to maintain!) 2) have LabVIEW object data in a format (XML) such that we should be able to convert LabVIEW objects to and from objects in another development environment. (Note that we haven't implemented such an XML-based language converter yet, but I expect it should be fairly straightforward to do. Suggestions on this are most welcome!) Note that there is a minor bug in 8.6 such that Enums in LabVIEW classes sometimes result in errors with the XML conversions. I reported this to NI and I'm confident that NI will fix it promptly. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.