source: flair-src/trunk/lib/FlairCore/src/io_data_impl.cpp

Last change on this file was 223, checked in by Sanahuja Guillaume, 4 years ago

add delta time to io_data

File size: 2.3 KB
RevLine 
[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_impl.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: classe définissant une donnée générique
14//
15//
16/*********************************************************************/
17
18#include "io_data.h"
19#include "io_data_impl.h"
20#include <fstream>
21
22using std::string;
23using namespace flair::core;
24
[15]25io_data_impl::io_data_impl(io_data *self, int n) {
26 this->self = self;
27 this->n = n;
28 if (n < 1)
29 self->Err("n doit être >0\n");
30 size = 0;
31 is_consistent = false;
32 circle_ptr = NULL;
[223]33 deltaTime=TIME_INFINITE;//init
34 time=TIME_INFINITE;//init
[2]35}
36
37io_data_impl::~io_data_impl() {}
38
[15]39void io_data_impl::AppendLogDescription(string description,
40 DataType const &datatype) {
41 description += " (" + datatype.GetDescription() + ")";
42 descriptors.push_back(description);
[2]43}
44
[15]45void io_data_impl::WriteLogDescriptor(std::fstream &desc_file, int *index) {
[122]46 if(descriptors.size()==0) self->Warn("AppendLogDescription was not called for this object.\n");
[15]47 for (size_t i = 0; i < descriptors.size(); i++) {
48 desc_file << (*index)++ << ": " << self->ObjectName() << " - "
49 << descriptors.at(i) << "\n";
50 }
[2]51}
52
53void io_data_impl::PrintLogDescriptor(void) {
[15]54 for (size_t i = 0; i < descriptors.size(); i++) {
55 Printf(" %s\n", descriptors.at(i).c_str());
56 }
[2]57}
58
59void io_data_impl::Circle(void) {
[15]60 if (n > 1) {
61 self->GetMutex();
[2]62
[15]63 void *tmp = *self->Prev(n - 1)->pimpl_->circle_ptr;
[2]64
[15]65 for (int i = 0; i < n - 1; i++) {
66 // printf("%i\n",i);
67 *(self->Prev(n - 1 - i)->pimpl_->circle_ptr) =
68 *(self->Prev(n - 2 - i)->pimpl_->circle_ptr);
69 self->Prev(n - 1 - i)->pimpl_->is_consistent =
70 self->Prev(n - 2 - i)->pimpl_->is_consistent;
71 self->Prev(n - 1 - i)->pimpl_->time = self->Prev(n - 2 - i)->pimpl_->time;
[2]72 }
[15]73 *circle_ptr = tmp;
74 is_consistent = false;
75 self->ReleaseMutex();
76 }
[2]77}
78
[15]79bool io_data_impl::IsConsistent(void) { return is_consistent; }
[2]80
[15]81void io_data_impl::SetConsistent(bool status) { is_consistent = status; }
Note: See TracBrowser for help on using the repository browser.