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

Last change on this file since 2 was 2, checked in by Sanahuja Guillaume, 7 years ago

flaircore

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