Changeset 69 in pacpusframework for trunk/include/Pacpus/PacpusTools


Ignore:
Timestamp:
01/10/13 00:04:42 (11 years ago)
Author:
Marek Kurdej
Message:

Added: more documentation.

Location:
trunk/include/Pacpus/PacpusTools
Files:
6 edited

Legend:

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

    r67 r69  
    1616#ifdef WIN32
    1717#   include "Win32ShMem.h"
     18/// Defines shared memory as a Windows shared memory
    1819#   define ShMemType Win32ShMem
    1920#else
    2021#   include "PosixShMem.h"
     22/// Defines shared memory as a POSIX shared memory
    2123#   define ShMemType PosixShMem
    2224#endif
     
    2426namespace pacpus {
    2527
     28/// Shared memory class.
     29///
     30/// Inherits from Win32ShMem on Windows system and from PosixShMem on Unix-like systems.
    2631class ShMem
    27         : public ShMemType
     32    : public ShMemType
    2833{
    2934public:
    30     /// @brief Ctor of shared memory class.
     35    /// Ctor of shared memory class.
    3136    ///
    3237    /// Creates a shared memory of size @b size and named @b name.
     
    4348    }
    4449
    45     /// @brief Dtor of shared memory class.
     50    /// Dtor of shared memory class.
    4651    ///
    4752    /// Does nothing.
  • trunk/include/Pacpus/PacpusTools/ShMemBase.h

    r66 r69  
    1414#define DEF_PACPUS_SHMEMBASE_H
    1515
     16/// Base class for shared memory objects.
    1617class ShMemBase
    1718{
    1819public:
    19   ShMemBase()
    20   {
    21       /*printf("ShMemBase::ShMemBase() not implemented !\n");*/
    22   }
     20    /// Ctor
     21    ShMemBase()
     22    {
     23    }
    2324
    24   virtual ~ShMemBase()
    25   {
    26       /*printf("ShMemBase::~ShMemBase() not implemented !\n");*/
    27   }
     25    /// Dtor
     26    virtual ~ShMemBase()
     27    {
     28    }
    2829
    29   // Use this method to get the data of the shared memory
    30   virtual void *read() = 0;
     30    /// Use this method to get the data of the shared memory
     31    virtual void *read() = 0;
    3132
    32   // Use this method to write data in shared memory
    33   virtual void write(void *data, int size, unsigned long offset = 0) = 0;
     33    /// Use this method to write data in shared memory
     34    virtual void write(void *data, int size, unsigned long offset = 0) = 0;
    3435
    35   // Use this method to wait the incoming of new data
    36   // you can specify a timeout in ms to avoid infinite blocking or 0 (infinite)
    37   // return true if new data available before the timeout or else false
    38   virtual bool wait(unsigned long timeout = 0) = 0;
     36    /// Use this method to wait the incoming of new data
     37    /// you can specify a timeout in ms to avoid infinite blocking or 0 (infinite)
     38    /// @returns @b true if new data available before the timeout, @b false otherwise
     39    virtual bool wait(unsigned long timeout = 0) = 0;
    3940
    40   // To lock the access to the memory
    41   virtual void lockMemory() = 0;
     41    /// To lock the access to the memory
     42    virtual void lockMemory() = 0;
    4243
    43   // To unlock the access to the memory
    44   virtual void unlockMemory() = 0;
     44    /// To unlock the access to the memory
     45    virtual void unlockMemory() = 0;
    4546
    4647#ifdef WIN32
    47   // Return the event handle under Windows
    48   // ... under Linux ?
    49   virtual void * getEventIdentifier() = 0;
     48    /// Return the event handle under Windows
     49    /// @todo ... under Linux ?
     50    virtual void * getEventIdentifier() = 0;
    5051#endif
    5152 
    5253protected:
    53   void * shMem_;
    54        
     54    /// @todo Documentation
     55    void * shMem_;
     56
    5557private:
    5658};
  • trunk/include/Pacpus/PacpusTools/Win32ShMem.h

    r67 r69  
    1717#include <Pacpus/PacpusTools/ShMemBase.h>
    1818
     19/// Windows handle (opaque pointer) type definition
     20///
     21/// Forward declaration of typedefs is impossible.
    1922typedef void * HANDLE;
    2023
     24/// Shared memory object for Windows.
    2125class Win32ShMem
    2226        : public ShMemBase
    2327{
    2428public:
     29    /// Ctor
    2530    Win32ShMem(const char * name, int size);
     31    /// Dtor
    2632    ~Win32ShMem();
    2733
     34    /// @todo Documentation
    2835    virtual bool wait(unsigned long timeout = 0);
     36    /// @todo Documentation
    2937    virtual void * read();
     38    /// @todo Documentation
    3039    virtual void read(void * mem, int size);
     40    /// @todo Documentation
    3141    virtual void write(void * data, int size, unsigned long offset = 0);
     42    /// @todo Documentation
    3243    virtual void lockMemory();
     44    /// @todo Documentation
    3345    virtual void unlockMemory();
     46    /// @todo Documentation
    3447    virtual void * getEventIdentifier();
    3548
  • trunk/include/Pacpus/PacpusTools/geodesie.h

    r67 r69  
    3131
    3232////////////////////////////////////////////////////////////////////////
     33/// 9x9 matrix ???
     34///
    3335/// @todo Documentation
    3436/// @todo Rewrite!
     
    5860    /// Dtor of Raf98 class.
    5961    ~Raf98();
     62   
    6063    /// @todo Documentation
    6164    /// @param s filepath
    6265    bool Load(const std::string & s);
     66   
    6367    /// @todo Documentation
    6468    /// @param longitude [degrees]
    6569    /// @param latitude [degrees]
     70    /// @param Hwgs84 Output: interpolated altitude using WGS84 geoid model [meters]
    6671    bool Interpol(double longitude/*deg*/, double latitude/*deg*/, double* Hwgs84) const;
    6772   
  • trunk/include/Pacpus/PacpusTools/math/rng.hpp

    r66 r69  
    77/// @version $Id$
    88/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
    9 /// @brief Brief description.
     9/// @brief Random number generators.
    1010///
    1111/// Detailed description.
     
    2222namespace rng {
    2323
    24 /*!
    25  * \class normal_generator
    26  * \brief This class is basic normal random number generator \n
    27  * template id RealType describe number precision (float double ....)\n
    28  * template id PRNG describe pseudo random number generator ( see boost random)
    29  */
    30 template < class RealType , class PRNG > class normal_generator {
    31 public :
    32   /*!
    33    * Default construtor
    34    */
    35   normal_generator():
    36   engine(time(NULL)),
    37   generator(engine,boost::normal_distribution<RealType>(0,1))
    38   {}
    39   /*!
    40    * Construtor
    41    * \param dist : a normal distribution (see boost distributions)
    42    */
    43   normal_generator(const boost::math::normal_distribution<RealType> & dist):
    44   engine(time(NULL)),
    45   generator(engine,boost::normal_distribution<RealType>(dist.mean(),dist.sigma()))
    46   {}
    47   /*!
    48    * Construtor
    49    * \param mean : mean of the normal distribution
    50    * \param sigma : satndard deviation of the normal distribution
    51    */
    52   normal_generator(const RealType & mean ,const RealType & sigma):
    53   engine(time(NULL)),
    54   generator(engine,boost::normal_distribution<RealType>(mean(),sigma()))
    55   {}
    56 
    57   /*!
    58    * Get a random number
    59    */
    60   RealType operator()() {return generator();}
    61 
    62   /*!
    63    * Set normal distribution
    64    * \param dist : a normal distribution (see boost distributions)
    65    */
    66   void distribution( const boost::math::normal_distribution<RealType> & dist) {
    67     generator.dist= boost::normal_distribution<RealType>(dist.mean(),dist.standard_deviation());
    68   }
    69 
    70   /*!
    71    * Set normal distrubution
    72    * \param mean : mean of the normal distribution
    73    * \param sigma : satndard deviation of the normal distribution
    74    */
    75   void distribution( const RealType & mean ,const RealType & sigma) {
    76     generator.distribution()= boost::normal_distribution<RealType>(mean,sigma);
    77   }
    78 
    79   private :
    80 
    81   /*!
    82    * \brief pseudo random number generator
    83    */
    84   PRNG engine;
    85 
    86   /*!
    87    * \brief the normal random number generator
    88    */
    89   boost::variate_generator<PRNG, boost::normal_distribution<RealType> > generator;
     24/// This class is basic normal random number generator
     25///
     26/// @tparam RealType describe number precision, e.g. @c float, @c double
     27/// @tparam PRNG describe pseudo random number generator
     28/// @see boost::random
     29template <class RealType, class PRNG>
     30class normal_generator
     31{
     32public:
     33    /// Default construtor
     34    normal_generator()
     35        : engine(time(NULL))
     36        , generator(engine,boost::normal_distribution<RealType>(0,1))
     37    {}
     38
     39    /// Construtor
     40    ///
     41    /// @param dist a normal distribution
     42    /// @see boost::distributions
     43    normal_generator(const boost::math::normal_distribution<RealType> & dist)
     44        : engine(time(NULL))
     45        , generator(engine,boost::normal_distribution<RealType>(dist.mean(),dist.sigma()))
     46    {}
     47
     48    /// Constructor
     49    ///
     50    /// @param mean mean of the normal distribution
     51    /// @param sigma standard deviation of the normal distribution
     52    normal_generator(const RealType & mean ,const RealType & sigma)
     53        : engine(time(NULL))
     54        , generator(engine,boost::normal_distribution<RealType>(mean(),sigma()))
     55    {}
     56
     57    /// Get a random number
     58    RealType operator()()
     59    {
     60        return generator();
     61    }
     62
     63    /// Set normal distribution
     64    ///
     65    /// @param dist : a normal distribution
     66    /// @see boost::distributions
     67    void distribution( const boost::math::normal_distribution<RealType> & dist)
     68    {
     69        generator.dist= boost::normal_distribution<RealType>(dist.mean(),dist.standard_deviation());
     70    }
     71
     72    /// Set normal distrubution
     73    ///
     74    /// @param mean : mean of the normal distribution
     75    /// @param sigma : satndard deviation of the normal distribution
     76    void distribution( const RealType & mean ,const RealType & sigma) {
     77        generator.distribution()= boost::normal_distribution<RealType>(mean,sigma);
     78    }
     79
     80private:
     81    /// pseudorandom number generator
     82    PRNG engine;
     83
     84    /// the normal random number generator
     85    boost::variate_generator<PRNG, boost::normal_distribution<RealType> > generator;
    9086};
    9187
    92 typedef class normal_generator<double,boost::mt19937> normal_rng;
    93 
    94 
    95 
    96 /*!
    97  * \class uniform_generator
    98  * \brief This class is basic uniform random number generator \n
    99  * template id RealType describe number precision (float double ....)\n
    100  * template id PRNG describe pseudo random number generator ( see boost random)
    101  */
    102 template < class RealType , class PRNG > class uniform_generator {
    103 
    104 public :
    105   /*!
    106    * Default construtor
    107    */
    108   uniform_generator():
    109   engine(time(NULL)),
    110   generator(engine, boost::uniform_real<RealType>(0,1))
    111   {}
    112   /*!
    113    * Construtor
    114    * \param dist : a uniform distribution (see boost distributions)
    115    */
    116    uniform_generator(const boost::math::uniform_distribution<RealType> & dist):
    117    engine(time(NULL)),
    118    generator(engine, boost::uniform_real<RealType>(dist.lower(),dist.upper()))
    119    {}
    120   /*!
    121    * Construtor
    122    * \param lower : the lower value of the uniform distribution
    123    * \param upper : the upper value of the uniform distribution
    124    */
    125   uniform_generator(const RealType & lower , const RealType & upper):
    126   engine(time(NULL)),
    127   generator(engine, boost::uniform_real<RealType>(lower,upper))
    128   {}
    129 
    130   /*!
    131    * Get a random number
    132    */
    133   RealType operator()() {return generator();}
    134   /*!
    135    * Set uniform distribution
    136    * \param dist : a normal distribution (see boost distributions)
    137    */
    138   void distribution( const boost::math::uniform_distribution<RealType> & dist) {
    139     generator.dist()= boost::uniform_real<RealType>(dist.lower(),dist.upper());
    140   }
    141   /*!
    142    * Set uniform distribution
    143    * \param lower : the lower value of the uniform distribution
    144    * \param upper : the upper value of the uniform distribution
    145    */
    146   void distribution( const RealType & lower , const RealType & upper) {
    147     generator.dist()= boost::uniform_real<RealType>(lower,upper);
    148   }
    149 
    150   private :
    151   /*!
    152    * \brief pseudo random number generator
    153    */
    154   PRNG engine;
    155   /*!
    156    * \brief the uniform random number generator
    157    */
    158   boost::variate_generator<PRNG, boost::uniform_real<RealType> > generator;
     88/// Defines normal random number generator as a Mersenne Twister 19937 with double-precision numbers
     89typedef class normal_generator<double, boost::mt19937> normal_rng;
     90
     91/// This class is basic uniform random number generator.
     92///
     93/// @tparam RealType describe number precision, e.g. @c float, @c double
     94/// @tparam PRNG describe pseudo random number generator
     95/// @see boost::random
     96template <class RealType, class PRNG>
     97class uniform_generator
     98{
     99public:
     100    /// Default construtor
     101    uniform_generator()
     102        : engine(time(NULL))
     103        , generator(engine, boost::uniform_real<RealType>(0,1))
     104    {}
     105
     106    /// Construtor
     107    /// @param dist a uniform distribution
     108    /// @see boost::distributions
     109    uniform_generator(const boost::math::uniform_distribution<RealType> & dist)
     110        : engine(time(NULL))
     111        , generator(engine, boost::uniform_real<RealType>(dist.lower(),dist.upper()))
     112    {}
     113   
     114    /// Constructor
     115    ///
     116    /// @param lower the lower value of the uniform distribution
     117    /// @param upper the upper value of the uniform distribution
     118    uniform_generator(const RealType & lower , const RealType & upper)
     119        : engine(time(NULL))
     120        , generator(engine, boost::uniform_real<RealType>(lower,upper))
     121    {}
     122
     123    /// Get a random number
     124    RealType operator()()
     125    {
     126        return generator();
     127    }
     128
     129    /// Set uniform distribution
     130    ///
     131    /// @param dist a normal distribution
     132    /// @see boost::distributions
     133    void distribution( const boost::math::uniform_distribution<RealType> & dist)
     134    {
     135        generator.dist()= boost::uniform_real<RealType>(dist.lower(),dist.upper());
     136    }
     137
     138    /// Set uniform distribution
     139    ///
     140    /// @param lower the lower value of the uniform distribution
     141    /// @param upper the upper value of the uniform distribution
     142    void distribution( const RealType & lower , const RealType & upper)
     143    {
     144        generator.dist()= boost::uniform_real<RealType>(lower,upper);
     145    }
     146
     147private:
     148    /// @brief pseudo random number generator
     149    PRNG engine;
     150    /// @brief the uniform random number generator
     151    boost::variate_generator<PRNG, boost::uniform_real<RealType> > generator;
    159152};
    160153
    161 typedef class uniform_generator<double,boost::mt19937> uniform_rng;
    162 
    163 
    164 /*!
    165  * \class traingle_generator
    166  * \brief This class is basic triangular random number generator \n
    167  * template id RealType describe number precision (float double ....)\n
    168  * template id PRNG describe pseudo random number generator ( see boost random)
    169  */
    170 template < class RealType , class PRNG > class triangle_generator {
    171 
    172 public :
    173   /*!
    174    * Default construtor
    175    */
    176   triangle_generator():
    177   engine(time(NULL)),
    178   generator(engine, boost::triangle_distribution<RealType>(-1,0,1))
    179   {}
    180   /*!
    181    * Construtor
    182    * \param dist : a traingle distribution (see boost distributions)
    183    */
    184    triangle_generator(const boost::math::triangular_distribution<RealType> & dist):
    185    engine(time(NULL)),
    186    generator(engine, boost::triangle_distribution<RealType>(dist.lower(),dist.upper()))
    187    {}
    188   /*!
    189    * Constructor :
    190    * \param lower : the lower value of the uniform distribution
    191    * \param mode : the mode value of the uniform distribution
    192    * \param upper : the upper value of the uniform distribution
    193    */
    194   triangle_generator(const RealType & lower , const RealType & mode ,const RealType & upper):
    195   engine(time(NULL)),
    196   generator(engine, boost::triangle_distribution<RealType>(lower,mode,upper))
    197   {}
    198   /*!
    199    * Get a random number
    200    */
    201   RealType operator()() {return generator();}
    202   /*!
    203    * Set triangle distribution
    204    * \param dist : a normal distribution (see boost distributions)
    205    */
    206   void distribution( const boost::math::triangular_distribution<RealType> & dist) {
    207     generator.dist()= boost::triangle_distribution<RealType>(dist.lower(),dist.mode(),dist.upper());
    208   }
    209   /*!
    210    * Set triangle distribution
    211    * \param lower : the lower value of the uniform distribution
    212    * \param mode : the mode value of the uniform distribution
    213    * \param upper : the upper value of the uniform distribution
    214    */
    215   void distribution( const RealType & lower ,const RealType & mode ,const RealType & upper) {
    216     generator.dist()= boost::triangle_distribution<RealType>(lower,mode,upper);
    217   }
    218 
    219   private :
    220   /*!
    221    * \brief pseudo random number generator
    222    */
    223   PRNG engine;
    224   /*!
    225    * \brief the triangle random number generator
    226    */
    227   boost::variate_generator<PRNG, boost::triangle_distribution<RealType> > generator;
     154/// Defines uniform random number generator as a Mersenne Twister 19937 with double-precision numbers
     155typedef class uniform_generator<double, boost::mt19937> uniform_rng;
     156
     157/// This class is basic triangular random number generator
     158///
     159/// @tparam RealType describe number precision, e.g. @c float, @c double
     160/// @tparam PRNG describe pseudo random number generator ( see boost random)
     161template <class RealType, class PRNG>
     162class triangle_generator
     163{
     164public:
     165    /// Default construtor
     166    triangle_generator()
     167        : engine(time(NULL))
     168        , generator(engine, boost::triangle_distribution<RealType>(-1,0,1))
     169    {}
     170
     171    /// Construtor
     172    ///
     173    /// @param dist : a traingle distribution
     174    /// @see boost distributions
     175    triangle_generator(const boost::math::triangular_distribution<RealType> & dist)
     176        : engine(time(NULL))
     177        ,generator(engine, boost::triangle_distribution<RealType>(dist.lower(),dist.upper()))
     178    {}
     179
     180    /// Constructor
     181    ///
     182    /// @param lower the lower value of the uniform distribution
     183    /// @param mode the mode value of the uniform distribution
     184    /// @param upper the upper value of the uniform distribution
     185    triangle_generator(const RealType & lower, const RealType & mode ,const RealType & upper)
     186        : engine(time(NULL))
     187        , generator(engine, boost::triangle_distribution<RealType>(lower,mode,upper))
     188    {}
     189
     190    /// Get a random number
     191    RealType operator()()
     192    {
     193        return generator();
     194    }
     195
     196    /// Set triangle distribution
     197    /// @param dist a normal distribution
     198    /// @see boost::distributions
     199    void distribution( const boost::math::triangular_distribution<RealType> & dist)
     200    {
     201        generator.dist()= boost::triangle_distribution<RealType>(dist.lower(),dist.mode(),dist.upper());
     202    }
     203
     204    /// Set triangle distribution
     205    /// @param lower    the lower value of the uniform distribution
     206    /// @param mode     the mode value of the uniform distribution
     207    /// @param upper    the upper value of the uniform distribution
     208    void distribution( const RealType & lower, const RealType & mode ,const RealType & upper)
     209    {
     210        generator.dist()= boost::triangle_distribution<RealType>(lower,mode,upper);
     211    }
     212
     213private :
     214    /// pseudorandom number generator
     215    PRNG engine;
     216    /// the triangle random number generator
     217    boost::variate_generator<PRNG, boost::triangle_distribution<RealType> > generator;
    228218};
    229219
    230 typedef class triangle_generator<double,boost::mt19937> triangle_rng;
     220typedef class triangle_generator<double, boost::mt19937> triangle_rng;
    231221
    232222} // namespace rng
  • trunk/include/Pacpus/PacpusTools/matrice.h

    r66 r69  
    2121} t_m;
    2222
     23/// Simple matrix.
     24/// @todo Documentation
    2325class matrice
    2426{
     
    2931
    3032public:
    31     //constructeurs
     33    /// Ctor
    3234    matrice();
     35    /// Ctor
    3336    matrice(unsigned short int nl, unsigned short int nc);
     37    /// Ctor
    3438    matrice(unsigned short int nl, unsigned short int nc,t_m type);
     39    /// Copy ctor
    3540    matrice(const matrice &source); //constructeur par copie
    36     //destructeur
     41    /// Dtor
    3742    virtual ~matrice(void);
    38     void Alloue(unsigned short int nl, unsigned short int nc); //allocation de la matrice
    3943
    40     // fonction pour le calcul de matrice
     44    /// Allocates matrix data
     45    /// @todo Rename
     46    void Alloue(unsigned short int nl, unsigned short int nc);
     47
     48    /// Assignment operator for matrix operand
    4149    matrice &operator=(const matrice &m);//m=m1
     50    /// Assignment operator for scalar operand
    4251    matrice &operator=(double x); //m=x
    43     operator double()const{return **lignes;}
     52    /// Conversion operator to double
     53    /// @todo FIXME
     54    operator double() const
     55    {
     56        return **lignes;
     57    }
    4458
    4559    matrice &operator+=(const matrice &m); //m+=m1
Note: See TracChangeset for help on using the changeset viewer.