Difference between revisions of "SDK Basics"

From The Foundry MODO SDK wiki
Jump to: navigation, search
Line 5: Line 5:
 
=== ILxUnknownID ===
 
=== ILxUnknownID ===
  
The methods that you implement will take the ILxUnknownID type as argument for any type
+
The methods that you implement will take the ILxUnknownID datatype as argument for any object. This is the general object type, and can be transformed into specific interfaces based on your needs. This is a COM thing. All objects have multiple interfaces and need to be queried before they can be used. It's a little like dynamic casting in C++, except that the types are known at runtime.
 +
 
 +
Likewise some of the service methods you will be calling also take ILxUnknownID arguments. Fortunately the wrapper classes can cast to that type implicitly so there is very little that needs to be done on your side to support this. Just know that you can pass a wrapper object and it will be converted to the right type.
 +
 
 +
=== Reference Counting ===
 +
 
 +
COM objects manage their existence by reference counting. Again, this is mostly handled for you by the wrapper classes. When you initialize a wrapper with an ILxUnknownID object a reference is added, and when the wrapper changes or goes out of scope the reference is released.

Revision as of 03:27, 28 January 2012

COM & Wrappers

The nexus SDK is implemented in COM, but as a C++ developer you mostly don't need to know any of that. Whew! That's a good thing because while COM is relatively simple, deal with raw COM objects is quite complicated. Fortunately the C++ wrapper classes hide most of the complexity. There are, however, a few concepts that are important to understand at a high level.

ILxUnknownID

The methods that you implement will take the ILxUnknownID datatype as argument for any object. This is the general object type, and can be transformed into specific interfaces based on your needs. This is a COM thing. All objects have multiple interfaces and need to be queried before they can be used. It's a little like dynamic casting in C++, except that the types are known at runtime.

Likewise some of the service methods you will be calling also take ILxUnknownID arguments. Fortunately the wrapper classes can cast to that type implicitly so there is very little that needs to be done on your side to support this. Just know that you can pass a wrapper object and it will be converted to the right type.

Reference Counting

COM objects manage their existence by reference counting. Again, this is mostly handled for you by the wrapper classes. When you initialize a wrapper with an ILxUnknownID object a reference is added, and when the wrapper changes or goes out of scope the reference is released.