Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (9 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h

    r2 r15  
    2424#endif
    2525
    26 namespace flair
    27 {
    28     namespace core
    29     {
    30         class FrameworkManager;
    31         class IODevice;
    32         class Watchdog;
    33     }
    34     namespace gui
    35     {
    36         class TabWidget;
    37         class PushButton;
    38         class Layout;
    39     }
     26namespace flair {
     27namespace core {
     28class FrameworkManager;
     29class IODevice;
     30class Watchdog;
     31}
     32namespace gui {
     33class TabWidget;
     34class PushButton;
     35class Layout;
     36}
    4037}
    4138
    4239class ui_com;
    4340
    44 class FrameworkManager_impl: public flair::core::Thread
    45 {
    46     public:
    47         FrameworkManager_impl(flair::core::FrameworkManager *self,std::string name);
    48         ~FrameworkManager_impl();
    49         void SetupConnection(std::string address,uint16_t port,size_t rcv_buf_size=10000);
    50         void SetupUserInterface(std::string xml_file);
    51         void SetupLogger(std::string log_path);
    52         void AddDeviceToLog(flair::core::IODevice *device);
    53         void StartLog();
    54         void StopLog();
    55         char* GetBuffer(size_t sz);
    56         void ReleaseBuffer(char* buf);
    57         void WriteLog(const char* buf,size_t size);
     41class FrameworkManager_impl : public flair::core::Thread {
     42public:
     43  FrameworkManager_impl(flair::core::FrameworkManager *self, std::string name);
     44  ~FrameworkManager_impl();
     45  void SetupConnection(std::string address, uint16_t port,
     46                       size_t rcv_buf_size = 10000);
     47  void SetupUserInterface(std::string xml_file);
     48  void SetupLogger(std::string log_path);
     49  void AddDeviceToLog(flair::core::IODevice *device);
     50  void StartLog();
     51  void StopLog();
     52  char *GetBuffer(size_t sz);
     53  void ReleaseBuffer(char *buf);
     54  void WriteLog(const char *buf, size_t size);
    5855
    59         /*!
    60         * \brief Affiche le xml
    61         *
    62         * Pour debug.
    63         */
    64         void PrintXml(void) const;
     56  /*!
     57  * \brief Affiche le xml
     58  *
     59  * Pour debug.
     60  */
     61  void PrintXml(void) const;
    6562
    66         bool is_logging;
    67         bool disable_errors;
    68         bool connection_lost;
    69         static ui_com *com;
    70         static FrameworkManager_impl *_this;
    71         std::string log_path;
     63  bool is_logging;
     64  bool disable_errors;
     65  bool connection_lost;
     66  static ui_com *com;
     67  static FrameworkManager_impl *_this;
     68  std::string log_path;
    7269
    73         flair::gui::TabWidget* tabwidget;
    74         flair::gui::PushButton *save_button;//,*load_button;
     70  flair::gui::TabWidget *tabwidget;
     71  flair::gui::PushButton *save_button; //,*load_button;
    7572
    76         xmlDocPtr file_doc;
     73  xmlDocPtr file_doc;
    7774
    78         typedef struct {
    79             const flair::core::IODevice* device;
    80             size_t size;
    81             flair::core::Time time;
    82         } log_header_t;
     75  typedef struct {
     76    const flair::core::IODevice *device;
     77    size_t size;
     78    flair::core::Time time;
     79  } log_header_t;
    8380
    84     private:
    85         flair::core::FrameworkManager *self;
    86         UDTSOCKET file_sock,com_sock;
    87         UDTSOCKET GetSocket(std::string address,uint16_t port);
    88         void Run();
    89         void SendFile(std::string path,std::string name);
    90         void FinishSending(void);
    91         std::string FileName(flair::core::IODevice* device);
    92         void SaveXmlChange(char* buf);
    93         void SaveXml(void);
    94         size_t rcv_buf_size;
    95         char *rcv_buf;
     81private:
     82  flair::core::FrameworkManager *self;
     83  UDTSOCKET file_sock, com_sock;
     84  UDTSOCKET GetSocket(std::string address, uint16_t port);
     85  void Run();
     86  void SendFile(std::string path, std::string name);
     87  void FinishSending(void);
     88  std::string FileName(flair::core::IODevice *device);
     89  void SaveXmlChange(char *buf);
     90  void SaveXml(void);
     91  size_t rcv_buf_size;
     92  char *rcv_buf;
    9693#ifdef __XENO__
    97         int CreatePipe(RT_PIPE* fd,std::string name);
    98         int DeletePipe(RT_PIPE* fd);
    99         RT_PIPE cmd_pipe;
    100         RT_PIPE data_pipe;
    101         RT_HEAP log_heap;
     94  int CreatePipe(RT_PIPE *fd, std::string name);
     95  int DeletePipe(RT_PIPE *fd);
     96  RT_PIPE cmd_pipe;
     97  RT_PIPE data_pipe;
     98  RT_HEAP log_heap;
    10299#else
    103         int CreatePipe(int (*fd)[2],std::string name);
    104         int DeletePipe(int (*fd)[2]);
    105         int cmd_pipe[2];
    106         int data_pipe[2];
     100  int CreatePipe(int (*fd)[2], std::string name);
     101  int DeletePipe(int (*fd)[2]);
     102  int cmd_pipe[2];
     103  int data_pipe[2];
    107104#endif
    108         //logger
    109         bool continuer;//a enlever, avoir un seul bool pour toutes les taches
    110         static void* write_log_user(void * arg);
    111         pthread_t log_th;
    112         std::string xml_file;
    113         bool logger_defined;
    114         bool ui_defined;
    115         flair::gui::Layout* top_layout;
     105  // logger
     106  bool continuer; // a enlever, avoir un seul bool pour toutes les taches
     107  static void *write_log_user(void *arg);
     108  pthread_t log_th;
     109  std::string xml_file;
     110  bool logger_defined;
     111  bool ui_defined;
     112  flair::gui::Layout *top_layout;
    116113
    117         typedef struct {
    118             flair::core::IODevice* device;
    119             size_t size;
    120             hdfile_t *dbtFile;
    121             bool running;
    122         } log_desc_t;
     114  typedef struct {
     115    flair::core::IODevice *device;
     116    size_t size;
     117    hdfile_t *dbtFile;
     118    bool running;
     119  } log_desc_t;
    123120
    124         std::vector<log_desc_t> logs;
    125         std::vector<std::string> xml_changes;
    126         flair::core::Watchdog* gcs_watchdog;
    127         void ConnectionLost(void);
     121  std::vector<log_desc_t> logs;
     122  std::vector<std::string> xml_changes;
     123  flair::core::Watchdog *gcs_watchdog;
     124  void ConnectionLost(void);
    128125};
    129126
    130 namespace
    131 {
    132     inline ui_com* getUiCom(void) {
    133         return FrameworkManager_impl::com;
    134     }
     127namespace {
     128inline ui_com *getUiCom(void) { return FrameworkManager_impl::com; }
    135129
    136     inline  FrameworkManager_impl* getFrameworkManagerImpl(void) {
    137         return FrameworkManager_impl::_this;
    138     }
     130inline FrameworkManager_impl *getFrameworkManagerImpl(void) {
     131  return FrameworkManager_impl::_this;
     132}
    139133}
    140134
Note: See TracChangeset for help on using the changeset viewer.