[2] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[2] | 4 | // %flair:license}
|
---|
| 5 | // created: 2012/03/21
|
---|
| 6 | // filename: io_data.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Abstract class for data types
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "io_data.h"
|
---|
| 19 | #include "io_data_impl.h"
|
---|
| 20 |
|
---|
| 21 | using std::string;
|
---|
| 22 |
|
---|
[15] | 23 | namespace flair {
|
---|
| 24 | namespace core {
|
---|
[2] | 25 |
|
---|
| 26 | DummyType dummyType;
|
---|
| 27 | FloatType floatType;
|
---|
[51] | 28 | DoubleType doubleType;
|
---|
[2] | 29 | SignedIntegerType Int8Type(8);
|
---|
| 30 | SignedIntegerType Int16Type(16);
|
---|
[51] | 31 | UnsignedIntegerType UInt8Type(8);
|
---|
| 32 | UnsignedIntegerType UInt16Type(16);
|
---|
[2] | 33 |
|
---|
[15] | 34 | io_data::io_data(const Object *parent, string name, int n)
|
---|
| 35 | : Mutex(parent, name) {
|
---|
| 36 | pimpl_ = new io_data_impl(this, n);
|
---|
[2] | 37 | }
|
---|
| 38 |
|
---|
[15] | 39 | io_data::~io_data() { delete pimpl_; }
|
---|
[2] | 40 |
|
---|
[15] | 41 | void io_data::AppendLogDescription(string description,
|
---|
| 42 | DataType const &datatype) {
|
---|
| 43 | pimpl_->AppendLogDescription(description, datatype);
|
---|
[2] | 44 | }
|
---|
| 45 |
|
---|
| 46 | void io_data::SetDataTime(Time time) {
|
---|
[15] | 47 | GetMutex();
|
---|
[223] | 48 | if(pimpl_->time!=TIME_INFINITE) pimpl_->deltaTime = time-pimpl_->time;
|
---|
[15] | 49 | pimpl_->time = time;
|
---|
| 50 | ReleaseMutex();
|
---|
[2] | 51 | }
|
---|
| 52 |
|
---|
[223] | 53 | void io_data::SetDataTime(Time time,Time deltaTime) {
|
---|
| 54 | GetMutex();
|
---|
| 55 | pimpl_->deltaTime = deltaTime;
|
---|
| 56 | pimpl_->time = time;
|
---|
| 57 | ReleaseMutex();
|
---|
| 58 | }
|
---|
| 59 |
|
---|
[2] | 60 | Time io_data::DataTime(void) const {
|
---|
[15] | 61 | Time tmp;
|
---|
| 62 | GetMutex();
|
---|
| 63 | tmp = pimpl_->time;
|
---|
| 64 | ReleaseMutex();
|
---|
| 65 | return tmp;
|
---|
[2] | 66 | }
|
---|
| 67 |
|
---|
[223] | 68 | Time io_data::DataDeltaTime(void) const {
|
---|
| 69 | Time tmp;
|
---|
| 70 | GetMutex();
|
---|
| 71 | tmp = pimpl_->deltaTime;
|
---|
| 72 | ReleaseMutex();
|
---|
| 73 | return tmp;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | void io_data::GetDataTime(Time &time,Time &deltaTime) const{
|
---|
| 77 | GetMutex();
|
---|
| 78 | deltaTime=pimpl_->deltaTime ;
|
---|
| 79 | time=pimpl_->time ;
|
---|
| 80 | ReleaseMutex();
|
---|
| 81 | }
|
---|
| 82 |
|
---|
[15] | 83 | const io_data *io_data::Prev(int n) const {
|
---|
| 84 | if (n > 0)
|
---|
| 85 | return prev->Prev(n - 1);
|
---|
| 86 | else
|
---|
| 87 | return this;
|
---|
[2] | 88 | }
|
---|
| 89 |
|
---|
[15] | 90 | void io_data::SetPtrToCircle(void **ptr) { pimpl_->circle_ptr = ptr; }
|
---|
[2] | 91 |
|
---|
| 92 | } // end namespace core
|
---|
| 93 | } // end namespace flair
|
---|