[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
CAPE-OPEN • View topic - CopyFromMaterial implementation question

CopyFromMaterial implementation question

Discusses CAPE-OPEN specific middleware and corresponding development kit

Moderator: jasper

CopyFromMaterial implementation question

Postby jrdp » 28 June 2023, 15:30

jrdp
 
Posts: 4
Joined: 12 May 2023, 13:35

Re: CopyFromMaterial implementation question

Postby jasper » 30 June 2023, 09:06

A potential implementation to avoid this is to:
- define a custom interface that returns a pointer to the Material Object (e.g. in a low and high integer part)
- implement this interface on the material object
- in CopyFromMaterial, query source for your custom interface
- if it is not there, return an error stating that you cannot copy from a foreign material object
- if obtained, get the pointer via your custom function
- use a C++ cast to cast it to your material object
- talk to the thing directly

A slightly simpler implementation is:
- QI source for ICapeInterface, this pointer is unique
- cast it using C++ machinery to your material object (have a look at the returned pointer from the debugger, you can probably directly figure out how to cast it from there)

Note that the second implementation does not guard against the potential pitfall of the object being casted is not actually your own material object implementation, which will subsequently surely lead to a crash, but under 'normal' conditions this should not happen.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain


Return to CAPE-OPEN Binary Interop Architecture

Who is online

Users browsing this forum: No registered users and 3 guests