[2] | 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 | /*!
|
---|
| 6 | * \file IODevice_impl.h
|
---|
| 7 | * \brief Classe de base pour un système à entrées/sorties
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2011/05/01
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef IO_DEVICE_IMPL_H
|
---|
| 14 | #define IO_DEVICE_IMPL_H
|
---|
| 15 |
|
---|
| 16 | #include <string>
|
---|
| 17 | #include <Object.h>
|
---|
| 18 |
|
---|
| 19 | namespace flair
|
---|
| 20 | {
|
---|
| 21 | namespace core
|
---|
| 22 | {
|
---|
| 23 | class io_data;
|
---|
| 24 | class IODevice;
|
---|
| 25 | class Thread;
|
---|
| 26 | class Mutex;
|
---|
| 27 | class FrameworkManager;
|
---|
| 28 | class SharedMem;
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | class FrameworkManager_impl;
|
---|
| 33 |
|
---|
| 34 | class IODevice_impl
|
---|
| 35 | {
|
---|
| 36 | public:
|
---|
| 37 | IODevice_impl(const flair::core::IODevice* self);
|
---|
| 38 | ~IODevice_impl();
|
---|
| 39 | void ResumeThread(void);
|
---|
| 40 | size_t LogSize(void) const;
|
---|
| 41 | void AppendLog(char** ptr);
|
---|
| 42 | void AddDataToLog(const flair::core::io_data* data);
|
---|
| 43 | void WriteLogsDescriptors(std::fstream& desc_file,int *index);
|
---|
| 44 | int SetToWake(const flair::core::Thread* thread);
|
---|
| 45 | void WriteLog(flair::core::Time time);
|
---|
| 46 | void AddDeviceToLog(const flair::core::IODevice* device);
|
---|
| 47 | bool SetToBeLogged(void);//return true if possible
|
---|
| 48 | void OutputToShMem(bool enabled);
|
---|
| 49 | void WriteToShMem(void);
|
---|
| 50 | void PrintLogsDescriptors(void);
|
---|
| 51 |
|
---|
| 52 | private:
|
---|
| 53 | std::vector<const flair::core::IODevice*> devicesToLog;
|
---|
| 54 | const flair::core::IODevice* self;
|
---|
| 55 | const flair::core::FrameworkManager* framework;
|
---|
| 56 | FrameworkManager_impl* framework_impl;
|
---|
| 57 | std::vector<const flair::core::io_data*> datasToLog;
|
---|
| 58 | flair::core::Thread* thread_to_wake;
|
---|
| 59 | flair::core::Mutex* wake_mutex;
|
---|
| 60 | bool tobelogged;
|
---|
| 61 | bool outputtoshm;
|
---|
| 62 | flair::core::SharedMem *shmem;
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | #endif // IO_DEVICE_IMPL_H
|
---|