Changeset 13 in flair-dev for trunk/include/FlairCore/FrameworkManager.h


Ignore:
Timestamp:
04/08/16 15:39:24 (8 years ago)
Author:
Bayard Gildas
Message:

formatting script + include reformatted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/FlairCore/FrameworkManager.h

    r2 r13  
    1818class FrameworkManager_impl;
    1919
    20 namespace flair
    21 {
    22     namespace gui
    23     {
    24         class TabWidget;
    25         class SendData;
    26     }
     20namespace flair {
     21namespace gui {
     22class TabWidget;
     23class SendData;
    2724}
    28 namespace flair
    29 {
    30 namespace core
    31 {
    32     class IODevice;
    33 
    34     /*! \class FrameworkManager
    35     *
    36     * \brief Main class of the Framework library
    37     *
    38     * This is the main class of the library. Only one instance of this class is allowed
    39     * by program. Morevoer, its name must be unique if more than one program using this class
    40     * is running on the same system (a control and a simlator for example). \n
    41     * This class allows: \n
    42     * -connexion with ground station, \n
    43     * -creation of a QTabWidget on ground station, \n
    44     * -handling of xml files, used for default values of Widgets, \n
    45     * -logging of datas.
    46     */
    47     class FrameworkManager: public Object
    48     {
    49         public:
    50             /*!
    51             * \brief Constructor
    52             *
    53             * Construct a FrameworkManager. \n
    54             * Call SetupConnection method just after this constructor to setup the conection with a ground station.
    55             *
    56             * \param name name, must be unique
    57             */
    58             FrameworkManager(std::string name);
    59 
    60             /*!
    61             * \brief Destructor
    62             *
    63             * Calling it will automatically destruct all childs. \n
    64             * Destruction implies destruction of the QTabWidget on ground station.
    65             *
    66             */
    67             ~FrameworkManager();
    68 
    69             /*!
    70             * \brief Setup the connection with ground station
    71             *
    72             * Call this method just after the constructor of this class. If this method is not called, the program will run headless.
    73             *
    74             * \param address address of ground station
    75             * \param port port of ground station
    76             * \param rcv_buf_size receive buffer size
    77             */
    78             void SetupConnection(std::string address,uint16_t port,size_t rcv_buf_size=10000);
    79 
    80             /*!
    81             * \brief Setup the user interface
    82             *
    83             * If this method is called after SetupConnection, Widgets will be displayed in the ground station.
    84             * Otherwise, it will run headless, but default values of Widgets will be taken from the xml file.
    85             *
    86             * \param xml_file xml file for default values of Widgets
    87             */
    88             void SetupUserInterface(std::string xml_file);
    89 
    90             /*!
    91             * \brief Get TabWidget
    92             *
    93             * \return TabWidget
    94             */
    95             gui::TabWidget* GetTabWidget(void) const;
    96 
    97             /*!
    98             * \brief Logger setup
    99             *
    100             * Setup path of log files. \n
    101             * No logging will be performed if this method is not called. \n
    102             *
    103             * \param log_path path to store logs
    104             */
    105             void SetupLogger(std::string log_path);
    106 
    107             /*!
    108             * \brief Add log element
    109             *
    110             * The added element will be automatically logged once
    111             * logging started (see StartLog()). \n
    112             * This element must define on its side the io_data
    113             * to log, trough IODevice::SetDataToLog method.
    114             *
    115             * \param device IODevice to add
    116             */
    117             void AddDeviceToLog(IODevice *device);
    118 
    119             /*!
    120             * \brief Start logging
    121             *
    122             * All IODevice added through AddDeviceToLog() method
    123             * will automatically be logged. \n
    124             * SetupLogger() must have been called before.
    125             */
    126             void StartLog(void);
    127 
    128             /*!
    129             * \brief Stop logging
    130             *
    131             * Logs will automatically be sent to ground station.
    132             */
    133             void StopLog(void);
    134 
    135             /*!
    136             * \brief Is logging?
    137             *
    138             * \return true if is logging
    139             */
    140             bool IsLogging(void) const;
    141 
    142             /*!
    143             * \brief Notify that SendData's period has changed
    144             *
    145             * This funtion must be called when the period has changed. \n
    146             * Normally, it occurs in the Widget::XmlEvent method. \n
    147             * This method must be called with communication blocked (see BlockCom()).
    148             *
    149             * \param obj SendData which changed
    150             */
    151             void UpdateSendData(const gui::SendData *obj);
    152 
    153             /*!
    154             * \brief Block communication
    155             *
    156             * This funtion blocks the communication beetween the program and ground station. \n
    157             * It must be called before changing datas or parameters exchanged between the program
    158             * and the ground station.
    159             *
    160             */
    161             void BlockCom(void);
    162 
    163              /*!
    164             * \brief Unblock communication
    165             *
    166             * This funtion unblocks the communication beetween the program and ground station. \n
    167             * It must be called after changing datas or parameters exchanged between the program
    168             * and the ground station.
    169             *
    170             */
    171             void UnBlockCom(void);
    172 
    173             /*!
    174             * \brief Is connection lost?
    175             *
    176             * Once this method returns true, it will never return false back. \n
    177             * Note that this method return false if no connection is defined (see SetupConnection).
    178             *
    179             * \return true if connection with ground station is lost
    180             */
    181             bool ConnectionLost(void) const;
    182 
    183             /*!
    184             * \brief Disable errors display
    185             *
    186             * Disable errors display, if you do not want to saturate console for exemple.
    187             * By defaults errors disply is enabled.
    188             *
    189             * \param value true to disable errors display
    190             */
    191             void DisableErrorsDisplay(bool value);
    192 
    193             /*!
    194             * \brief Is displaying errors?
    195             *
    196             *
    197             * \return true if errors display is enabled
    198             */
    199             bool IsDisplayingErrors(void) const;
    200 
    201         private:
    202             class FrameworkManager_impl* pimpl_;
    203     };
    204 
    205     /*!
    206     * \brief get FrameworkManager
    207     *
    208     * \return the FrameworkManager
    209     */
    210     FrameworkManager* getFrameworkManager(void);
    211 
    212     /*!
    213     * \brief is big endian?
    214     *
    215     * \return true if big endian, false if little endian
    216     */
    217     bool IsBigEndian(void);
     25}
     26namespace flair {
     27namespace core {
     28class IODevice;
     29
     30/*! \class FrameworkManager
     31*
     32* \brief Main class of the Framework library
     33*
     34* This is the main class of the library. Only one instance of this class is
     35*allowed
     36* by program. Morevoer, its name must be unique if more than one program using
     37*this class
     38* is running on the same system (a control and a simlator for example). \n
     39* This class allows: \n
     40* -connexion with ground station, \n
     41* -creation of a QTabWidget on ground station, \n
     42* -handling of xml files, used for default values of Widgets, \n
     43* -logging of datas.
     44*/
     45class FrameworkManager : public Object {
     46public:
     47  /*!
     48  * \brief Constructor
     49  *
     50  * Construct a FrameworkManager. \n
     51  * Call SetupConnection method just after this constructor to setup the
     52  *conection with a ground station.
     53  *
     54  * \param name name, must be unique
     55  */
     56  FrameworkManager(std::string name);
     57
     58  /*!
     59  * \brief Destructor
     60  *
     61  * Calling it will automatically destruct all childs. \n
     62  * Destruction implies destruction of the QTabWidget on ground station.
     63  *
     64  */
     65  ~FrameworkManager();
     66
     67  /*!
     68  * \brief Setup the connection with ground station
     69  *
     70  * Call this method just after the constructor of this class. If this method is
     71  *not called, the program will run headless.
     72  *
     73  * \param address address of ground station
     74  * \param port port of ground station
     75  * \param rcv_buf_size receive buffer size
     76  */
     77  void SetupConnection(std::string address, uint16_t port,
     78                       size_t rcv_buf_size = 10000);
     79
     80  /*!
     81  * \brief Setup the user interface
     82  *
     83  * If this method is called after SetupConnection, Widgets will be displayed in
     84  *the ground station.
     85  * Otherwise, it will run headless, but default values of Widgets will be taken
     86  *from the xml file.
     87  *
     88  * \param xml_file xml file for default values of Widgets
     89  */
     90  void SetupUserInterface(std::string xml_file);
     91
     92  /*!
     93  * \brief Get TabWidget
     94  *
     95  * \return TabWidget
     96  */
     97  gui::TabWidget *GetTabWidget(void) const;
     98
     99  /*!
     100  * \brief Logger setup
     101  *
     102  * Setup path of log files. \n
     103  * No logging will be performed if this method is not called. \n
     104  *
     105  * \param log_path path to store logs
     106  */
     107  void SetupLogger(std::string log_path);
     108
     109  /*!
     110  * \brief Add log element
     111  *
     112  * The added element will be automatically logged once
     113  * logging started (see StartLog()). \n
     114  * This element must define on its side the io_data
     115  * to log, trough IODevice::SetDataToLog method.
     116  *
     117  * \param device IODevice to add
     118  */
     119  void AddDeviceToLog(IODevice *device);
     120
     121  /*!
     122  * \brief Start logging
     123  *
     124  * All IODevice added through AddDeviceToLog() method
     125  * will automatically be logged. \n
     126  * SetupLogger() must have been called before.
     127  */
     128  void StartLog(void);
     129
     130  /*!
     131  * \brief Stop logging
     132  *
     133  * Logs will automatically be sent to ground station.
     134  */
     135  void StopLog(void);
     136
     137  /*!
     138  * \brief Is logging?
     139  *
     140  * \return true if is logging
     141  */
     142  bool IsLogging(void) const;
     143
     144  /*!
     145  * \brief Notify that SendData's period has changed
     146  *
     147  * This funtion must be called when the period has changed. \n
     148  * Normally, it occurs in the Widget::XmlEvent method. \n
     149  * This method must be called with communication blocked (see BlockCom()).
     150  *
     151  * \param obj SendData which changed
     152  */
     153  void UpdateSendData(const gui::SendData *obj);
     154
     155  /*!
     156  * \brief Block communication
     157  *
     158  * This funtion blocks the communication beetween the program and ground
     159  *station. \n
     160  * It must be called before changing datas or parameters exchanged between the
     161  *program
     162  * and the ground station.
     163  *
     164  */
     165  void BlockCom(void);
     166
     167  /*!
     168 * \brief Unblock communication
     169 *
     170 * This funtion unblocks the communication beetween the program and ground
     171 *station. \n
     172 * It must be called after changing datas or parameters exchanged between the
     173 *program
     174 * and the ground station.
     175 *
     176 */
     177  void UnBlockCom(void);
     178
     179  /*!
     180  * \brief Is connection lost?
     181  *
     182  * Once this method returns true, it will never return false back. \n
     183  * Note that this method return false if no connection is defined (see
     184  *SetupConnection).
     185  *
     186  * \return true if connection with ground station is lost
     187  */
     188  bool ConnectionLost(void) const;
     189
     190  /*!
     191  * \brief Disable errors display
     192  *
     193  * Disable errors display, if you do not want to saturate console for exemple.
     194  * By defaults errors disply is enabled.
     195  *
     196  * \param value true to disable errors display
     197  */
     198  void DisableErrorsDisplay(bool value);
     199
     200  /*!
     201  * \brief Is displaying errors?
     202  *
     203  *
     204  * \return true if errors display is enabled
     205  */
     206  bool IsDisplayingErrors(void) const;
     207
     208private:
     209  class FrameworkManager_impl *pimpl_;
     210};
     211
     212/*!
     213* \brief get FrameworkManager
     214*
     215* \return the FrameworkManager
     216*/
     217FrameworkManager *getFrameworkManager(void);
     218
     219/*!
     220* \brief is big endian?
     221*
     222* \return true if big endian, false if little endian
     223*/
     224bool IsBigEndian(void);
    218225
    219226} // end namespace core
Note: See TracChangeset for help on using the changeset viewer.