Difference between revisions of "Util (lx-util.hpp)"

From The Foundry MODO SDK wiki
Jump to: navigation, search
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{DISPLAYTITLE:Util (lx_util.hpp)}}
 +
== Classes ==
 +
 
Utility classes used by wrappers.
 
Utility classes used by wrappers.
  
== '''CLxObject''' ==
+
=== CLxObject ===
  
 
This is just a class with a virtual destructor. Anything inheriting from this has the ability to be destroyed anywhere, and that's a powerfully important concept in C++.
 
This is just a class with a virtual destructor. Anything inheriting from this has the ability to be destroyed anywhere, and that's a powerfully important concept in C++.
  
== '''CLxList''' ==
+
=== CLxRefCounted ===
 +
 
 +
This is a CLxObject class which is reference-counted using explicit '''acquire()''' and '''release()''' methods.
 +
 
 +
=== CLxHolder ===
 +
 
 +
This template class creates a container for any CLxRefCounted type. The reference counting is managed implicitly using '''set()''' on the holder, and the internal object's members can be accessed with '''->'''.
 +
 
 +
=== CLxList ===
  
 
Simple template list class using the next and prev pointers in the templated type.
 
Simple template list class using the next and prev pointers in the templated type.
 +
 +
=== CLxObjectList ===
 +
 +
Extension of CLxList that manages a list of allocated CLxObject types.
 +
 +
=== CLxArray ===
 +
 +
Simple template class for an allocated array of types. Like std::vector but much simpler.
  
 
== Object Management ==
 
== Object Management ==
Line 19: Line 38:
 
== Globals ==
 
== Globals ==
  
Globals con from querying the global object, which can be done though:
+
Globals come from querying the global object, which can be done through:
  
 
* '''lx::GetGlobal()''' -- this can take a GUID pointer or a GUID string
 
* '''lx::GetGlobal()''' -- this can take a GUID pointer or a GUID string
Line 29: Line 48:
 
* '''lx::LookupGUID()''' -- returns a GUID pointer from a string
 
* '''lx::LookupGUID()''' -- returns a GUID pointer from a string
 
* '''lx::GUIDCompare()''' -- compares two GUIDs
 
* '''lx::GUIDCompare()''' -- compares two GUIDs
* '''lx::GUIDSet()''' -- sets a GUID struct from raw numbers. This is mostly used by the CLxLoc localization wrappers
+
 
 +
== Error Handling ==
 +
 
 +
* '''lx::ThrowErr()''' -- throw an LxResult code if it's an error
 +
* '''lx::ThrowOpt()''' -- throw an LxResult code if it's an error except for NOTIMPL
 +
* '''lx_err::check()''' -- several functions with different args that throw errors on bad LxResults, false booleans, or negative ints
 +
* '''CLxArm...''' -- related sub-classes that perform some cleanup when they go out of scope, unless disrmed
  
 
[[Category:Headers]]
 
[[Category:Headers]]

Latest revision as of 18:32, 16 August 2013

Classes

Utility classes used by wrappers.

CLxObject

This is just a class with a virtual destructor. Anything inheriting from this has the ability to be destroyed anywhere, and that's a powerfully important concept in C++.

CLxRefCounted

This is a CLxObject class which is reference-counted using explicit acquire() and release() methods.

CLxHolder

This template class creates a container for any CLxRefCounted type. The reference counting is managed implicitly using set() on the holder, and the internal object's members can be accessed with ->.

CLxList

Simple template list class using the next and prev pointers in the templated type.

CLxObjectList

Extension of CLxList that manages a list of allocated CLxObject types.

CLxArray

Simple template class for an allocated array of types. Like std::vector but much simpler.

Object Management

The three things you can do with COM objects without knowing anything about them are QueryInterface, AddRef, and Release. These functions handle different data types.

  • lx::IfcQuery(), lx::IfcAddRef(), lx::IfcRelease() -- for an ILxInterfaceID pointer
  • lx::ObjQuery(), lx::ObjAddRef(), lx::ObjRelease() -- for an LXtObjectID
  • lx::UnkQuery(), lx::UnkAddRef(), lx::UnkRelease() -- for an ILxUnknownID pointer

Globals

Globals come from querying the global object, which can be done through:

  • lx::GetGlobal() -- this can take a GUID pointer or a GUID string

GUID Services

If you really need to deal in GUIDs, there are some functions for that:

  • lx::LookupGUID() -- returns a GUID pointer from a string
  • lx::GUIDCompare() -- compares two GUIDs

Error Handling

  • lx::ThrowErr() -- throw an LxResult code if it's an error
  • lx::ThrowOpt() -- throw an LxResult code if it's an error except for NOTIMPL
  • lx_err::check() -- several functions with different args that throw errors on bad LxResults, false booleans, or negative ints
  • CLxArm... -- related sub-classes that perform some cleanup when they go out of scope, unless disrmed