- Timestamp:
- Jun 25, 2013, 1:44:25 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/Pacpus/PacpusTools/AsyncWorkerBase.h
r106 r116 22 22 namespace pacpus 23 23 { 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. 32 class PACPUSTOOLS_API AsyncWorkerBase 34 33 : public QObject 35 34 , private boost::noncopyable 36 35 { 37 36 Q_OBJECT 38 public:39 /** Constructor. */40 AsyncWorkerBase();41 37 42 /** Destructor. */ 43 virtual ~AsyncWorkerBase(); 38 public: 39 /// Constructor. 40 AsyncWorkerBase(); 44 41 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(); 47 44 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(); 58 47 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); 61 57 62 Q_SIGNALS:63 /// @todo Documentation64 void finished();65 /// @todo Documentation66 void stopped();58 /// @returns @b true if the worker is active, @b false otherwise. 59 bool isActive() const 60 { 61 return active_; 62 } 67 63 68 protected: 69 /// @todo Documentation 70 virtual void setup(); 71 /// @todo Documentation 72 virtual void process(); 73 /// @todo Documentation 74 virtual void cleanup(); 64 Q_SIGNALS: 65 /// @todo Documentation 66 void finished(); 67 /// @todo Documentation 68 void stopped(); 75 69 76 /** Returns true if the worker is stopping. */ 77 bool isStopping() const { return stopping_; } 70 protected: 71 /// @todo Documentation 72 virtual void setup(); 73 /// @todo Documentation 74 virtual void process(); 75 /// @todo Documentation 76 virtual void cleanup(); 78 77 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_; } 84 80 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(); 81 private Q_SLOTS: 82 /// @todo Documentation 83 void doSetup(); 84 /// @todo Documentation 85 void doFinish(); 93 86 94 // Attributes 95 bool active_; 96 bool stopping_; 97 }; 87 private: 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 98 100 } // namespace pacpus 99 101 -
trunk/include/Pacpus/PacpusTools/PeriodicWorker.h
r115 r116 23 23 namespace pacpus 24 24 { 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 /// ~~~ 42 class PACPUSTOOLS_API PeriodicWorker 43 : public AsyncWorkerBase 44 { 44 45 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 } 46 public: 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 66 private: 67 QTimer * mHeartbeat; 68 }; 69 70 } // namespace pacpus 71 71 72 72 #endif // DEF_PACPUS_PERIODIC_WORKER_H -
trunk/include/Pacpus/PacpusTools/geodesie.h
r91 r116 89 89 /// @param latitude [degrees] 90 90 /// @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; 92 92 93 93 private: … … 127 127 void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,double& lambda,double& phi,double& he); 128 128 void 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. 134 133 void 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. 140 138 void ECEF_2_ENU(double x,double y,double z,double& e,double& n,double& u,double lon0,double lat0,double he0); 141 139 //////////////////////////////////////////////////////////////////////// … … 164 162 double ConvMerApp(double longitude); 165 163 166 /** 167 Converts Cartesian (x, y) coordinates to polar coordinates (r, theta) 168 */ 164 /// Converts Cartesian (x, y) coordinates to polar coordinates (r, theta) 169 165 template <typename _T1, typename _T2> 170 166 void cartesianToPolar(const _T1 x, const _T1 y, _T2 & r, _T2 & theta) { … … 173 169 } 174 170 175 /** 176 Converts polar coordinates (r, theta) to Cartesian (x, y) coordinates 177 */ 171 /// Converts polar coordinates (r, theta) to Cartesian (x, y) coordinates 178 172 template <typename _T1, typename _T2> 179 173 void polarToCartesian(const _T1 r, const _T1 theta, _T2 & x, _T2 & y) { … … 182 176 } 183 177 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. 188 180 template <typename _T1, typename _T2> 189 181 void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2 & r, _T2 & theta, _T2 & phi) { … … 193 185 } 194 186 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. 199 189 template <typename _T1, typename _T2> 200 190 void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2 & x, _T2 & y, _T2 & z) { -
trunk/include/Pacpus/kernel/ComponentBase.h
r76 r116 23 23 24 24 #include <Pacpus/kernel/ComponentManager.h> 25 #include <Pacpus/kernel/ pacpus.h>25 #include <Pacpus/kernel/PacpusLibConfig.h> 26 26 #include <Pacpus/kernel/XmlComponentConfig.h> 27 27 … … 33 33 class ComponentManager; 34 34 35 /** ComponentBase 36 * @brief Base class of a Pacpus component. 37 */ 35 /// Base class of a Pacpus component. 38 36 class PACPUSLIB_API ComponentBase 39 37 { 40 38 friend class ComponentManager; 39 41 40 public: 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. 46 43 enum COMPONENT_STATE 47 44 { 48 STOPPED,49 NOT_MONITORED,50 MONITOR_OK,51 MONITOR_NOK45 STOPPED, 46 NOT_MONITORED, 47 MONITOR_OK, 48 MONITOR_NOK 52 49 }; 53 50 54 / ** Resulting state of a component after its configuration. */51 /// Resulting state of a component after its configuration. 55 52 enum COMPONENT_CONFIGURATION 56 53 { 57 CONFIGURED_OK,58 NOT_CONFIGURED,59 CONFIGURATION_DELAYED,60 CONFIGURED_FAILED54 CONFIGURED_OK, 55 NOT_CONFIGURED, 56 CONFIGURATION_DELAYED, 57 CONFIGURED_FAILED 61 58 }; 62 59 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); 67 63 68 / ** Dtor of ComponentBase. */64 /// Dtor of ComponentBase. 69 65 virtual ~ComponentBase(); 70 66 71 /** Return the state of the component. 72 * @return Value of the current state. 73 */ 67 /// @returns Value of the current state. 74 68 COMPONENT_STATE getState(); 75 69 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. 79 72 bool isConfigured() const; 80 73 81 74 protected: 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. 85 77 void setState(COMPONENT_STATE state); 86 78 87 / ** Called when the component starts, you must override this function. */79 /// Called when the component starts, you must override this function. 88 80 virtual void startActivity() = 0; 89 81 90 / ** Called when the component stops, you must override this function. */82 /// Called when the component stops, you must override this function. 91 83 virtual void stopActivity() = 0; 92 84 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. 99 89 virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config) = 0; 100 90 101 91 protected: 102 92 /// The XML node that is got in the configureComponent method … … 132 122 }; 133 123 134 } // pacpus124 } // namespace pacpus 135 125 136 126 #endif // DEF_PACPUS_COMPONENTBASE_H -
trunk/include/Pacpus/kernel/ComponentFactory.h
r115 r116 23 23 #include <Pacpus/kernel/ComponentFactoryBase.h> 24 24 25 #include <QtGlobal>26 25 #include <QString> 27 26 … … 37 36 /// @see pacpus::ComponentFactory 38 37 #define REGISTER_COMPONENT(className, factoryName) \ 39 static pacpus::ComponentFactory<className> sFactory(factoryName)38 static pacpus::ComponentFactory<className> sFactory(factoryName) 40 39 41 40 namespace pacpus { … … 50 49 { 51 50 BOOST_STATIC_ASSERT_MSG((boost::is_base_of<ComponentBase, T>::value), "T must inherit from ComponentBase"); 51 52 52 public: 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. 56 55 ComponentFactory(const QString& type); 57 58 / ** Dtor of ComponentFactory. */56 57 /// Dtor of ComponentFactory. 59 58 virtual ~ComponentFactory(); 60 59 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. 64 62 const QString& getType() const; 65 63 66 64 protected: 67 65 virtual ComponentBase* instantiateComponent(const QString& name); 68 66 69 67 private: 70 68 QString mType; … … 73 71 template <typename T> 74 72 ComponentFactory<T>::ComponentFactory(const QString& type) 75 : mType(type)73 : mType(type) 76 74 { 77 75 assert(!type.isEmpty()); … … 96 94 } 97 95 98 } // pacpus96 } // namespace pacpus 99 97 100 98 #endif // DEF_PACPUS_DBITEEXCEPTION_H -
trunk/include/Pacpus/kernel/ComponentFactoryBase.h
r76 r116 16 16 #define DEF_PACPUS_COMPONENTFACTORYBASE_H 17 17 18 #include <Pacpus/kernel/ pacpus.h>18 #include <Pacpus/kernel/PacpusLibConfig.h> 19 19 20 20 class QString; … … 25 25 class ComponentBase; 26 26 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. 30 29 class PACPUSLIB_API ComponentFactoryBase 31 30 { 32 31 friend class ComponentManager; 32 33 33 public: 34 / ** Ctor of ComponentFactoryBase. */34 /// Ctor of ComponentFactoryBase. 35 35 ComponentFactoryBase(); 36 / ** Dtor of ComponentFactoryBase. */36 /// Dtor of ComponentFactoryBase. 37 37 virtual ~ComponentFactoryBase(); 38 38 39 39 protected: 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. 44 45 virtual ComponentBase * instantiateComponent(const QString& name) = 0; 45 46 46 / ** Registera new factory.47 * @param addr Address of the factory.48 * @param type Name of the type created bythe 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. 50 51 void addFactory(ComponentFactoryBase* addr, const QString& type); 51 52 52 / ** Adda 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. 55 56 void addComponent(const QString& name); 56 57 -
trunk/include/Pacpus/kernel/ComponentManager.h
r76 r116 18 18 #define DEF_PACPUS_COMPONENTMANAGER_H 19 19 20 #include <Pacpus/kernel/ComponentFactoryBase.h> 20 21 #include <Pacpus/kernel/pacpus.h> 21 #include <Pacpus/kernel/ ComponentFactoryBase.h>22 #include <Pacpus/kernel/PacpusLibConfig.h> 22 23 #include <Pacpus/kernel/PacpusPluginInterface.h> 23 24 #include <Pacpus/kernel/XmlConfigFile.h> … … 41 42 { 42 43 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); 43 48 44 49 public: … … 68 73 }; 69 74 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. 74 78 PACPUSLIB_API std::size_t loadComponents(const QString& file); 75 79 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. 79 82 PACPUSLIB_API bool start(); 80 83 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. 85 87 PACPUSLIB_API bool start(const QString& component); 86 88 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. 90 91 PACPUSLIB_API bool stop(); 91 92 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. 96 96 PACPUSLIB_API bool stop(const QString& component); 97 97 98 / ** Geta 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. 102 102 PACPUSLIB_API ComponentBase* getComponent(const QString& name); 103 103 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. 107 106 PACPUSLIB_API QStringList getAllComponentsName() const; 108 107 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 . 113 111 PACPUSLIB_API bool loadPlugin(const QString& filename); 114 112 … … 118 116 119 117 bool registerComponent(ComponentBase* addr, const QString& name); 120 bool registerComponentFactory(ComponentFactoryBase * addr, const QString& type);118 bool registerComponentFactory(ComponentFactoryBase * addr, const QString& type); 121 119 122 120 bool unRegisterComponent(const QString& name); 123 121 bool unRegisterComponentFactory(const QString& type); 124 125 // Allow 2 functions to access to private members of ComponentManager126 friend void ComponentFactoryBase::addFactory(ComponentFactoryBase* addr, const QString & type);127 friend void ComponentFactoryBase::addComponent(const QString & name);128 122 129 123 /// private constructor accessible only via static create() function -
trunk/include/Pacpus/kernel/DbiteException.h
r114 r116 16 16 17 17 #include <Pacpus/kernel/FileLibConfig.h> 18 #include <Pacpus/kernel/PacpusException.h> 18 19 19 20 #include <exception> 20 21 #include <string> 21 22 22 #ifdef _MSC_VER23 # pragma warning(push)24 # pragma warning(disable: 4251)25 #endif // _MSC_VER26 27 23 namespace pacpus { 28 24 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. 32 27 class FILELIB_API DbiteException 33 : public std::exception28 : virtual public PacpusException 34 29 { 35 30 public: 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); 40 34 41 / ** Dtor of DbiteException. */35 /// Dtor. 42 36 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;53 37 }; 54 38 55 39 } // namespace pacpus 56 40 57 #ifdef _MSC_VER58 # pragma warning(pop)59 #endif // _MSC_VER60 61 41 #endif // DEF_PACPUS_DBITEEXCEPTION_H -
trunk/include/Pacpus/kernel/FileLibConfig.h
r76 r116 18 18 #define DEF_PACPUS_FILELIBCONFIG_H 19 19 20 // Export macro for FileLib DLL for Windows only20 /// Export macro for FileLib DLL for Windows only 21 21 #ifdef WIN32 22 22 # ifdef FILELIB_EXPORTS -
trunk/include/Pacpus/kernel/Log.h
r112 r116 15 15 #define DEF_PACPUS_LOG_H 16 16 17 // Includes, pacpus. 18 #include <Pacpus/kernel/pacpus.h> 17 #include <Pacpus/kernel/PacpusLibConfig.h> 19 18 20 19 namespace pacpus { … … 43 42 static log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(name)) 44 43 45 / * https://devel.hds.utc.fr/projects/pacpus/ticket/55 */44 // https://devel.hds.utc.fr/projects/pacpus/ticket/55 46 45 #define LOG_TRACE(message) do{LOG4CXX_TRACE(logger, message);} while(false) 47 46 #define LOG_DEBUG(message) do{LOG4CXX_DEBUG(logger, message);} while(false) -
trunk/include/Pacpus/kernel/XmlComponentConfig.h
r91 r116 15 15 #define DEF_PACPUS_XMLCOMPONENTCONFIG_H 16 16 17 #include <Pacpus/kernel/ pacpus.h>17 #include <Pacpus/kernel/PacpusLibConfig.h> 18 18 19 19 #include <QDomElement> … … 23 23 class XmlConfigFile; 24 24 25 /** XmlComponentConfig 26 * @brief Defines the XML structure of a component. 27 */ 25 /// XmlComponentConfig 26 /// @brief Defines the XML structure of a component. 28 27 class PACPUSLIB_API XmlComponentConfig 29 28 { 30 29 friend class ComponentManager; 30 31 31 public: 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); 36 35 37 / ** Dtor of XmlComponentConfig. */36 /// Dtor of XmlComponentConfig. 38 37 ~XmlComponentConfig(); 39 38 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. 43 41 void addProperty(const QString& name); 44 42 45 / ** Delete a propertyfrom 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. 48 46 int delProperty(const QString& name); 49 47 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. 55 52 QString getProperty(const QString& name, const QString& defaultValue = QString::null) const; 56 53 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. 62 58 bool getBoolProperty(const QString& name, bool defaultValue = false) const; 63 59 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. 69 64 int getIntProperty(const QString& name, int defaultValue = 0) const; 70 65 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. 76 70 double getDoubleProperty(const QString& name, double defaultValue = 0.0) const; 77 71 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. 82 75 void setProperty(const QString& name, const QString& value); 83 76 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. 88 80 bool hasProperty(const QString& name) const; 89 81 -
trunk/include/Pacpus/kernel/XmlConfigFile.h
r91 r116 15 15 /// - parameters : parameters of the application 16 16 /// - components : a list of components to load 17 ///18 19 17 20 18 #ifndef DEF_PACPUS_XMLCONFIGFILE_H 21 19 #define DEF_PACPUS_XMLCONFIGFILE_H 22 20 23 #include <Pacpus/kernel/ pacpus.h>21 #include <Pacpus/kernel/PacpusLibConfig.h> 24 22 #include <Pacpus/kernel/XmlComponentConfig.h> 25 23 -
trunk/include/Pacpus/kernel/pacpus.h
r76 r116 16 16 #define DEF_PACPUS_H 17 17 18 #include <Pacpus/kernel/PacpusLibConfig.h> 18 19 #include <Pacpus/kernel/road_time.h> 19 20 … … 23 24 #ifndef PACPUS_PI 24 25 # define PACPUS_PI 3.1415926 25 #endif26 27 /// Export macro for PacpusLib DLL for Windows only28 #ifdef WIN3229 # ifdef PACPUSLIB_EXPORTS30 // make DLL31 # define PACPUSLIB_API __declspec(dllexport)32 # else33 // use DLL34 # define PACPUSLIB_API __declspec(dllimport)35 # endif36 #else37 // On other platforms, simply ignore this38 # define PACPUSLIB_API39 26 #endif 40 27 -
trunk/include/Pacpus/kernel/road_time.h
r91 r116 49 49 /// at the same time. 50 50 /// Description of each field is provided inside the structure 51 struct Initialisation_Time51 struct ROAD_TIME_API Initialisation_Time 52 52 { 53 53 /// Time (extended to micro seconds precision) -
trunk/src/FileLib/CMakeLists.txt
r103 r116 46 46 ${PACPUS_DEPENDENCIES_LIB} 47 47 PacpusLib 48 49 48 ) 50 49 -
trunk/src/FileLib/src/DbiteException.cpp
r91 r116 11 11 12 12 DbiteException::DbiteException(const std::string& what) 13 : mWhat(what)13 : PacpusException(what) 14 14 { 15 15 } … … 18 18 { 19 19 } 20 21 const char* DbiteException::what() const throw()22 {23 return mWhat.c_str();24 } -
trunk/src/PacpusLib/CMakeLists.txt
r101 r116 48 48 ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/pacpus.h 49 49 ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/PacpusApplication.h 50 ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/PacpusException.h 51 ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/PacpusLibConfig.h 50 52 ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/road_time.h 51 53 ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/XmlComponentConfig.h … … 56 58 ./Log.cpp 57 59 ./PacpusApplication.cpp 60 ./PacpusException.cpp 58 61 ./XmlComponentConfig.cpp 59 62 ./XmlConfigFile.cpp -
trunk/src/PacpusLib/ComponentManager.cpp
r91 r116 6 6 /// @version $Id$ 7 7 8 #include <Pacpus/kernel/ComponentFactoryBase.h> 8 9 #include <Pacpus/kernel/ComponentManager.h> 9 10 #include <Pacpus/kernel/ComponentBase.h> -
trunk/src/PacpusLib/XmlComponentConfig.cpp
r91 r116 55 55 int XmlComponentConfig::delProperty(const QString& name) 56 56 { 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 << "'" 60 59 << " of component '" << component_.tagName() << "'" 61 60 << ". Component does not contain this property."
Note:
See TracChangeset
for help on using the changeset viewer.