Hi,
You have encountered a classical problem in object-orientation, when two objects share the same resource, in your example, the DAQ-card. How do you handle this in GOOP?
There are of course a number of ways of dealing with this, but the key issue is to decide how to create and destroy the DAQ resource. The best way is probably to create a DAQ class that is able to handle multiple instance that share the DAQ-card. This is quite easy to handle inside a class, but much harder if you call the DAQ VIs directly from other classes (such as the heater or fan class). Once you have finished the DAQ-class, you aggregate this into the heater or fan class.
This way the Heater and Fan does not really know that they are sharing the physical DAQ card, they only see that they uses an instance of the DAQ class. It is the DAQ-class responsibility to handle the resource conflict between different objects of the DAQ class.
To deal with resource conflict within a class between multiple object, you probably have to create a common storage for all objects to store DAQ handles etc. One useful thing is to check nr of objects in the create method. This way you may find out if this is the first object created of the class (and thereby initate the DAQ-card). The opposite thinking is concerned in the destroy method (the last object should probably clean up).
GOOP does not directly support a common storage shared by all objects in a class, but that may easily be implemented by a simple shiftregister memory as a private method.
However, the new GOOP2, just released this August, does have support for shared attribute within a class, called "Class Attribute", which could be very useful in situations like this.
Please visit:
http://www.endevo.se/default.asp?lang=eng
and click on "Products". There are more information, downloads, presentations, white papers and examples about the new GOOP2, which together with the new GOOP Wizard 3, is called GOOP Inheritance Toolkit. This new GOOP has support for inheritance and also class attributes as mentioned before.
Regards,
Mattias Ericsson
Endevo, Sweden
Main developer of the new GOOP2 and GOOP Wizard 2 and 3