File: Development.txt

package info (click to toggle)
openni 1.5.4.0%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 45,208 kB
  • sloc: cpp: 116,706; ansic: 58,794; sh: 10,287; cs: 7,698; java: 7,402; python: 1,544; makefile: 492; xml: 167
file content (73 lines) | stat: -rw-r--r-- 3,921 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
********************************************************************************
***************       OpenNI Development Guidelines       **********************
********************************************************************************

Adding new APIs
-----------------
Adding new function to any node/capability is a Sisyphean labor, and steps are 
always forgotten, so here's a short list of all neccessary steps.
First of all, determine if the functions are between OpenNI and the module only,
are API functions for applications only, or both (where OpenNI is a pass-through
to the module).

1. Module Interface (if those functions is a vendor-specific function)
    - XnModuleInterface.h
	    - If this is a new node, or new capability, define a new struct.
		- If this is a new node, add a pointer to the base node struct.
		- Add function pointers to the struct - one for each new function.
		  NOTE: changing existing struct should only be made at the end. NEVER ADD ANYTHING
          IN THE MIDDLE OF AN EXISTING STRUCT. This will break backwards-compatibility.
		- If this is a new capability, add a pointer to this struct in the 
		  corresponding node struct.
	- XnModuleCppInterface.h
	    - If this is a new node, or new capability, define a new class.
		- If this is a new node, make the class inherit virtually from the base node.
		- Add pure virtual functions to the class - one for each new function.
		- If this is a new capability, add a GetXXXInterface() function in the 
		  corresponding node struct.
	- XnModuleCFunctions.h
		- Implement all the new C functions. Each implementation should convert the 
		  XnModuleNodeHandle to a ModuleProductionNode pointer and then dynamic_cast
		  it to the needed node type. If the function belongs to a capability, 
		  the corresponding GetXXXInterface() function should be called to access
		  the capability interface. The call the requested method.
		  NOTE: no validation of parameters is required. This is OpenNI's responsibility
		  (we'll get to that).
		- If this is a new node, or new capability, add a __ModuleGetXXXInterface function 
		  which gets the struct declared in XnModuleInterface.h and fills it up.
		- If this is a new capability, add a call to the new __ModuleGetXXXInterface function
		  in the __ModuleGetXXXInterface function of the corresponding node.
    - XnModuleCppRegistration.h
	    - If this is a new node, add it to the __ModuleGetGetInterfaceFunc function.
	- XnModuleInterfaceContainers.h
		- If this is a new node, create a new interface container for it.
		- If this is a new capability, add the struct to the corresponding node interface
		  container. Don't forget to memset it and set a pointer to it in the ctor.
	- XnTypeManager
	    - If this is a new node, in TypeManager ctor, add the type.
	- XnModuleLoader
	    - If this is a new node, add Load and Validate methods for it. Add a call to
		  the Load method in LoadSpecificInterface().
		- Check if those function are defined in the corresponding Validate function.

2. OpenNI API (if those functions are application interfaces)
    - XnPrdNode.h
	    - Add the new set of functions as API calls.
    - XnOpenNI.cpp
	    - Implement the API. If needed, call the module functions.
	- XnCppInterface.h
	    - If this is a new node, or new capability, define a new class.
		- If this is a new node, make the class inherit from the base node.
		- If this is a new capability, make the class inherit from Capability.
		- Add inline functions to the class - one for each new function. Those should
		  call the C API directly.
		- If this is a new capability, add a GetXXXCap() method in the 
		  corresponding node class.
    - OpenNI.Net
	    - Add it to C# wrappers
		
	- To make the data exposed by those function recorded and played-back:
		- Add the functions to the mock node.
	    - Add reading in NodeWatcher.
		- Add setting in Mock node.