1 | // %flair:license{
|
---|
2 | // This file is part of the Flair framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %flair:license}
|
---|
5 | // created: 2014/03/06
|
---|
6 | // filename: SimuCamera.cpp
|
---|
7 | //
|
---|
8 | // author: Guillaume Sanahuja
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: Class for a simulation camera
|
---|
14 | //
|
---|
15 | //
|
---|
16 | /*********************************************************************/
|
---|
17 |
|
---|
18 | #include "SimuCamera.h"
|
---|
19 | #include <SharedMem.h>
|
---|
20 | #include <sstream>
|
---|
21 |
|
---|
22 | using std::string;
|
---|
23 | using std::ostringstream;
|
---|
24 | using namespace flair::core;
|
---|
25 |
|
---|
26 | namespace flair {
|
---|
27 | namespace sensor {
|
---|
28 |
|
---|
29 |
|
---|
30 | SimuCamera::SimuCamera(const IODevice *parent, string name, uint16_t width,
|
---|
31 | uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId)
|
---|
32 | : IODevice(parent,name) {
|
---|
33 |
|
---|
34 | size_t buf_size = width * height * channels+sizeof(Time);
|
---|
35 |
|
---|
36 | shmem = new SharedMem(this,ShMemName(modelId, deviceId),
|
---|
37 | buf_size, SharedMem::Type::producerConsumer);
|
---|
38 |
|
---|
39 | SetIsReady(true);
|
---|
40 | }
|
---|
41 |
|
---|
42 | SimuCamera::~SimuCamera() {
|
---|
43 | SetIsReady(false);
|
---|
44 | delete shmem;
|
---|
45 | }
|
---|
46 |
|
---|
47 | string SimuCamera::ShMemName(uint32_t modelId,uint32_t deviceId) {
|
---|
48 | ostringstream dev_name;
|
---|
49 | dev_name << "simu" << modelId << "_cam_" << deviceId;
|
---|
50 | return dev_name.str().c_str();
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 |
|
---|
55 | } // end namespace sensor
|
---|
56 | } // end namespace flair
|
---|