restSessionInfo* _pmdController::newSessionInfo( const string & userName, UINT32 localIP ) { restSessionInfo *newSession = SDB_OSS_NEW restSessionInfo ; if( !newSession ) { PD_LOG( PDERROR, "Alloc rest session info failed" ) ; goto error ; } _ctrlLatch.get() ; newSession->_attr._sessionID = ossPack32To64( localIP, _sequence++ ) ; ossStrncpy( newSession->_attr._userName, userName.c_str(), SESSION_USER_NAME_LEN ) ; _mapSessions[ _makeID( newSession ) ] = newSession ; _add2UserMap( userName, newSession ) ; newSession->_inNum.inc() ; _ctrlLatch.release() ; newSession->lock() ; done: return newSession ; error: goto done ; }
// The caller is responsible to free memory restSessionInfo* _pmdController::newSessionInfo( const string & userName, UINT32 localIP ) { // memory will be freed in releaseSessionInfo ( manual release )and // _checkSession ( timeout release ) restSessionInfo *newSession = SDB_OSS_NEW restSessionInfo ; if( !newSession ) { PD_LOG( PDERROR, "Alloc rest session info failed" ) ; goto error ; } // get lock _ctrlLatch.get() ; newSession->_attr._sessionID = ossPack32To64( localIP, _sequence++ ) ; ossStrncpy( newSession->_attr._userName, userName.c_str(), SESSION_USER_NAME_LEN ) ; // add to session map _mapSessions[ _makeID( newSession ) ] = newSession ; // add to user session map _add2UserMap( userName, newSession ) ; // attach session newSession->_inNum.inc() ; // release lock _ctrlLatch.release() ; // The session will be locked once it's created, and the caller will // start working on the session. Once the work is done, the session will // be unlocked ( detached or destroyed ) newSession->lock() ; done: return newSession ; error: goto done ; }
DepthCamera::DepthCamera(const String &name, const String &chipset, DevicePtr device): _device(device), _name(name), _chipset(chipset), _rawFrameBuffers(MAX_FRAME_BUFFERS), _depthFrameBuffers(MAX_FRAME_BUFFERS), _pointCloudBuffers(MAX_FRAME_BUFFERS), _parameterInit(true), _running(false), _isPaused(false), _unprocessedFilters(_rawFrameBuffers), _processedFilters(_rawFrameBuffers), _depthFilters(_depthFrameBuffers), _pointCloudFrameGenerator(new PointCloudFrameGenerator()), configFile(name, "") { _frameGenerators[2] = std::dynamic_pointer_cast<FrameGenerator>(_pointCloudFrameGenerator); _makeID(); configFile.read(name + ".conf"); // Read and keep the configuration ready for use. The file must be in VOXEL_CONF_PATH }