devicemanager.cpp

来自「It s a tool designed to extract as much 」· C++ 代码 · 共 67 行

CPP
67
字号
/* -*- c++ -*- ---------------------------------------------------------------   Copyright (C) 2005, SWECO, All Rights Reserved.   Implementation of DeviceManager class   Author: Zsolt Molnar (Zsolt.Molnar@ieee.org)   ---------------------------------------------------------------------------*/#include <iostream>#include "base.hh"#include "AppFactory.hh"#include "ICommInitiator.hh"#include "INetHandler.hh"#include "DeviceManager.hh"namespace { 	const char rcs_id[] = "$Id$"; }void DeviceManager::addDevice(const Device& aDevice){	pthread_t tid;	// this is to be deleted by the thread...	Device* dev = new Device(aDevice);	pthread_create(&tid, NULL, &DeviceManager__addDevice_thr, 				   static_cast<void*>(dev));}voidDeviceManager::removeDevice(const Device& aDevice){	AppFactory::getNetHandler().unconnect(aDevice);}void* DeviceManager__addDevice_thr(void* aDevice){	Device* dev = static_cast<Device*>(aDevice);	// Connect those devices that report successfull initialization	if (AppFactory::getCommInitiator().perform(*dev)) {		AppFactory::getNetHandler().connect(*dev);	}	delete dev;}#ifdef __TEST__#include <assert.h>#include <iostream>#define TEST_DNH_TRUE 1#define TEST_DNH_FALSE 2boolDeviceManager::test(){		cout << "DeviceManager test passed" << endl;	return true;}#endif // #ifdef __TEST__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?