Ejemplo n.º 1
0
TintinCDKCameraFactory::TintinCDKCameraFactory(const String &name): ToFCameraFactoryBase(name)
{
  _addSupportedDevices({
    DevicePtr(new USBDevice(TINTIN_CDK_VENDOR_ID, TINTIN_CDK_PRODUCT_BULK, "")),
    DevicePtr(new USBDevice(TINTIN_CDK_VENDOR_ID, TINTIN_CDK_PRODUCT_UVC, "")),
  });
}
Ejemplo n.º 2
0
DevicePtr DeviceType_RicohAficio::open(const std::string& hostname,
                                       const std::string& username, const std::string& password
                                      ) const
throw (ECommFailure)
{
    return DevicePtr(new Device_RicohAficio(hostname, username, password));
}
Ejemplo n.º 3
0
Archivo: kernel.c Proyecto: dche/rcl
/*
 * call-seq:
 *      Kernel#workgroup_info(Device, CL_KERNEL_WORK_GROUP_SIZE)
 *
 * Wrapps +clGetKernelWorkGroupInfo()+.
 *
 * deivce - A Device object. Can be +nil+ if there is only single device
 *          is used by the context to which the receiver belongs.
 * param_name - The information to query.
 */
static VALUE
rcl_kernel_workgroup_info(VALUE self, VALUE device, VALUE param_name)
{
    EXPECT_RCL_TYPE(device, Device);
    EXPECT_RCL_CONST(param_name);

    cl_kernel k = KernelPtr(self);
    cl_device_id dev = NIL_P(device) ? NULL : DevicePtr(device);
    cl_kernel_work_group_info kwi = FIX2UINT(param_name);

    size_t param_value[3];

    cl_uint res = clGetKernelWorkGroupInfo(k, dev, kwi, sizeof(size_t) * 3, param_value, NULL);
    CHECK_AND_RAISE(res);

    VALUE ret = Qnil;
    switch (kwi) {
    case CL_KERNEL_WORK_GROUP_SIZE:
    case CL_KERNEL_LOCAL_MEM_SIZE:
#ifdef CL_VERSION_1_1
    case CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE:
#endif
        return ULONG2NUM(param_value[0]);
    case CL_KERNEL_COMPILE_WORK_GROUP_SIZE:
        ret = rb_ary_new2(3);
        for (int i = 0; i < 3; i++) {
            rb_ary_push(ret, ULONG2NUM(param_value[i]));
        }
        return ret;
    default:
        break;
    }
    return Qnil;
}
DevicePtr NodesRepository::Find(const boost::int32_t deviceID) const
{
	NodesByIDT::const_iterator found = nodesById.find(deviceID);
	if (found != nodesById.end())
	{
		return found->second;
	}
	return DevicePtr();
}
DevicePtr NodesRepository::Find(const IPv6& ip) const
{
	NodesByIPv6T::const_iterator found = nodesByIPv6.find(ip);
	if (found != nodesByIPv6.end())
	{
		return found->second;
	}
	return DevicePtr();
}
DevicePtr NodesRepository::Find(const MAC& mac) const
{
	NodesByMACT::const_iterator found = nodesByMAC.find(mac);
	if (found != nodesByMAC.end())
	{
		return found->second;
	}
	return DevicePtr();
}
Ejemplo n.º 7
0
		DevicePtr DeviceManager::createDevice( const char* name )
		{
			HashMap<uint32, DeviceInfo>::Iterator itDeviceInfo = deviceInfo.find( Math::Hash::DJB32( name ) );
			if( itDeviceInfo != deviceInfo.end() )
			{
				Device* device = 0;
				if( itDeviceInfo.value().plugin != 0 )
				{
					device = itDeviceInfo.value().plugin->createDevice( name );
				}
				
				assert( device );
				if( device )
				{
					if( device->init() )
					{
						HashMap<int, Array<DevicePtr> >::Iterator itDevice = devices.find( itDeviceInfo.value().deviceType );
						if( itDevice != devices.end() )
						{
							itDevice.value().add( device );
						}
						else
						{
							Array<DevicePtr> newDeviceArray;
							newDeviceArray.add( DevicePtr( device ) );
							devices.add( itDeviceInfo.value().deviceType, newDeviceArray );
						}
					}
					else
					{
						itDeviceInfo.value().plugin->destroyDevice( device );
						device = 0;
					}
				}

				return DevicePtr( device );
			}

			return DevicePtr::null;
		}
Ejemplo n.º 8
0
PlayerFactory::PlayerFactory( const unsigned char player_id, CameraPtr camera ) {
	FrameworkPtr fw = Framework::getInstance ( );
	DevicePtr device = DevicePtr( new Device );
	KeyboardPtr keyboad = KeyboardPtr( new Keyboard );
	MousePtr mouse = MousePtr( new Mouse );
	ClientPtr client = ClientPtr( new Client );
	AppPtr app = AppPtr( new App( player_id )  );
	ViewerPtr viewer = ViewerPtr( new Viewer );
	DrawerPtr drawer = DrawerPtr( new Drawer( "../Resource" ) );
	SoundPtr sound = SoundPtr( new Sound( ) );
	if ( !camera ) {
		camera = PlayerCameraPtr( new PlayerCamera );
	}

	fw->addTask( Device::getTag( ), device );
	fw->addTask( Keyboard::getTag( ), keyboad );
	fw->addTask( Mouse::getTag( ), mouse );
	fw->addTask( Client::getTag( ), client );
	fw->addTask( Viewer::getTag( ), viewer );
	fw->addTask( Drawer::getTag( ), drawer );
	fw->addTask( App::getTag( ), app );
	fw->addTask( Camera::getTag( ), camera );
	fw->addTask( Sound::getTag( ), sound );
}
Ejemplo n.º 9
0
DevicePtr
MacroDevices::newDevice( CommPortPtr dev )
{
    return DevicePtr( new MacroDevice( dev ));
}
Ejemplo n.º 10
0
///Конструктор
    WindowInputDriverSubsystem (ParseNode& node)
    {
      for (Parser::NamesakeIterator iter=node.First ("Device"); iter; ++iter)
        devices.push_back (DevicePtr (new WindowDevice (*iter), false));
    }
Ejemplo n.º 11
0
DevicePtr
SrmDevices::newDevice( CommPortPtr dev )
{
    return DevicePtr( new SrmDevice( dev, protoVersion));
}
Ejemplo n.º 12
0
DevicePtr
JouleDevices::newDevice( CommPortPtr dev )
{
    return DevicePtr( new JouleDevice( dev ));
}
Ejemplo n.º 13
0
DevicePtr
MacroDevices::newDevice( CommPortPtr dev, Device::StatusCallback cb )
{
    return DevicePtr( new MacroDevice( dev, cb ));
}
Ejemplo n.º 14
0
	void ZombieGame::init() {
		keyboard_ = DevicePtr(new InputKeyboard(SDLK_UP, SDLK_DOWN, SDLK_LEFT,
			SDLK_RIGHT, SDLK_SPACE, SDLK_r, SDLK_LSHIFT, SDLK_e));		
		clipsize_ = 0;
		bulletsInWeapon_ = 0;
		health_ = 0;
		scale_ = 1.f;
		lastSpawnTime_ = engine_.getTime();
		spawnPeriod_ = 0.5f;

		addKeyListener([&](gui::Component& component, const SDL_Event& keyEvent) {
			keyboard_->eventUpdate(keyEvent);
		});

		if (zombieEntry_.getDeepChildEntry("music switch").getBool()) {
			music_ = zombieEntry_.getDeepChildEntry("music track").getMusic();
			music_.setVolume(zombieEntry_.getDeepChildEntry("music volume").getFloat());
			music_.play(-1);
		}

		tree_ = zombieEntry_.getDeepChildEntry("tree image").getSprite();
		wall_ = zombieEntry_.getDeepChildEntry("buildings wallImage").getSprite();
		nbrUnits_ = 0;

		unitMaxLimit_ = zombieEntry_.getDeepChildEntry("settings unitLimit").getInt();

		innerSpawnRadius_ = zombieEntry_.getDeepChildEntry("settings innerSpawnRadius").getFloat();
		outerSpawnRadius_ = zombieEntry_.getDeepChildEntry("settings outerSpawnRadius").getFloat();
		
		terrain_.loadRoadSprites(zombieEntry_.getDeepChildEntry("roads"));
		loadTerrain();
		
		explosionProperties_ = zombie::loadExplosion(zombieEntry_.getDeepChildEntry("explosion"));

		humanInjured_ = zombieEntry_.getDeepChildEntry("human injuredAnimation").getAnimation();
		humanDie_ = zombieEntry_.getDeepChildEntry("human dieAnimation").getAnimation();
		Unit2D human(loadUnit(this, "human", zombieEntry_, false));
		human.setDieSound(zombieEntry_.getDeepChildEntry("human dieSound").getSound());
		human.setHitSound(zombieEntry_.getDeepChildEntry("human hitSound").getSound());
		
		zombieInjured_ = zombieEntry_.getDeepChildEntry("zombie injuredAnimation").getAnimation();
		zombieDie_ = zombieEntry_.getDeepChildEntry("zombie dieAnimation").getAnimation();
		Unit2D zombie(loadUnit(this, "zombie", zombieEntry_, true));
		zombie.setDieSound(zombieEntry_.getDeepChildEntry("zombie dieSound").getSound());
		zombie.setHitSound(zombieEntry_.getDeepChildEntry("zombie hitSound").getSound());

		// Add human to engine.
		{
			State state(Position(85,120), ORIGO, 0);
			//Position p = generatePosition(spawningPoints_);
			//State state(Position(200,200), ORIGO, 0);
			Unit* unit = units_.pushBack(human);
			engine_.add(unit);
			unit->setState(state);
			unit->setActive(true);
			unit->setAwake(true);
			players_.push_back(std::unique_ptr<HumanPlayer>(new HumanPlayer(keyboard_, unit)));
			viewPosition_ = state.position_;
			refViewPosition_ = viewPosition_;
			++nbrUnits_;
		}

		// Add zombies to engine.
		calculateValidSpawningPoints(units_[0]);
		unsigned int unitLevel = zombieEntry_.getDeepChildEntry("settings unitLevel").getInt();
		for (unsigned int i = 1; i <= unitLevel && i < units_.getMaxSize(); ++i) {
			Position p = generatePosition(vaildSpawningPoints_);
			float angle = calculateAnglePointToPoint(p, units_[0].getPosition());
			State state(p, ORIGO, angle);
			Unit* unit = units_.pushBack(zombie);
			engine_.add(unit);
			unit->setState(state);
			unit->setActive(true);
			unit->setAwake(true);
			players_.push_back(std::unique_ptr<ZombieBehavior>(new ZombieBehavior(unit)));
		}
	
		// Add cars to engine.
		Car2D car(zombie::loadCar(zombieEntry_.getDeepChildEntry("car")));
		for (unsigned int i = 0; i < 8 && i < units_.getMaxSize(); ++i) {
			State state(Position(85,130), ORIGO, 0);
			Car* c = cars_.pushBack(car);
			engine_.add(c);
			c->setState(state);
			c->setActive(true);
			c->setAwake(true);
		}

		// Add missile to engine.
		Missile2D missile(loadMissile2D(this, zombieEntry_.getDeepChildEntry("equipment missile")));
		for (unsigned int i = 0; i < 10 && i < units_.getMaxSize(); ++i) {
			engine_.add(missiles_.emplaceBack(missile));
		}

		setBackgroundColor(0, 0.1f, 0);
		zombiesKilled_ = 0;

		drawBuildings_.createVBO(buildings_, wall_.getTexture());
	}
Ejemplo n.º 15
0
DevicePtr
PowerTapDevices::newDevice( CommPortPtr dev )
{
    return DevicePtr( new PowerTapDevice( dev ));
}
Ejemplo n.º 16
0
DevicePtr
PowerTapDevices::newDevice( CommPortPtr dev, Device::StatusCallback cb)
{
    return DevicePtr( new PowerTapDevice( dev, cb ));
}