Please, need some help with OCAF.

Hello.

I'm trying to understand how OCAF works but I think I need a little help. I'm not totaly blank regarding OCAF but basicaly I know what's in the OCAF Sample. Because this is a big issue I think the best is to start with a simple case I'm trying to solve.

Imagine a case similar to the OCAF Sample where a boolean object references two other objects. If an operand object changes what is the best procedure to update the boolean object? The MustExecute method from the boolean object driver would return true because it evaluates the state of the referenced labels.

My question is this: How can I know what objects reference the label of the modified operand? I marked the label of the operand as modified in the document. (I guess we use the document methods to mark the object label as modified after the computation for that object is done and we use a logbook inside that operation. Is this right?) When trying to update the document I called GetModified to get all modified labels but I can't seem to find a function to check wheather a label is referenced or not. Must I iterate all labels in the document and call MustExecute in all Functions attributes?

Can someone give me some lights on this? I'm a little confused.

Thanks.

Sergey RUIN's picture

Hi,

At present there is no standard way to determine whether a label is refernced by another or not. You should to invent something to store reference information if you really need this fuctionality. If I were you I would build a tree using TDataStd_TreeNode attributes containing each function in a document and iterate it to find out if the current function has to be recomputed. The time on iteration of such tree would be quite short and could be considered as insignificant when comparing with one typical boolean operation.

Best Regards

Sergey

r-fortes's picture

Thanks Sergey.

I have to take a deeper look at your post about the TreeNode attributes. Has I understand it you can have a tree structure representing labels that could have another hierarquic relation in the document? In the document they could all be first level, right? Let me see if I understand. If I have some objects that need information of other objects (and can't be created unless the referenced ones are already accessible) this hierarquic structure would control the sequence of the creation (or regeneration). Is this right?

What happens when I load a saved document? Ok,let me try to answer this one. The framework will call every mustexecute method found in the function attribute driver and this method would scan the "TDataStd_TreeNode" (placed in the root label I guess) to see if execution of the driver is possible. If a referenced label is found than the object can't be created. What then? I guess "mustexecute" must return true or the object is not created. Should the "mustexecute" method call the direct referenced objects driver and try to create them? This could be applied to the called "mustexecute" methods and eventually the all objects could be created. I'm I going in the right direction?

Well, I guess I must study a little more and make some experiences.

If you could point me some directions to start with I'd be very appreciated.

Thanks again Sergey.

Sergey RUIN's picture

Hello,

> Thanks Sergey.

> I have to take a deeper look at your post
> about the TreeNode attributes. Has I
> understand it you can have a tree structure
> representing labels that could have another
> hierarquic relation in the document? In the
> document they could all be first level,
> right? Let me see if I understand. If I have
> some objects that need information of other
> objects (and can't be created unless the
> referenced ones are already accessible) this
> hierarquic structure would control the
> sequence of the creation (or regeneration).
> Is this right?

The main idea is to use TreeNode tree instead of label tree for model's iterations. TreeNode can be easily updated unlike the label tree to reflect modification of your model. There could be even several diffirent TreeNodes trees in the one model as it's possible to place any number of TreeNode attributes on one label.

> What happens when I load a saved document?
> Ok,let me try to answer this one. The
> framework will call every mustexecute method
> found in the function attribute driver and
> this method would scan the
> "TDataStd_TreeNode" (placed in the
> root label I guess) to see if execution of
> the driver is possible. If a referenced
> label is found than the object can't be
> created. What then? I guess
> "mustexecute" must return true or
> the object is not created. Should the
> "mustexecute" method call the
> direct referenced objects driver and try to
> create them? This could be applied to the
> called "mustexecute" methods and
> eventually the all objects could be created.
> I'm I going in the right direction?

When you have opened a document you need to rebuild your model by yourself as the dataframework don't call any MustExecute methods by default.

> Well, I guess I must study a little more and
> make some experiences.

> If you could point me some directions to
> start with I'd be very appreciated.

As a good example I can propose you to look at the source code of Kitchen Demo application.

> Thanks again Sergey.

Best Regards

Steve Holden's picture

Hi there,

Where exactly can I find the source code for the Kitchen Demo application? I downloaded the demo itself, which is merely an exe and some dll’s, and am pleased to say that it looks like a far more robust example of OCAF than SampleOcaf, but there’s no source code. Could you please give me a URL where I may find this?

Thanks.

Steve Holden

power123456789's picture

hi,

i am newbie in OCAF, and i had accouted many problems,and the one puzzled me lot is : when i build a model in a document, at last i want to erase it for some reasons. and because the data is written in the label ,and which cannt be removed ,so i had to hide the model which i donnt want. at last ,the trash data is too much. what show i do, please help me

Best Regards