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 | namespace core {
|
---|
28 |
|
---|
29 | IODevice::IODevice(const Object* parent,string name): Object(parent,name,"IODevice") {
|
---|
30 | pimpl_=new IODevice_impl(this);
|
---|
31 | }
|
---|
32 |
|
---|
33 | IODevice::~IODevice() { delete pimpl_; }
|
---|
34 |
|
---|
35 | void IODevice::AddDeviceToLog(const IODevice *device) {
|
---|
36 | pimpl_->AddDeviceToLog(device);
|
---|
37 | }
|
---|
38 |
|
---|
39 | void IODevice::OutputToShMem(bool enabled) { pimpl_->OutputToShMem(enabled); }
|
---|
40 |
|
---|
41 | void IODevice::ProcessUpdate(io_data *data) {
|
---|
42 | if (data != NULL)
|
---|
43 | data->pimpl_->SetConsistent(true);
|
---|
44 |
|
---|
45 | for (size_t i = 0; i < TypeChilds()->size(); i++) {
|
---|
46 | ((IODevice *)TypeChilds()->at(i))->UpdateFrom(data);
|
---|
47 | }
|
---|
48 |
|
---|
49 | if(data!=NULL) {
|
---|
50 | if(getFrameworkManager()->IsLogging()==true) pimpl_->WriteLog(data->DataTime());
|
---|
51 | data->pimpl_->Circle();
|
---|
52 | }
|
---|
53 |
|
---|
54 | pimpl_->WriteToShMem();
|
---|
55 |
|
---|
56 | pimpl_->ResumeThread();
|
---|
57 | }
|
---|
58 |
|
---|
59 | void IODevice::AddDataToLog(const io_data *data) { pimpl_->AddDataToLog(data); }
|
---|
60 |
|
---|
61 | DataType const &IODevice::GetInputDataType() const { return dummyType; }
|
---|
62 |
|
---|
63 | DataType const &IODevice::GetOutputDataType() const { return dummyType; }
|
---|
64 |
|
---|
65 | void IODevice::SetIsReady(bool status) {
|
---|
66 | pimpl_->SetIsReady(status);
|
---|
67 | }
|
---|
68 |
|
---|
69 | bool IODevice::IsReady(void) const {
|
---|
70 | return pimpl_->IsReady();
|
---|
71 | }
|
---|
72 |
|
---|
73 | } // end namespace core
|
---|
74 | } // end namespace flair
|
---|