constraint_app
/home/jbrooksh/drc/software/perception/constraint_app/src/matlab_mex/cam_initialize.cpp
Go to the documentation of this file.
00001 #include "mex.h"
00002 #include "ConstraintApp_RB_UKF.h"
00003 #include "ConstraintApp_MB.h"
00004 #include <vector>
00005 
00006 typedef std::vector<ConstraintApp*> ConstraintAppVector;
00007 static ConstraintAppVector cam_objects;
00008 
00009 static void cleanup(void)
00010 {
00011   for ( ConstraintAppVector::iterator iter = cam_objects.begin(); 
00012         iter != cam_objects.end(); ++iter ) {
00013     mexPrintf("deleteing cam object at %p.\n", *iter);
00014     delete *iter;
00015   }
00016   cam_objects.clear();
00017 }
00018 
00030 void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
00031 {
00032   //ConstraintApp* app((ConstraintApp*)new ConstraintApp_RB_UKF());
00033   ConstraintApp* app((ConstraintApp*)new ConstraintApp_MB());
00034 
00035   if ( nrhs ) {
00036     mexErrMsgTxt("too many parameters"); 
00037   }
00038 
00039   if ( nlhs != 1 ) {
00040     mexErrMsgTxt("returns exactly 1 parameter");
00041   }
00042 
00043   mwSize outdim[] = {1};
00044   plhs[0] = mxCreateNumericArray(1, outdim, mxUINT64_CLASS, mxREAL);
00045 
00046   ConstraintApp** retAddress((ConstraintApp**)mxGetData(plhs[0]));
00047   *retAddress = app;
00048 
00049   cam_objects.push_back(app);
00050 
00051   mexPrintf("created cam object at %p.  %i cam's exist.\n", (void*)app, (int)cam_objects.size());
00052 
00053   mexAtExit(cleanup);
00054 }
00055 
 All Classes Files Functions Variables Typedefs