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

Last change on this file since 93 was 15, checked in by Bayard Gildas, 8 years ago

sources reformatted with flair-format-dir script

File size: 2.1 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 for (size_t i = 0; i < descriptors.size(); i++) {
45 desc_file << (*index)++ << ": " << self->ObjectName() << " - "
46 << descriptors.at(i) << "\n";
47 }
48}
49
50void io_data_impl::PrintLogDescriptor(void) {
51 for (size_t i = 0; i < descriptors.size(); i++) {
52 Printf(" %s\n", descriptors.at(i).c_str());
53 }
54}
55
56void io_data_impl::Circle(void) {
57 if (n > 1) {
58 self->GetMutex();
59
60 void *tmp = *self->Prev(n - 1)->pimpl_->circle_ptr;
61
62 for (int i = 0; i < n - 1; i++) {
63 // printf("%i\n",i);
64 *(self->Prev(n - 1 - i)->pimpl_->circle_ptr) =
65 *(self->Prev(n - 2 - i)->pimpl_->circle_ptr);
66 self->Prev(n - 1 - i)->pimpl_->is_consistent =
67 self->Prev(n - 2 - i)->pimpl_->is_consistent;
68 self->Prev(n - 1 - i)->pimpl_->time = self->Prev(n - 2 - i)->pimpl_->time;
69 }
70 *circle_ptr = tmp;
71 is_consistent = false;
72 self->ReleaseMutex();
73 }
74}
75
76bool io_data_impl::IsConsistent(void) { return is_consistent; }
77
78void io_data_impl::SetConsistent(bool status) { is_consistent = status; }
Note: See TracBrowser for help on using the repository browser.