Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 66923

Array of objects in class private data and calling overridden VIs on these objects?

$
0
0

Hello

 

I am developing part of an application using the actor framework and have run into problems.

 

I have a several actors and will try briefly describe them and their intended functionality. All actors are started by a Controller actor and in the actor core for the controller I have the possibility to do a lot of intiliazation etc.

 

Logger:

Has a message (Send Log Message) that other actors can use to write to the log. It is supposed to take a string input and a log level (error, warning, debug etc). This message chain sends data to the actor core with a user event.

The Actor Core of Logger is supposed to save the incoming message to a log, but should be able to do it in several different ways (file, database, email or whatever).

 

 

Logger Output:

Abstract class that has a dynamic dispatch vi called "Write Output" that all it's children are supposed to overwrite.

 

Logger Output File

Child of Logger Output and overwrites "Write Output" to save the string to a file on disk.

 

 

 

Problem:

I want to be able to set up the actor core for Logger once and for all but still be able to create new children of "Logger Output" and have them be handled in the Logger actor core.

 

My idea was to have Logger use an array of objects as private data and initialize this array in the Controller actor core.

In the logger actor core I could then auto index the array and use each element (each Logger Output child) and the abstract "Write Output" vi to get the correct functionality.

 

HOWEVER, I cannot get this to work properly and I think I have misunderstood something or stared myself blind on this problem. I have tried 3 different methods when it comes to private data for Logger.

1. Labview Object

2. Array of Labview Object

3. Array of Logger Output Object

 

Of these 3 methods, I can only get the first one to work and that doesn't accomplish what I want in the end (being able to add more classes without changing private data / actor core for Logger).

 

I have included 3 screenshots that show snippets of 2 of the actor cores and the private data. File names should correspond to my description above.

The screenshot "Logger actor core.png" shows a very fast test of the 3 different methods I described above. Each of the 3 tunnel inputs to the event structure can be wired to the "Reference" input of "To More Specific Class", but only method 1 (Labview Object) works.

 

 

If you need additional information / screenshots or whatever please ask.

 

Thanks in advance

 


Viewing all articles
Browse latest Browse all 66923

Trending Articles