Changeset 116 in pacpusframework for trunk


Ignore:
Timestamp:
Jun 25, 2013, 1:44:25 PM (11 years ago)
Author:
Marek Kurdej
Message:

Added: PacpusException - base class for all exceptions. DbiteExceptions inherits from it.
Added: PacpusLibConfig.h - dllimport/dllexport clauses separated from pacpus.h.
Update: comments.

Location:
trunk
Files:
3 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/Pacpus/PacpusTools/AsyncWorkerBase.h

    r106 r116  
    2222namespace pacpus
    2323{
    24   /**
    25    * @brief A simple base class for asynchronous workers able to partake in the
    26    * Qt slot / signal mechanism
    27    *
    28    * This class represents an asynchronous event-based worker able to receive and
    29    * send Qt signals to other workers or threads. The rationale is to be able to
    30    * define stateful objects that perform calculations asynchronously, triggered
    31    * by external user-defined messages.
    32    */
    33   class PACPUSTOOLS_API AsyncWorkerBase
     24
     25/// A simple base class for asynchronous workers able to partake in the
     26/// Qt slot / signal mechanism
     27///
     28/// This class represents an asynchronous event-based worker able to receive and
     29/// send Qt signals to other workers or threads. The rationale is to be able to
     30/// define stateful objects that perform calculations asynchronously, triggered
     31/// by external user-defined messages.
     32class PACPUSTOOLS_API AsyncWorkerBase
    3433    : public QObject
    3534    , private boost::noncopyable
    36   {
     35{
    3736    Q_OBJECT
    38     public:
    39       /** Constructor. */
    40       AsyncWorkerBase();
    4137
    42       /** Destructor. */
    43       virtual ~AsyncWorkerBase();
     38public:
     39    /// Constructor.
     40    AsyncWorkerBase();
    4441
    45       /** Starts the worker by creating a new thread for it, and calling the setup() virtual method. */
    46       void start();
     42    /// Destructor.
     43    virtual ~AsyncWorkerBase();
    4744
    48       /** Terminates the worker as soon as there are no more requests pending and its current processing
    49        *  is finished.
    50        *
    51        *        This method tries to end the worker gracefully. All pending signals sent before the stop() request will
    52        *        be honored.
    53        *        It is safe to call this method from any thread.
    54        *
    55        *  @param autoDelete if true, deletes the worker as soon as its event loop has finished processing.
    56        */
    57       void stop(bool autoDelete);
     45    /// Starts the worker by creating a new thread for it, and calling the setup() virtual method. */
     46    void start();
    5847
    59       /** Returns true if the worker is active. */
    60       bool isActive() const { return active_; }
     48    /// Terminates the worker as soon as there are no more requests pending and its current processing
     49    /// is finished.
     50    ///
     51    /// This method tries to end the worker gracefully. All pending signals sent before the stop() request will
     52    /// be honored.
     53    /// It is safe to call this method from any thread.
     54    ///
     55    ///  @param autoDelete if true, deletes the worker as soon as its event loop has finished processing.
     56    void stop(bool autoDelete);
    6157
    62     Q_SIGNALS:
    63        /// @todo Documentation
    64        void finished();
    65        /// @todo Documentation
    66        void stopped();
     58    /// @returns @b true if the worker is active, @b false otherwise.
     59    bool isActive() const
     60    {
     61        return active_;
     62    }
    6763
    68     protected:
    69        /// @todo Documentation
    70        virtual void setup();
    71        /// @todo Documentation
    72        virtual void process();
    73        /// @todo Documentation
    74        virtual void cleanup();
     64Q_SIGNALS:
     65    /// @todo Documentation
     66    void finished();
     67    /// @todo Documentation
     68    void stopped();
    7569
    76        /** Returns true if the worker is stopping. */
    77        bool isStopping() const { return stopping_; }
     70protected:
     71    /// @todo Documentation
     72    virtual void setup();
     73    /// @todo Documentation
     74    virtual void process();
     75    /// @todo Documentation
     76    virtual void cleanup();
    7877
    79     private Q_SLOTS:
    80       /// @todo Documentation
    81       void doSetup();
    82       /// @todo Documentation
    83       void doFinish();
     78    /// Returns true if the worker is stopping.
     79    bool isStopping() const { return stopping_; }
    8480
    85     private:
    86       /*! \brief Ends the worker, asking the underlying thread to terminate
    87        *
    88        * This method signals the end of processing and requests the underlying thread to terminate. Actual termination
    89        * will occur as soon as all pending signals (including those that may come from other workers during the
    90        * finish request handling) have been processed.
    91        */
    92       void finish();
     81private Q_SLOTS:
     82    /// @todo Documentation
     83    void doSetup();
     84    /// @todo Documentation
     85    void doFinish();
    9386
    94       // Attributes
    95       bool active_;
    96       bool stopping_;
    97   };
     87private:
     88    /// Ends the worker, asking the underlying thread to terminate
     89    ///
     90    /// This method signals the end of processing and requests the underlying thread to terminate. Actual termination
     91    /// will occur as soon as all pending signals (including those that may come from other workers during the
     92    /// finish request handling) have been processed.
     93    void finish();
     94
     95    // Attributes
     96    bool active_;
     97    bool stopping_;
     98};
     99
    98100} // namespace pacpus
    99101
  • trunk/include/Pacpus/PacpusTools/PeriodicWorker.h

    r115 r116  
    2323namespace pacpus
    2424{
    25     /// @brief A simple base class for periodic worker.
    26     ///
    27     /// @example
    28     /// To use the PeriodicWorker, simply inherit from this class when creating your worker.
    29     /// ~~~
    30     /// class MyWorker
    31     ///     : public PeriodicWorkder
    32     /// {
    33     /// public:
    34     ///     void doWork() { std::cout << "Hey, I'm working!" << std::endl; }
    35     /// };
    36     ///
    37     /// // Do its work every second.
    38     /// MyWorker worker;
    39     /// worker.startWork(1000);
    40     /// ~~~
    41     class PACPUSTOOLS_API PeriodicWorker
    42         : public AsyncWorkerBase
    43     {
     25
     26/// @brief A simple base class for periodic worker.
     27///
     28/// @example
     29/// To use the PeriodicWorker, simply inherit from this class when creating your worker.
     30/// ~~~
     31/// class MyWorker
     32///     : public PeriodicWorkder
     33/// {
     34/// public:
     35///     void doWork() { std::cout << "Hey, I'm working!" << std::endl; }
     36/// };
     37///
     38/// // Do its work every second.
     39/// MyWorker worker;
     40/// worker.startWork(1000);
     41/// ~~~
     42class PACPUSTOOLS_API PeriodicWorker
     43    : public AsyncWorkerBase
     44{
    4445    Q_OBJECT
    45     public:
    46       /// Ctor of PeriodicWorker.
    47       PeriodicWorker();
    48      
    49       /// Dtor of PeriodicWorker.
    50       virtual ~PeriodicWorker();
    51      
    52       /** Start the periodic worker.
    53        * @param msec Period in mseconds.
    54        */
    55       void startWork(int msec);
    56      
    57       /** Stop the periodic worker, but do not delete it. */
    58       void stopWork();
    59      
    60     public slots:
    61       /** Do the work.
    62        * This method need to be implemented in the subclasses, it will be called
    63        * each time the timer has reached its period.
    64        */
    65       virtual void doWork() = 0;
    66      
    67     private:
    68       QTimer* mHeartbeat;
    69   };
    70 }
     46public:
     47    /// Ctor of PeriodicWorker.
     48    PeriodicWorker();
     49
     50    /// Dtor of PeriodicWorker.
     51    virtual ~PeriodicWorker();
     52
     53    /// Start the periodic worker.
     54    /// @param msec Period in mseconds.
     55    void startWork(int msec);
     56
     57    /// Stop the periodic worker, but do not delete it.
     58    void stopWork();
     59
     60    public Q_SLOTS:
     61        /// Do the work.
     62        /// This method need to be implemented in the subclasses, it will be called
     63        /// each time the timer has reached its period.
     64        virtual void doWork() = 0;
     65
     66private:
     67    QTimer * mHeartbeat;
     68};
     69
     70} // namespace pacpus
    7171
    7272#endif // DEF_PACPUS_PERIODIC_WORKER_H
  • trunk/include/Pacpus/PacpusTools/geodesie.h

    r91 r116  
    8989    /// @param latitude [degrees]
    9090    /// @param Hwgs84 Output: interpolated altitude using WGS84 geoid model [meters]
    91     bool Interpol(double longitude/*deg*/, double latitude/*deg*/, double* Hwgs84) const;
     91    bool Interpol(double longitudeDegrees, double latitudeDegrees, double * heightMetersWgs84) const;
    9292   
    9393private:
     
    127127void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,double& lambda,double& phi,double& he);
    128128void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,Matrice in,double& lambda,double& phi,double& he,Matrice& out);
    129 /** Convert from geographique to ECEF.
    130  * @param[in] longitude Longitude in radian.
    131  * @param[in] latitude Latitude in radian.
    132  * @param[in] he Height in meter.
    133  */
     129/// Convert from geographique to ECEF.
     130/// @param[in] longitude Longitude in radian.
     131/// @param[in] latitude Latitude in radian.
     132/// @param[in] he Height in meter.
    134133void Geographique_2_ECEF(double longitude, double latitude, double he, double& x, double& y, double& z);
    135 /** Convert from ECEF two ENU.
    136  * @param[in] lon0 Longitude of the origin in radian.
    137  * @param[in] lat0 Latitude of the origin in radian.
    138  * @param[in] he0 Height of the origin in radian.
    139  */
     134/// Convert from ECEF two ENU.
     135/// @param[in] lon0 Longitude of the origin in radian.
     136/// @param[in] lat0 Latitude of the origin in radian.
     137/// @param[in] he0 Height of the origin in radian.
    140138void ECEF_2_ENU(double x,double y,double z,double& e,double& n,double& u,double lon0,double lat0,double he0);
    141139////////////////////////////////////////////////////////////////////////
     
    164162double ConvMerApp(double longitude);
    165163
    166 /**
    167 Converts Cartesian (x, y) coordinates to polar coordinates (r, theta)
    168 */
     164/// Converts Cartesian (x, y) coordinates to polar coordinates (r, theta)
    169165template <typename _T1, typename _T2>
    170166void cartesianToPolar(const _T1 x, const _T1 y, _T2 & r, _T2 & theta) {
     
    173169}
    174170
    175 /**
    176 Converts polar coordinates (r, theta) to Cartesian (x, y) coordinates
    177 */
     171/// Converts polar coordinates (r, theta) to Cartesian (x, y) coordinates
    178172template <typename _T1, typename _T2>
    179173void polarToCartesian(const _T1 r, const _T1 theta, _T2 & x, _T2 & y) {
     
    182176}
    183177
    184 /**
    185 Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta, phi)
    186 Angles expressed in radians.
    187 */
     178/// Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta, phi)
     179/// Angles expressed in radians.
    188180template <typename _T1, typename _T2>
    189181void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2 & r, _T2 & theta, _T2 & phi) {
     
    193185}
    194186
    195 /**
    196 Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z) coordinates.
    197 Angles expressed in radians.
    198 */
     187/// Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z) coordinates.
     188/// Angles expressed in radians.
    199189template <typename _T1, typename _T2>
    200190void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2 & x, _T2 & y, _T2 & z) {
  • trunk/include/Pacpus/kernel/ComponentBase.h

    r76 r116  
    2323
    2424#include <Pacpus/kernel/ComponentManager.h>
    25 #include <Pacpus/kernel/pacpus.h>
     25#include <Pacpus/kernel/PacpusLibConfig.h>
    2626#include <Pacpus/kernel/XmlComponentConfig.h>
    2727
     
    3333class ComponentManager;
    3434
    35 /** ComponentBase
    36  * @brief Base class of a Pacpus component.
    37  */
     35/// Base class of a Pacpus component.
    3836class PACPUSLIB_API ComponentBase
    3937{
    4038    friend class ComponentManager;
     39
    4140public:
    42     /**
    43      * Enumeration of the state that can take a component, the three last states suppose
    44      * that the component is started.
    45      */
     41    /// Enumeration of the state that can take a component, the three last states suppose
     42    /// that the component is started.
    4643    enum COMPONENT_STATE
    4744    {
    48       STOPPED,
    49       NOT_MONITORED,
    50       MONITOR_OK,
    51       MONITOR_NOK
     45        STOPPED,
     46        NOT_MONITORED,
     47        MONITOR_OK,
     48        MONITOR_NOK
    5249    };
    5350
    54     /** Resulting state of a component after its configuration. */
     51    /// Resulting state of a component after its configuration.
    5552    enum COMPONENT_CONFIGURATION
    5653    {
    57       CONFIGURED_OK,
    58       NOT_CONFIGURED,
    59       CONFIGURATION_DELAYED,
    60       CONFIGURED_FAILED
     54        CONFIGURED_OK,
     55        NOT_CONFIGURED,
     56        CONFIGURATION_DELAYED,
     57        CONFIGURED_FAILED
    6158    };
    6259
    63     /** Ctor of ComponentBase.
    64      * @param name Name of your component.
    65      */
    66     ComponentBase(const QString& name);
     60    /// Ctor of ComponentBase.
     61    /// @param name Name of your component.
     62    ComponentBase(const QString & name);
    6763
    68     /** Dtor of ComponentBase. */
     64    /// Dtor of ComponentBase.
    6965    virtual ~ComponentBase();
    7066
    71     /** Return the state of the component.
    72      * @return Value of the current state.
    73      */
     67    /// @returns Value of the current state.
    7468    COMPONENT_STATE getState();
    7569
    76     /** Check whether the component if configurer or not.
    77      * @return True if the component is configured, otherwise false.
    78      */
     70    /// Checks whether the component if configurer or not.
     71    /// @returns @b true if the component is configured, @b false otherwise.
    7972    bool isConfigured() const;
    8073
    8174protected:
    82     /** Change the state of the component.
    83      * @param state New component state.
    84      */
     75    /// Change the state of the component.
     76    /// @param state New component state.
    8577    void setState(COMPONENT_STATE state);
    8678
    87     /** Called when the component starts, you must override this function. */
     79    /// Called when the component starts, you must override this function.
    8880    virtual void startActivity() = 0;
    8981
    90     /** Called when the component stops, you must override this function. */
     82    /// Called when the component stops, you must override this function.
    9183    virtual void stopActivity() = 0;
    9284
    93     /** Called by the ComponentManager, it configure the component thanks a XML node.
    94      * @param config Component's XML node.
    95      * @return State of the configuration.
    96      * FIXME: 'config' should be const, but we can't change the prototype without breaking
    97      * old stuff.
    98      */
     85    /// Called by the ComponentManager, it configure the component thanks a XML node.
     86    /// @param config Component's XML node.
     87    /// @returns State of the configuration.
     88    /// @todo FIXME: 'config' should be const, but we can't change the prototype without breaking old stuff.
    9989    virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config) = 0;
    100    
     90
    10191protected:
    10292    /// The XML node that is got in the configureComponent method
     
    132122};
    133123
    134 } // pacpus
     124} // namespace pacpus
    135125
    136126#endif // DEF_PACPUS_COMPONENTBASE_H
  • trunk/include/Pacpus/kernel/ComponentFactory.h

    r115 r116  
    2323#include <Pacpus/kernel/ComponentFactoryBase.h>
    2424
    25 #include <QtGlobal>
    2625#include <QString>
    2726
     
    3736/// @see pacpus::ComponentFactory
    3837#define REGISTER_COMPONENT(className, factoryName) \
    39   static pacpus::ComponentFactory<className> sFactory(factoryName)
     38    static pacpus::ComponentFactory<className> sFactory(factoryName)
    4039
    4140namespace pacpus {
     
    5049{
    5150    BOOST_STATIC_ASSERT_MSG((boost::is_base_of<ComponentBase, T>::value), "T must inherit from ComponentBase");
     51
    5252public:
    53     /** Ctor of ComponentFactory, initialize the factory of the components of type @em T.
    54      * @param type Name of the type of the components.
    55      */
     53    /// Ctor of ComponentFactory, initialize the factory of the components of type @em T.
     54    /// @param type Name of the type of the components.
    5655    ComponentFactory(const QString& type);
    57    
    58     /** Dtor of ComponentFactory. */
     56
     57    /// Dtor of ComponentFactory.
    5958    virtual ~ComponentFactory();
    6059
    61     /** Get the name of the type of the components.
    62      * @return Name of the type of the components.
    63      */
     60    /// Gets the name of the type of the components.
     61    /// @returns Name of the type of the components.
    6462    const QString& getType() const;
    6563
    6664protected:
    6765    virtual ComponentBase* instantiateComponent(const QString& name);
    68  
     66
    6967private:
    7068    QString mType;
     
    7371template <typename T>
    7472ComponentFactory<T>::ComponentFactory(const QString& type)
    75   : mType(type)
     73    : mType(type)
    7674{
    7775    assert(!type.isEmpty());
     
    9694}
    9795
    98 } // pacpus
     96} // namespace pacpus
    9997
    10098#endif // DEF_PACPUS_DBITEEXCEPTION_H
  • trunk/include/Pacpus/kernel/ComponentFactoryBase.h

    r76 r116  
    1616#define DEF_PACPUS_COMPONENTFACTORYBASE_H
    1717
    18 #include <Pacpus/kernel/pacpus.h>
     18#include <Pacpus/kernel/PacpusLibConfig.h>
    1919
    2020class QString;
     
    2525class ComponentBase;
    2626
    27 /** ComponentFactoryBase
    28  * @brief Provide an abstract class to the template ComponentFactory.
    29  */
     27/// ComponentFactoryBase
     28/// @brief Provide an abstract class to the template ComponentFactory.
    3029class PACPUSLIB_API ComponentFactoryBase
    3130{
    3231    friend class ComponentManager;
     32
    3333public:
    34     /** Ctor of ComponentFactoryBase. */
     34    /// Ctor of ComponentFactoryBase.
    3535    ComponentFactoryBase();
    36     /** Dtor of ComponentFactoryBase. */
     36    /// Dtor of ComponentFactoryBase.
    3737    virtual ~ComponentFactoryBase();
    3838
    3939protected:
    40     /** Create a new component having @em name as component name.
    41      * @param name Name of the instantiated component.
    42      * @return Pointer on the newly created component, you become the owner of its lifetime.
    43      */
     40    /// Creates a new component having @em name as component name.
     41    /// Caller becomes the owner of its lifetime
     42    ///
     43    /// @param name Name of the instantiated component.
     44    /// @returns Pointer on the newly created component.
    4445    virtual ComponentBase * instantiateComponent(const QString& name) = 0;
    4546   
    46     /** Register a new factory.
    47      * @param addr Address of the factory.
    48      * @param type Name of the type created by the factory.
    49      */
     47    /// Registers a new factory.
     48    ///
     49    /// @param addr Address of the factory.
     50    /// @param type Name of the type created by the factory.
    5051    void addFactory(ComponentFactoryBase* addr, const QString& type);
    5152   
    52     /** Add a new component.
    53      * @param name Name of the new component.
    54      */
     53    /// Adds a new component.
     54    ///
     55    /// @param name Name of the new component.
    5556    void addComponent(const QString& name);
    5657
  • trunk/include/Pacpus/kernel/ComponentManager.h

    r76 r116  
    1818#define DEF_PACPUS_COMPONENTMANAGER_H
    1919
     20#include <Pacpus/kernel/ComponentFactoryBase.h>
    2021#include <Pacpus/kernel/pacpus.h>
    21 #include <Pacpus/kernel/ComponentFactoryBase.h>
     22#include <Pacpus/kernel/PacpusLibConfig.h>
    2223#include <Pacpus/kernel/PacpusPluginInterface.h>
    2324#include <Pacpus/kernel/XmlConfigFile.h>
     
    4142{
    4243    friend class ComponentBase;
     44
     45    // Allow 2 functions to access to private members of ComponentManager
     46    friend void ComponentFactoryBase::addFactory(ComponentFactoryBase * addr, const QString & type);
     47    friend void ComponentFactoryBase::addComponent(const QString & name);
    4348
    4449public:
     
    6873    };
    6974
    70     /** Load the components included in the XML config file.
    71      * @param file Name of the XML file.
    72      * @return Number of components loaded by the manager.
    73      */
     75    /// Loads the components included in the XML config file.
     76    /// @param file Name of the XML file.
     77    /// @returns Number of components loaded by the manager.
    7478    PACPUSLIB_API std::size_t loadComponents(const QString& file);
    7579
    76     /** Start all the components
    77      * @return True if all the component has been started, otherwise false.
    78      */
     80    /// Starts all the components
     81    /// @return @b true if all the component has been started, @b false otherwise.
    7982    PACPUSLIB_API bool start();
    8083
    81     /** Start only the component passed in parameter.
    82      * @param component Component to start.
    83      * @return True if the component exists and has been started, otherwise false.
    84      */
     84    /// Starts only the component passed in parameter.
     85    /// @param component Component to start.
     86    /// @returns @b true if the component exists and has been started, @b false otherwise.
    8587    PACPUSLIB_API bool start(const QString& component);
    8688
    87     /** Stop all the components
    88      * @return True if all the component has been stopped, otherwise false.
    89      */
     89    /// Stops all the components
     90    /// @returns @b true if all the component has been stopped, @b false otherwise.
    9091    PACPUSLIB_API bool stop();
    9192
    92     /** Stop only the component passed in parameter.
    93      * @param component Component to stop.
    94      * @return True if the component has been stopped, otherwise false.
    95      */
     93    /// Stops only the component passed in parameter.
     94    /// @param component Component to stop.
     95    /// @returns @b true if the component has been stopped, @b false otherwise.
    9696    PACPUSLIB_API bool stop(const QString& component);
    9797
    98     /** Get a pointer to the component referred by @em name.
    99      * @param name Name of the component.
    100      * @return Pointer to the component if it exists, otherwise @em NULL.
    101      */
     98    /// Gets a pointer to the component referred by @em name.
     99    ///
     100    /// @param name Name of the component.
     101    /// @returns Pointer to the component if it exists, @b NULL otherwise.
    102102    PACPUSLIB_API ComponentBase* getComponent(const QString& name);
    103103
    104     /** Get the list of all the names of the component known by the manager.
    105      * @return List of all the component's name.
    106      */
     104    /// Gets the list of all the names of the component known by the manager.
     105    /// @returns List of all the component's name.
    107106    PACPUSLIB_API QStringList getAllComponentsName() const;
    108107
    109     /** Load a new plugin from the file filename (it may be a .so/.dll file)
    110      * @param filename Name of the shared object or the dll.
    111      * @return True if the plugin has been loaded, otherwise false.
    112      */
     108    /// Loads a new plugin from the file filename (it may be a .so/.dll file)
     109    /// @param filename Name of the shared object or the dll.
     110    /// @returns @b true if the plugin has been loaded, @b false otherwise .
    113111    PACPUSLIB_API bool loadPlugin(const QString& filename);
    114112
     
    118116
    119117    bool registerComponent(ComponentBase* addr, const QString& name);
    120     bool registerComponentFactory(ComponentFactoryBase* addr, const QString& type);
     118    bool registerComponentFactory(ComponentFactoryBase * addr, const QString& type);
    121119
    122120    bool unRegisterComponent(const QString& name);
    123121    bool unRegisterComponentFactory(const QString& type);
    124 
    125     // Allow 2 functions to access to private members of ComponentManager
    126     friend void ComponentFactoryBase::addFactory(ComponentFactoryBase* addr, const QString & type);
    127     friend void ComponentFactoryBase::addComponent(const QString & name);
    128122
    129123    /// private constructor accessible only via static create() function
  • trunk/include/Pacpus/kernel/DbiteException.h

    r114 r116  
    1616
    1717#include <Pacpus/kernel/FileLibConfig.h>
     18#include <Pacpus/kernel/PacpusException.h>
    1819
    1920#include <exception>
    2021#include <string>
    2122
    22 #ifdef _MSC_VER
    23 #   pragma warning(push)
    24 #   pragma warning(disable: 4251)
    25 #endif // _MSC_VER
    26 
    2723namespace pacpus {
    2824
    29 /** DbiteException
    30  * @brief Exception thrown when an error manipulation a dbite file occured.
    31  */
     25/// DbiteException
     26/// @brief Exception thrown when an error manipulation a dbite file occured.
    3227class FILELIB_API DbiteException
    33     : public std::exception
     28    : virtual public PacpusException
    3429{
    3530public:
    36     /** Ctor of DbiteException.
    37      * @param what Information about the exception.
    38      */
    39     DbiteException(const std::string& what);
     31    /// Ctor.
     32    /// @param what Information about the exception.
     33    DbiteException(const std::string & what);
    4034
    41     /** Dtor of DbiteException. */
     35    /// Dtor.
    4236    virtual ~DbiteException() throw();
    43 
    44 
    45     /** Get more information about the error.
    46      * @return Message containing information about the error.
    47      */
    48     virtual const char* what() const throw();
    49 
    50 
    51 private:
    52     std::string mWhat;
    5337};
    5438
    5539} // namespace pacpus
    5640
    57 #ifdef _MSC_VER
    58 #   pragma warning(pop)
    59 #endif // _MSC_VER
    60 
    6141#endif // DEF_PACPUS_DBITEEXCEPTION_H
  • trunk/include/Pacpus/kernel/FileLibConfig.h

    r76 r116  
    1818#define DEF_PACPUS_FILELIBCONFIG_H
    1919
    20 // Export macro for FileLib DLL for Windows only
     20/// Export macro for FileLib DLL for Windows only
    2121#ifdef WIN32
    2222#   ifdef FILELIB_EXPORTS
  • trunk/include/Pacpus/kernel/Log.h

    r112 r116  
    1515#define DEF_PACPUS_LOG_H
    1616
    17 // Includes, pacpus.
    18 #include <Pacpus/kernel/pacpus.h>
     17#include <Pacpus/kernel/PacpusLibConfig.h>
    1918
    2019namespace pacpus {
     
    4342    static log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(name))
    4443
    45   /* https://devel.hds.utc.fr/projects/pacpus/ticket/55 */
     44  // https://devel.hds.utc.fr/projects/pacpus/ticket/55
    4645  #define LOG_TRACE(message)          do{LOG4CXX_TRACE(logger, message);} while(false)
    4746  #define LOG_DEBUG(message)          do{LOG4CXX_DEBUG(logger, message);} while(false)
  • trunk/include/Pacpus/kernel/XmlComponentConfig.h

    r91 r116  
    1515#define DEF_PACPUS_XMLCOMPONENTCONFIG_H
    1616
    17 #include <Pacpus/kernel/pacpus.h>
     17#include <Pacpus/kernel/PacpusLibConfig.h>
    1818
    1919#include <QDomElement>
     
    2323class XmlConfigFile;
    2424
    25 /** XmlComponentConfig
    26  * @brief Defines the XML structure of a component.
    27  */
     25/// XmlComponentConfig
     26/// @brief Defines the XML structure of a component.
    2827class PACPUSLIB_API XmlComponentConfig
    2928{
    3029    friend class ComponentManager;
     30
    3131public:
    32     /** Ctor of XmlComponentConfig.
    33      * @param name Name of the ComponentFactory, by convention equal to class name.
    34      */
    35     explicit XmlComponentConfig(const QString& name = QString::null);
     32    /// Ctor of XmlComponentConfig.
     33    /// @param name Name of the ComponentFactory, by convention equal to class name.
     34    explicit XmlComponentConfig(const QString & name = QString::null);
    3635
    37     /** Dtor of XmlComponentConfig. */
     36    /// Dtor of XmlComponentConfig.
    3837    ~XmlComponentConfig();
    3938
    40     /** Add the property @em name to the XML and set its value to @em 0 if it does not exist.
    41      * @param name Name of the property.
    42      */
     39    /// Adds the property @em name to the XML and set its value to @em 0 if it does not exist.
     40    /// @param name Name of the property.
    4341    void addProperty(const QString& name);
    4442
    45     /** Delete a property from the XML.
    46      * @return False if the property does not exist, false otherwise.
    47      */
     43    /// Deletes property @em name from the XML.
     44    ///
     45    /// @returns @b true if the property existed and was removed, @b false if the property did not exist or could not be removed.
    4846    int delProperty(const QString& name);
    4947
    50     /** Get the value of a property.
    51      * @param name Name of the property.
    52      * @param defaultValue Value returned if the property does not exist.
    53      * @return Value of the property, @em defaultValue otherwise.
    54      */
     48    /// Gets the value of a property.
     49    /// @param name Name of the property.
     50    /// @param defaultValue Value returned if the property does not exist.
     51    /// @return Value of the property, @em defaultValue otherwise.
    5552    QString getProperty(const QString& name, const QString& defaultValue = QString::null) const;
    5653
    57     /** Get the value of a property as a boolean.
    58      * @param name Name of the property.
    59      * @param defaultValue Value returned if the property does not exist.
    60      * @return Value of the property, @em defaultValue otherwise.
    61      */
     54    /// Gets the value of a property as a boolean.
     55    /// @param name Name of the property.
     56    /// @param defaultValue Value returned if the property does not exist.
     57    /// @returns Value of the property, @em defaultValue otherwise.
    6258    bool getBoolProperty(const QString& name, bool defaultValue = false) const;
    6359
    64     /** Get the value of a property as an integer.
    65      * @param name Name of the property.
    66      * @param defaultValue Value returned if the property does not exist.
    67      * @return Value of the property, @em defaultValue otherwise.
    68      */
     60    /// Get the value of a property as an integer.
     61    /// @param name Name of the property.
     62    /// @param defaultValue Value returned if the property does not exist.
     63    /// @return Value of the property, @em defaultValue otherwise.
    6964    int getIntProperty(const QString& name, int defaultValue = 0) const;
    7065
    71     /** Get the value of a property as a double.
    72      * @param name Name of the property.
    73      * @param defaultValue Value returned if the property does not exist.
    74      * @return Value of the property, @em defaultValue otherwise.
    75      */
     66    /// Get the value of a property as a double.
     67    /// @param name Name of the property.
     68    /// @param defaultValue Value returned if the property does not exist.
     69    /// @return Value of the property, @em defaultValue otherwise.
    7670    double getDoubleProperty(const QString& name, double defaultValue = 0.0) const;
    7771
    78     /** Set the value of a property.
    79      * @param name Name of the property.
    80      * @param value Value to set.
    81      */
     72    /// Set the value of a property.
     73    /// @param name Name of the property.
     74    /// @param value Value to set.
    8275    void setProperty(const QString& name, const QString& value);
    8376
    84     /** Check if a property exists.
    85      * @param name Name of the property.
    86      * @return True if the property exists, false otherwise.
    87      */
     77    /// Check if a property exists.
     78    /// @param name Name of the property.
     79    /// @return True if the property exists, false otherwise.
    8880    bool hasProperty(const QString& name) const;
    8981
  • trunk/include/Pacpus/kernel/XmlConfigFile.h

    r91 r116  
    1515///             - parameters : parameters of the application
    1616///             - components : a list of components to load
    17 ///             
    18 
    1917
    2018#ifndef DEF_PACPUS_XMLCONFIGFILE_H
    2119#define DEF_PACPUS_XMLCONFIGFILE_H
    2220
    23 #include <Pacpus/kernel/pacpus.h>
     21#include <Pacpus/kernel/PacpusLibConfig.h>
    2422#include <Pacpus/kernel/XmlComponentConfig.h>
    2523
  • trunk/include/Pacpus/kernel/pacpus.h

    r76 r116  
    1616#define DEF_PACPUS_H
    1717
     18#include <Pacpus/kernel/PacpusLibConfig.h>
    1819#include <Pacpus/kernel/road_time.h>
    1920
     
    2324#ifndef PACPUS_PI
    2425#   define PACPUS_PI       3.1415926
    25 #endif
    26 
    27 /// Export macro for PacpusLib DLL for Windows only
    28 #ifdef WIN32
    29 #   ifdef PACPUSLIB_EXPORTS
    30 //  make DLL
    31 #       define PACPUSLIB_API __declspec(dllexport)
    32 #   else
    33 //      use DLL
    34 #       define PACPUSLIB_API __declspec(dllimport)
    35 #   endif
    36 #else
    37 //  On other platforms, simply ignore this
    38 #   define PACPUSLIB_API
    3926#endif
    4027
  • trunk/include/Pacpus/kernel/road_time.h

    r91 r116  
    4949/// at the same time.
    5050/// Description of each field is provided inside the structure
    51 struct Initialisation_Time
     51struct ROAD_TIME_API Initialisation_Time
    5252{
    5353    /// Time (extended to micro seconds precision)
  • trunk/src/FileLib/CMakeLists.txt

    r103 r116  
    4646        ${PACPUS_DEPENDENCIES_LIB}
    4747                PacpusLib
    48 
    4948)
    5049
  • trunk/src/FileLib/src/DbiteException.cpp

    r91 r116  
    1111
    1212DbiteException::DbiteException(const std::string& what)
    13     : mWhat(what)
     13    : PacpusException(what)
    1414{
    1515}
     
    1818{
    1919}
    20 
    21 const char* DbiteException::what() const throw()
    22 {
    23     return mWhat.c_str();
    24 }
  • trunk/src/PacpusLib/CMakeLists.txt

    r101 r116  
    4848    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/pacpus.h
    4949    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/PacpusApplication.h
     50    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/PacpusException.h
     51    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/PacpusLibConfig.h
    5052    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/road_time.h
    5153    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/XmlComponentConfig.h
     
    5658    ./Log.cpp
    5759    ./PacpusApplication.cpp
     60    ./PacpusException.cpp
    5861    ./XmlComponentConfig.cpp
    5962    ./XmlConfigFile.cpp
  • trunk/src/PacpusLib/ComponentManager.cpp

    r91 r116  
    66/// @version    $Id$
    77
     8#include <Pacpus/kernel/ComponentFactoryBase.h>
    89#include <Pacpus/kernel/ComponentManager.h>
    910#include <Pacpus/kernel/ComponentBase.h>
  • trunk/src/PacpusLib/XmlComponentConfig.cpp

    r91 r116  
    5555int XmlComponentConfig::delProperty(const QString& name)
    5656{
    57     if (!hasProperty(name))
    58     {
    59         LOG_WARN("cannot delete compoenent property '" << name << "'"
     57    if (!hasProperty(name)) {
     58        LOG_WARN("cannot delete component property '" << name << "'"
    6059                 << " of component '" << component_.tagName() << "'"
    6160                 << ". Component does not contain this property."
Note: See TracChangeset for help on using the changeset viewer.