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: 2011/05/01
|
---|
6 | // filename: IODevice.cpp
|
---|
7 | //
|
---|
8 | // author: Guillaume Sanahuja
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: Abstract class for input/ouput system
|
---|
14 | //
|
---|
15 | //
|
---|
16 | /*********************************************************************/
|
---|
17 |
|
---|
18 | #include "IODevice.h"
|
---|
19 | #include "IODevice_impl.h"
|
---|
20 | #include "io_data.h"
|
---|
21 | #include "io_data_impl.h"
|
---|
22 | #include "FrameworkManager.h"
|
---|
23 |
|
---|
24 | using std::string;
|
---|
25 |
|
---|
26 | namespace flair
|
---|
27 | {
|
---|
28 | namespace core
|
---|
29 | {
|
---|
30 |
|
---|
31 | IODevice::IODevice(const Object* parent,string name): Object(parent,name,"IODevice")
|
---|
32 | {
|
---|
33 | pimpl_=new IODevice_impl(this);
|
---|
34 | }
|
---|
35 |
|
---|
36 | IODevice::~IODevice()
|
---|
37 | {
|
---|
38 | delete pimpl_;
|
---|
39 | }
|
---|
40 |
|
---|
41 | void IODevice::AddDeviceToLog(const IODevice* device)
|
---|
42 | {
|
---|
43 | pimpl_->AddDeviceToLog(device);
|
---|
44 | }
|
---|
45 |
|
---|
46 | void IODevice::OutputToShMem(bool enabled) {
|
---|
47 | pimpl_->OutputToShMem(enabled);
|
---|
48 | }
|
---|
49 |
|
---|
50 | void IODevice::ProcessUpdate(io_data* data)
|
---|
51 | {
|
---|
52 | if(data!=NULL) data->pimpl_->SetConsistent(true);
|
---|
53 |
|
---|
54 | for(size_t i=0;i<TypeChilds()->size();i++)
|
---|
55 | {
|
---|
56 | ((IODevice*)TypeChilds()->at(i))->UpdateFrom(data);
|
---|
57 | }
|
---|
58 |
|
---|
59 | if(data!=NULL)
|
---|
60 | {
|
---|
61 | if(getFrameworkManager()->IsLogging()==true) pimpl_->WriteLog(data->DataTime());
|
---|
62 |
|
---|
63 | data->pimpl_->Circle();
|
---|
64 | }
|
---|
65 |
|
---|
66 | pimpl_->WriteToShMem();
|
---|
67 |
|
---|
68 | pimpl_->ResumeThread();
|
---|
69 | }
|
---|
70 |
|
---|
71 | void IODevice::AddDataToLog(const io_data* data)
|
---|
72 | {
|
---|
73 | pimpl_->AddDataToLog(data);
|
---|
74 | }
|
---|
75 |
|
---|
76 | DataType const &IODevice::GetInputDataType() const {
|
---|
77 | return dummyType;
|
---|
78 | }
|
---|
79 |
|
---|
80 | DataType const &IODevice::GetOutputDataType() const {
|
---|
81 | return dummyType;
|
---|
82 | }
|
---|
83 |
|
---|
84 | } // end namespace core
|
---|
85 | } // end namespace flair
|
---|