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

Last change on this file since 122 was 122, checked in by Sanahuja Guillaume, 5 years ago

modifs uav vrpn i686

File size: 2.2 KB
Line 
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:    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
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;
33}
34
35io_data_impl::~io_data_impl() {}
36
37void io_data_impl::AppendLogDescription(string description,
38                                        DataType const &datatype) {
39  description += " (" + datatype.GetDescription() + ")";
40  descriptors.push_back(description);
41}
42
43void io_data_impl::WriteLogDescriptor(std::fstream &desc_file, int *index) {
44        if(descriptors.size()==0) self->Warn("AppendLogDescription was not called for this object.\n");
45  for (size_t i = 0; i < descriptors.size(); i++) {
46    desc_file << (*index)++ << ": " << self->ObjectName() << " - "
47              << descriptors.at(i) << "\n";
48  }
49}
50
51void io_data_impl::PrintLogDescriptor(void) {
52  for (size_t i = 0; i < descriptors.size(); i++) {
53    Printf("    %s\n", descriptors.at(i).c_str());
54  }
55}
56
57void io_data_impl::Circle(void) {
58  if (n > 1) {
59    self->GetMutex();
60
61    void *tmp = *self->Prev(n - 1)->pimpl_->circle_ptr;
62
63    for (int i = 0; i < n - 1; i++) {
64      // printf("%i\n",i);
65      *(self->Prev(n - 1 - i)->pimpl_->circle_ptr) =
66          *(self->Prev(n - 2 - i)->pimpl_->circle_ptr);
67      self->Prev(n - 1 - i)->pimpl_->is_consistent =
68          self->Prev(n - 2 - i)->pimpl_->is_consistent;
69      self->Prev(n - 1 - i)->pimpl_->time = self->Prev(n - 2 - i)->pimpl_->time;
70    }
71    *circle_ptr = tmp;
72    is_consistent = false;
73    self->ReleaseMutex();
74  }
75}
76
77bool io_data_impl::IsConsistent(void) { return is_consistent; }
78
79void io_data_impl::SetConsistent(bool status) { is_consistent = status; }
Note: See TracBrowser for help on using the repository browser.